order comment 7.31

This commit is contained in:
2020-07-31 21:47:41 +08:00
parent cdd0105acb
commit ff7c6b358d
10 changed files with 310 additions and 164 deletions

View File

@@ -3,7 +3,7 @@
<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 class="time" v-if="orderInfo.view_type == 1">结束时间{{ orderInfo.end_time }}</view>
</view>
<image :src="s_object[state].image"></image>
</view>
@@ -67,8 +67,10 @@
<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="btn" v-if="['1', '2', '4', '6'].indexOf(state) >= 0">
<view class="cancel" v-if="state == '4' || state == '1' " @click="applyRefund">申请退款</view>
<view class="cancel" v-if="state == '1'" @click="toOtherPage('Logistics')">查看物流</view>
<view class="logistics" v-if="state == '1'" @click="confirmReceive">确认收货</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'" @click="payNow">立即支付</view>
@@ -96,8 +98,8 @@ export default {
image: '../static/mine/31.png',
},
'4': {
text: '已取消',
image: '../static/mine/33.png',
text: '待发货',
image: '../static/mine/36.png',
},
'5': {
text: '已退款',
@@ -112,45 +114,44 @@ export default {
image: '../static/mine/34.png',
},
},
current: 0,
orderInfo: {}
orderInfo: {},
oid: '',
}
},
onLoad(option) {
this.setTitle();
this.oid = option.oid;
this.getOrderInfo(option.oid);
},
// 下拉刷新
onPullDownRefresh() {
this.getOrderInfo(this.oid);
},
methods: {
viewState(value) {
let state;
switch (value) {
case 0: // 已取消
state = '4';
break;
case 10: // 未付款
case 1:
state = '6';
break;
case 20: // 已付款
state = '3';
case 2:
state = '4';
break;
case 30: // 已发货
case 3:
state = '1';
break;
case 40: // 已收货
if(this.orderInfo.evaluation_state == 0) state = '2';
case 4:
state = '2';
break;
case 6:
state = '7';
break;
case 7:
state = '5';
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) {
@@ -159,9 +160,14 @@ export default {
}).then(res => {
if(res.errCode == 0) {
this.orderInfo = res.data;
this.viewState(this.orderInfo.order_state);
this.viewState(this.orderInfo.view_type);
this.setTitle(this.orderInfo.view_type);
}
uni.stopPullDownRefresh(); // 结束刷新
})
},
applyRefund() {
},
cancelOrder() {
this.$u.api.cancelOrder({
@@ -172,10 +178,20 @@ export default {
}
})
},
setTitle(){
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){
let title = '';
switch (this.current) {
case '1':
switch (value) {
case 1:
title = "支付成功"
break;
default:
@@ -292,6 +308,7 @@ export default {
}
.store-goods {
display: flex;
margin-bottom: 20rpx;
> image {
width: 180rpx;
height: 160rpx;
@@ -300,6 +317,7 @@ export default {
flex-shrink: 0;
}
.goods-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;