|
|
|
@ -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(){
|
|
|
|
|
const {error, result} = await ApiGetOrderDetail(this.orderId);
|
|
|
|
|
if(error){
|
|
|
|
|
this.$message.warning(error.message);
|
|
|
|
|
return false;
|
|
|
|
|
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.orderDetail = result;
|
|
|
|
|
}
|
|
|
|
|
this.orderInfo = result;
|
|
|
|
|
if(this.orderInfo.orderStatus === 1){
|
|
|
|
|
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(()=> {
|
|
|
|
|