feat: 单个物流查看
This commit is contained in:
@@ -58,38 +58,90 @@
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { computed, reactive } from 'vue';
|
||||
import OrderApi from '@/sheep/api/trade/order';
|
||||
import { getOrderDetail as getAiOrderDetail } from '@/sheep/api/ai';
|
||||
import { getExpressTrackList } from '@/sheep/api/index/index';
|
||||
import HighlightNumber from '@/pages/components/HighlightNumberText.vue';
|
||||
|
||||
const state = reactive({
|
||||
info: [],
|
||||
info: {},
|
||||
tracks: [],
|
||||
});
|
||||
|
||||
const goodsImages = computed(() => {
|
||||
let array = [];
|
||||
if (state.info.items) {
|
||||
if (state.info && state.info.items) {
|
||||
state.info.items.forEach((item) => {
|
||||
array.push({
|
||||
image: item.picUrl,
|
||||
});
|
||||
});
|
||||
}
|
||||
if (state.info && state.info.delayRecords && Array.isArray(state.info.delayRecords)) {
|
||||
state.info.delayRecords.forEach((record) => {
|
||||
if (record.picUrl || record.orderItemVO?.picUrl) {
|
||||
array.push({
|
||||
image: record.picUrl || record.orderItemVO?.picUrl,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
return array;
|
||||
});
|
||||
|
||||
async function getExpressDetail(id) {
|
||||
const { data } = await OrderApi.getOrderExpressTrackList(id);
|
||||
state.tracks = data;
|
||||
async function getExpressDetail(options) {
|
||||
const id = options?.id;
|
||||
const codeRaw = options?.code;
|
||||
const code =
|
||||
codeRaw !== undefined && codeRaw !== null && String(codeRaw).trim() !== ''
|
||||
? Number(codeRaw)
|
||||
: 0;
|
||||
const delayRecordId = options?.delayRecordId;
|
||||
const hasDelayRecordId =
|
||||
delayRecordId !== undefined &&
|
||||
delayRecordId !== null &&
|
||||
String(delayRecordId).trim() !== '';
|
||||
if (id) {
|
||||
state.info.id = id;
|
||||
}
|
||||
if (code === 2 && hasDelayRecordId) {
|
||||
const { data } = await getExpressTrackList({
|
||||
id,
|
||||
code: 2,
|
||||
delayRecordId,
|
||||
});
|
||||
state.tracks = data;
|
||||
} else if (code > 0) {
|
||||
const { data } = await getExpressTrackList({
|
||||
id,
|
||||
code,
|
||||
});
|
||||
state.tracks = data;
|
||||
} else {
|
||||
const { data } = await OrderApi.getOrderExpressTrackList(id);
|
||||
state.tracks = data;
|
||||
}
|
||||
}
|
||||
|
||||
async function getOrderDetail(id) {
|
||||
const { data } = await OrderApi.getOrderDetail(id);
|
||||
state.info = data;
|
||||
if (!id) return;
|
||||
try {
|
||||
const { data } = await OrderApi.getOrderDetail(id);
|
||||
if (data) {
|
||||
state.info = data;
|
||||
return;
|
||||
}
|
||||
} catch (e) {}
|
||||
try {
|
||||
const { data } = await getAiOrderDetail({ id });
|
||||
if (data) {
|
||||
state.info = data;
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
getExpressDetail(options.id);
|
||||
getOrderDetail(options.id);
|
||||
getExpressDetail(options || {});
|
||||
getOrderDetail(options?.id);
|
||||
});
|
||||
|
||||
function handlePhoneClick(data) {
|
||||
|
||||
Reference in New Issue
Block a user