|
|
<template>
|
|
|
<div class="order-status">
|
|
|
<p>{{order.status | convertOrderState}}</p>
|
|
|
<p v-if="order.status == 0">剩余: 订单将被取消</p>
|
|
|
<p v-if="order.status == 0 && order.payLefttime != 0">剩余: <span v-count-down v-bind:left-time="order.payLefttime"></span>,订单将被取消</p>
|
|
|
</div>
|
|
|
<div class="order-address">
|
|
|
<p><span>{{order.userName}}</span><span>{{order.phone}}</span></p>
|
|
|
<p><span>{{order.userName}}</span><span>{{order.mobile}}</span></p>
|
|
|
<p>{{order.area}} <br>{{order.address}}</p>
|
|
|
</div>
|
|
|
<div class="order-code">
|
...
|
...
|
@@ -34,15 +34,15 @@ |
|
|
</div>
|
|
|
<div class="order-amount">
|
|
|
<ul>
|
|
|
<li><label>商品:</label><span>{{order.goodsTotalAmount}}</span></li>
|
|
|
<li><label>YOHO币:</label><span>{{order.yohoCoinNum}}</span></li>
|
|
|
<li><label>运费:</label><span>{{order.shippingCost}}</span></li>
|
|
|
<li><label>总计:</label><span>¥{{order.paymentAmount}}</span></li>
|
|
|
<li v-for="promotion in order.promotionFormulas">
|
|
|
<label>{{promotion.promotion}}:</label><span>{{promotion.promotionAmount}}</span>
|
|
|
</li>
|
|
|
<li><label>总计:</label><span>{{order.amount}}</span></li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
<div class="order-button">
|
|
|
<div class="order-button" v-show="order.status != 1 && order.status != 2 && order.status != 3">
|
|
|
<button v-if="order.status == 0" @click="cancelOrder(order.orderCode)">取消订单</button>
|
|
|
<button v-if="order.status == 0 " class="countdown" @click="goBuy()">去支付 11:58:12</button>
|
|
|
<button v-if="order.status == 0 " class="countdown" @click="goBuy(order.orderCode)">去支付 <span v-count-down v-bind:left-time="order.payLefttime" v-bind:callback="autoCancel(order.orderCode)"></span></button>
|
|
|
<button v-if="order.status == 4 || order.status == 5 ">查看物流</button>
|
|
|
<button v-if="order.status == 4 || order.status == 5 " class="black" @click="confirmGoods(order.orderCode)">确认收货</button>
|
|
|
<button v-if="order.status == 6" @click="deleteOrder(order,index)">删除订单</button>
|
...
|
...
|
@@ -55,6 +55,7 @@ |
|
|
const $ = require('yoho-jquery');
|
|
|
const tip = require('common/tip');
|
|
|
const Modal = require('common/modal');
|
|
|
const yohoAPI = require('yoho');
|
|
|
|
|
|
module.exports = {
|
|
|
data() {
|
...
|
...
|
@@ -73,28 +74,50 @@ |
|
|
orderCode: this.$parent.$data.orderCode
|
|
|
}
|
|
|
}).then(result => {
|
|
|
if (result) {
|
|
|
if (result.code === 200) {
|
|
|
this.$set('order', result.data);
|
|
|
} else {
|
|
|
tip(result.message);
|
|
|
}
|
|
|
}).fail(() => {
|
|
|
tip('网络错误');
|
|
|
});
|
|
|
},
|
|
|
cancelOrder(code) {
|
|
|
Modal.confirm('订单取消后不能恢复,确认取消订单吗?', '', function() {
|
|
|
orderDetail() {
|
|
|
return {
|
|
|
cancel(code, success, fail) {
|
|
|
$.ajax({
|
|
|
url: '/home/cancel-order',
|
|
|
type: 'post',
|
|
|
data: {
|
|
|
orderCode: code
|
|
|
}
|
|
|
}).then(result => {
|
|
|
}).then(success).fail(fail);
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
autoCancel(code) {
|
|
|
let _that = this;
|
|
|
|
|
|
return () => {
|
|
|
_that.orderDetail().cancel(code, (result) => {
|
|
|
if (result.code === 200) {
|
|
|
location.href = '/home/orders';
|
|
|
location.href = '/home/orders?type=2';
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
},
|
|
|
cancelOrder(code) {
|
|
|
let _that = this;
|
|
|
|
|
|
Modal.confirm('订单取消后不能恢复,确认取消订单吗?', '', function() {
|
|
|
_that.orderDetail().cancel(code, (result) => {
|
|
|
if (result.code === 200) {
|
|
|
location.href = '/home/orders?type=2';
|
|
|
} else {
|
|
|
tip(result.message);
|
|
|
}
|
|
|
}).fail(() => {
|
|
|
}, () => {
|
|
|
tip('操作失敗');
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -135,8 +158,8 @@ |
|
|
tip('操作失敗');
|
|
|
});
|
|
|
},
|
|
|
goBuy() {
|
|
|
location.href = '';
|
|
|
goBuy(code) {
|
|
|
yohoAPI.goPay({orderid: code});
|
|
|
},
|
|
|
seeExpress() {
|
|
|
location.href = '';
|
...
|
...
|
|