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>
<!-- 单条弹出框 -->
<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}}
<span class="send_num" v-if="ysf.entity.send_num>1">x{{ysf.entity.send_num}}</span>
</p>
@ -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();

View File

@ -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)
}