feat: 开通店铺商品详情、物流接口变更
This commit is contained in:
@@ -58,7 +58,7 @@
|
||||
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 { getOrderDetail as getAiOrderDetail, getOpenOrderDetail, getOpenOrderExpressTrackList } from '@/sheep/api/ai';
|
||||
import { getExpressTrackList } from '@/sheep/api/index/index';
|
||||
import HighlightNumber from '@/pages/components/HighlightNumberText.vue';
|
||||
|
||||
@@ -103,6 +103,30 @@
|
||||
if (id) {
|
||||
state.info.id = id;
|
||||
}
|
||||
|
||||
// 开通店铺订单(type===5):物流接口 /aishop/app/open/order/get-express-track-list
|
||||
const isOpenOrder = Number(state.info?.type) === 5;
|
||||
if (isOpenOrder) {
|
||||
// 优先传 delayRecordId + code=2;没传 delayRecordId 就只传 code(具体 code 值看原 code 参数)
|
||||
const params = { id };
|
||||
if (code === 2 && hasDelayRecordId) {
|
||||
params.code = 2;
|
||||
params.delayRecordId = delayRecordId;
|
||||
} else if (code > 0) {
|
||||
params.code = code;
|
||||
if (hasDelayRecordId) params.delayRecordId = delayRecordId;
|
||||
} else {
|
||||
params.code = 0;
|
||||
}
|
||||
try {
|
||||
const { data } = await getOpenOrderExpressTrackList(params);
|
||||
state.tracks = Array.isArray(data) ? data : [];
|
||||
} catch (e) {
|
||||
state.tracks = [];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (code === 2 && hasDelayRecordId) {
|
||||
const { data } = await getExpressTrackList({
|
||||
id,
|
||||
@@ -124,6 +148,14 @@
|
||||
|
||||
async function getOrderDetail(id) {
|
||||
if (!id) return;
|
||||
// 开通店铺订单(type===5):详情接口 /aishop/order/get-detail-open,优先尝试
|
||||
try {
|
||||
const { code: rc, data } = await getOpenOrderDetail({ id });
|
||||
if (rc === 0 && data && Number(data?.type) === 5) {
|
||||
state.info = data;
|
||||
return;
|
||||
}
|
||||
} catch (e) {}
|
||||
try {
|
||||
const { data } = await OrderApi.getOrderDetail(id);
|
||||
if (data) {
|
||||
@@ -139,9 +171,10 @@
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
getExpressDetail(options || {});
|
||||
getOrderDetail(options?.id);
|
||||
onLoad(async (options) => {
|
||||
// 先拿订单详情(确定 type===5,以及填充 state.info),再拿物流
|
||||
await getOrderDetail(options?.id);
|
||||
await getExpressDetail(options || {});
|
||||
});
|
||||
|
||||
function handlePhoneClick(data) {
|
||||
|
||||
Reference in New Issue
Block a user