|
@@ -44,30 +44,30 @@
|
|
|
</el-table>
|
|
</el-table>
|
|
|
<div class="address">
|
|
<div class="address">
|
|
|
<div class="title sa-m-b-16">{{ t('modules.order.deliveryInfo') }}</div>
|
|
<div class="title sa-m-b-16">{{ t('modules.order.deliveryInfo') }}</div>
|
|
|
- <div class="sa-m-l-16" v-if="props.modal?.params?.data?.orderAddressVO">
|
|
|
|
|
|
|
+ <div class="sa-m-l-16" v-if="state.addressInfo">
|
|
|
<div class="sa-flex sa-m-b-8">
|
|
<div class="sa-flex sa-m-b-8">
|
|
|
<div class="label">{{ t('modules.order.recipientInfo') }}:</div>
|
|
<div class="label">{{ t('modules.order.recipientInfo') }}:</div>
|
|
|
<div class="content">
|
|
<div class="content">
|
|
|
- {{ props.modal?.params?.data?.orderAddressVO?.realName }}
|
|
|
|
|
- {{ props.modal?.params?.data?.orderAddressVO?.phone }}
|
|
|
|
|
|
|
+ {{ state.addressInfo?.realName }}
|
|
|
|
|
+ {{ state.addressInfo?.phone || state.addressInfo?.userPhone }}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="sa-flex sa-col-top sa-m-b-16">
|
|
<div class="sa-flex sa-col-top sa-m-b-16">
|
|
|
<div class="label">{{ t('modules.order.recipientAddress') }}:</div>
|
|
<div class="label">{{ t('modules.order.recipientAddress') }}:</div>
|
|
|
<div class="content">
|
|
<div class="content">
|
|
|
<div>
|
|
<div>
|
|
|
- {{ props.modal?.params?.data?.orderAddressVO?.province }}
|
|
|
|
|
- {{ props.modal?.params?.data?.orderAddressVO?.city }}
|
|
|
|
|
- {{ props.modal?.params?.data?.orderAddressVO?.district }}
|
|
|
|
|
|
|
+ {{ state.addressInfo?.province }}
|
|
|
|
|
+ {{ state.addressInfo?.city }}
|
|
|
|
|
+ {{ state.addressInfo?.district }}
|
|
|
</div>
|
|
</div>
|
|
|
- <div>{{ props.modal?.params?.data?.orderAddressVO?.detail }}</div>
|
|
|
|
|
- <div v-if="props.modal?.params?.data?.orderAddressVO?.postCode">
|
|
|
|
|
- {{ t('modules.order.postalCode') }}:{{ props.modal?.params?.data?.orderAddressVO?.postCode }}
|
|
|
|
|
|
|
+ <div>{{ state.addressInfo?.detail }}</div>
|
|
|
|
|
+ <div v-if="state.addressInfo?.postCode">
|
|
|
|
|
+ {{ t('modules.order.postalCode') }}:{{ state.addressInfo?.postCode }}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div v-if="!props.modal?.params?.data?.orderAddressVO" class="mb-20px text-14px text-red ml-20px">
|
|
|
|
|
|
|
+ <div v-if="!state.addressInfo" class="mb-20px text-14px text-red ml-20px">
|
|
|
{{ t('modules.order.incompleteAddress') }}
|
|
{{ t('modules.order.incompleteAddress') }}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -200,10 +200,21 @@ const state = reactive({
|
|
|
nosendItem: computed(() => {
|
|
nosendItem: computed(() => {
|
|
|
console.log('发货弹窗接收到的数据:', props.modal);
|
|
console.log('发货弹窗接收到的数据:', props.modal);
|
|
|
console.log('订单详情数据:', props.modal?.params?.data);
|
|
console.log('订单详情数据:', props.modal?.params?.data);
|
|
|
- console.log('商品信息数据:', props.modal?.params?.data?.orderInfoVO);
|
|
|
|
|
- console.log('地址信息数据:', props.modal?.params?.data?.orderAddressVO);
|
|
|
|
|
- if (!props.modal?.params?.data?.orderInfoVO) return [];
|
|
|
|
|
- return props.modal.params?.data.orderInfoVO;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (!props.modal?.params?.data) return [];
|
|
|
|
|
+
|
|
|
|
|
+ const data = props.modal.params.data;
|
|
|
|
|
+
|
|
|
|
|
+ // 判断数据来源:
|
|
|
|
|
+ // 1. 如果有 orderInfoVO 字段,说明是从详情页进入,使用 orderInfoVO
|
|
|
|
|
+ if (data.orderInfoVO && Array.isArray(data.orderInfoVO)) {
|
|
|
|
|
+ console.log('详情页数据结构,使用 orderInfoVO');
|
|
|
|
|
+ return data.orderInfoVO;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 2. 否则是从列表进入,直接使用 data 包装成数组
|
|
|
|
|
+ console.log('列表页数据结构,使用 data');
|
|
|
|
|
+ return [data];
|
|
|
}),
|
|
}),
|
|
|
method: 'input',
|
|
method: 'input',
|
|
|
expressItem: [],
|
|
expressItem: [],
|
|
@@ -220,6 +231,8 @@ const state = reactive({
|
|
|
}),
|
|
}),
|
|
|
custom_type: 'text',
|
|
custom_type: 'text',
|
|
|
custom_content: [],
|
|
custom_content: [],
|
|
|
|
|
+ // 地址信息 - 需要通过订单号获取
|
|
|
|
|
+ addressInfo: null,
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
function handleSelectionChange(val) {
|
|
function handleSelectionChange(val) {
|
|
@@ -231,8 +244,7 @@ const { express, deliverCompany, getDeliverCompany, onChangeExpressCode, remoteM
|
|
|
// TODO
|
|
// TODO
|
|
|
async function onSend() {
|
|
async function onSend() {
|
|
|
// 检查订单是否有收货地址信息
|
|
// 检查订单是否有收货地址信息
|
|
|
- const orderAddress = props.modal?.params?.data?.orderAddressVO;
|
|
|
|
|
- if (!orderAddress || !orderAddress.realName || !orderAddress.phone || !orderAddress.detail) {
|
|
|
|
|
|
|
+ if (!state.addressInfo || !state.addressInfo.realName || (!state.addressInfo.phone && !state.addressInfo.userPhone) || !state.addressInfo.detail) {
|
|
|
ElMessage.error(t('modules.order.incompleteAddress'));
|
|
ElMessage.error(t('modules.order.incompleteAddress'));
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -257,6 +269,7 @@ async function onSend() {
|
|
|
]);
|
|
]);
|
|
|
state.sendLoading = false;
|
|
state.sendLoading = false;
|
|
|
if (code == '200') {
|
|
if (code == '200') {
|
|
|
|
|
+ ElMessage.success(t('modules.order.sendSuccess'));
|
|
|
emit('modalCallBack', { event: 'confirm' });
|
|
emit('modalCallBack', { event: 'confirm' });
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -271,6 +284,7 @@ async function onSend() {
|
|
|
});
|
|
});
|
|
|
state.sendLoading = false;
|
|
state.sendLoading = false;
|
|
|
if (code == '200') {
|
|
if (code == '200') {
|
|
|
|
|
+ ElMessage.success(t('modules.order.sendSuccess'));
|
|
|
emit('modalCallBack', { event: 'confirm' });
|
|
emit('modalCallBack', { event: 'confirm' });
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -322,7 +336,37 @@ watch(
|
|
|
},
|
|
},
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
|
|
+// 获取订单地址信息
|
|
|
|
|
+async function getOrderAddress() {
|
|
|
|
|
+ const data = props.modal?.params?.data;
|
|
|
|
|
+ if (!data) return;
|
|
|
|
|
+
|
|
|
|
|
+ // 如果已经有 orderAddressVO (从详情页进入),直接使用
|
|
|
|
|
+ if (data.orderAddressVO) {
|
|
|
|
|
+ console.log('使用详情页已有的地址信息');
|
|
|
|
|
+ state.addressInfo = data.orderAddressVO;
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 否则通过订单号请求地址信息 (从列表页进入)
|
|
|
|
|
+ const orderId = data.orderId;
|
|
|
|
|
+ if (!orderId) return;
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ console.log('从列表页进入,请求订单地址信息');
|
|
|
|
|
+ const { code, data: detailData } = await api.order.detail({ orderNo: orderId });
|
|
|
|
|
+ if (code == '200' && detailData?.orderAddressVO) {
|
|
|
|
|
+ state.addressInfo = detailData.orderAddressVO;
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('获取订单地址失败:', error);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
|
|
+ // 获取订单地址信息
|
|
|
|
|
+ getOrderAddress();
|
|
|
|
|
+
|
|
|
if (state.nosendItem.length) {
|
|
if (state.nosendItem.length) {
|
|
|
state.dispatch_type = 'express';
|
|
state.dispatch_type = 'express';
|
|
|
// 默认选中所有快递发货商品
|
|
// 默认选中所有快递发货商品
|