fix: 增加判断

This commit is contained in:
zhangds 2024-03-19 17:55:37 +08:00
parent de7986c47d
commit 1b9a52c844
1 changed files with 25 additions and 23 deletions

View File

@ -215,7 +215,7 @@
let goodsCount = null, goodsDetail = null;
new Vue({
el: '#exchangePage',
data () {
data() {
return {
account: '',
reAccount: '',
@ -253,7 +253,7 @@
filters: {
cardType (val) {
cardType(val) {
return val.map((item) => {
return item == 1 ? "借记卡" : "信用卡" + " ";
}).join(" ");
@ -261,17 +261,17 @@
},
watch: {
account (va) {
account(va) {
va && this.watchAccount();
},
reAccount (va) {
reAccount(va) {
va && this.watchAccount();
},
productType: {
immediate: true,
handler (newVal) {
handler(newVal) {
this.maxlen = 50;
this.acctype = "text";
switch (Number(newVal)) {
@ -345,15 +345,17 @@
modelPop
},
created () {
created() {
/* 配置信息 */
document.title = localStorage.getItem('title');
let detailsConfig = JSON.parse(localStorage.getItem('product_detail'));
goodsCount = localStorage.getItem('goodsCount');
this.backAble = goodsCount > 1;//多个商品才有返回
this.bgcolor = detailsConfig.button_color;
this.ftColor = detailsConfig.font_color;
this.describe = detailsConfig.describe;
if (detailsConfig) {
this.bgcolor = detailsConfig.button_color;
this.ftColor = detailsConfig.font_color;
this.describe = detailsConfig.describe;
}
//商品详情
goodsDetail = JSON.parse(localStorage.getItem('goodsInfo'));
@ -364,18 +366,18 @@
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;
}
},
methods: {
bindAvailable () {
bindAvailable() {
if (goodsDetail.wait_pay_order == 1) {
this.openErrorDialog('您有未支付的订单');
return;
@ -387,7 +389,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) => {
@ -408,7 +410,7 @@
},
/* 请求详情 */
getDetails (goods_id, code_batch_id) {
getDetails(goods_id, code_batch_id) {
const token = localStorage.getItem('token');
return new Promise((resolve, reject) => {
req.axiosPost(`/key/product_detail/${goods_id}`, { token, code_batch_id }).then(({ code, data, message }) => {
@ -452,11 +454,11 @@
},
/* 跳转订单 */
toOrder () {
toOrder() {
window.location.replace('./myOrder.html');
},
openErrorDialog (tip, bottomText) {
openErrorDialog(tip, bottomText) {
this.popTitle = '温馨提示';
this.popText = tip;
this.popStatus = 2;
@ -464,7 +466,7 @@
this.bottomText = bottomText;
},
backHandler () {
backHandler() {
if (goodsCount > 1) {
window.location.replace('./couponCollection.html');
} else {
@ -473,7 +475,7 @@
},
// 单条弹框
openDialog (tip) {
openDialog(tip) {
this.promtshow = true;
this.promttip = tip;
setTimeout(() => {
@ -483,14 +485,14 @@
},
/* 弹窗回调 */
backFunctionPop (type) {
backFunctionPop(type) {
if (this.isLogin) {
this.delayedOut();
}
},
/* 延时自动退出 */
delayedOut (time = 1) {
delayedOut(time = 1) {
let entryLink = localStorage.getItem('entryLink');
setTimeout(() => {
window.location.replace(entryLink);
@ -498,7 +500,7 @@
},
//兑换商品
exchangeGoodsFn () {
exchangeGoodsFn() {
//wait_pay_order 1有订单 5无订单
if (goodsDetail.wait_pay_order == 1) {
this.openErrorDialog('您有未支付的订单');
@ -603,7 +605,7 @@
window.location.href = './settlement.html';
},
focusFn (a) {
focusFn(a) {
let ele = document.querySelector('.ipt-acc');
setTimeout(function () {
ele.scrollIntoView(false);
@ -612,7 +614,7 @@
}, 400);
},
/* 监听账号 */
watchAccount () {
watchAccount() {
if ((this.account === this.reAccount) && this.account) {
this.exchangeOpen = true;
} else {