diff --git a/pages/activity/goods_seckill_details/index.vue b/pages/activity/goods_seckill_details/index.vue index 1ee7f3fb..d52bbf3d 100644 --- a/pages/activity/goods_seckill_details/index.vue +++ b/pages/activity/goods_seckill_details/index.vue @@ -26,12 +26,12 @@ {{ fen2yuan(spu.price) }} ¥{{ fen2yuan(spu.marketPrice) }} - + - + 距秒杀结束仅剩 - + @@ -97,30 +97,30 @@ 收藏 - - 单独购买 - 立即购买 - - + + 单独购买 + 已关闭 + + + 单独购买 + 未开始 + + 单独购买 立即购买 - + 单独购买 已售罄 - - 单独购买 - 已关闭 - - - 单独购买 - 未开始 - - + 单独购买 已结束 + + 单独购买 + 未开始 + @@ -216,6 +216,7 @@ return { // 秒杀活动相关变量 activity: {}, + status: 1, // 0 - 已禁用;1 - 未开始;2 - 进行中;3 - 已结束 // 商品相关变量 spu: {}, // 商品 SPU 详情 @@ -229,7 +230,6 @@ 'width': '44rpx', 'timeTxtwidth': '16rpx', }, - dataShow: 0, id: 0, time: 0, countDownHour: "00", @@ -252,7 +252,6 @@ isOpen: false, attr: '请选择', attrValue: '', - status: 1, iShidden: false, iSplus: false, replyCount: 0, //总评论数量 @@ -273,7 +272,6 @@ table: 'width:100%', video: 'width:100%' }, - datatime: 0, navActive: 0, meunHeight: 0, backH: '', @@ -413,6 +411,19 @@ this.activity.quota = this.activity.products.reduce((accumulator, product) => { return accumulator + product.quota; }, 0); + // 计算活动状态 + const now = new Date().getTime(); + if (this.activity.status !== 0) { + if (this.activity.startTime > now) { + this.status = 1; + } else if (now <= this.activity.endTime) { + this.status = 2; + } else { + this.status = 3; + } + } else { + this.status = this.activity; + } // 获得商品详情 this.getGoodsDetails(); @@ -421,12 +432,8 @@ return; } getSeckillDetail(that.id).then(res => { - this.dataShow = 1; this.storeInfo = res.data.storeSeckill; this.userCollect = res.data.userCollect; - this.status = this.storeInfo.seckillStatus; - this.datatime = Number(this.storeInfo.timeSwap); - this.imgUrls = JSON.parse(res.data.storeSeckill.sliderImage) || []; this.attribute.productAttr = res.data.productAttr; this.productValue = res.data.productValue; this.attribute.productSelect.num = res.data.storeSeckill.num; @@ -487,14 +494,8 @@ // // 设置分销相关变量 // TODO 芋艿:待接入 // this.$set(this.sharePacket, 'priceName', res.data.priceName); // this.$set(this.sharePacket, 'isState', Math.floor(res.data.priceName) === 0); - // - // // 设置营销活动 - // PromotionActivityApi.getActivityListBySpuId(this.id).then(res => { - // let activityList = res.data; - // activityList = ProductUtil.sortActivityList(activityList); - // this.$set(this, 'activityH5', activityList); - // }); - // + + // // 设置标题 // uni.setNavigationBarTitle({ // title: spu.name.substring(0, 7) + "..." @@ -911,33 +912,6 @@ }, }); }, - /** - * 获取产品分销二维码 - * @param function successFn 下载完成回调 - * - */ - downloadFilePromotionCode: function(successFn) { - let that = this; - seckillCode(that.id,{stop_time:that.datatime}).then(res => { - uni.downloadFile({ - url: that.setDomain(res.data.code), - success: function(res) { - that.$set(that, 'isDown', false); - if (typeof successFn == 'function') - successFn && successFn(res.tempFilePath); - else - that.$set(that, 'PromotionCode', res.tempFilePath); - }, - fail: function() { - that.$set(that, 'isDown', false); - that.$set(that, 'PromotionCode', ''); - }, - }); - }).catch(err => { - that.$set(that, 'isDown', false); - that.$set(that, 'PromotionCode', ''); - }); - }, getImageBase64:function(images){ let that = this; imageBase64({url:images}).then(res=>{