fix: 修改 卡密兑换商品
This commit is contained in:
parent
8b7c4b5783
commit
d90f947c3b
|
@ -156,7 +156,7 @@
|
|||
let goodsCount = null, goodsDetail = null;
|
||||
new Vue({
|
||||
el: '#exchangePage',
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
account: '',
|
||||
reaccount: '',
|
||||
|
@ -189,7 +189,7 @@
|
|||
]
|
||||
};
|
||||
},
|
||||
created () {
|
||||
created() {
|
||||
document.title = localStorage.getItem('title');
|
||||
let detailsConfig = JSON.parse(localStorage.getItem('product_detail'));
|
||||
goodsCount = sessionStorage.getItem('goodsCount');
|
||||
|
@ -227,7 +227,7 @@
|
|||
});
|
||||
},
|
||||
methods: {
|
||||
bindAvailable () {
|
||||
bindAvailable() {
|
||||
if (goodsDetail.available != 1) {
|
||||
this.openErrorDialog(product_status(goodsDetail.available, goodsDetail));
|
||||
return;
|
||||
|
@ -235,7 +235,7 @@
|
|||
},
|
||||
|
||||
/* 获取京东E卡短信 */
|
||||
sendJDSms () {
|
||||
sendJDSms() {
|
||||
if (this.cunt === 60) {
|
||||
req.axiosPost('/key/order/jdSendSms', { code_batch_id: this.goodsDetail.code_batch_id, mobile: this.account })
|
||||
.then((res) => {
|
||||
|
@ -255,27 +255,27 @@
|
|||
}
|
||||
},
|
||||
|
||||
openErrorDialog (tip) {
|
||||
openErrorDialog(tip) {
|
||||
this.maskshow = true;
|
||||
this.popboxtype = '提示';
|
||||
this.tiptext = tip;
|
||||
this.popboxshow = true;
|
||||
},
|
||||
backgoodsFn () {
|
||||
backgoodsFn() {
|
||||
if (goodsCount > 1) {
|
||||
window.location.replace('./homepage.html');
|
||||
} else {
|
||||
history.go(-2);
|
||||
}
|
||||
},
|
||||
closeTip () {
|
||||
closeTip() {
|
||||
this.suspension = false;
|
||||
},
|
||||
susTipFn () {
|
||||
susTipFn() {
|
||||
this.suspension = true;
|
||||
},
|
||||
// 单条弹框
|
||||
openDialog (tip) {
|
||||
openDialog(tip) {
|
||||
this.promtshow = true;
|
||||
this.promttip = tip;
|
||||
const clr = setTimeout(() => {
|
||||
|
@ -286,22 +286,28 @@
|
|||
},
|
||||
|
||||
//刷新页面
|
||||
successchangeBtnFn () {
|
||||
successchangeBtnFn() {
|
||||
window.location.replace(document.referrer);
|
||||
},
|
||||
|
||||
//兑换商品
|
||||
exchangeGoodsFn () {
|
||||
exchangeGoodsFn() {
|
||||
if (goodsDetail.available != 1) {
|
||||
return this.openErrorDialog(product_status(goodsDetail.available, goodsDetail));
|
||||
}
|
||||
|
||||
/* 卡密商品直接兑换 */
|
||||
if (this.goodInfo.product_type === 2 && this.goodInfo.card_show == 2 && this.backAble) {
|
||||
if (this.goodInfo.product_type === 2 && this.goodInfo.card_show == 2) {
|
||||
/* 当只有一个卡密商品、为线上查看卡密且只能兑换一次时执行 */
|
||||
if (!this.backAble && this.goodsDetail.restrict == 1) {
|
||||
return this.surexchangeBtn();
|
||||
} else {
|
||||
this.maskshow = true;
|
||||
this.popboxshow = true;
|
||||
this.popboxtype = '兑换';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* 当只有一个卡密商品、为线上查看卡密且只能兑换一次时执行 */
|
||||
if (this.goodInfo.product_type === 2 && this.goodInfo.card_show == 2 && !this.backAble && this.goodsDetail.restrict == 1) {
|
||||
|
@ -380,7 +386,7 @@
|
|||
this.popboxtype = '兑换';
|
||||
},
|
||||
//确定兑换
|
||||
surexchangeBtn () {
|
||||
surexchangeBtn() {
|
||||
this.maskshow = false;
|
||||
let self = this;
|
||||
let data = {
|
||||
|
@ -434,14 +440,14 @@
|
|||
});
|
||||
},
|
||||
//关闭弹出框,仅关闭弹框
|
||||
successchangeBtn () {
|
||||
successchangeBtn() {
|
||||
this.maskshow = false;
|
||||
this.popboxshow = false;
|
||||
this.account = "";
|
||||
this.reaccount = "";
|
||||
this.jd_code = '';
|
||||
},
|
||||
focusFn (a) {
|
||||
focusFn(a) {
|
||||
let ele = document.querySelector('.ipt-acc');
|
||||
setTimeout(function () {
|
||||
ele.scrollIntoView(false);
|
||||
|
@ -450,7 +456,7 @@
|
|||
}, 400);
|
||||
},
|
||||
//关闭,关闭弹框
|
||||
closeBtn () {
|
||||
closeBtn() {
|
||||
this.popboxshow = false;
|
||||
this.maskshow = false;
|
||||
this.account = "";
|
||||
|
@ -461,25 +467,25 @@
|
|||
|
||||
computed: {
|
||||
/* 手机号验证 */
|
||||
computedAccount () {
|
||||
computedAccount() {
|
||||
return /^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(this.account);
|
||||
},
|
||||
|
||||
/* 兑换按钮验证 */
|
||||
computedExChange () {
|
||||
computedExChange() {
|
||||
return this.exchangeOpen || (this.goodInfo.product_type === 2 && this.goodInfo.card_show == 2) || this.goodInfo.is_e_card && this.computedAccount && this.jd_code.length === 6;
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
account () {
|
||||
account() {
|
||||
if ((this.account == this.reaccount) && this.account) {
|
||||
this.exchangeOpen = true;
|
||||
} else {
|
||||
this.exchangeOpen = false;
|
||||
}
|
||||
},
|
||||
reaccount () {
|
||||
reaccount() {
|
||||
if ((this.account == this.reaccount) && this.account) {
|
||||
this.exchangeOpen = true;
|
||||
} else {
|
||||
|
@ -488,7 +494,7 @@
|
|||
},
|
||||
productType: {
|
||||
immediate: true,
|
||||
handler (newVal) {
|
||||
handler(newVal) {
|
||||
this.maxlen = 50;
|
||||
this.acctype = "text";
|
||||
if (newVal == 0) {
|
||||
|
|
|
@ -343,13 +343,19 @@
|
|||
if (goodsDetail.available != 1) {
|
||||
return this.openErrorDialog(product_status(goodsDetail.available, goodsDetail));
|
||||
}
|
||||
|
||||
/* 卡密商品直接兑换 */
|
||||
if (this.goodInfo.product_type === 2 && this.goodInfo.card_show == 2 && this.backAble) {
|
||||
if (this.goodInfo.product_type === 2 && this.goodInfo.card_show == 2) {
|
||||
/* 当只有一个卡密商品、为线上查看卡密且只能兑换一次时执行 */
|
||||
if (!this.backAble && this.goodsDetail.restrict == 1) {
|
||||
return this.surexchangeBtn();
|
||||
} else {
|
||||
this.maskshow = true;
|
||||
this.popboxshow = true;
|
||||
this.popboxtype = '兑换';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* 当只有一个卡密商品、为线上查看卡密且只能兑换一次时执行 */
|
||||
if (this.goodInfo.product_type === 2 && this.goodInfo.card_show == 2 && !this.backAble && this.goodsDetail.restrict == 1) {
|
||||
|
|
Loading…
Reference in New Issue