fix: 服务单

feature/task1.0.0__0514__ch
向文可 2 years ago
parent eb4051be12
commit 9a0c23c52c

@ -37,21 +37,25 @@ const actions = {
company: await api.searchShip(),
});
},
save: async ({ rootState }, data) => {
save: async ({ dispatch, state }, data) => {
let res = null;
if (data.every((item) => item.companyCode && item.trackingNo)) {
if (data.every((item) => item.logistics.companyCode && item.logistics.trackingNo)) {
res = await api.sendAll(
data.map((item) => {
return {
companyCode: item.logistics.companyCode,
companyName: dict(rootState.order.opts.company, item.logistics.companyCode),
companyName: dict(state.opts.company, item.logistics.companyCode, {
label: 'companyName',
value: 'companyCode',
}),
orderId: item.orderId,
trackingNo: item.trackingNo,
trackingNo: item.logistics.trackingNo,
};
})
);
if (res) {
ElMessage.success('批量发货成功');
dispatch('search');
} else {
ElMessage.error('批量发货失败');
}

@ -1,5 +1,5 @@
<template>
<el-dialog v-model="visible" title="批量发货">
<el-dialog v-model="visible" title="批量发货" width="800px">
<TableList
v-loading="loading"
:code="code"
@ -10,7 +10,7 @@
/>
<template #footer>
<el-button type="danger" @click="handleCancel"></el-button>
<el-button type="primary" @click="handleSave"></el-button>
<el-button :loading="loading" type="primary" @click="handleSave"></el-button>
</template>
</el-dialog>
</template>
@ -39,17 +39,22 @@
const handleCancel = () => {
router.push({ name: 'OrderManagement' });
};
const handleSave = () => {
const handleSave = async () => {
loading.value = true;
store.dispatch('orderShip/save', unref(list));
let res = await store.dispatch('orderShip/save', unref(list));
if (res) {
handleClose();
}
loading.value = false;
};
const handleShow = () => {
visible.value = true;
handleSearch();
};
const emits = defineEmits(['save']);
const handleClose = () => {
visible.value = false;
emits('save');
};
defineExpose({
show: handleShow,
@ -84,7 +89,7 @@
},
{
label: '配送方式',
width: 120,
width: 140,
slots: {
default: ({ row }) => (
<ElSelect

@ -163,7 +163,12 @@
<el-input-number v-model="state.form.refundAmount" />
</el-form-item>
<el-form-item label="选择收货点" prop="receivePoint">
<el-select v-model="state.form.receivePoint" :opts="opts.receivePoint" />
<el-select
v-model="state.form.receivePoint"
:config="{ label: 'recipientName', value: 'detailAddress' }"
:opts="[state.detail.refundAddress]"
@change="handlePointChange"
/>
</el-form-item>
<el-form-item label="收货人姓名" prop="recipientName">
<el-input v-model="state.form.recipientName" />
@ -221,10 +226,10 @@
<span>
{{ state.detail.refundLogistics?.companyName }}
</span>
<span>
<span style="margin: 0 10px">
{{ state.detail.refundLogistics?.trackingNo }}
</span>
<el-button type="text">查看</el-button>
<el-button type="text" @click="handleTrack"></el-button>
</el-form-item>
<el-form-item label="退款说明">
{{ state.detail.handleReturnLog?.problemDescribe }}
@ -250,10 +255,12 @@
</template>
</el-scrollbar>
</div>
<OrderTrack ref="refsOrderTrack" />
</div>
</template>
<script setup lang="jsx">
import OrderTrack from '../order/track.vue';
const store = useStore();
const route = useRoute();
const { proxy } = getCurrentInstance();
@ -373,6 +380,7 @@
refundProduct: [],
}
);
handlePointChange(state.detail.refundAddress.detailAddress);
state.form.refundId = res.refundId;
state.form.refundAmount = res.refundAmount;
[null, state.steps, state.steps2][res.refundType].forEach((step, index) => {
@ -388,7 +396,19 @@
state.loading = false;
};
onActivated(handleLoad);
const handlePointChange = (e) => {
state.form.receivePoint = e;
let point = [state.detail.refundAddress].find((item) => item.detailAddress === e);
state.form.recipientName = point?.recipientName || null;
state.form.recipientPhone = point?.recipientPhone || null;
state.form.detailAddress = point?.detailAddress || null;
state.form.address = point ? [point.provinceCode, point.cityCode, point.areaCode] : [];
state.form.addressInfo = point ? [point.province, point.city, point.area] : [];
};
const refsOrderTrack = ref(null);
const handleTrack = () => {
unref(refsOrderTrack).show(state.detail.orderId);
};
/* 同意退货/退款 */
const handleResolveRefundOrReturn = async () => {
state.loading = true;

Loading…
Cancel
Save