{{ysf.entity.batch_goods_name}} x{{ysf.entity.send_num}}
@@ -115,7 +115,7 @@ el: "#ysf", data() { return { - ysf: JSON.parse(sessionStorage.getItem('goodsInfo')), + ysf: null, account: null, confirmAccount: null, backAble: (~~sessionStorage.getItem('goodsCount')) > 1, @@ -125,7 +125,7 @@ popStatus: 1, /*1 成功 2提示 3失败 */ prompt_text: '', cls: null, - receive_time: JSON.parse(sessionStorage.getItem('goodsInfo')).entity.time_limit, + receive_time: null, isMini: false, is: false, loading: false, @@ -136,7 +136,17 @@ components: { modelPop }, - + created() { + let token = localStorage.getItem('token'); + if (token) { + req.axiosPost('/key/products', { token }).then(res => { + if (res.code === 200) { + this.ysf = res.data[0]; + this.receive_time = res.data[0].entity.time_limit; + } + }) + } + }, mounted() { document.title = localStorage.getItem('title'); /* 判断是否是微信小程序内 */ @@ -144,7 +154,7 @@ this.isMini = /miniProgram/i.test(ua); /* 初始弹窗 */ - if (![1, 9].includes(this.ysf.available)) { + if (this.ysf && ![1, 9].includes(this.ysf.available)) { this.is = true; this.tip(product_status(this.ysf.available, this.ysf), 2); } @@ -176,7 +186,7 @@ methods: { /* 立即领取 */ submit() { - if (this.ysf.available != 1) return; + if (this.ysf && this.ysf.available != 1) return; if (phoneReg.test(this.account) && this.confirmAccount) { if (this.account === this.confirmAccount) { this.finalSubmit(); diff --git a/index.html b/index.html index e2e7834..5dd8835 100644 --- a/index.html +++ b/index.html @@ -224,15 +224,7 @@ req.axiosGet('/key/isOnlyOneUnionVoucher', params).then(res => { if (res.code === 200) { if (res.data.is_only_one_union_voucher) { - // 获取 商品详情,存储商品详情 - req.axiosPost('/key/products', { token: data.token }).then(ysfRes => { - if (ysfRes.code === 200) { - sessionStorage.setItem('goodsInfo', JSON.stringify(ysfRes.data[0])); - resolve(true) - } else { - resolve(false) - } - }) + resolve(true) } else { resolve(false) }