♻️ refactor: 重构单个卡密兑换逻辑

This commit is contained in:
wangsongsole 2024-01-08 18:08:36 +08:00
parent bce181d2b3
commit 71999bcc52
1 changed files with 6 additions and 13 deletions

View File

@ -243,15 +243,7 @@
//刷新页面
successchangeBtnFn () {
/* 只有卡密商品时 直接跳转查看卡密页面 */
if (this.goodInfo.product_type === 2 && this.goodInfo.card_show == 2 && !this.backAble) {
this.popboxshow = false;
this.maskshow = false;
localStorage.setItem('orderNumber', this.order_number);
window.location.href = './coupon/lookCard.html';
} else {
window.location.replace(document.referrer);
}
},
//兑换商品
@ -260,11 +252,13 @@
return this.openErrorDialog(product_status(goodsDetail.available, goodsDetail));
}
/* 卡密商品直接兑换 */
if (this.goodInfo.product_type === 2 && this.goodInfo.card_show == 2) {
if (this.goodInfo.product_type === 2 && this.goodInfo.card_show == 2 && this.backAble) {
this.maskshow = true;
this.popboxshow = true;
this.popboxtype = '兑换';
return;
} else {
return this.surexchangeBtn();
};
if (!this.account) {
@ -351,10 +345,9 @@
if (this.goodInfo.card_show == 2) {
if (!this.backAble) { /* 当只有一个卡密商品时 */
this.loading = true;
this.order_number = res.data.order_number;
this.successTip = '兑换成功!';
setTimeout(() => {
this.popboxshow = true;
localStorage.setItem('orderNumber', res.data.order_number);
window.location.href = './coupon/lookCard.html';
this.loading = false;
}, 3000);
} else {