This commit is contained in:
Your Name
2026-06-05 17:15:15 +08:00
parent b9d36d8d04
commit 5a235280a1
10 changed files with 328 additions and 54 deletions
+5
View File
@@ -403,6 +403,11 @@ export function prescriptionOrderLogisticsTrace(params: {
return request.get({ url: '/tcm.prescriptionOrder/logisticsTrace', params })
}
/** 直接调用京东官方物流接口刷新轨迹并落库(绕过快递100缓存) */
export function prescriptionOrderLogisticsJdUpdate(params: { id: number }) {
return request.post({ url: '/tcm.prescriptionOrder/logisticsJdUpdate', params })
}
export function prescriptionOrderDetail(params: { id: number }) {
return request.get({ url: '/tcm.prescriptionOrder/detail', params })
}
@@ -1353,6 +1353,17 @@
<template #icon><el-icon><Refresh /></el-icon></template>
刷新轨迹
</el-button>
<el-button
v-perms="['tcm.prescriptionOrder/logisticsTrace']"
type="warning"
plain
size="default"
:loading="jdLogisticsUpdating"
@click="updateJdLogistics"
>
<template #icon><el-icon><Van /></el-icon></template>
京东接口更新
</el-button>
<div class="ml-2 flex items-center gap-4 border-l pl-4 border-gray-200">
<el-link :href="detailOfficialUrls.sf" target="_blank" type="primary" :underline="false" class="text-[13px]">顺丰官网</el-link>
<el-link :href="detailOfficialUrls.jd" target="_blank" type="primary" :underline="false" class="text-[13px]">京东物流</el-link>
@@ -2870,7 +2881,7 @@
<script lang="ts" setup name="prescriptionOrderList">
import { computed, onMounted, reactive, ref, nextTick, watch, defineAsyncComponent } from 'vue'
import { useRoute } from 'vue-router'
import { Refresh, Loading, ArrowDown, InfoFilled, QuestionFilled, Search, Calendar, Document, Link as LinkIcon, Wallet } from '@element-plus/icons-vue'
import { Refresh, Loading, ArrowDown, InfoFilled, QuestionFilled, Search, Calendar, Document, Link as LinkIcon, Wallet, Van } from '@element-plus/icons-vue'
import ListTimeFilter from '@/components/list-time-filter/index.vue'
import { useListTimeFilter } from '@/hooks/useListTimeFilter'
import {
@@ -2883,6 +2894,7 @@ import {
prescriptionOrderPaidPayOrders,
prescriptionOrderWithdraw,
prescriptionOrderLogisticsTrace,
prescriptionOrderLogisticsJdUpdate,
prescriptionOrderShip,
prescriptionOrderLogs,
prescriptionOrderUpdateAmount,
@@ -4181,6 +4193,7 @@ function formatOrderTime(v: unknown) {
const detailLogisticsExpress = ref<string>('auto')
const logisticsTraceLoading = ref(false)
const jdLogisticsUpdating = ref(false)
const logisticsTracePayload = ref<Record<string, any> | null>(null)
/** 顺丰/快递100:与运单一致的收件手机后四位(可覆盖订单收货手机) */
const logisticsTracePhoneTail = ref('')
@@ -4414,6 +4427,26 @@ async function fetchLogisticsTrace() {
}
}
//
async function updateJdLogistics() {
const orderId = Number(detailData.value?.id)
const trackingNumber = String(detailData.value?.tracking_number || '').trim()
if (!orderId || !trackingNumber) {
feedback.msgWarning('当前订单未填写快递单号')
return
}
jdLogisticsUpdating.value = true
try {
const res: any = await prescriptionOrderLogisticsJdUpdate({ id: orderId })
feedback.msgSuccess(res?.message || '京东物流轨迹已更新')
await fetchLogisticsTrace()
} catch (e: any) {
feedback.msgError(e?.message || '京东物流更新失败')
} finally {
jdLogisticsUpdating.value = false
}
}
const patchRxPatientVisible = ref(false)
const patchRxPatientSaving = ref(false)
const patchRxPatientFormRef = ref<FormInstance>()