deming/pageE/order/Details.vue

456 lines
11 KiB
Vue
Raw Normal View History

2020-06-08 15:23:23 +08:00
<template>
2020-07-10 17:38:21 +08:00
<view class="details" v-if="orderInfo.extend_store">
2020-08-04 19:08:04 +08:00
<view class="status" v-if="orderstate">
2020-06-08 15:23:23 +08:00
<view class="text">
2020-08-04 19:08:04 +08:00
<view class="status-text">{{ s_object[orderstate].text }}</view>
2020-08-04 20:00:58 +08:00
<view class="time" v-if="orderInfo.view_type == 1 || orderInfo.view_type == 9">距离结束{{ countdown }}</view>
2020-06-08 15:23:23 +08:00
</view>
2020-08-04 19:08:04 +08:00
<image :src="s_object[orderstate].image"></image>
2020-06-08 15:23:23 +08:00
</view>
<view class="info">
<view class="info-address">
<image src="../static/mine/28.png"></image>
<view class="address-right">
<view class="user-info">
2020-07-14 10:13:27 +08:00
<view>{{ orderInfo.extend_order_common.reciver_name }}</view>
<view>{{ orderInfo.extend_order_common.reciver_info.mob_phone }}</view>
2020-06-08 15:23:23 +08:00
</view>
2020-07-14 10:13:27 +08:00
<view class="address-text u-line-2">{{ orderInfo.extend_order_common.reciver_info.address }}</view>
2020-06-08 15:23:23 +08:00
</view>
</view>
<view class="info-goods">
<view class="goods-store">
<view class="stoer-title">
2020-07-10 09:03:19 +08:00
<image :src="orderInfo.extend_store.store_avatar" class="store-image"></image>
<view class="store-name">{{ orderInfo.extend_store.store_name }}</view>
2020-06-08 15:23:23 +08:00
<image src="../static/mine/21.png" class="right-icon"></image>
</view>
2020-07-10 09:03:19 +08:00
<view v-for="goods in orderInfo.extend_order_goods" :key="goods.goods_id">
<view class="store-goods">
<image :src="goods.goods_image"></image>
<view class="goods-info">
<view class="goods-name u-line-2">{{ goods.goods_name }}</view>
<view class="goods-order">
<view class="price">{{ goods.goods_pay_price }}</view>
<view class="num">x{{ goods.goods_num }}</view>
</view>
2020-06-08 15:23:23 +08:00
</view>
</view>
</view>
</view>
<view class="goods-others">
<view>
<view class="title">运费(快递/骑手)</view>
2020-07-14 10:13:27 +08:00
<view class="price">{{ orderInfo.shipping_fee }}</view>
2020-06-08 15:23:23 +08:00
</view>
<view>
<view class="title">店铺优惠</view>
2020-07-14 10:13:27 +08:00
<view class="price">{{ orderInfo.extend_order_common.voucher_price || '0.00' }}</view>
2020-06-08 15:23:23 +08:00
</view>
<view>
<view class="title">订单总价</view>
2020-07-14 10:13:27 +08:00
<view class="price">{{ orderInfo.goods_amount }}</view>
2020-06-08 15:23:23 +08:00
</view>
<view>
<view class="title">实付费(含运费)</view>
2020-07-14 10:13:27 +08:00
<view class="price">{{ orderInfo.order_amount }}</view>
2020-06-08 15:23:23 +08:00
</view>
<view>
<view class="title">支付方式</view>
2020-07-10 09:03:19 +08:00
<view class="price">{{ orderInfo.payment_name }}</view>
2020-06-08 15:23:23 +08:00
</view>
</view>
</view>
<view class="info-order">
2020-07-10 17:38:21 +08:00
<view>订单编号{{ orderInfo.order_sn }}</view>
<view>支付单号{{ orderInfo.pay_sn }}</view>
<view>创建时间{{ orderInfo.add_time | date}}</view>
2020-06-08 15:23:23 +08:00
</view>
</view>
2020-08-04 19:08:04 +08:00
<view class="btn" v-if="['1', '2', '4', '6'].indexOf(orderstate) >= 0">
2020-08-06 17:52:25 +08:00
<view class="cancel" v-if="(orderstate == '4' || orderstate == '1') && orderInfo.is_refund == 1" @click="toOtherPage('RefundOrder')">申请退款</view>
2020-08-04 19:08:04 +08:00
<view class="cancel" v-if="orderstate == '1'" @click="toOtherPage('Logistics')">查看物流</view>
<view class="logistics" v-if="orderstate == '1'" @click="confirmReceive">确认收货</view>
<view class="comment" v-if="orderstate == '2'" @click="toOtherPage('Comment')">立即评价</view>
<view class="cancel" v-if="orderstate == '6'" @click="cancelOrder">取消支付</view>
<view class="payment" v-if="orderstate == '6'" @click="payNow">立即支付</view>
<view class="service" v-if="orderstate == '7'">联系官方客服</view>
<view class="submit" v-if="orderstate == '7'">提交官方审核</view>
2020-06-08 15:23:23 +08:00
</view>
</view>
</template>
<script>
export default {
data() {
return {
2020-08-04 19:08:04 +08:00
orderstate: '', // 1: 待收货 2: 待评价 3: 交易成功 4: 已取消 5: 已退款 6: 待支付 7: 待退款 8: 已退款
2020-07-10 17:38:21 +08:00
s_object: {
'1': {
text: '待收货',
image: '../static/mine/32.png',
},
'2': {
text: '待评价',
image: '../static/mine/35.png',
},
'3': {
text: '交易成功',
image: '../static/mine/31.png',
},
'4': {
2020-07-31 21:47:41 +08:00
text: '待发货',
image: '../static/mine/36.png',
2020-07-10 17:38:21 +08:00
},
'5': {
text: '已退款',
image: '../static/mine/34.png',
},
'6': {
text: '待支付',
image: '../static/mine/31.png',
},
2020-07-14 10:13:27 +08:00
'7': {
text: '待退款',
image: '../static/mine/34.png',
},
2020-08-04 19:08:04 +08:00
'8': {
text: '拼团中',
image: '../static/mine/37.png',
},
2020-07-10 17:38:21 +08:00
},
2020-07-31 21:47:41 +08:00
orderInfo: {},
oid: '',
2020-08-03 18:38:04 +08:00
timer: '',
countdown: '', // 倒计时
isSpike: false, // 倒计时是否结束
2020-06-08 15:23:23 +08:00
}
},
onLoad(option) {
this.setTitle();
2020-07-31 21:47:41 +08:00
this.oid = option.oid;
2020-07-14 10:13:27 +08:00
this.getOrderInfo(option.oid);
2020-06-08 15:23:23 +08:00
},
2020-07-31 21:47:41 +08:00
// 下拉刷新
onPullDownRefresh() {
this.getOrderInfo(this.oid);
2020-08-03 18:38:04 +08:00
},
beforeDestroy() {
clearInterval(this.timer);
},
2020-06-08 15:23:23 +08:00
methods: {
2020-07-10 17:38:21 +08:00
viewState(value) {
let state;
switch (value) {
2020-07-31 21:47:41 +08:00
case 1:
2020-07-10 17:38:21 +08:00
state = '6';
break;
2020-07-31 21:47:41 +08:00
case 2:
state = '4';
2020-07-10 17:38:21 +08:00
break;
2020-07-31 21:47:41 +08:00
case 3:
2020-07-10 17:38:21 +08:00
state = '1';
break;
2020-07-31 21:47:41 +08:00
case 4:
state = '2';
break;
case 6:
state = '7';
break;
case 7:
state = '5';
2020-07-10 17:38:21 +08:00
break;
2020-08-04 19:08:04 +08:00
case 9:
state = '8';
break;
2020-07-10 17:38:21 +08:00
default:
break;
}
2020-08-04 19:08:04 +08:00
this.orderstate = state;
2020-07-10 17:38:21 +08:00
},
2020-08-03 18:38:04 +08:00
setSpikeTime(time) {
// console.log(time);
this.timer = setInterval(() => {
let spikeTime = time * 1000 - new Date().getTime();
// console.log(spikeTime);
if(spikeTime <= 0) {
this.isSpike = true;
2020-08-04 20:00:58 +08:00
this.countdown = '00:00:00'
2020-08-03 18:38:04 +08:00
clearInterval(this.timer);
return false;
};
// 计算天数
const days = Math.floor(spikeTime/(24*3600*1000));
//计算出小时数
const leave1 = spikeTime % (24*3600*1000) // 计算天数后剩余的毫秒数
let hours = Math.floor(leave1/(3600*1000));
//计算相差分钟数
const leave2 = leave1 % (3600*1000) // 计算小时数后剩余的毫秒数
let minutes = Math.floor(leave2 / (60*1000))
//计算相差秒数
const leave3 = leave2 % (60*1000) // 计算分钟数后剩余的毫秒数
let seconds = Math.round(leave3 / 1000)
// 把天数算在小时里
hours = days * 24 + hours;
if(hours < 10) hours = '0' + hours;
if(minutes < 10) minutes = '0' + minutes;
if(seconds < 10) seconds = '0' + seconds;
this.countdown = hours + ':' + minutes + ':' + seconds;
}, 1000)
},
2020-06-30 18:06:50 +08:00
getOrderInfo(id) {
this.$u.api.getOrderInfo({
order_id: id,
}).then(res => {
if(res.errCode == 0) {
this.orderInfo = res.data;
2020-07-31 21:47:41 +08:00
this.viewState(this.orderInfo.view_type);
this.setTitle(this.orderInfo.view_type);
2020-08-04 20:00:58 +08:00
if(res.data.view_type == 1) this.setSpikeTime(res.data.end_time);
else if(res.data.view_type == 9) this.setSpikeTime(res.data.pintuangroup_endtime);
2020-06-30 18:06:50 +08:00
}
2020-07-31 21:47:41 +08:00
uni.stopPullDownRefresh(); // 结束刷新
2020-06-30 18:06:50 +08:00
})
},
2020-07-14 17:43:15 +08:00
cancelOrder() {
this.$u.api.cancelOrder({
order_id: this.orderInfo.order_id,
}).then(res => {
if(res.errCode == 0) {
uni.navigateBack();
}
})
},
2020-07-31 21:47:41 +08:00
confirmReceive() {
this.$u.api.confirmReceive({
order_id: this.order.order_id,
}).then(res => {
if(res.errCode == 0) {
this.getOrderInfo(this.oid);
}
this.$u.toast(res.message);
})
},
setTitle(value){
2020-07-10 09:03:19 +08:00
let title = '';
2020-07-31 21:47:41 +08:00
switch (value) {
case 1:
2020-06-08 15:23:23 +08:00
title = "支付成功"
break;
default:
title = "订单详情"
break;
}
2020-08-03 19:51:05 +08:00
// uni.setNavigationBarTitle({
// title: title
// });
2020-06-08 15:23:23 +08:00
},
2020-07-25 15:17:52 +08:00
payNow() {
this.$u.route('/pageC/cart/cashier', {
pay_sn: this.orderInfo.pay_sn,
price: this.orderInfo.order_amount,
2020-08-04 21:46:52 +08:00
order_id: this.orderInfo.order_id,
2020-07-25 15:17:52 +08:00
});
},
2020-06-08 15:23:23 +08:00
toOtherPage(url) {
2020-07-10 17:38:21 +08:00
this.$u.route('/pageE/order/' + url, {
oid: this.orderInfo.order_id,
2020-06-08 15:23:23 +08:00
});
}
},
};
</script>
<style lang="scss" scoped>
.details {
min-height: calc(100vh - var(--window-top));
background-color: #ECECEC;
2020-07-10 17:38:21 +08:00
padding-bottom: 98rpx;
2020-06-08 15:23:23 +08:00
.status {
display: flex;
2020-07-10 17:38:21 +08:00
height: 180rpx;
// height: calc(180rpx + var(--window-top));
2020-06-08 15:23:23 +08:00
width: 100%;
2020-07-10 17:38:21 +08:00
background: #ff780f;
2020-06-08 15:23:23 +08:00
.text {
2020-07-10 17:38:21 +08:00
margin: 74rpx auto 0 73rpx;
2020-06-08 15:23:23 +08:00
color: rgba(255,255,255,1);
.status-text {
font-size: 36rpx;
font-weight: 500;
margin-bottom: 17rpx;
}
.time {
// white-space: nowrap;
font-size: 26rpx;
color: rgba(255,255,255,1);
}
}
> image {
2020-07-10 17:38:21 +08:00
margin: 36rpx 70rpx 0 0;
2020-06-08 15:23:23 +08:00
width: 126rpx;
height: 109rpx;
flex-shrink: 0;
}
}
.info {
margin-bottom: 10rpx;
.info-address {
padding: 30rpx;
display: flex;
align-items: center;
margin-bottom: 10rpx;
background:rgba(255,255,255,1);
> image {
width: 28rpx;
height: 34rpx;
margin-right: 31rpx;
flex-shrink: 0;
}
.address-right {
.user-info {
display: flex;
align-items: center;
font-size: 28rpx;
color: rgba(51,51,51,1);
margin-bottom: 20rpx;
> view:first-child {
margin-right: 13rpx;
}
}
.address-text {
font-size: 24rpx;
color: rgba(102,102,102,1);
line-height: 42rpx;
}
}
}
.info-goods {
margin-bottom: 10rpx;
.goods-store {
padding: 30rpx;
margin-bottom: 2rpx;
background:rgba(255,255,255,1);
.stoer-title {
display: flex;
align-items: center;
margin-bottom: 20rpx;
.store-image {
width: 60rpx;
height: 60rpx;
border-radius: 50%;
margin-right: 16rpx;
}
.store-name {
font-size: 28rpx;
color: rgba(51,51,51,1);
margin-right: 14rpx;
}
.right-icon {
width: 11rpx;
height: 22rpx;
}
}
.store-goods {
display: flex;
2020-07-31 21:47:41 +08:00
margin-bottom: 20rpx;
2020-06-08 15:23:23 +08:00
> image {
width: 180rpx;
height: 160rpx;
border-radius: 10rpx;
margin-right: 30rpx;
flex-shrink: 0;
}
.goods-info {
2020-07-31 21:47:41 +08:00
flex: 1;
2020-06-08 15:23:23 +08:00
display: flex;
flex-direction: column;
justify-content: space-between;
.goods-name {
font-size: 30rpx;
color: rgba(51,51,51,1);
line-height: 44rpx;
}
.goods-order {
display: flex;
align-items: center;
justify-content: space-between;
.price {
font-size: 30rpx;
font-weight: 500;
color: rgba(51,51,51,1);
}
.num {
font-size: 28rpx;
color: rgba(102,102,102,1);
}
}
}
}
}
.goods-others {
background:rgba(255,255,255,1);
padding: 30rpx;
> view {
display: flex;
align-items: center;
justify-content: space-between;
&:not(:last-child) {
margin-bottom: 30rpx;
}
.title {
font-size: 28rpx;
color: rgba(102,102,102,1);
}
.price {
font-size: 30rpx;
color: rgba(51,51,51,1);
}
}
}
}
.info-order {
background:rgba(255,255,255,1);
padding: 30rpx;
font-size: 28rpx;
color: rgba(102,102,102,1);
> view:not(:last-child) {
margin-bottom: 30rpx;
}
}
}
.btn {
2020-07-10 17:38:21 +08:00
position: fixed;
bottom: 0;
left: 0;
width: 100%;
2020-06-08 15:23:23 +08:00
height: 98rpx;
background: rgba(255,255,255,1);
display: flex;
justify-content: flex-end;
padding: 19rpx 30rpx;
@mixin btn-class($width, $color) {
width: $width;
height: 60rpx;
border: 2rpx solid $color;
color: $color;
border-radius: 30rpx;
padding: 15rpx 23rpx;
font-size: 28rpx;
&:not(:last-child) {
margin-right: 30rpx;
}
}
.logistics, .comment, .payment {
@include btn-class($width: 160rpx, $color: rgba(255,119,15,1));
}
2020-07-10 17:38:21 +08:00
.cancel {
@include btn-class($width: 160rpx, $color: rgba(155,153,153,1));
}
2020-06-08 15:23:23 +08:00
.service {
@include btn-class($width: 216rpx, $color: rgba(155,153,153,1));
}
.submit {
@include btn-class($width: 216rpx, $color: rgba(255,119,15,1));
}
}
}
</style>