feat:新增卡密商品类型支付

This commit is contained in:
wangsongsole 2022-10-28 11:28:30 +08:00
parent 7b45f7ec2b
commit 7578db7ac1
1 changed files with 30 additions and 23 deletions

View File

@ -52,6 +52,7 @@
</p> </p>
<p class="text">{{goodInfo.product_name}}</p> <p class="text">{{goodInfo.product_name}}</p>
</div> </div>
<template v-if="goodInfo.product_type===1">
<p v-if="acctype=='tel'"><span>账号:</span><input :type="acctype" <p v-if="acctype=='tel'"><span>账号:</span><input :type="acctype"
onkeyup="this.value=this.value.replace(/\D/g,'')" :disabled="goodsDetail.available!=1" onkeyup="this.value=this.value.replace(/\D/g,'')" :disabled="goodsDetail.available!=1"
onKeypress="return(/[\d]/.test(String.fromCharCode(event.keyCode)))" :maxlength="maxlen" onKeypress="return(/[\d]/.test(String.fromCharCode(event.keyCode)))" :maxlength="maxlen"
@ -66,6 +67,7 @@
<p v-if="acctype!='tel'"><span>再次输入:</span><input :type="acctype" :maxlength="maxlen" <p v-if="acctype!='tel'"><span>再次输入:</span><input :type="acctype" :maxlength="maxlen"
v-model="reAccount" :disabled="goodsDetail.available!=1" placeholder="请再次输入" v-model="reAccount" :disabled="goodsDetail.available!=1" placeholder="请再次输入"
@focus="(e)=>focusFn(e)"></p> @focus="(e)=>focusFn(e)"></p>
</template>
</div> </div>
<div class="bottom" id="bottom" :style="{borderWidth:(describe.type||detailUrl)?'0.05rem':'0'}" <div class="bottom" id="bottom" :style="{borderWidth:(describe.type||detailUrl)?'0.05rem':'0'}"
v-show="describe.type||detailUrl"> v-show="describe.type||detailUrl">
@ -156,9 +158,14 @@
{{(goodsDetail.origin_price-goodsDetail.coupon_price).toFixed(2)}}</p> {{(goodsDetail.origin_price-goodsDetail.coupon_price).toFixed(2)}}</p>
</div> </div>
</div> </div>
<button class="exchange-btn" v-if="goodsDetail.type===1" <template v-if="goodsDetail.type===1">
<button class="exchange-btn" v-if="goodInfo.product_type===1"
:style="{'background': exchangeOpen?bgcolor:'#D7D7D7','color':exchangeOpen?ftColor:'#333'}" :style="{'background': exchangeOpen?bgcolor:'#D7D7D7','color':exchangeOpen?ftColor:'#333'}"
@click="exchangeGoodsFn">立即支付</button> @click="exchangeGoodsFn">立即支付</button>
<button v-else class="exchange-btn" v-else :style="{'background': bgcolor,'color':ftColor}"
@click="exchangeGoodsFn">立即支付</button>
</template>
<button class="exchange-btn" v-else :style="{'background': bgcolor,'color':ftColor}" <button class="exchange-btn" v-else :style="{'background': bgcolor,'color':ftColor}"
@click="exchangeGoodsFn">立即支付</button> @click="exchangeGoodsFn">立即支付</button>
</div> </div>
@ -435,7 +442,7 @@
//兑换商品 //兑换商品
exchangeGoodsFn () { exchangeGoodsFn () {
if (this.goodsDetail.type === 1) { /* 兑换码 */ if (this.goodsDetail.type === 1 && this.goodInfo.product_type === 1) { /* 兑换码 */
if (goodsDetail.available != 1) { if (goodsDetail.available != 1) {
this.openErrorDialog(product_status(goodsDetail.available, goodsDetail)); this.openErrorDialog(product_status(goodsDetail.available, goodsDetail));
return return
@ -533,8 +540,8 @@
this.payType = payType this.payType = payType
this.show = false this.show = false
let orderInfo = await this.createdOrder(payType); let orderInfo = await this.createdOrder(payType);
if (orderInfo.pay_status == 2||[1,2].includes(orderInfo.channel)) {//pay_status 2已支付 channel 1 支付宝 2微信 if (orderInfo.pay_status == 2 || [1, 2].includes(orderInfo.channel)) {//pay_status 2已支付 channel 1 支付宝 2微信
let orderNumber=orderInfo.pay_status == 2?orderInfo.order_number:orderInfo.original_order_number; let orderNumber = orderInfo.pay_status == 2 ? orderInfo.order_number : orderInfo.original_order_number;
window.location.replace('http://test.86885.cn/paysuccess.html?order_number=' + orderNumber); window.location.replace('http://test.86885.cn/paysuccess.html?order_number=' + orderNumber);
} else { } else {
this.createdPay(orderInfo.order_number); this.createdPay(orderInfo.order_number);
@ -549,9 +556,9 @@
"key": localStorage.getItem('key'), "key": localStorage.getItem('key'),
"code_batch_id": this.goodsDetail.code_batch_id, "code_batch_id": this.goodsDetail.code_batch_id,
"goods_id": this.goodInfo.goods_id, "goods_id": this.goodInfo.goods_id,
"account": this.account, "account": this.account || '888888', /* 卡密时默认账号 */
"pay_type": payType == 2 ? 1 : 5, "pay_type": payType == 2 ? 1 : 5,
"pay_amount":this.goodsDetail.coupon_price "pay_amount": this.goodsDetail.coupon_price
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
req.axiosPost('/key/createCouponOrder', data).then(res => { req.axiosPost('/key/createCouponOrder', data).then(res => {
@ -571,7 +578,7 @@
//优惠券订单支付 //优惠券订单支付
createdPay (orderNumber) { createdPay (orderNumber) {
req.axiosGet('/key/coupon/createPay/' + orderNumber,{token:localStorage.getItem('token')}).then(res => { req.axiosGet('/key/coupon/createPay/' + orderNumber, { token: localStorage.getItem('token') }).then(res => {
if (res.code == 200) { if (res.code == 200) {
this.payWayRun(res.data); this.payWayRun(res.data);
} else { } else {