Compare commits

...

1 Commits

Author SHA1 Message Date
ch 110ecd547b fix: 修复立即支付报订单异常问题
3 years ago

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-05-08 00:39:50 * @Date: 2022-05-08 00:39:50
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-05-12 11:44:04 * @LastEditTime: 2022-06-10 18:12:14
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -11,7 +11,7 @@
<div class="pay"> <div class="pay">
<span class="pay--timer">{{timerTxt}}</span> <span class="pay--timer">{{timerTxt}}</span>
<UiMoney class="money" sufSize="14px" preSize="14px" size="20px" <UiMoney class="money" sufSize="14px" preSize="14px" size="20px"
float suffix prefix :money="orderInfo.payAmount"/> float suffix prefix :money="orderDetail.payAmount"/>
<div class="pay--code"> <div class="pay--code">
<img :src="imgUrl" v-if="imgUrl"/> <img :src="imgUrl" v-if="imgUrl"/>
<!-- <p v-if="!timer"></p> --> <!-- <p v-if="!timer"></p> -->
@ -34,11 +34,15 @@ export default {
orderId : { orderId : {
type : Number | String, type : Number | String,
default : '' default : ''
},
orderInfo:{
type : Object,
default : () => ({})
} }
}, },
data(){ data(){
return { return {
orderInfo: {}, orderDetail: {},
imgUrl : '', imgUrl : '',
timerTxt : '', timerTxt : '',
startSecondNum : 0, startSecondNum : 0,
@ -57,20 +61,24 @@ export default {
}, },
methods : { methods : {
open(){ open(){
this.getOrderInfo(); this.getOrderDetail();
this.getCodeImg(); this.getCodeImg();
}, },
/** /**
* 获取订单最新信息 * 获取订单最新信息
*/ */
async getOrderInfo(){ async getOrderDetail(){
if(this.orderInfo.orderId){
this.orderDetail = this.orderInfo;
}else{
const {error, result} = await ApiGetOrderDetail(this.orderId); const {error, result} = await ApiGetOrderDetail(this.orderId);
if(error){ if(error){
this.$message.warning(error.message); this.$message.warning(error.message);
return false; return false;
} }
this.orderInfo = result; this.orderDetail = result;
if(this.orderInfo.orderStatus === 1){ }
if(this.orderDetail.orderStatus === 1 || !this.orderDetail.orderStatus){
// //
if(this.timerStop){ if(this.timerStop){
clearInterval(this.timerStop); clearInterval(this.timerStop);
@ -81,7 +89,7 @@ export default {
} }
}, },
async getCodeImg(){ async getCodeImg(){
const {error, result} = await ApiPostPayCdoeImg({orderId : this.orderId}); const {error, result} = await ApiPostPayCdoeImg({orderId : this.orderId || this.orderInfo.orderId});
if(error){ if(error){
return false; return false;
} }
@ -92,8 +100,8 @@ export default {
* 计算倒计时开始秒数 * 计算倒计时开始秒数
*/ */
calcTimerStartSecondNum(){ calcTimerStartSecondNum(){
let expireTime = (new Date(this.orderInfo.expireTime.replace(/-/g,'/'))).getTime(), let expireTime = (new Date(this.orderDetail.expireTime.replace(/-/g,'/'))).getTime(),
curTime = (new Date(this.orderInfo.serverTime.replace(/-/g,'/'))).getTime(), curTime = (new Date(this.orderDetail.serverTime.replace(/-/g,'/'))).getTime(),
second = Math.floor((expireTime - curTime) / 1000); second = Math.floor((expireTime - curTime) / 1000);
this.startSecondNum = second > 0 ? second : 0; this.startSecondNum = second > 0 ? second : 0;
this.timerStop = setInterval(()=> { this.timerStop = setInterval(()=> {

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-05-04 17:30:58 * @Date: 2022-05-04 17:30:58
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-05-27 19:54:39 * @LastEditTime: 2022-06-10 18:05:11
* @Description: file content * @Description: file content
--> -->
@ -24,7 +24,7 @@
<div class="pay"> <div class="pay">
<UiButton radius type="red_panel" @click="submit"></UiButton> <UiButton radius type="red_panel" @click="submit"></UiButton>
</div> </div>
<BsPay :visible.sync="payVisible" :orderId="payOrder.orderId" <BsPay :visible.sync="payVisible" :orderInfo="payOrder"
@cancel="cancelPay" @finish="finishPay" /> @cancel="cancelPay" @finish="finishPay" />
</div> </div>
</template> </template>

Loading…
Cancel
Save