fix: 服务单

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

@ -37,21 +37,25 @@ const actions = {
company: await api.searchShip(), company: await api.searchShip(),
}); });
}, },
save: async ({ rootState }, data) => { save: async ({ dispatch, state }, data) => {
let res = null; 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( res = await api.sendAll(
data.map((item) => { data.map((item) => {
return { return {
companyCode: item.logistics.companyCode, 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, orderId: item.orderId,
trackingNo: item.trackingNo, trackingNo: item.logistics.trackingNo,
}; };
}) })
); );
if (res) { if (res) {
ElMessage.success('批量发货成功'); ElMessage.success('批量发货成功');
dispatch('search');
} else { } else {
ElMessage.error('批量发货失败'); ElMessage.error('批量发货失败');
} }

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

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

Loading…
Cancel
Save