| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782 |
- <template>
- <view>
- <!--mine/shop/shop.wxml-->
- <view class="top">
- <view class="topc dflex">
- <image :src="merchant.logo" mode="aspectFill" class="userimg"></image>
- <view class="userinfo flex">
- <view class="username">{{merchant.title}}</view>
- <view class="username">电话:{{merchant.phone?merchant.phone:''}}</view>
- </view>
- <button open-type="share" class="share dflex">
- <image src="/static/pages/images/bshare.png"></image>分享
- </button>
- </view>
- </view>
- <view class="box1">
- <view class="search dflex">
- <view class="dflex flex" @tap="search">
- <image src="/static/pages/images/ssico.png"></image>
- <view class="flex">搜索你想要的商品</view>
- </view>
- </view>
- </view>
- <view class="con">
- <!-- 秒杀 -->
- <view class="box" v-if="seckill.length>0">
- <view class="mstit dflex">
- <image src="/static/pages/images/msico.png" class="msico"></image>
- <image src="/static/pages/images/xsms.png" class="xsms"></image>
- <view class="countdown dflex">
- <text>{{timer[0]}}</text>:<text>{{timer[1]}}</text>:<text>{{timer[2]}}</text>
- </view>
- </view>
- <view class="times dflex">
- <view v-for="(item, index) in TabList" :key="index"
- :class="'li ' + (item.active ? 'active' : '') + ' left'" :data-index="index" @tap="switchTab">
- <text :class="item.active ? 'weight' : ''">{{item.label}}</text>
- <view :class="'state ' + (item.active? 'bg' :'')">{{item.state}}</view>
- </view>
- <!-- <view class="li active"><text>08:00</text>已开抢</view>
- <view class="li"><text>10:00</text>已开抢</view>
- <view class="li"><text>12:00</text>抢购中</view>
- <view class="li"><text>14:00</text>即将开抢</view>
- <view class="li"><text>16:00</text>待开抢</view> -->
- </view>
- <navigator v-for="(item, index) in seckill" :key="index" url hover-class="none"
- class="msinfos bgfff r10">
- <image :src="item.pic" mode="aspectFill" @tap="toSeckillList" :data-id="item.id"
- :data-productId="item.productId"></image>
- <view class="msinfo">
- <view class="msname" @tap="toSeckillList" :data-id="item.id" :data-productId="item.productId">
- {{item.productName}}
- </view>
- <view class="qgsta dflex">
- <view class="price proprice" @tap="toSeckillList" :data-id="item.id"
- :data-productId="item.productId">¥<text>{{item.money}}</text><text
- class="del">¥{{item.marketPrice}}</text></view>
- <view class="qiang mbgcolor" v-if="item.start" @tap="toSeckillList" :data-id="item.id"
- :data-productId="item.productId">立即抢购</view>
- <!-- <view class="remind mbglinear" bindtap="cancelActivityRemind" data-index="{{index}}" data-id="{{item.id}}" wx:if="{{item.isRemind}}" data-type="1">取消预约</view> -->
- <block v-else>
- <view class="qiang mbggreen" @tap="cancelActivityRemind" :data-index="index"
- :data-id="item.id" v-if="item.isRemind" data-type="3">取消提醒</view>
- <view class="qiang mbggreen" @tap="addActivityRemind" :data-index="index"
- :data-id="item.id" data-type="3" v-else>预约提醒</view>
- </block>
- </view>
- </view>
- </navigator>
- </view>
- <!-- 社区团购 -->
- <view class="mt20 bgfff r10" v-if="group.length > 0">
- <navigator hover-class="none" url="/product/groupList/groupList" class="title pdlr20 dflex">社区团购<image
- src="/static/pages/images/more.png" class="more"></image>
- </navigator>
- <view class="shequ">
- <view v-for="(item, index) in group" :key="index" class="li">
- <view class="dflex">
- <image :src="item.pic" mode="aspectFill" class="proimg" :data-index="index"
- @tap="toGroupRemind">
- </image>
- <view class="flex">
- <view class="proname" :data-index="index" @tap="toGroupRemind">{{item.title}}</view>
- <view class="endtime" :data-index="index" @tap="toGroupRemind">
- {{item.start ? '距结束' : '距开始'}}
- {{item.times}}
- </view>
- <view class="operate dflex">
- <view class="price proprice" :data-index="index" @tap="toGroupRemind">
- ¥<text>{{item.money}}</text><text class="del">¥{{item.marketPrice}}</text>
- </view>
- <view class="add-cart">
- <image src="/static/pages/images/jia.png" :data-index="index"
- @tap="toGroupRemind" v-if="item.start"></image>
- <block v-else>
- <view class="remind mbggreen" @tap="cancelActivityRemind"
- :data-index="index" :data-id="item.id" v-if="item.isRemind"
- data-type="1">取消提醒</view>
- <view class="remind mbggreen" @tap="addActivityRemind" :data-index="index"
- :data-id="item.id" data-type="1" v-else>开团提醒</view>
- </block>
- </view>
- </view>
- </view>
- </view>
- <view class="datas dflex" v-if="item.start" :data-index="index" @tap="toGroupRemind">
- <view class="yigou dflex">
- <image v-for="(item, index2) in item.dtoList" :key="index2" :src="item.avatar"
- mode="aspectFill"></image>
- <image src="/static/pages/images/more1.png" mode="aspectFill" class="more1"
- v-if="item.dtoList && item.dtoList.length > 0"></image>
- <text>已售{{item.payQuantity}}/剩余{{item.quantity - item.payQuantity}}</text>
- </view>
- <view class="xiaoliang">累计销量 {{item.sellStock}}</view>
- </view>
- </view>
- </view>
- </view>
- <!-- 拼团 -->
- <view class="mt20 bgfff pdlr20 r10" v-if="joingroup.length>0">
- <view class="title dflex" @tap="goUrl" data-url="activity/group/index/index?type=4">拼团<image
- src="/static/pages/images/more.png" class="more"></image>
- </view>
- <goodsList :pageList="joingroup" :merchant="web">
- </goodsList>
- <!-- <view class="pintuan">
- <view v-for="(item, index) in joingroup" :key="index" class="li dflex">
- <view class="pinimgs" @tap="goUrl"
- :data-url="'activity/group/detail/detail?acid=' + item.id + '&id=' + item.productId">
- <image :src="item.pic" mode="aspectFill" class="pinimg"></image>
- <view class="tuan">
- <image src="/static/pages/images/tagbg.png"></image>
- <text>3人团</text>
- </view>
- </view>
- <view class="pininfo flex">
- <view class="proname" @tap="goUrl"
- :data-url="'activity/group/detail/detail?acid=' + item.id + '&id=' + item.productId">
- {{item.productName}}
- </view>
- <view :class="'endtime ' + (item.start? '' : 'wei')">{{item.start ? '距结束': '距开始'}}
- {{item.times}}
- </view>
- <view class="del" @tap="goUrl"
- :data-url="'activity/group/detail/detail?acid=' + item.id + '&id=' + item.productId">
- ¥{{item.marketPrice}}</view>
- <view class="operate dflex">
- <view class="price" @tap="goUrl"
- :data-url="'activity/group/detail/detail?acid=' + item.id + '&id=' + item.productId">
- 拼团价¥<text>{{item.money}}</text></view>
- <view class="add-cart">
- <view class="remind mbglinear dflex" v-if="item.start" @tap="goUrl"
- :data-url="'activity/group/detail/detail?acid=' + item.id + '&id=' + item.productId">
- 立即开团</view>
- <block v-else>
- <view class="remind mbggreen dflex" v-if="item.isRemind"
- @tap="cancelActivityRemind" :data-index="index" data-type="2"
- :data-id="item.id">取消预约</view>
- <view class="remind mbggreen dflex" @tap="addActivityRemind" :data-index="index"
- data-type="2" :data-id="item.id" v-else>
- <icon class="iconfont icon-yugao"></icon>预约提醒
- </view>
- </block>
- </view>
- </view>
- </view>
- </view>
- </view> -->
- </view>
- <!-- 店长推荐 -->
- <view class="tuijian dflex" v-if="activityGroup.products.length>0">
- <image src="/static/pages/images/tjico.png"></image>
- <text>店长推荐</text>
- <image src="/static/pages/images/tjico.png"></image>
- </view>
- <!-- <view class="tjlist">
- <navigator v-for="(item, index) in activityGroup" :key="index" url hover-class="none"
- class="msinfos bgfff r10" @tap="toDetail" :data-id="item.id">
- <image :src="item.pic" mode="aspectFill"></image>
- <view class="msinfo">
- <view class="msname">{{item.title}}</view>
- <view class="qgsta dflex">
- <view class="price proprice">¥<text>{{item.actualPrice}}</text><text
- class="del">¥{{item.marketPrice}}</text>
- </view>
- <view class="qiang mbgcolor">立即抢购</view>
- </view>
- </view>
- </navigator>
- </view> -->
- <goodsList :pageList="activityGroup" :merchant="web">
- </goodsList>
- </view>
- <view class="nodata_cart"
- v-if="activityGroup.products.length<1&&joingroup.products.length<1&&group.products.length<1&&seckill.products.length<1&&bargain.products.length<1">
- <image :src="picUrlss+'empty_xd.png'"></image>
- <view>小店橱窗,空空如也~</view>
- <text>挑选宝贝 > 查看详情 > 添加到小店</text>
- <navigator url="/pages/index/index" open-type="switchTab" hover-class="none">去逛逛</navigator>
- </view>
- <!-- <view class="placeholder-view" :style="'height:' + (bottomBlankHeight + 115) + 'rpx'"></view> -->
- <!-- <foot channel="shop" :isUpdate="isUpdate"></foot> -->
- </view>
- </template>
- <script>
- // mine/shop/shop.js
- const app = getApp();
- const req = require("../../utils/request.js");
- const api = require("../../utils/api.js");
- const utils = require("../../utils/util.js");
- const mes = require("../../utils/requestmessage.js");
- // import foot from "../../components/nav-bar/index";
- import goodsList from "../../components/goodsList/goodsList";
- export default {
- data() {
- return {
- picUrlss: req.public.picUrls,
- bottomBlankHeight: app.globalData.isIPhoneX ? 68 : 0,
- isUpdate: false,
- // 是否更新消息
- activityGroup: {},
- //店长推荐
- group: {},
- //社区团购
- seckill: [],
- //秒杀
- joingroup: {},
- //拼团
- bargain: [],
- //砍价
- TabList: [{
- label: '今天',
- active: true,
- state: "抢购中",
- dayType: 1,
- time: ''
- }, {
- label: '明天',
- state: "预热中",
- active: false,
- time: '',
- dayType: 2
- }, {
- label: '后天',
- state: "预热中",
- dayType: 3,
- time: ''
- }, {
- label: '',
- state: "预热中",
- dayType: 4,
- active: false,
- time: ''
- }, {
- label: '',
- state: "预热中",
- dayType: 5,
- active: false,
- time: ''
- }],
- timer: "",
- userInfo: "",
- merchant: {},
- homeTemplate: {},
- web: ''
- };
- },
- components: {
- // foot
- goodsList
- },
- props: {},
- onLoad: function(options) {
- console.log(options);
- this.query = options;
- if (options.scene) {
- this.scene = options.scene;
- }
- if (options.isShare) {
- req.setStorage('pidCode', options.userId);
- }
- this.web = '&merchantId=' + options.merchantId + '&shopId=' + options.shopId
- uni.setNavigationBarColor({
- frontColor: '#ffffff',
- backgroundColor: req.public.titleTopBgColor
- });
- this.init();
- this.getTime();
- this.getShop();
- this.getHomeTemplateConfig()
- },
- onShow() {
- let _ts = this;
- _ts.setData({
- isUpdate: !_ts.isUpdate
- });
- },
- onShareAppMessage: function() {
- return {
- title: req.excludeSpecial(req.getStorage('userInfo').nickName) + '为你推荐' + this.merchant.title,
- // imageUrl: this.data.seckill[0].pic
- // path: '/product/detail/detail?id=' + this.query.id + '&isShare=' + true + '&userId=' + req.getStorage('userInfo').id
- path: '/pages/shop/shop?userId=' + req.getStorage('userInfo').id + '&isShare=' + true + '&shopId=' +
- this.query.shopId + '&merchantId=' + this.query.merchantId
- };
- },
- methods: {
- //获取小店配置
- getHomeTemplateConfig() {
- let _ts = this;
- req.getRequest('/api/config', {}, data => {
- if (data.shop_config) {
- this.setData({
- homeTemplate: JSON.parse(data.shop_config)
- });
- }
- console.log(this.homeTemplate)
- });
- },
- /**
- *
- * 设置tab导航
- */
- switchTab(event) {
- let index = event.currentTarget.dataset.index;
- let def = this.TabList.findIndex(it => it.active);
- let d = {};
- console.log(index, def);
- d[`TabList[${def}].active`] = false;
- d[`TabList[${index}].active`] = true;
- console.log(d);
- this.isLoad = true; // this.data.form.page = 1;
- d['pageList'] = []; // this.data.form.dayType = this.data.TabList[index].dayType;
- this.setData(d);
- this.seckillFun();
- this.clearAllTimer(); // this.getDate()
- },
- /**
- * 获取当前时间往后退四天
- */
- laterDay(num) {
- var t = new Date();
- var iToDay = t.getDate();
- var iToMon = t.getMonth();
- var iToYear = t.getFullYear();
- var arr = [];
- for (var i = 1; i < num + 1; i++) {
- var newDate = new Date(iToYear, iToMon, iToDay + i);
- arr.push(newDate.getFullYear() + '-' + (newDate.getMonth() + 1).toString().padStart(2, '0') + "-" +
- newDate.getDate().toString().padStart(2, '0'));
- } // console.log(arr)
- return arr;
- },
- /**
- * 给tab添加动态时间
- */
- getTime() {
- const data = this.TabList;
- var t = new Date();
- var iToDay = t.getDate().toString().padStart(2, '0');
- var iToMon = (t.getMonth() + 1).toString().padStart(2, '0');
- var iToYear = t.getFullYear();
- const rq = (iToYear + '-' + iToMon + '-' + iToDay).toString();
- const rq1 = this.laterDay(4)[0];
- const rq2 = this.laterDay(4)[1];
- const rq3 = this.laterDay(4)[2];
- const rq4 = this.laterDay(4)[3]; // console.log("rq" + "---", rq1, rq2, rq3, rq4)
- data[0].time = rq;
- data[1].time = rq1;
- data[2].time = rq2;
- data[3].label = this.getda(rq3);
- data[3].time = rq3;
- data[4].label = this.getda(rq4);
- data[4].time = rq4;
- this.setData({
- TabList: data
- }); // console.log(this.data.TabList)
- },
- /**
- * 时间转换
- */
- getda(str) {
- var strArr = str.split('-');
- var day = strArr[2];
- var month = strArr[1];
- var year = strArr[0];
- let date = (month + '月' + day + '日').toString();
- return date;
- },
- search() {
- app.globalData.openPage('pages/search/search');
- },
- async init() {
- await this.loadGroup();
- await this.groupFun();
- await this.seckillFun();
- await this.joingroupFun();
- await this.bargainFun();
- },
- // 获取店长推荐
- loadGroup() {
- let _ts = this; // type
- // 类型:1 普通商品 2 社区团购订单 3 秒杀订单 4 拼团订单 5 及时达订单 6 新客特价 7 优惠砍价
- req.getRequest('/api/shopProduct/list', {
- page: 1,
- limit: 3,
- type: 1,
- // userId: this.query.userId
- shopId: this.query.shopId,
- merchantId: this.query.merchantId
- }, data => {
- data = data.map(it => {
- it.isRemind = it.remindId;
- return it;
- });
- console.log(data[0]);
- let arrObjFilter
- arrObjFilter = {
- // backgroundColor:this.homeTemplate.backgroundColor,
- displayStyle: this.homeTemplate.displayStyle,
- lineNumber: this.homeTemplate.lineNumber,
- products: data
- };
- _ts.setData({
- activityGroup: arrObjFilter
- });
- console.log(this.activityGroup)
- // _ts.initGroupTimer();
- });
- },
- // 获取社区团购产品
- groupFun() {
- let _ts = this; // type
- // 类型:1 普通商品 2 社区团购订单 3 秒杀订单 4 拼团订单 5 及时达订单 6 新客特价 7 优惠砍价
- req.getRequest('/api/shopProduct/list', {
- page: 1,
- limit: 3,
- // userId: this.query.userId
- type: 2,
- merchantId: this.query.merchantId,
- sid: this.query.shopId
- }, data => {
- data = data.list.map(it => {
- it.isRemind = it.remindId;
- return it;
- });
- console.log(data);
- let arrObjFilter
- arrObjFilter = {
- // backgroundColor:this.homeTemplate.backgroundColor,
- displayStyle: this.homeTemplate.displayStyle,
- lineNumber: this.homeTemplate.lineNumber,
- products: data.filter(ele => ele.end == false)
- };
- _ts.setData({
- group: arrObjFilter
- }); // console.log(this.data.activityGroup)
- _ts.initGroupTimer(2);
- });
- },
- // 获取秒杀产品
- seckillFun() {
- let _ts = this; // type
- // 类型:1 普通商品 2 社区团购订单 3 秒杀订单 4 拼团订单 5 及时达订单 6 新客特价 7 优惠砍价
- req.getRequest('/api/shopProduct/list', {
- page: 1,
- limit: 3,
- type: 3,
- // userId: this.query.userId
- shopId: this.query.shopId,
- merchantId: this.query.merchantId
- }, data => {
- data = data.list.map(it => {
- it.isRemind = it.remindId;
- return it;
- });
- console.log(data);
- let arrObjFilter
- arrObjFilter = {
- // backgroundColor:this.homeTemplate.backgroundColor,
- displayStyle: this.homeTemplate.displayStyle,
- lineNumber: this.homeTemplate.lineNumber,
- products: data.filter(ele => ele.end == false)
- };
- _ts.setData({
- seckill: arrObjFilter
- }); // console.log(this.data.activityGroup)
- var now = new Date();
- var next = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1);
- this.NextTime(next, function(hour, minute, second) {
- hour = _ts.lpad(hour, 2);
- minute = _ts.lpad(minute, 2);
- second = _ts.lpad(second, 2);
- let res = [hour, minute, second];
- _ts.setData({
- timer: res
- });
- });
- _ts.initGroupTimer(3);
- });
- },
- // 获取拼团产品
- joingroupFun() {
- let _ts = this; // type
- // 类型:1 普通商品 2 社区团购订单 3 秒杀订单 4 拼团订单 5 及时达订单 6 新客特价 7 优惠砍价
- req.getRequest('/api/shopProduct/list', {
- page: 1,
- limit: 3,
- type: 4,
- // userId: this.query.userId
- shopId: this.query.shopId,
- merchantId: this.query.merchantId
- }, data => {
- data = data.list.map(it => {
- it.isRemind = it.remindId;
- return it;
- });
- let arrObjFilter
- arrObjFilter = {
- // backgroundColor:this.homeTemplate.backgroundColor,
- displayStyle: this.homeTemplate.displayStyle,
- lineNumber: this.homeTemplate.lineNumber,
- products:data.filter(ele => ele.end == false)
- };
- _ts.setData({
- joingroup: arrObjFilter
- }); // console.log(this.data.activityGroup)
- _ts.initGroupTimer(4);
- });
- },
- // 获取砍价产品
- bargainFun() {
- let _ts = this; // type
- // 类型:1 普通商品 2 社区团购订单 3 秒杀订单 4 拼团订单 5 及时达订单 6 新客特价 7 优惠砍价
- req.getRequest('/api/shopProduct/list', {
- page: 1,
- limit: 3,
- type: 7,
- // userId: this.query.userId
- shopId: this.query.shopId,
- merchantId: this.query.merchantId
- }, data => {
- data = data.list.map(it => {
- it.isRemind = it.remindId;
- return it;
- });
- let arrObjFilter
- arrObjFilter = {
- // backgroundColor:this.homeTemplate.backgroundColor,
- displayStyle: this.homeTemplate.displayStyle,
- lineNumber: this.homeTemplate.lineNumber,
- products:data.filter(ele => ele.end == false)
- };
- _ts.setData({
- bargain: arrObjFilter
- }); // console.log(this.data.activityGroup)
- _ts.initGroupTimer(7);
- });
- },
- // 获取新客产品
- //2为社区团购,4为拼团,7为砍价
- initGroupTimer(type) {
- //社区拼图定时器
- let _ts = this;
- let list = [];
- if (type == 2) list = this.group.products;
- else if (type == 4) list = this.joingroup.products;
- else if (type == 7) list = this.bargain.products; // console.log(this.data.joingroupList)
- if (list && list.length > 0) {
- // let activityGroup = this.data.activityGroup;
- for (let i = 0, len = list.length; i < len; i++) {
- let group = list[i];
- let nowTime = new Date(group.nowTime.replace(/-/g, '/')).getTime();
- let startTime = new Date(group.startTime.replace(/-/g, '/')).getTime();
- let endTime = new Date(group.endTime.replace(/-/g, '/')).getTime();
- if (!group.start) endTime = startTime;
- let times = parseInt((endTime - nowTime) / 1000);
- console.log(times);
- let timer = setInterval(() => {
- times--;
- let data = {};
- if (times === 0) {
- //重新加载列表
- if (type == 2) data['group[' + i + '].end'] = true;
- else if (type == 4) data['joingroup[' + i + '].end'] = true;
- else if (type == 7) data['bargain[' + i + '].end'] = true;
- clearInterval(timer);
- } else {
- let n = utils.formatDayTimes(times);
- if (type == 2) data['group[' + i + '].times'] = n;
- else if (type == 4) data['joingroup[' + i + '].times'] = n;
- else if (type == 7) data['bargain[' + i + '].times'] = n.split(/:|天/g);
- }
- _ts.setData(data);
- }, 1000);
- if (type == 2) this.group[i]['timer'] = timer;
- else if (type == 4) this.joingroup[i]['timer'] = timer;
- else if (type == 7) this.bargain[i]['timer'] = timer; // let fs = [];
- // fs['activityGroup[' + i + '].timer'] = timer;
- // _ts.setData(fs);
- }
- }
- },
- // 一天倒计时
- NextTime(next, cb) {
- var t;
- (function ft() {
- var dif = (next.getTime() - new Date().getTime()) / 1000;
- if (dif > 0) {
- t = setTimeout(ft, 1000);
- if (cb) cb(Math.floor(dif % 86400 / 3600), Math.floor(dif % 3600 / 60), Math.floor(dif % 60));
- } else {
- clearTimeout(t);
- }
- })();
- return function() {
- clearTimeout(t);
- };
- },
- lpad(num, n) {
- var len = num.toString().length;
- while (len < n) {
- num = "0" + num;
- len++;
- }
- return num;
- },
- toGroupRemind(event) {
- const index = event.currentTarget.dataset.index;
- const activity = this.activityGroup[index];
- app.globalData.openPage('product/groupDetail/groupDetail?acid=' + activity.id + "&id=" + activity
- .productId);
- console.log('acid', activity.id);
- console.log('productId', activity.productId);
- },
- addActivityRemind(event) {
- const index = event.currentTarget.dataset.index;
- const id = event.currentTarget.dataset.id;
- const type = event.currentTarget.dataset.type;
- mes.remind().then(res => res);
- req.postRequest('/api/activity/remind', {
- activityId: id
- }, res => {
- req.msg('订阅提醒成功');
- let data = {};
- if (type == 1) data['activityGroup[' + index + '].isRemind'] = true;
- else if (type == 2) data['joingroup[' + index + '].isRemind'] = true;
- else if (type == 3) data['seckill[' + index + '].isRemind'] = true;
- else if (type == 4) data['bargain[' + index + '].isRemind'] = true;
- this.setData(data);
- });
- },
- cancelActivityRemind(event) {
- const index = event.currentTarget.dataset.index;
- const id = event.currentTarget.dataset.id;
- const type = event.currentTarget.dataset.type;
- req.postRequest('/api/activity/cancel/remind', {
- id: id
- }, res => {
- req.msg('取消提醒成功');
- let data = {};
- if (type == 1) data['activityGroup[' + index + '].isRemind'] = false;
- else if (type == 2) data['joingroup[' + index + '].isRemind'] = false;
- else if (type == 3) data['seckill[' + index + '].isRemind'] = false;
- else if (type == 4) data['bargain[' + index + '].isRemind'] = false;
- this.setData(data);
- });
- },
- clearAllTimer() {
- this.activityGroup.forEach(it => clearInterval(it.timer));
- },
- // 获取小店详情
- getShop() {
- let that = this;
- req.getRequest('/api/merchant/detail', {
- id: this.query.shopId
- }, data => {
- console.log(data);
- this.setData({
- merchant: data
- });
- console.log(this.merchant);
- });
- },
- toDetail(e) {
- let id = e.currentTarget.dataset.id;
- app.globalData.openPage("product/detail/detail?id=" + id + '&&hideShop=' + false + '&shopId=' + this.query
- .shopId + '&merchantId=' + this.query.merchantId);
- },
- goUrl(event) {
- //跳转链接
- let url = event.currentTarget.dataset.url;
- app.globalData.openPage(url + '&&hideShop=' + false + '&shopId=' + this.query.shopId + '&merchantId=' +
- this.query.merchantId);
- },
- toSeckillList(event) {
- const id = event.currentTarget.dataset.id;
- const productId = event.currentTarget.dataset.productid;
- console.log(event.currentTarget.dataset);
- app.globalData.openPage('activity/seckillDetails/seckillDetails?acid=' + id + "&id=" + productId +
- '&&hideShop=' + false + '&shopId=' + this.query.shopId + '&merchantId=' + this.query.merchantId);
- }
- }
- };
- </script>
- <style>
- @import "./shop.css";
- </style>
|