mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2026-09-21 20:32:01 +08:00
Merge branch 'feature/order-delivery-fulfillment'
This commit is contained in:
@@ -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