From d1d8db3669824405c4ddd0544d707cab3165bef9 Mon Sep 17 00:00:00 2001 From: zhangds Date: Fri, 1 Mar 2024 15:30:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=E4=BA=AC=E4=B8=9CE?= =?UTF-8?q?=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packkey/exchange.html | 103 +++++++++++++++++++++++++++++++++++------- 1 file changed, 87 insertions(+), 16 deletions(-) diff --git a/packkey/exchange.html b/packkey/exchange.html index b19a6df..65fe72f 100644 --- a/packkey/exchange.html +++ b/packkey/exchange.html @@ -72,22 +72,45 @@

{{goodInfo.product_name}}

-
@@ -100,7 +123,7 @@

订单

@@ -169,6 +192,8 @@ popboxshow: false, exchangeOpen: false, suspension: false, + cunt: 60, + jd_code: '', popboxtype: '', describe: {}, detailUrl: '', @@ -244,7 +269,29 @@ return; } }, - openErrorDialog(tip) { + + /* 获取京东E卡短信 */ + sendJDSms () { + if (this.cunt === 60) { + req.axiosPost('/key/order/jdSendSms', { code_batch_id: this.goodsDetail.code_batch_id, mobile: this.account }) + .then((res) => { + if (res.code == 200) { + this.openDialog('短信下发成功!'); + const clr = setInterval(() => { + if (this.cunt <= 1) { + this.cunt = 60; + return clearInterval(clr); + } + this.cunt--; + }, 1000); + } else { + this.openErrorDialog(res.message); + } + }); + } + }, + + openErrorDialog (tip) { this.maskshow = true; this.popboxtype = '提示'; this.tiptext = tip; @@ -297,6 +344,16 @@ return this.surexchangeBtn(); } + /* 京东E卡 */ + if (this.goodInfo.is_e_card && this.goodInfo.product_type === 1) { + if (this.computedExChange) { + this.maskshow = true; + this.popboxshow = true; + this.popboxtype = '兑换'; + } + return; + } + if (!this.account) { this.openDialog('请输入兑换账号!'); return false; @@ -367,7 +424,8 @@ "goods_id": this.goodInfo.goods_id, "account": this.account, "code_batch_id": this.goodInfo.code_batch_id, - "token": localStorage.getItem('token') + "token": localStorage.getItem('token'), + 'jd_code': this.jd_code }; self.popboxshow = false; req.axiosPost('/key/usage', data).then(res => { @@ -450,6 +508,19 @@ this.reaccount = ""; }, }, + + computed: { + /* 手机号验证 */ + computedAccount () { + return /^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(this.account); + }, + + /* 兑换按钮验证 */ + 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() { if ((this.account == this.reaccount) && this.account) {