diff --git a/src/view/month-card.vue b/src/view/month-card.vue index e700d43..8027a18 100644 --- a/src/view/month-card.vue +++ b/src/view/month-card.vue @@ -124,11 +124,24 @@ export default { } }); }, + countExtend() { + return new Promise((resolve, reject) => { + var params = { + buryingPointType: 0, + salesmanUniqueIdentity: this.uniqueId, + timeStr: this.getTime(Date.now()) + }; + homeApi.countExtend(params).then(res => { + + resolve(); + }); + }); + }, // 立即使用优惠券 handleUseCoupon() { window.location.href = - locationUrl + "/mall/web/vgoods/detail/" + this.getData.goodsNo+ '?uniqueId='+ uniqueId; + locationUrl + "/mall/web/vgoods/detail/" + this.getData.goodsNo+ '?uniqueId='+ this.uniqueId; }, // 领取优惠券 @@ -187,16 +200,33 @@ export default { let uuniqueId = Qs.parse(location.search.substring(1)).uniqueId var url = location.href.split('?')[0] if(this.uniqueId !== undefined && this.uniqueId !== null && this.uniqueId !== ""){ - + this.uniqueId = '' } // 初始化 this.handleInit(); - console.log('url:'+ url.split('?')[0]) - this.wxShare({ - couponNo: this.batchNo, - source: 20, - url: encodeURIComponent(url) - }); + return new Promise((resolve, reject) => { + var params = { + salesmanUniqueIdentity: this.uniqueId, + }; + homeApi.updateUniqueId(params).then(res => { + this.showLoading = false; + if (res.code == 0) { + this.uniqueId=this.$cookies.get('1hjz_mall_unique_id') + if(this.uniqueId !== undefined && this.uniqueId !== null && this.uniqueId !== ""){ + this.countExtend(); + } + this.wxShare({ + couponNo: this.batchNo, + source: 20, + url: encodeURIComponent(url) + }); + } else { + this.$vux.toast.text(res.msg, "middle"); + } + resolve(); + }); + }); + } };