diff --git a/components/CountDown.vue b/components/CountDown.vue index cec9316..7bb8037 100644 --- a/components/CountDown.vue +++ b/components/CountDown.vue @@ -42,8 +42,9 @@ export default { default: true, }, }, - data: function() { + data() { return { + timeInterval: null, time: this.datatime, day: '00', hour: '00', @@ -51,7 +52,7 @@ export default { second: '00', } }, - created: function() { + created() { this.show_time() }, watch: { @@ -61,10 +62,11 @@ export default { this.show_time() }, }, - mounted: function() {}, + mounted() { + }, methods: { - show_time: function() { - let that = this + show_time() { + console.log(this.datatime) if (this.time.toString().length == 13) { // 毫秒级 console.log('毫秒') @@ -77,41 +79,44 @@ export default { console.log('时间') this.time = Date.parse(this.time) / 1000 } - - function runTime() { - //时间函数 - let intDiff = that.time - Date.parse(new Date()) / 1000 //获取数据中的时间戳的时间差; - let day = 0, - hour = 0, - minute = 0, - second = 0 - if (intDiff > 0) { - //转换时间 - if (that.isDay === true) { - day = Math.floor(intDiff / (60 * 60 * 24)) - } else { - day = 0 - } - hour = Math.floor(intDiff / (60 * 60)) - day * 24 - minute = Math.floor(intDiff / 60) - day * 24 * 60 - hour * 60 - second = Math.floor(intDiff) - day * 24 * 60 * 60 - hour * 60 * 60 - minute * 60 - if (hour <= 9) hour = '0' + hour - if (minute <= 9) minute = '0' + minute - if (second <= 9) second = '0' + second - that.day = day - that.hour = hour - that.minute = minute - that.second = second - } else { - that.day = '00' - that.hour = '00' - that.minute = '00' - that.second = '00' - } - } - runTime() - this.timeInterval = setInterval(runTime, 1000) + this.runTime() + this.timeInterval = setInterval(this.runTime, 1000) }, + runTime() { + //时间函数 + let intDiff = this.time - Date.parse(new Date()) / 1000 //获取数据中的时间戳的时间差 + console.log(intDiff) + let day = 0, + hour = 0, + minute = 0, + second = 0 + if (intDiff > 0) { + //转换时间 + if (this.isDay === true) { + day = Math.floor(intDiff / (60 * 60 * 24)) + } else { + day = 0 + } + hour = Math.floor(intDiff / (60 * 60)) - day * 24 + minute = Math.floor(intDiff / 60) - day * 24 * 60 - hour * 60 + second = Math.floor(intDiff) - day * 24 * 60 * 60 - hour * 60 * 60 - minute * 60 + if (hour <= 9) hour = '0' + hour + if (minute <= 9) minute = '0' + minute + if (second <= 9) second = '0' + second + this.day = day + this.hour = hour + this.minute = minute + this.second = second + } else { + this.day = '00' + this.hour = '00' + this.minute = '00' + this.second = '00' + } + } }, + destroyed() { + clearTimeout(this.timeInterval) + } } diff --git a/components/ProductWindow.vue b/components/ProductWindow.vue index 0dda009..3bdf3f6 100644 --- a/components/ProductWindow.vue +++ b/components/ProductWindow.vue @@ -83,6 +83,7 @@ export default { return {}; }, mounted: function () { + console.log(this.attr) console.log(this); }, watch: { diff --git a/pages/activity/GoodsSeckill/index.vue b/pages/activity/GoodsSeckill/index.vue index 60df6de..7652ea2 100644 --- a/pages/activity/GoodsSeckill/index.vue +++ b/pages/activity/GoodsSeckill/index.vue @@ -37,7 +37,7 @@ 距离{{ item.status == 1 ? '结束还剩' : '开始还有' }} - + @@ -163,6 +163,7 @@ export default { that.status = false that.active = index that.datatime = that.timeList[that.active].stop + console.log(new Date(that.datatime)) this.seckillList = [] that.getSeckillList() }, diff --git a/pages/activity/GroupDetails/index.vue b/pages/activity/GroupDetails/index.vue index 5cfd5c1..cac09b4 100644 --- a/pages/activity/GroupDetails/index.vue +++ b/pages/activity/GroupDetails/index.vue @@ -260,7 +260,7 @@ export default { }, methods: { formatPrice(price, index) { - console.log(price) + // console.log(price) if (price) { return price.split('.')[index] } @@ -284,15 +284,6 @@ export default { }, } }, - openAlone: function() { - this.$yrouter.push({ - path: '/pages/shop/GoodsCon/index', - query: { - id: this.storeInfo.productId, - }, - }) - // this.$yrouter.replace({ path: "/detail/" + this.storeInfo.productId }); - }, //收藏商品 setCollect: function() { let that = this, @@ -452,24 +443,41 @@ export default { this.$set(this, 'attrTxt', '请选择') } }, - + // 单独购买 + openAlone: function() { + this.$yrouter.push({ + path: '/pages/shop/GoodsCon/index', + query: { + id: this.storeInfo.productId, + }, + }) + // this.$yrouter.replace({ path: "/detail/" + this.storeInfo.productId }); + }, + // 发起拼团 openTeam: function() { var that = this - if (that.attr.cartAttr == false) { + console.log(this.attr) + if (that.attr.cartAttr == false) { // 展示弹框 + console.log(this.attr.cartAttr) that.attr.cartAttr = !this.attr.cartAttr - } else { + // 设置拼团价格 + that.attr.productSelect.price = this.storeInfo.price + } else { // 已有弹框——初始化商品信息,下单请求 var data = {} data.productId = that.storeInfo.productId + data.price = that.storeInfo.price data.cartNum = that.attr.productSelect.cart_num data.uniqueId = that.attr.productSelect.unique data.combinationId = that.storeInfo.id data.new = 1 + console.log(data) postCartAdd(data) .then(res => { that.$yrouter.push({ path: '/pages/order/OrderSubmission/index', query: { - id: res.data.cartId, + // id: res.data.cartId, + pinkId: res.data.cartId, }, }) }) diff --git a/pages/home/index.vue b/pages/home/index.vue index c4647da..0d0525f 100644 --- a/pages/home/index.vue +++ b/pages/home/index.vue @@ -46,6 +46,10 @@ + + + PC +