mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2026-09-20 20:02:02 +08:00
Merge branch 'feature/order-delivery-fulfillment'
This commit is contained in:
@@ -1,238 +1,310 @@
|
||||
<template>
|
||||
<div>
|
||||
<view class="logistics-detail">
|
||||
<view class="card">
|
||||
<div v-if="logisticsList && logisticsList.length>0">
|
||||
<ul class="express-log" v-for="(packageItem, packageIndex) in logisticsList" :key="packageIndex">
|
||||
<div class="layui-layer-wrap">
|
||||
<dl>
|
||||
<dt>物流公司:</dt>
|
||||
<dd><div class="text-box">{{ packageItem.logisticsName }}</div></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>快递单号:</dt>
|
||||
<dd>
|
||||
<div nctype="ordersSn" class="text-box">
|
||||
<a class="item" :href='"https://www.baidu.com/s?wd="+packageItem.logisticsNo' target="_blank">{{ packageItem.logisticsNo }}</a>
|
||||
</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="div-express-log">
|
||||
<ul class="express-log express-log-name">
|
||||
<li v-for="(item, index) in packageItem.orderPackageItemList" :key="index">
|
||||
<p class="time" style="width: 50%;"><span>商品名称:</span><span>{{ item.goodsName }}</span></p>
|
||||
<p class="time" style="width: 30%;"><span>发货时间:</span><span>{{ item.logisticsTime }}</span></p>
|
||||
<p class="time" style="width: 20%;"><span>发货数量:</span><span>{{ item.deliverNumber }}</span></p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="div-express-log">
|
||||
<ul class="express-log" v-if="packageItem.traces && packageItem.traces.traces">
|
||||
<li v-for="(item, index) in packageItem.traces.traces" :key="index">
|
||||
<span class="time">{{ item.AcceptTime || item.acceptTime }}</span>
|
||||
<span class="detail">{{ item.AcceptStation || item.remark }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="express-log" v-else>
|
||||
<li>暂无物流信息</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</ul>
|
||||
</div>
|
||||
</view>
|
||||
<view class="logistics-detail">
|
||||
<view v-if="loading" class="loading-wrap">
|
||||
<u-loading mode="circle" />
|
||||
</view>
|
||||
</div>
|
||||
|
||||
<view v-else-if="loadError" class="error-wrap">
|
||||
<u-empty text="加载失败,请重试" mode="list" />
|
||||
<u-button size="medium" shape="circle" @click="retryLoad">重试</u-button>
|
||||
</view>
|
||||
|
||||
<view v-else class="card">
|
||||
<view v-if="orderStatus === 'PARTS_DELIVERED'" class="parts-tip">
|
||||
其余商品待商家继续发货
|
||||
</view>
|
||||
|
||||
<!-- 包裹列表 -->
|
||||
<view
|
||||
v-for="(packageItem, index) in packageList"
|
||||
:key="packageItem.packageNo || index"
|
||||
class="package-card"
|
||||
>
|
||||
<view class="package-title">{{ getPackageTitle(packageItem, index) }}</view>
|
||||
|
||||
<template v-if="isNoDelivery(packageItem)">
|
||||
<view v-if="packageItem.logisticsTime" class="info-row">
|
||||
<text class="label">完成时间:</text>
|
||||
<text class="value">{{ packageItem.logisticsTime }}</text>
|
||||
</view>
|
||||
<view v-if="packageItem.deliveryRemark" class="info-row">
|
||||
<text class="label">商家说明:</text>
|
||||
<text class="value">{{ packageItem.deliveryRemark }}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<view class="info-row">
|
||||
<text class="label">物流公司:</text>
|
||||
<text class="value">{{ packageItem.logisticsName || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="label">运单号:</text>
|
||||
<text class="value">{{ packageItem.logisticsNo || '-' }}</text>
|
||||
</view>
|
||||
<view v-if="packageItem.logisticsTime" class="info-row">
|
||||
<text class="label">发货时间:</text>
|
||||
<text class="value">{{ packageItem.logisticsTime }}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<view
|
||||
v-if="packageItem.orderPackageItemList && packageItem.orderPackageItemList.length"
|
||||
class="div-express-log goods-block"
|
||||
>
|
||||
<view
|
||||
class="goods-row"
|
||||
v-for="(item, gIndex) in packageItem.orderPackageItemList"
|
||||
:key="item.orderItemSn || gIndex"
|
||||
>
|
||||
<text class="goods-name">{{ item.goodsName }}</text>
|
||||
<text class="goods-meta">x{{ item.deliverNumber }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="!isNoDelivery(packageItem)" class="div-express-log">
|
||||
<ul class="express-log" v-if="packageItem.traces && packageItem.traces.traces && packageItem.traces.traces.length">
|
||||
<li v-for="(item, tIndex) in packageItem.traces.traces" :key="tIndex">
|
||||
<span class="time">{{ item.AcceptTime || item.acceptTime }}</span>
|
||||
<span class="detail">{{ item.AcceptStation || item.remark }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="express-log" v-else>
|
||||
<li>物流信息同步中</li>
|
||||
</ul>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 历史订单降级:主表物流 -->
|
||||
<view v-if="!packageList.length && legacyTraces" class="package-card">
|
||||
<view class="package-title">整单发货</view>
|
||||
<view class="info-row">
|
||||
<text class="label">物流公司:</text>
|
||||
<text class="value">{{ legacyTraces.shipper || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="label">运单号:</text>
|
||||
<text class="value">{{ legacyTraces.logisticCode || '-' }}</text>
|
||||
</view>
|
||||
<view class="div-express-log">
|
||||
<ul class="express-log" v-if="legacyTraces.traces && legacyTraces.traces.length">
|
||||
<li v-for="(item, index) in legacyTraces.traces" :key="index">
|
||||
<span class="time">{{ item.AcceptTime || item.acceptTime }}</span>
|
||||
<span class="detail">{{ item.AcceptStation || item.remark }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="express-log" v-else>
|
||||
<li>物流信息同步中</li>
|
||||
</ul>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<u-empty
|
||||
v-if="!packageList.length && !legacyTraces"
|
||||
class="empty"
|
||||
text="物流信息同步中"
|
||||
mode="list"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { getPackage } from '@/api/trade.js'
|
||||
import { getPackage, getExpress } from '@/api/trade.js'
|
||||
import { getOrderDetail } from '@/api/order.js'
|
||||
import { isNoDelivery, getPackageTitle } from '@/utils/orderDelivery.js'
|
||||
|
||||
const logisticsList = ref<any[]>([])
|
||||
const packageList = ref<any[]>([])
|
||||
const legacyTraces = ref<any>(null)
|
||||
const orderSn = ref('')
|
||||
const orderStatus = ref('')
|
||||
const loading = ref(true)
|
||||
const loadError = ref(false)
|
||||
|
||||
onLoad((option) => {
|
||||
const sn = option.order_sn
|
||||
if (sn) fetchLogistics(sn)
|
||||
orderSn.value = option?.order_sn || ''
|
||||
if (orderSn.value) {
|
||||
loadData(orderSn.value)
|
||||
} else {
|
||||
loading.value = false
|
||||
loadError.value = true
|
||||
}
|
||||
})
|
||||
|
||||
function fetchLogistics(sn: string) {
|
||||
getPackage(sn).then((res) => {
|
||||
if (res.data.success) {
|
||||
logisticsList.value = res.data.result
|
||||
}
|
||||
})
|
||||
function retryLoad() {
|
||||
if (orderSn.value) loadData(orderSn.value)
|
||||
}
|
||||
|
||||
async function loadData(sn: string) {
|
||||
loading.value = true
|
||||
loadError.value = false
|
||||
packageList.value = []
|
||||
legacyTraces.value = null
|
||||
|
||||
try {
|
||||
const orderRes = await getOrderDetail(sn)
|
||||
if (orderRes.data?.success) {
|
||||
orderStatus.value = orderRes.data.result?.order?.orderStatus || ''
|
||||
}
|
||||
|
||||
const packageRes = await getPackage(sn)
|
||||
if (!packageRes.data?.success) {
|
||||
loadError.value = true
|
||||
return
|
||||
}
|
||||
|
||||
const packages = packageRes.data.result || []
|
||||
if (packages.length) {
|
||||
packageList.value = packages
|
||||
return
|
||||
}
|
||||
|
||||
const traceRes = await getExpress(sn)
|
||||
if (traceRes.data?.success && traceRes.data.result) {
|
||||
legacyTraces.value = traceRes.data.result
|
||||
}
|
||||
} catch {
|
||||
loadError.value = true
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style >
|
||||
|
||||
<style>
|
||||
page {
|
||||
background: #fff;
|
||||
background: #f1f1f1;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// @import url('./goods.scss');
|
||||
.goods-item-view {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10rpx 30rpx;
|
||||
|
||||
.goods-img {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.goods-info {
|
||||
padding-left: 30rpx;
|
||||
flex: 3;
|
||||
|
||||
.goods-title {
|
||||
margin-bottom: 10rpx;
|
||||
color: $font-color-dark;
|
||||
}
|
||||
|
||||
.goods-specs {
|
||||
font-size: 24rpx;
|
||||
margin-bottom: 10rpx;
|
||||
color: #cccccc;
|
||||
}
|
||||
|
||||
.goods-price {
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 10rpx;
|
||||
color: #ff5a10;
|
||||
}
|
||||
}
|
||||
|
||||
.goods-num {
|
||||
>.good-complaint {
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
text-align: center;
|
||||
flex: 1;
|
||||
width: 60rpx;
|
||||
color: $main-color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.goods-info {
|
||||
flex: 2;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
background: #f2f2f2;
|
||||
}
|
||||
.logistics-detail {
|
||||
margin-top: 20rpx;
|
||||
padding: 0 16rpx;
|
||||
margin-top: 20rpx;
|
||||
padding: 0 16rpx 40rpx;
|
||||
}
|
||||
|
||||
.loading-wrap,
|
||||
.error-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 80rpx 0;
|
||||
gap: 24rpx;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
width: 100%;
|
||||
> .card-title {
|
||||
font-size: 24rpx;
|
||||
border-top-left-radius: 20rpx;
|
||||
border-top-right-radius: 20rpx;
|
||||
padding: 16rpx;
|
||||
}
|
||||
> .time-line {
|
||||
padding: 16rpx 32rpx;
|
||||
}
|
||||
}
|
||||
.u-order-title {
|
||||
font-weight: bold;
|
||||
}
|
||||
.u-order-desc {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
margin: 10rpx 0;
|
||||
}
|
||||
.u-order-time {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
.empty {
|
||||
padding: 40rpx 0;
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
width: 100%;
|
||||
padding: 16rpx 0;
|
||||
}
|
||||
|
||||
.parts-tip {
|
||||
margin: 0 20rpx 16rpx;
|
||||
padding: 16rpx 20rpx;
|
||||
background: #fff7e6;
|
||||
color: #fa8c16;
|
||||
font-size: 24rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.package-card {
|
||||
padding: 20rpx;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
.package-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
font-size: 26rpx;
|
||||
line-height: 44rpx;
|
||||
padding: 4rpx 0;
|
||||
|
||||
.label {
|
||||
color: #999;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.value {
|
||||
color: #333;
|
||||
word-break: break-all;
|
||||
}
|
||||
}
|
||||
|
||||
.goods-block {
|
||||
padding: 16rpx 20rpx;
|
||||
}
|
||||
|
||||
.goods-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 24rpx;
|
||||
line-height: 44rpx;
|
||||
color: #666;
|
||||
|
||||
.goods-name {
|
||||
flex: 1;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.goods-meta {
|
||||
flex-shrink: 0;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.express-log {
|
||||
/*margin: 5px -10px 5px 5px;*/
|
||||
padding: 20rpx;
|
||||
list-style-type: none;
|
||||
li {
|
||||
display: flex;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
li:nth-of-type(1) {
|
||||
margin-top: 0;
|
||||
}
|
||||
.time {
|
||||
width: 140rpx;
|
||||
display: flex;
|
||||
// float: left;
|
||||
flex-direction: column;
|
||||
font-size: 24rpx;
|
||||
line-height: 40rpx;
|
||||
span:nth-of-type(1) {
|
||||
margin-bottom: 16rpx;
|
||||
padding: 20rpx;
|
||||
list-style-type: none;
|
||||
|
||||
li {
|
||||
display: flex;
|
||||
margin-top: 18rpx;
|
||||
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.detail {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
margin-left: 30rpx;
|
||||
display: inline-block;
|
||||
font-size: 24rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
.time {
|
||||
width: 180rpx;
|
||||
flex-shrink: 0;
|
||||
font-size: 24rpx;
|
||||
line-height: 40rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
li {
|
||||
line-height: 60rpx;
|
||||
}
|
||||
.detail {
|
||||
flex: 1;
|
||||
margin-left: 20rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 40rpx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
.layui-layer-wrap {
|
||||
dl {
|
||||
border-top: solid 1px #f5f5f5;
|
||||
margin-top: -2rpx;
|
||||
overflow: hidden;
|
||||
|
||||
dt {
|
||||
font-size: 26rpx;
|
||||
line-height: 40rpx;
|
||||
display: inline-block;
|
||||
padding: 16rpx 1% 16rpx 0;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
dd {
|
||||
font-size: 26rpx;
|
||||
line-height: 40rpx;
|
||||
display: inline-block;
|
||||
padding: 16rpx 0 16rpx 16rpx;
|
||||
border-left: solid 2rpx #f5f5f5;
|
||||
|
||||
.text-box {
|
||||
line-height: 40rpx;
|
||||
color: #333;
|
||||
word-break: break-all;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.div-express-log {
|
||||
// max-height: 600rpx;
|
||||
border: solid 2rpx #e7e7e7;
|
||||
background: #fafafa;
|
||||
border-radius: 10rpx;
|
||||
margin-bottom: 6rpx;
|
||||
// overflow-y: auto;
|
||||
// overflow-x: auto;
|
||||
border: solid 2rpx #e7e7e7;
|
||||
background: #fafafa;
|
||||
border-radius: 10rpx;
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
.empty {
|
||||
padding: 40rpx 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -294,18 +294,9 @@ function waitPay(val: any) {
|
||||
|
||||
function pay(val: any) {
|
||||
if (val.sn) {
|
||||
// #ifdef MP-WEIXIN
|
||||
new LiLiWXPay({
|
||||
sn: val.sn,
|
||||
price: val.flowPrice,
|
||||
orderType: 'ORDER',
|
||||
}).pay()
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
uni.navigateTo({
|
||||
url: '/pages/cart/payment/payOrder?order_sn=' + val.sn,
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- 物流信息 / 卡密入口 -->
|
||||
<view class="info-view logistics-view">
|
||||
<!-- 物流/配送信息 / 卡密入口 -->
|
||||
<view class="info-view logistics-view" v-if="showDeliveryInfoBlock">
|
||||
<view class="logistics-List">
|
||||
<view v-if="isECouponOrder" class="card-key-entry">
|
||||
<view v-if="ecouponCardKeyDelivered" class="card-key-entry__btn" @click="goCardKeyDetail">
|
||||
@@ -25,16 +25,16 @@
|
||||
<view class="verificationCode" v-else-if="order.verificationCode">
|
||||
券码: {{ order.orderStatus == 'CANCELLED' ? '已失效' : order.verificationCode }}
|
||||
</view>
|
||||
<view @click="handleClickDeliver()" class="info-view logi-view" v-else-if="orderPackage && orderPackage.length">
|
||||
<view class="verificationCode">
|
||||
当前订单有 {{ orderPackage.length }} 个包裹快递
|
||||
</view>
|
||||
<div>
|
||||
点击此处查看
|
||||
</div>
|
||||
</view>
|
||||
<view v-else-if="!isECouponOrder" class="logistics-List-title">
|
||||
{{ '暂无物流信息' }}
|
||||
<view
|
||||
v-else-if="allowOperation.showLogistics"
|
||||
@click="handleClickDeliver()"
|
||||
class="info-view logi-view"
|
||||
>
|
||||
<view class="verificationCode">{{ deliveryEntryText }}</view>
|
||||
<div>点击此处查看</div>
|
||||
</view>
|
||||
<view v-else-if="order.orderStatus === 'UNDELIVERED'" class="logistics-List-title">
|
||||
等待商家发货
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -144,7 +144,7 @@
|
||||
<view class="customer-service"
|
||||
v-if="orderDetail.allowOperationVO && orderDetail.allowOperationVO.cancel == true"
|
||||
@click="onCancel(order.sn)">取消订单</view>
|
||||
<view class="customer-service" v-if="order.orderStatus == 'DELIVERED' && !isECouponOrder" @click="onLogistics(order)">查看物流</view>
|
||||
<view class="customer-service" v-if="allowOperation.showLogistics" @click="handleClickDeliver()">查看物流</view>
|
||||
<view class="customer-service" v-if="order.orderStatus != 'UNPAID' && order.orderPromotionType == 'PINTUAN'"
|
||||
@click="ByUserMessage(order)">查看拼团信息</view>
|
||||
<view class="customer-service"
|
||||
@@ -219,7 +219,7 @@
|
||||
>立即付款</view>
|
||||
<view
|
||||
class="pay-btn"
|
||||
v-if="order.orderStatus == 'DELIVERED' && !isECouponOrder"
|
||||
v-if="allowOperation.rog"
|
||||
@click="onRog(order.sn)"
|
||||
>确认收货</view>
|
||||
<view
|
||||
@@ -275,6 +275,11 @@ import {
|
||||
talkIm,
|
||||
callPhone,
|
||||
} from '@/utils/filters.js'
|
||||
import {
|
||||
shouldLoadDelivery,
|
||||
getDeliveryEntryText,
|
||||
getOrderAllowOperation,
|
||||
} from '@/utils/orderDelivery.js'
|
||||
import {
|
||||
isECouponOrder as checkECouponOrder,
|
||||
isNonPhysicalOrder as checkNonPhysicalOrder,
|
||||
@@ -300,7 +305,6 @@ const orderStatusMap: Record<string, { title: string; value?: string }> = {
|
||||
TAKE: { title: '待核验' },
|
||||
}
|
||||
|
||||
const logisticsList = ref<any>('')
|
||||
const shareFlag = ref(false)
|
||||
const order = ref<Record<string, any>>({})
|
||||
const cancelShow = ref(false)
|
||||
@@ -311,8 +315,9 @@ const sn = ref('')
|
||||
const cancelList = ref<any[]>([])
|
||||
const rogShow = ref(false)
|
||||
const reason = ref('')
|
||||
const orderPackage = ref<any>('')
|
||||
// orderType=E_COUPON:无物流/核销码;卡密见 cardKeyDetail(仅本单 orderItems,不含满赠子单)
|
||||
const orderPackage = ref<any[]>([])
|
||||
const legacyTraces = ref<any>(null)
|
||||
|
||||
const isECouponOrder = computed(() => checkECouponOrder(order.value?.orderType))
|
||||
const isNonPhysicalOrder = computed(() => checkNonPhysicalOrder(order.value?.orderType))
|
||||
const ecouponCardKeyDelivered = computed(() =>
|
||||
@@ -325,6 +330,27 @@ const ecouponPendingMessage = computed(() => {
|
||||
return pending ? resolveCardKeyFulfillMessage(pending) : ''
|
||||
})
|
||||
|
||||
const allowOperation = computed(() =>
|
||||
getOrderAllowOperation(order.value, orderDetail.value)
|
||||
)
|
||||
|
||||
const showDeliveryInfoBlock = computed(() => {
|
||||
if (isECouponOrder.value) return true
|
||||
if (order.value.orderType === 'VIRTUAL') return false
|
||||
if (order.value.deliveryMethod === 'SELF_PICK_UP') return false
|
||||
if (order.value.verificationCode) return true
|
||||
if (order.value.deliveryMethod === 'LOGISTICS') return true
|
||||
return false
|
||||
})
|
||||
|
||||
const deliveryEntryText = computed(() =>
|
||||
getDeliveryEntryText(
|
||||
orderPackage.value,
|
||||
order.value.orderStatus,
|
||||
legacyTraces.value
|
||||
)
|
||||
)
|
||||
|
||||
function hideLoadingIfNeeded() {
|
||||
if (store.state.isShowToast) uni.hideLoading()
|
||||
}
|
||||
@@ -335,12 +361,27 @@ onLoad((options) => {
|
||||
loadData(orderSnParam)
|
||||
})
|
||||
|
||||
function getOrderPackage() {
|
||||
getPackage(order.value.sn).then((res) => {
|
||||
if (res.data.success) {
|
||||
orderPackage.value = res.data.result
|
||||
async function loadDelivery(orderData: Record<string, any>) {
|
||||
orderPackage.value = []
|
||||
legacyTraces.value = null
|
||||
|
||||
if (!shouldLoadDelivery(orderData)) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const packageResponse = await getPackage(orderData.sn)
|
||||
const packages = packageResponse?.data?.result || []
|
||||
if (packages.length) {
|
||||
orderPackage.value = packages
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
const traceResponse = await getExpress(orderData.sn)
|
||||
legacyTraces.value = traceResponse?.data?.result || null
|
||||
} catch {
|
||||
// 配送信息加载失败时不阻断订单详情展示
|
||||
}
|
||||
}
|
||||
|
||||
function handleClickDeliver() {
|
||||
@@ -349,6 +390,13 @@ function handleClickDeliver() {
|
||||
})
|
||||
}
|
||||
|
||||
function goCardKeyDetail() {
|
||||
if (!sn.value) return
|
||||
uni.navigateTo({
|
||||
url: `/pages/order/cardKey/cardKeyDetail?sn=${sn.value}`,
|
||||
})
|
||||
}
|
||||
|
||||
function refundPriceList(status: string) {
|
||||
switch (status) {
|
||||
case 'ALL_REFUND':
|
||||
@@ -380,12 +428,6 @@ function goToShopPage(val: any) {
|
||||
})
|
||||
}
|
||||
|
||||
function loadLogistics(orderSnParam: string) {
|
||||
getExpress(orderSnParam).then((res) => {
|
||||
logisticsList.value = res.data.result
|
||||
})
|
||||
}
|
||||
|
||||
function inviteGroup() {
|
||||
shareFlag.value = true
|
||||
}
|
||||
@@ -404,32 +446,19 @@ function ByUserMessage(orderItem: any) {
|
||||
|
||||
function loadData(orderSnParam: string) {
|
||||
uni.showLoading({ title: '加载中' })
|
||||
getOrderDetail(orderSnParam).then((res) => {
|
||||
getOrderDetail(orderSnParam).then(async (res) => {
|
||||
const result = res.data.result
|
||||
order.value = result.order
|
||||
orderGoodsList.value = result.orderItems
|
||||
orderDetail.value = result
|
||||
if (
|
||||
result.order.deliveryMethod === 'LOGISTICS' &&
|
||||
!checkECouponOrder(result.order.orderType) &&
|
||||
result.order.orderType !== 'VIRTUAL'
|
||||
) {
|
||||
// E_COUPON 无物流信息
|
||||
loadLogistics(orderSnParam)
|
||||
getOrderPackage()
|
||||
if (!order.value.allowOperationVO && result.allowOperationVO) {
|
||||
order.value.allowOperationVO = result.allowOperationVO
|
||||
}
|
||||
await loadDelivery(order.value)
|
||||
hideLoadingIfNeeded()
|
||||
})
|
||||
}
|
||||
|
||||
function goCardKeyDetail() {
|
||||
// 仅传 orderSn,卡密在二级页重新请求订单详情,不经路由/Vuex 传递明文
|
||||
if (!sn.value) return
|
||||
uni.navigateTo({
|
||||
url: `/pages/order/cardKey/cardKeyDetail?sn=${sn.value}`,
|
||||
})
|
||||
}
|
||||
|
||||
function onReceipt(val: any) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/order/invoice/invoiceDetail?id=' + val.id,
|
||||
@@ -528,18 +557,6 @@ function onComment(_orderSnText: string) {
|
||||
})
|
||||
}
|
||||
|
||||
function onLogistics(orderItem: any) {
|
||||
uni.navigateTo({
|
||||
url:
|
||||
'/pages/mine/msgTips/packageMsg/logisticsDetail?logi_id=' +
|
||||
orderItem.logi_id +
|
||||
'&ship_no=' +
|
||||
orderItem.ship_no +
|
||||
'&order_sn=' +
|
||||
orderItem.sn,
|
||||
})
|
||||
}
|
||||
|
||||
function reasonChange(val: string) {
|
||||
reason.value = val
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user