Merge branch 'feature/task1.0.0-0505-ch' into feature/task1.0.0

merge-requests/26/head
ch 2 years ago
commit f3d14a0e4d

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Before

Width:  |  Height:  |  Size: 928 B

After

Width:  |  Height:  |  Size: 928 B

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 763 B

After

Width:  |  Height:  |  Size: 763 B

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 752 B

After

Width:  |  Height:  |  Size: 752 B

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 812 B

After

Width:  |  Height:  |  Size: 812 B

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-05-09 20:20:02
* @LastEditors: ch
* @LastEditTime: 2022-05-09 20:41:46
* @LastEditTime: 2022-05-12 11:18:03
* @Description: file content
-->
<template>
@ -19,7 +19,7 @@
</template>
<script>
import {ApiPutCancelOrder,ApiPutOrderReceive} from '@/plugins/api/order'
import UiButton from '../../../../../../components/UiButton.vue';
import UiButton from '@/components/UiButton.vue';
export default {
components: { UiButton },
props : {
@ -105,6 +105,7 @@ export default {
}
.el-dialog__header{
padding: 30px 0 15px;
text-align: center;
}
.el-dialog__title{
font-size: 20px;

@ -2,19 +2,19 @@
* @Author: ch
* @Date: 2022-05-08 00:39:50
* @LastEditors: ch
* @LastEditTime: 2022-05-10 14:12:29
* @LastEditTime: 2022-05-12 11:44:04
* @Description: file content
-->
<template>
<el-dialog title="打开微信扫描付款" width="380px" class="box" center
:visible.sync="myVisible" @open="getCodeImg" @close="close">
:visible.sync="myVisible" @open="open" @close="close">
<div class="pay">
<span class="pay--timer">{{timer}}</span>
<span class="pay--timer">{{timerTxt}}</span>
<UiMoney class="money" sufSize="14px" preSize="14px" size="20px"
float suffix prefix :money="39"/>
float suffix prefix :money="orderInfo.payAmount"/>
<div class="pay--code">
<img :src="imgUrl" v-if="imgUrl"/>
<p v-if="!timer"></p>
<!-- <p v-if="!timer"></p> -->
</div>
<p class="pay--tips">如支付后没有自动跳转请点击 <span class="pay--finish" @click="finish"></span></p>
</div>
@ -22,6 +22,7 @@
</template>
<script>
import {ApiPostPayCdoeImg} from '@/plugins/api/wx'
import {ApiGetOrderDetail} from '@/plugins/api/order'
import UiMoney from './UiMoney.vue'
export default {
components: { UiMoney },
@ -33,20 +34,15 @@ export default {
orderId : {
type : Number | String,
default : ''
},
timer : {
type : String,
default : '',
},
money : {
type : String | Number,
default : 0
}
},
data(){
return {
orderInfo: {},
imgUrl : '',
timerTxt : '',
startSecondNum : 0,
timerStop : null,
}
},
computed:{
@ -60,6 +56,30 @@ export default {
}
},
methods : {
open(){
this.getOrderInfo();
this.getCodeImg();
},
/**
* 获取订单最新信息
*/
async getOrderInfo(){
const {error, result} = await ApiGetOrderDetail(this.orderId);
if(error){
this.$message.warning(error.message);
return false;
}
this.orderInfo = result;
if(this.orderInfo.orderStatus === 1){
//
if(this.timerStop){
clearInterval(this.timerStop);
}
this.calcTimerStartSecondNum();
this.timer();
}
},
async getCodeImg(){
const {error, result} = await ApiPostPayCdoeImg({orderId : this.orderId});
if(error){
@ -67,7 +87,35 @@ export default {
}
this.imgUrl = result.dataInfo.codeImgData;
},
/**
* 计算倒计时开始秒数
*/
calcTimerStartSecondNum(){
let expireTime = (new Date(this.orderInfo.expireTime.replace(/-/g,'/'))).getTime(),
curTime = (new Date(this.orderInfo.serverTime.replace(/-/g,'/'))).getTime(),
second = Math.floor((expireTime - curTime) / 1000);
this.startSecondNum = second > 0 ? second : 0;
this.timerStop = setInterval(()=> {
this.timer()
},1000)
},
/**
* 待付款的倒计时
*/
timer(){
if(this.startSecondNum == 0){
this.close();
return;
}
this.startSecondNum--;
let minute = parseInt(this.startSecondNum / 60);
let second = parseInt(this.startSecondNum % 60);
this.timerTxt = `剩余${minute > 0 ? `${minute}` : ''} ${second}`;
},
close(){
clearInterval(this.timerStop);
this.timerStop = null;
this.$emit('cancel');
},
finish(){

@ -2,11 +2,11 @@
* @Author: ch
* @Date: 2022-05-08 14:41:42
* @LastEditors: ch
* @LastEditTime: 2022-05-09 22:01:52
* @LastEditTime: 2022-05-12 10:00:52
* @Description: file content
-->
<template>
<div class="ui-goods-info">
<div class="ui-goods-info" @click="$router.push(`/goods/detail/${goods.productId}`)">
<div class="ui-goods-info--img">
<img :src="goods.productImageUrl"/>
</div>
@ -29,6 +29,7 @@ export default {
<style lang="scss" scoped>
.ui-goods-info{
display: flex;
cursor: pointer;
&--img{
width: 100px;
height: 100px;

@ -0,0 +1,37 @@
<!--
* @Author: ch
* @Date: 2022-05-12 10:30:07
* @LastEditors: ch
* @LastEditTime: 2022-05-12 11:01:57
* @Description: file content
-->
<template>
<div class="ui-empty">
<img class="ui-empty--icon" :src="icon"/>
<p class="ui-empty--desc">{{desc}}</p>
<slot></slot>
</div>
</template>
<script>
export default {
props : {
title : String,
desc : String,
icon : String
},
}
</script>
<style lang="scss" scoped>
.ui-empty{
margin-top: 30px;
text-align: center;
padding: 80px 0;
&--icon{
width: 228px;
}
&--desc{
margin: 20px 0;
color: #999;
}
}
</style>

@ -2,14 +2,13 @@
* @Author: ch
* @Date: 2022-05-08 01:14:03
* @LastEditors: ch
* @LastEditTime: 2022-05-09 21:39:31
* @LastEditTime: 2022-05-11 22:22:15
* @Description: file content
-->
<template>
<div>
<div class="box">
<StatusInfo :orderInfo="orderInfo" @cancel="getOrderInfo"
@receive="getOrderInfo" @payFinish="getOrderInfo"/>
<StatusInfo :orderInfo="orderInfo" @changeStatus="getOrderInfo"/>
<StatusStep :orderInfo="orderInfo" />
</div>
<LogisitcsInfo :orderInfo="orderInfo" />

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-05-09 14:41:37
* @LastEditors: ch
* @LastEditTime: 2022-05-10 11:38:35
* @LastEditTime: 2022-05-12 11:08:57
* @Description: file content
-->
<template>
@ -19,16 +19,16 @@
<UiButton type="grey" :radius="true" @click="cancelVisible=true"></UiButton>
</template>
</div>
<Cancel :visible.sync="cancelVisible" :orderId="orderInfo.orderId" @cancel="cancel"/>
<BsPay :visible.sync="payVisible" :orderId="orderInfo.orderId" :timer="ctxCon.tips" @finish="payFinish"/>
<BsCancelOrder :visible.sync="cancelVisible" :orderId="orderInfo.orderId" @cancel="emitStatus"/>
<BsPay :visible.sync="payVisible" :orderId="orderInfo.orderId" @finish="emitStatus" @cancel="emitStatus"/>
</div>
</template>
<script>
import BsPay from '../../../../../../components/BsPay.vue'
import UiButton from '../../../../../../components/UiButton.vue'
import Cancel from './Cancel.vue'
import BsPay from '@/components/BsPay.vue'
import UiButton from '@/components/UiButton.vue'
import BsCancelOrder from '../../../../../../components/BsCancelOrder.vue'
export default {
components: { UiButton, Cancel, BsPay },
components: { UiButton, BsPay, BsCancelOrder },
props: {
orderInfo : {
type : Object,
@ -92,7 +92,7 @@ export default {
*/
timer(){
if(this.startSecondNum == 0){
this.$emit('close');
this.emitStatus()
return;
}
this.startSecondNum--;
@ -120,14 +120,11 @@ export default {
type: 'success',
message: '成功收货!'
});
this.$emit('receive')
this.emitStatus()
});
},
cancel(){
this.$emit('cancel')
},
payFinish(){
this.$emit('payFinish')
emitStatus(){
this.$emit('changeStatus')
}
}

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-05-09 14:41:37
* @LastEditors: ch
* @LastEditTime: 2022-05-10 13:33:57
* @LastEditTime: 2022-05-12 10:43:37
* @Description: file content
-->
<template>
@ -18,7 +18,7 @@
</ul>
</template>
<script>
import UiButton from '../../../../../../components/UiButton.vue';
import UiButton from '@/components/UiButton.vue';
import {FormatDate} from '@/plugins/utils'
export default {
components: { UiButton },
@ -37,23 +37,23 @@ export default {
const defaultStep = [
{
id : 1, name : '提交订单',
icon: require('@/assets/img/account/order_status_1.png'),
iconActive : require('@/assets/img/account/order_status_1_active.png')
icon: require('@/assets/img/account/order/order_status_1.png'),
iconActive : require('@/assets/img/account/order/order_status_1_active.png')
},
{
id : 6, name : '支付订单' ,
icon: require('@/assets/img/account/order_status_2.png'),
iconActive : require('@/assets/img/account/order_status_2_active.png')
icon: require('@/assets/img/account/order/order_status_2.png'),
iconActive : require('@/assets/img/account/order/order_status_2_active.png')
},
{
id : 7, name : '平台发货' ,
icon: require('@/assets/img/account/order_status_3.png'),
iconActive : require('@/assets/img/account/order_status_3_active.png')
icon: require('@/assets/img/account/order/order_status_3.png'),
iconActive : require('@/assets/img/account/order/order_status_3_active.png')
},
{
id : 8, name : '确认收货' ,
icon: require('@/assets/img/account/order_status_4.png'),
iconActive : require('@/assets/img/account/order_status_4_active.png')
icon: require('@/assets/img/account/order/order_status_4.png'),
iconActive : require('@/assets/img/account/order/order_status_4_active.png')
},
];
let showStep = [];
@ -78,8 +78,8 @@ export default {
type:-1, name: '交易关闭', active: true,
date : FormatDate(createTime,'yyyy-mm-dd'),
time : FormatDate(createTime, 'hh:ii:ss'),
icon: require('@/assets/img/account/order_status_close.png'),
iconActive : require('@/assets/img/account/order_status_close.png')
icon: require('@/assets/img/account/order/order_status_close.png'),
iconActive : require('@/assets/img/account/order/order_status_close.png')
});
}else{
@ -96,8 +96,8 @@ export default {
let lastLog = logs[logs.length - 1];
let lastStep = {
type:-1, name: '交易完成',
icon: require('@/assets/img/account/order_status_5.png'),
iconActive : require('@/assets/img/account/order_status_5_active.png')
icon: require('@/assets/img/account/order/order_status_5.png'),
iconActive : require('@/assets/img/account/order/order_status_5_active.png')
}
if(lastLog.id === 8){
lastStep.createTime = lastLog.createTime;

@ -2,78 +2,106 @@
* @Author: ch
* @Date: 2022-05-04 20:47:29
* @LastEditors: ch
* @LastEditTime: 2022-05-10 13:16:44
* @LastEditTime: 2022-05-12 11:29:24
* @Description: file content
-->
<template>
<div>
<ul class="tab">
<li v-for="item in tabs" :key="item.value" @click="changeTab(item.value)"
:class="tabActive == item.value && 'tab__active'">
{{item.label}}
<span>6</span>
</li>
</ul>
<div class="order" v-for="item in orderList" :key="item.orderId">
<div class="order--head"></div>
<table class="order--table">
<tbody>
<tr v-for="(i, idx) in item.products" :key="i.orderProductId">
<td width="620px">
<div class="order--product">
<UIGoodsInfo :goods="i"/>
<p>{{i.realAmount}}</p>
<p>{{i.quantity}}</p>
</div>
</td>
<template v-if="!idx">
<td width="119px" :rowspan="item.products.length">{{item.payAmount}}</td>
<td width="110px" :rowspan="item.products.length">{{item.orderStatusDesc}}</td>
<td :rowspan="item.products.length">
<button v-if="item.orderStatus === 1" @click="pay(item)"></button>
<button v-if="[2,3].includes(item.orderStatus)"
@click="$router.push(`./detail?id=${item.orderId}`)">查看详情</button>
<button v-if="item.orderStatus >= 4"
@click="$router.push(`/logisitcsInfo?orderId=${item.orderId}`)">查看物流</button>
<button v-if="item.orderStatus === 4" @click="receive(item)"></button>
</td>
</template>
<div class="main">
<Tab :active="tabActive" @change="changeTab"></Tab>
<div class="loading" v-if="loading">...</div>
<UiEmptyAccount v-if="!orderTotal && !loading" desc="暂无订单数据" :icon="require('@/assets/img/account/order/empty.png')">
<UiButton type="grey" @click="$router.push('/')"></UiButton>
</UiEmptyAccount>
<template v-if="!loading">
<table v-if="orderTotal" class="order--table order--table-head">
<thead>
<tr>
<th>商品信息</th>
<th width="96">单价</th>
<th width="96">数量</th>
<th width="120">实付款</th>
<th width="110">交易状态</th>
<th width="145">操作</th>
</tr>
</tbody>
</thead>
</table>
</div>
<el-pagination v-if=" orderTotal > pageSize" background layout="prev, pager, next"
:current-page.sync="pageIndex"
:total="orderTotal" @current-change="getOrderList"></el-pagination>
<div class="order" v-for="item in orderList" :key="item.orderId">
<div class="order--head">
<p>
<span>订单编号{{item.orderNo || '9c665dc0b20b 假的'}}</span>
<span>下单时间{{item.submitTime || `2011-01-01 00:00:00 假的`}}</span>
</p>
<router-link :to="`./detail?id=${item.orderId}`">订单详情 ></router-link>
</div>
<table class="order--table">
<tbody>
<tr v-for="(i, idx) in item.products" :key="i.orderProductId">
<td class="not-border">
<UIGoodsInfo :goods="i"/>
</td>
<td class="not-border" width="96">{{i.realAmount}}</td>
<td class="not-border" width="96">{{i.quantity}}</td>
<template v-if="!idx">
<td width="120" :rowspan="item.products.length">{{item.payAmount}}</td>
<td width="110" :rowspan="item.products.length">{{item.orderStatusDesc}}</td>
<td width="145" :rowspan="item.products.length">
<template v-if="item.orderStatus === 1">
<UiButton type="yellow_gradual" @click="pay(item)"></UiButton>
<span class="link-btn" @click="canvelPay(item)"></span>
</template>
<router-link :to="`./detail?id=${item.orderId}`" v-if="item.orderStatus > 4"></router-link>
<template v-if="item.orderStatus === 4">
<UiButton type="yellow_gradual" @click="receive(item)"></UiButton>
<router-link class="link-btn" :to="`./detail?id=${item.orderId}`">查看物流</router-link>
</template>
</td>
</template>
</tr>
</tbody>
</table>
</div>
<el-pagination class="pagination" v-if=" orderTotal > pageSize" background layout="prev, pager, next"
:current-page.sync="pageIndex" :page-size="pageSize"
:total="orderTotal" @current-change="getOrderList"></el-pagination>
</template>
<BsCancelOrder :visible.sync="cancelVisible" :orderId="operationOrder.orderId"/>
<BsPay :visible.sync="payVisible" :orderId="operationOrder.orderId" @finish="getOrderList"/>
</div>
</template>
<script>
import {ApiGetOrderList, ApiPutOrderReceive} from '~/plugins/api/order';
import {ApiGetOrderList, ApiPutOrderReceive, ApiGetOrderStatistics} from '~/plugins/api/order';
import BsCancelOrder from '../../../../../components/BsCancelOrder.vue';
import BsPay from '../../../../../components/BsPay.vue';
import UiButton from '../../../../../components/UiButton.vue';
import UiEmptyAccount from '../../../../../components/UiEmptyAccount.vue';
import UIGoodsInfo from '../../../../../components/UIGoodsInfo.vue';
import UiLineBox from '../../../../../components/UiLineBox.vue';
import Tab from './module/Tab.vue';
export default {
components: { UiLineBox, UIGoodsInfo },
components: { UiLineBox, UIGoodsInfo, Tab, UiButton, BsPay, UiEmptyAccount, BsCancelOrder },
data(){
return {
tabs : [
{label : '全部', value : -1},
{label : '待付款', value : 1},
{label : '待发货', value : 3},
{label : '待收货', value : 4},
],
tabActive : this.$route.query.type || -1,
pageIndex : 1,
pageSize : 15,
orderList : [],
orderTotal : 0
orderTotal : 0,
loading : true,
payVisible : false,
cancelVisible : false,
operationOrder : {}
}
},
mounted(){
this.getOrderList()
this.getOrderList();
},
methods : {
changeTab(val){
if(val === this.$route.query.type){
if(val === this.tabActive){
return false;
}
this.$router.replace({
@ -87,76 +115,111 @@ export default {
},
async getOrderList(){
this.loading = true;
const {error, result} = await ApiGetOrderList({
length : this.pageSize,
pageIndex : this.pageIndex,
orderStatus : this.tabActive > -1 ? this.tabActive : null
});
this.loading = false;
if(error){
this.message.warning(error.message);
return false;
}
this.orderList = result.records;
this.orderTotal = result.total
}
},
pay(item){
this.operationOrder = item;
this.payVisible = true;
},
canvelPay(item){
this.operationOrder = item;
this.cancelVisible = true;
},
receive(){
this.$confirm('确认已经收到货了吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const {error} = await ApiPutOrderReceive({orderId : this.operationOrder.orderId});
if(error){
uni.$toast(error.message);
return false;
}
this.$message({
type: 'success',
message: '成功收货!'
});
this.emitStatus()
});
},
}
}
</script>
<style lang="scss" scoped>
.tab {
height: 42px;
line-height: 42px;
border-bottom: 1px solid #ddd;
li{
float: left;
margin-right: 54px;
font-size: 16px;
cursor: pointer;
span{
color: #FF875B;
}
}
&__active{
color: #FF875B;
position: relative;
&::after{
display: block;
height: 2px;
width: 100%;
content: '';
background: #FF875B;
position: absolute;
bottom: 0;
}
}
.main{
flex: 1;
}
.loading{
height: 100px;
line-height: 100px;
text-align: center;
color: #666;
}
.order{
margin: 10px 0;
&--head{
height: 42px;
line-height: 42px;
color: #999;
background: #F8F8F8;
border: 1px solid #ddd;
border-bottom: 0;
display: flex;
justify-content: space-between;
padding: 0 20px;
span{
margin-right: 50px;
}
a{
color: #999;
}
}
&--table{
border: 1px solid #ddd;
width: 100%;
&-head{
margin: 30px 0 20px;
}
th{
height: 46px;
background: #f8f8f8;
font-weight: normal;
}
td{
border: 1px solid #ddd;
padding: 20px;
text-align: center;
&.not-border{
border-left: 0;
border-right: 0;
}
}
tr:first-child td{
border-top: 0;
}
}
&--product{
display: flex;
align-items: center;
p{
width: 96px;
text-align: center;
}
}
}
.link-btn{
display: block;
margin: 10px 0;
color: #999;
display: block;
}
.pagination{
text-align: right;
}
</style>

@ -0,0 +1,83 @@
<!--
* @Author: ch
* @Date: 2019-01-01 08:04:09
* @LastEditors: ch
* @LastEditTime: 2022-05-11 21:34:49
* @Description: file content
-->
<template>
<ul class="tab">
<li v-for="item in tabs" :key="item.value" @click="change(item.value)"
:class="active == item.value && 'tab__active'">
{{item.label}}
<span v-if="item.count">{{item.count}}</span>
</li>
</ul>
</template>
<script>
import {ApiGetOrderStatistics} from '~/plugins/api/order';
export default {
props:{
active : {
type : Number | String,
default : -1
}
},
data(){
return {
tabs : [
{label : '全部', value : -1, code: 'allCount'},
{label : '待付款', value : 1, code: 'unpaidCount'},
{label : '待发货', value : 3, code: 'waitDeliveryCount'},
{label : '待收货', value : 4, code: 'deliveredCount'},
]
}
},
mounted(){
this.getOrderStatistics();
},
methods : {
change(val){
this.$emit('change', val)
},
async getOrderStatistics(){
const {result} = await ApiGetOrderStatistics();
this.tabs = this.tabs.map(i => {
i.count = result[i.code];
return i;
})
}
}
}
</script>
<style lang="scss" scoped>
.tab {
width: 100%;
height: 42px;
line-height: 42px;
border-bottom: 1px solid #ddd;
li{
float: left;
margin-right: 54px;
font-size: 16px;
cursor: pointer;
span{
color: #FF875B;
}
}
&__active{
color: #FF875B;
position: relative;
&::after{
display: block;
height: 2px;
width: 100%;
content: '';
background: #FF875B;
position: absolute;
bottom: 0;
}
}
}
</style>

@ -2,15 +2,17 @@
* @Author: ch
* @Date: 2022-05-08 01:11:33
* @LastEditors: ch
* @LastEditTime: 2022-05-09 22:27:35
* @LastEditTime: 2022-05-10 15:48:51
* @Description: file content
-->
<template>
<div class="c-white-main" style="padding-top:350px">
<div class="main">
<img class="icon" src="@/assets/img/order/pay_success.png" />
<p>交易成功</p>
<b>交易成功</b>
<p>您的包裹整装待发~</p>
<div>
<UiButton type="grey" @click="goHome" :radius="true">返回首页</UiButton>
<UiButton type="yellow_gradual" @click="goDetail" :radius="true">查看订单</UiButton>
</div>
</div>
</template>
@ -43,20 +45,30 @@ export default {
},
goHome(){
this.$router.replace('/');
},
goDetail(){
this.$router.replace(`/account/order/detail?id=${this.$route.query.id}`)
}
}
}
</script>
<style lang="scss" scoped>
.c-white-main{
.main{
@include layout-box;
text-align: center;
padding-bottom: 40px;
padding: 100px 0 40px;
}
.icon{
width: 239px;
}
b{
display: block;
}
p{
margin: 10px 0 25px 0;
color: #999;
}
button{
margin: 0 10px;
}
</style>

@ -2,17 +2,19 @@
* @Author: ch
* @Date: 2022-05-04 17:30:58
* @LastEditors: ch
* @LastEditTime: 2022-05-10 12:22:53
* @LastEditTime: 2022-05-12 09:58:47
* @Description: file content
-->
<template>
<div class="main">
<h3 class="title">支付方式</h3>
<h3 class="title">收货地址</h3>
<BsAddress v-model="address"/>
<!-- <h3 class="title">支付方式</h3>
<div class="pay-type">
<el-radio label="微信支付" />
<el-radio label="支付宝支付" />
</div>
</div> -->
<h3 class="title">确认商品信息</h3>
<OrderInfo :products="orderInfo.products" />
<Message :orderInfo="orderInfo" :message.sync="userMessage"/>
@ -20,8 +22,8 @@
<div class="pay">
<UiButton radius type="red_panel" @click="submit"></UiButton>
</div>
<BsPay :visible.sync="payVisible" :orderId="payOrder.orderId" :timer="payTimerTxt"
@cancel="cancelPay" @finish="finishPay"/>
<BsPay :visible.sync="payVisible" :orderId="payOrder.orderId"
@cancel="cancelPay" @finish="finishPay" />
</div>
</template>
<script>
@ -32,11 +34,12 @@ import OrderInfo from './module/OrderInfo.vue';
import Message from './module/Message.vue';
import Amount from './module/Amount.vue';
import UiButton from '../../../components/UiButton.vue';
import BsAddress from '../../../components/BsAddress.vue';
export default {
components: { BsPay, UIGoodsInfo, OrderInfo, Message, Amount, UiButton },
components: { BsPay, UIGoodsInfo, OrderInfo, Message, Amount, UiButton, BsAddress },
data(){
return {
address : {id:3},
address : {},
orderInfo : {},
userMessage : '',
payOrder : {},
@ -113,36 +116,6 @@ export default {
}
this.payVisible = true;
this.payOrder = result;
//
if(this.payTimerStop){
clearTimeout(this.payTimerStop);
}
this.calcTimerStartSecondNum();
},
/**
* 计算倒计时开始秒数
*/
calcTimerStartSecondNum(){
let expireTime = (new Date(this.payOrder.expireTime.replace(/-/g,'/'))).getTime(),
curTime = (new Date(this.payOrder.serverTime.replace(/-/g,'/'))).getTime(),
second = Math.floor((expireTime - curTime) / 1000);
this.payStartSecondNum = second > 0 ? second : 0;
this.timer();
},
/**
* 待付款的倒计时
*/
timer(){
if(this.payStartSecondNum == 0){
this.$emit('close');
return;
}
this.payStartSecondNum--;
let minute = parseInt(this.payStartSecondNum / 60);
let second = parseInt(this.payStartSecondNum % 60);
this.payTimerTxt = `剩余${minute > 0 ? `${minute}` : ''} ${second}`;
this.payTimerStop = setTimeout(()=>this.timer(),1000)
},
cancelPay(){
this.$router.replace(`/account/order/detail?id=${this.payOrder.orderId}`)
@ -155,7 +128,8 @@ export default {
</script>
<style lang="scss" scoped>
.main{
@include layout-box
@include layout-box;
padding: 30px 0;
}
.title{
margin: 24px 0 13px;

Loading…
Cancel
Save