Refactor(订单):订单列表和详情状态值判断重构
This commit is contained in:
@@ -6,11 +6,21 @@
|
||||
<image class="status-img" :src="getStatusImg(orderInfo)" mode=""></image>
|
||||
</view> -->
|
||||
<view :class="refundOrder ? 'on' : ''">
|
||||
<view class="state v12-primary-text v12-font-32 v12-font-bold" v-if="orderInfo.isTickets===1 && orderInfo._status._type == 2">待核销</view>
|
||||
<view class="state v12-primary-text v12-font-32 v12-font-bold" v-else>{{ getStatus(orderInfo) }}</view>
|
||||
<view v-if="getStatus(orderInfo)!=='待付款'" class="v12-mt-2 v12-font-24 v12-secondary-dark-text" :class="{'fails-bg': orderInfo._status._type == -3}">
|
||||
<view
|
||||
v-if="orderInfo.isTickets === 1 && orderInfo._status._type === 2"
|
||||
class="state v12-primary-text v12-font-32 v12-font-bold"
|
||||
>待核销</view>
|
||||
<view
|
||||
v-else
|
||||
class="state v12-primary-text v12-font-32 v12-font-bold"
|
||||
>{{ getStatus(orderInfo) }}</view>
|
||||
<view
|
||||
v-if="getStatus(orderInfo)!=='待付款'"
|
||||
:class="{'fails-bg': orderInfo._status._type === -3}"
|
||||
class="v12-mt-2 v12-font-24 v12-secondary-dark-text"
|
||||
>
|
||||
<view>{{ orderInfo._status._msg }}</view>
|
||||
<view v-if="orderInfo._status._type == -3">驳回原因: {{ orderInfo.refundRejectReason }}</view>
|
||||
<view v-if="orderInfo._status._type === -3">驳回原因: {{ orderInfo.refundRejectReason }}</view>
|
||||
</view>
|
||||
<view class="pending-payments flex ai-center v12-mt-2 v12-font-24 v12-secondary-dark-text" v-else>
|
||||
<text>需支付{{ orderInfo.payPrice }}元,</text>
|
||||
@@ -28,8 +38,7 @@
|
||||
</div>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="reject-reason" v-if="orderInfo._status._type==-3 && orderInfo.refundRejectReason">驳回原因:{{ orderInfo.refundRejectReason }}</view> -->
|
||||
<view v-if="orderInfo.deliveryId !== null && (orderInfo._status._type == -1 || orderInfo._status._type == -2 || orderInfo._status._type == 4 || orderInfo._status._type == 3 || (orderInfo._status._type == 2 && orderInfo.isTickets!==1))">
|
||||
<view v-if="orderInfo.deliveryId !== null && ([-1, -2, 3, 4].includes(orderInfo._status._type) || (orderInfo._status._type == 2 && orderInfo.isTickets !== 1))">
|
||||
<view
|
||||
v-for="(delivery, index) in orderInfo.deliveryInfo"
|
||||
:key="index"
|
||||
@@ -74,12 +83,18 @@
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="!refundOrder">
|
||||
<view class="code-box flex jc-center ai-center" v-if="orderInfo.isTickets===1 && orderInfo._status._type==2">
|
||||
<view
|
||||
v-if="orderInfo.isTickets === 1 && orderInfo._status._type === 2"
|
||||
class="code-box flex jc-center ai-center"
|
||||
>
|
||||
<image class="code-img" :src="orderInfo.code"/>
|
||||
</view>
|
||||
<template v-else>
|
||||
<div class="writeOff" v-if="orderInfo.shippingType === 2 && orderInfo.paid === 1"
|
||||
style="margin-top: 30rpx;border-radius: 24rpx;">
|
||||
<div
|
||||
v-if="orderInfo.shippingType === 2 && orderInfo.paid === 1"
|
||||
class="writeOff"
|
||||
style="margin-top: 30rpx;border-radius: 24rpx;"
|
||||
>
|
||||
<div class="title">核销信息</div>
|
||||
<div class="grayBg">
|
||||
<div class="pictrue">
|
||||
@@ -968,79 +983,78 @@ export default {
|
||||
if (type == 1 && combination_id > 0) {
|
||||
status.type = 6;
|
||||
status.class_status = 1;
|
||||
} //查看拼团
|
||||
if (type == 2 && delivery_type == "express") status.class_status = 2; //查看物流
|
||||
if (type == 2) status.class_status = 3; //确认收货
|
||||
if (type == 4 || type === 0) status.class_status = 4; //删除订单
|
||||
} // 查看拼团
|
||||
if (type == 2 && delivery_type == "express") status.class_status = 2; // 查看物流
|
||||
if (type == 2) status.class_status = 3; // 确认收货
|
||||
if (type == 4 || type === 0) status.class_status = 4; // 删除订单
|
||||
if (
|
||||
!seckill_id &&
|
||||
!bargain_id &&
|
||||
!combination_id &&
|
||||
(type == 3 || type == 4)
|
||||
!seckill_id &&
|
||||
!bargain_id &&
|
||||
!combination_id &&
|
||||
(type == 3 || type == 4)
|
||||
)
|
||||
status.class_status = 5; //再次购买
|
||||
status.class_status = 5; // 再次购买
|
||||
if (type == 9) {
|
||||
//线下付款
|
||||
// 线下付款
|
||||
status.class_status = 0;
|
||||
this.offlineStatus = false;
|
||||
this.offlineStatus = false
|
||||
}
|
||||
this.status = status;
|
||||
this.status = status
|
||||
},
|
||||
getDetail() {
|
||||
const id = this.id;
|
||||
const id = this.id
|
||||
if (!id) {
|
||||
uni.showToast({
|
||||
title: "订单不存在",
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
return;
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.loading = true
|
||||
orderDetail(id)
|
||||
.then(res => {
|
||||
this.orderInfo = res.data;
|
||||
this.getOrderStatus();
|
||||
if (this.orderInfo.combinationId > 0) {
|
||||
this.orderTypeName = "拼团订单";
|
||||
this.orderTypeNameStatus = false;
|
||||
} else if (this.orderInfo.bargainId > 0) {
|
||||
this.orderTypeName = "砍价订单";
|
||||
this.orderTypeNameStatus = false;
|
||||
} else if (this.orderInfo.seckillId > 0) {
|
||||
this.orderTypeName = "秒杀订单";
|
||||
this.orderTypeNameStatus = false;
|
||||
} else if (this.orderInfo.isGiftCardReceive === 1 || this.orderInfo.isGiftCardSend === 1) {
|
||||
this.orderTypeName = "礼包订单";
|
||||
this.orderTypeNameStatus = false;
|
||||
orderDetail(id).then(res => {
|
||||
this.orderInfo = res.data
|
||||
this.orderInfo._status._type = parseInt(this.orderInfo._status._type)
|
||||
this.getOrderStatus()
|
||||
if (this.orderInfo.combinationId > 0) {
|
||||
this.orderTypeName = "拼团订单"
|
||||
this.orderTypeNameStatus = false
|
||||
} else if (this.orderInfo.bargainId > 0) {
|
||||
this.orderTypeName = "砍价订单"
|
||||
this.orderTypeNameStatus = false
|
||||
} else if (this.orderInfo.seckillId > 0) {
|
||||
this.orderTypeName = "秒杀订单"
|
||||
this.orderTypeNameStatus = false
|
||||
} else if (this.orderInfo.isGiftCardReceive === 1 || this.orderInfo.isGiftCardSend === 1) {
|
||||
this.orderTypeName = "礼包订单"
|
||||
this.orderTypeNameStatus = false
|
||||
}
|
||||
this.system_store = res.data.systemStore || {}
|
||||
this.mapKey = res.data.mapKay
|
||||
this.setOfflinePayStatus(this.orderInfo.offlinePayStatus)
|
||||
const statusType = this.orderInfo._status._type
|
||||
if([-1, -2, 4, 3].includes(statusType) || (statusType === 2 && this.orderInfo.isTickets !== 1)) {
|
||||
for(let i = 0; i < this.orderInfo.deliveryInfo.length; i++) {
|
||||
this.orderInfo.deliveryInfo[i].estimatedTime = ''
|
||||
this.getExpressInfo(this.orderInfo.deliveryInfo[i], i)
|
||||
if (statusType === 2) {
|
||||
this.getDay(this.orderInfo.deliveryInfo[i], i)
|
||||
}
|
||||
this.system_store = res.data.systemStore || {};
|
||||
this.mapKey = res.data.mapKay;
|
||||
this.setOfflinePayStatus(this.orderInfo.offlinePayStatus);
|
||||
const orderInfo = this.orderInfo
|
||||
if(orderInfo._status._type == -1 || orderInfo._status._type == -2 || orderInfo._status._type == 4 || orderInfo._status._type == 3 || (orderInfo._status._type == 2 && orderInfo.isTickets!==1)) {
|
||||
for(let i = 0; i < orderInfo.deliveryInfo.length; i++) {
|
||||
orderInfo.deliveryInfo[i].estimatedTime = ''
|
||||
this.getExpressInfo(orderInfo.deliveryInfo[i], i)
|
||||
if (orderInfo._status._type === 2) {
|
||||
this.getDay(orderInfo.deliveryInfo[i], i)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
uni.showToast({
|
||||
title: err.response.data.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
uni.hideLoading()
|
||||
});
|
||||
}
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.response.data.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
})
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
uni.hideLoading()
|
||||
})
|
||||
},
|
||||
async toPay(type) {
|
||||
var that = this;
|
||||
|
||||
Reference in New Issue
Block a user