Compare commits

...

1 Commits

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

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

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

Loading…
Cancel
Save