|
|
@@ -9,8 +9,8 @@
|
|
|
<el-option
|
|
|
v-for="item in logisticsList"
|
|
|
:key="item.id"
|
|
|
- :label="`${item.logisticNo},${getDictLabel(deliver_method, item.deliverMethod)}`"
|
|
|
- :value="item.logisticNo"
|
|
|
+ :label="`${item.logisticNo || item.deliverCode},${getDictLabel(deliver_method, item.deliverMethod)}`"
|
|
|
+ :value="item.logisticNo || item.deliverCode"
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
@@ -39,7 +39,7 @@
|
|
|
<script setup lang="ts">
|
|
|
import { listOrderDeliver, queryTrack } from '@/api/order/orderDeliver';
|
|
|
import { OrderDeliverVO } from '@/api/order/orderDeliver/types';
|
|
|
-
|
|
|
+import { listOrderStatusLog } from '@/api/order/orderStatusLog';
|
|
|
interface Props {
|
|
|
modelValue: boolean;
|
|
|
orderId?: string | number;
|
|
|
@@ -88,7 +88,7 @@ const loadLogisticsList = async () => {
|
|
|
logisticsList.value = res.rows || [];
|
|
|
|
|
|
if (logisticsList.value.length > 0) {
|
|
|
- form.value.selectedLogisticNo = logisticsList.value[0].logisticNo;
|
|
|
+ form.value.selectedLogisticNo = logisticsList.value[0].logisticNo || logisticsList.value[0].deliverCode;
|
|
|
handleLogisticNoChange(form.value.selectedLogisticNo);
|
|
|
}
|
|
|
} catch (error) {
|
|
|
@@ -98,29 +98,54 @@ const loadLogisticsList = async () => {
|
|
|
|
|
|
const handleLogisticNoChange = async (logisticNo: string) => {
|
|
|
const selected = logisticsList.value.find((item) => item.logisticNo === logisticNo);
|
|
|
- if (!selected) return;
|
|
|
-
|
|
|
try {
|
|
|
- const res = await queryTrack({
|
|
|
- logisticNo: logisticNo,
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 100
|
|
|
- });
|
|
|
-
|
|
|
- if (res.data && Array.isArray(res.data) && res.data.length > 0) {
|
|
|
- logisticsInfo.value = res.data.map((item: any) => ({
|
|
|
- time: item.acceptTime || item.time || '',
|
|
|
- location: selected.orderCode ? `${selected.orderCode}` : '',
|
|
|
- status: item.context || ''
|
|
|
- }));
|
|
|
+ if (selected) {
|
|
|
+ const res = await queryTrack({
|
|
|
+ logisticNo: logisticNo,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 100
|
|
|
+ });
|
|
|
+ // 1. 兼容处理:有些接口返回在 res.data,有些可能直接是 res
|
|
|
+ const dataList = res.data || [];
|
|
|
+ if (Array.isArray(dataList) && dataList.length > 0) {
|
|
|
+ logisticsInfo.value = dataList.map((item: any) => {
|
|
|
+ // 2. 核心修复:精准匹配时间字段
|
|
|
+ // 顺丰用 'time',韵达用 'ftime'。
|
|
|
+ // 优先取 ftime (韵达标准),如果没有则取 time (顺丰标准)
|
|
|
+ const displayTime = item.ftime || item.time || item.acceptTime || '';
|
|
|
+
|
|
|
+ return {
|
|
|
+ time: displayTime,
|
|
|
+ // 3. 建议:保留原始状态字段,方便后续筛选(如“已签收”)
|
|
|
+ status: item.context || item.content || '',
|
|
|
+ // 4. 建议:如果有地址字段,也可以映射进来,没有则保持订单号
|
|
|
+ location: item.location || (selected.orderCode ? `${selected.orderCode}` : '')
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
} else {
|
|
|
- logisticsInfo.value = [
|
|
|
- {
|
|
|
- time: (selected as any).createTime || '',
|
|
|
- location: selected.orderCode ? `${selected.orderCode}` : '',
|
|
|
- status: '已下单'
|
|
|
- }
|
|
|
- ];
|
|
|
+ await listOrderStatusLog({
|
|
|
+ orderId: props.orderId,
|
|
|
+ logisticNos: form.value.selectedLogisticNo,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 100
|
|
|
+ }).then((res) => {
|
|
|
+ logisticsInfo.value = res.rows.map((item: any) => {
|
|
|
+ return {
|
|
|
+ time: item.createTime,
|
|
|
+ location: item.orderCode ? `${item.orderCode}` : '',
|
|
|
+ status: item.statusName
|
|
|
+ };
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // logisticsInfo.value = [
|
|
|
+ // {
|
|
|
+ // time: (selected as any).createTime || '',
|
|
|
+ // location: selected.orderCode ? `${selected.orderCode}` : '',
|
|
|
+ // status: '已下单'
|
|
|
+ // }
|
|
|
+ // ];
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.error('Failed to query track:', error);
|