deming/pageE/order/Details.vue
2020-07-14 17:43:15 +08:00

389 lines
9.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="details" v-if="orderInfo.extend_store">
<view class="status" v-if="state">
<view class="text">
<view class="status-text">{{ s_object[state].text }}</view>
<view class="time" v-if="state == '2'">距离结束22:22:22</view>
</view>
<image :src="s_object[state].image"></image>
</view>
<view class="info">
<view class="info-address">
<image src="../static/mine/28.png"></image>
<view class="address-right">
<view class="user-info">
<view>{{ orderInfo.extend_order_common.reciver_name }}</view>
<view>{{ orderInfo.extend_order_common.reciver_info.mob_phone }}</view>
</view>
<view class="address-text u-line-2">{{ orderInfo.extend_order_common.reciver_info.address }}</view>
</view>
</view>
<view class="info-goods">
<view class="goods-store">
<view class="stoer-title">
<image :src="orderInfo.extend_store.store_avatar" class="store-image"></image>
<view class="store-name">{{ orderInfo.extend_store.store_name }}</view>
<image src="../static/mine/21.png" class="right-icon"></image>
</view>
<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>
</view>
</view>
</view>
</view>
<view class="goods-others">
<view>
<view class="title">运费(快递/骑手)</view>
<view class="price">{{ orderInfo.shipping_fee }}</view>
</view>
<view>
<view class="title">店铺优惠</view>
<view class="price">{{ orderInfo.extend_order_common.voucher_price || '0.00' }}</view>
</view>
<view>
<view class="title">订单总价</view>
<view class="price">{{ orderInfo.goods_amount }}</view>
</view>
<view>
<view class="title">实付费(含运费)</view>
<view class="price">{{ orderInfo.order_amount }}</view>
</view>
<view>
<view class="title">支付方式</view>
<view class="price">{{ orderInfo.payment_name }}</view>
</view>
</view>
</view>
<view class="info-order">
<view>订单编号{{ orderInfo.order_sn }}</view>
<view>支付单号{{ orderInfo.pay_sn }}</view>
<view>创建时间{{ orderInfo.add_time | date}}</view>
</view>
</view>
<view class="btn" v-if="['1', '2', '6'].indexOf(state) >= 0">
<view class="logistics" v-if="state == '1'" @click="toOtherPage('Logistics')">查看物流</view>
<view class="comment" v-if="state == '2'" @click="toOtherPage('Comment')">立即评价</view>
<view class="cancel" v-if="state == '6'" @click="cancelOrder">取消支付</view>
<view class="payment" v-if="state == '6'">立即支付</view>
<view class="service" v-if="state == '7'">联系官方客服</view>
<view class="submit" v-if="state == '7'">提交官方审核</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
state: '', // 1: 待收货 2: 待评价 3: 交易成功 4: 已取消 5: 已退款 6: 待支付 7: 待退款 8: 已退款
s_object: {
'1': {
text: '待收货',
image: '../static/mine/32.png',
},
'2': {
text: '待评价',
image: '../static/mine/35.png',
},
'3': {
text: '交易成功',
image: '../static/mine/31.png',
},
'4': {
text: '已取消',
image: '../static/mine/33.png',
},
'5': {
text: '已退款',
image: '../static/mine/34.png',
},
'6': {
text: '待支付',
image: '../static/mine/31.png',
},
'7': {
text: '待退款',
image: '../static/mine/34.png',
},
},
current: 0,
orderInfo: {}
}
},
onLoad(option) {
this.setTitle();
this.getOrderInfo(option.oid);
},
methods: {
viewState(value) {
let state;
switch (value) {
case 0: // 已取消
state = '4';
break;
case 10: // 未付款
state = '6';
break;
case 20: // 已付款
state = '3';
break;
case 30: // 已发货
state = '1';
break;
case 40: // 已收货
if(this.orderInfo.evaluation_state == 0) state = '2';
break;
default:
break;
}
if(this.orderInfo.refund_state) state = '5';
// 申请退款
if(this.orderInfo.refund_list) {
const refund = this.orderInfo.refund_list[this.orderInfo.extend_order_common.order_id];
if(this.orderInfo.refund_list) {
if([1, 2].indexOf(refund.refund_state) >= 0) state = '7';
if(refund.refund_state == 3) state = '8';
}
}
this.state = state;
},
getOrderInfo(id) {
this.$u.api.getOrderInfo({
order_id: id,
}).then(res => {
if(res.errCode == 0) {
this.orderInfo = res.data;
this.viewState(this.orderInfo.order_state);
}
})
},
cancelOrder() {
this.$u.api.cancelOrder({
order_id: this.orderInfo.order_id,
}).then(res => {
if(res.errCode == 0) {
uni.navigateBack();
}
})
},
setTitle(){
let title = '';
switch (this.current) {
case '1':
title = "支付成功"
break;
default:
title = "订单详情"
break;
}
uni.setNavigationBarTitle({
title: title
});
},
toOtherPage(url) {
this.$u.route('/pageE/order/' + url, {
oid: this.orderInfo.order_id,
});
}
},
};
</script>
<style lang="scss" scoped>
.details {
min-height: calc(100vh - var(--window-top));
background-color: #ECECEC;
padding-bottom: 98rpx;
.status {
display: flex;
height: 180rpx;
// height: calc(180rpx + var(--window-top));
width: 100%;
background: #ff780f;
.text {
margin: 74rpx auto 0 73rpx;
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 {
margin: 36rpx 70rpx 0 0;
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;
> image {
width: 180rpx;
height: 160rpx;
border-radius: 10rpx;
margin-right: 30rpx;
flex-shrink: 0;
}
.goods-info {
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 {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
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));
}
.cancel {
@include btn-class($width: 160rpx, $color: rgba(155,153,153,1));
}
.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>