fix: 修复核销接口不刷新

This commit is contained in:
zhangds 2024-04-29 15:37:18 +08:00
parent e1d98f9c55
commit 7a9a6502e4
2 changed files with 17 additions and 15 deletions

View File

@ -28,7 +28,7 @@
:text="popText"></model-pop> :text="popText"></model-pop>
<!-- 单条弹出框 --> <!-- 单条弹出框 -->
<img class="bubble" src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/ysf-logo.png" alt=""> <img class="bubble" src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/ysf-logo.png" alt="">
<div class="content"> <div class="content" v-if="ysf">
<p class="title">{{ysf.entity.batch_goods_name}} <p class="title">{{ysf.entity.batch_goods_name}}
<span class="send_num" v-if="ysf.entity.send_num>1">x{{ysf.entity.send_num}}</span> <span class="send_num" v-if="ysf.entity.send_num>1">x{{ysf.entity.send_num}}</span>
</p> </p>
@ -115,7 +115,7 @@
el: "#ysf", el: "#ysf",
data() { data() {
return { return {
ysf: JSON.parse(sessionStorage.getItem('goodsInfo')), ysf: null,
account: null, account: null,
confirmAccount: null, confirmAccount: null,
backAble: (~~sessionStorage.getItem('goodsCount')) > 1, backAble: (~~sessionStorage.getItem('goodsCount')) > 1,
@ -125,7 +125,7 @@
popStatus: 1, /*1 成功 2提示 3失败 */ popStatus: 1, /*1 成功 2提示 3失败 */
prompt_text: '', prompt_text: '',
cls: null, cls: null,
receive_time: JSON.parse(sessionStorage.getItem('goodsInfo')).entity.time_limit, receive_time: null,
isMini: false, isMini: false,
is: false, is: false,
loading: false, loading: false,
@ -136,7 +136,17 @@
components: { components: {
modelPop 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() { mounted() {
document.title = localStorage.getItem('title'); document.title = localStorage.getItem('title');
/* 判断是否是微信小程序内 */ /* 判断是否是微信小程序内 */
@ -144,7 +154,7 @@
this.isMini = /miniProgram/i.test(ua); 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.is = true;
this.tip(product_status(this.ysf.available, this.ysf), 2); this.tip(product_status(this.ysf.available, this.ysf), 2);
} }
@ -176,7 +186,7 @@
methods: { methods: {
/* 立即领取 */ /* 立即领取 */
submit() { submit() {
if (this.ysf.available != 1) return; if (this.ysf && this.ysf.available != 1) return;
if (phoneReg.test(this.account) && this.confirmAccount) { if (phoneReg.test(this.account) && this.confirmAccount) {
if (this.account === this.confirmAccount) { if (this.account === this.confirmAccount) {
this.finalSubmit(); this.finalSubmit();

View File

@ -224,18 +224,10 @@
req.axiosGet('/key/isOnlyOneUnionVoucher', params).then(res => { req.axiosGet('/key/isOnlyOneUnionVoucher', params).then(res => {
if (res.code === 200) { if (res.code === 200) {
if (res.data.is_only_one_union_voucher) { 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) resolve(true)
} else { } else {
resolve(false) resolve(false)
} }
})
} else {
resolve(false)
}
} else { } else {
resolve(false) resolve(false)
} }