parent
26c96680d6
commit
5d1d3ea942
@ -0,0 +1,64 @@
|
|||||||
|
import * as api from '@/api/sales/order.js';
|
||||||
|
import { ElMessage } from '@/plugins/element-plus';
|
||||||
|
import { dict } from '@/plugins/global-api';
|
||||||
|
const state = () => ({
|
||||||
|
code: 'OrderShipManagement',
|
||||||
|
condition: {
|
||||||
|
orderIs: [],
|
||||||
|
},
|
||||||
|
list: [],
|
||||||
|
total: 0,
|
||||||
|
summary: [],
|
||||||
|
opts: {
|
||||||
|
init: false,
|
||||||
|
company: [{ label: '顺丰', value: 'sf' }],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const getters = {};
|
||||||
|
const mutations = {
|
||||||
|
setCode: (state, data) => (state.code = data),
|
||||||
|
setCondition: (state, data) => (state.condition = data),
|
||||||
|
setList: (state, data) => (state.list = data),
|
||||||
|
setTotal: (state, data) => (state.total = data),
|
||||||
|
setSummary: (state, data) => (state.summary = data),
|
||||||
|
setOpts: (state, data) => (state.opts = data),
|
||||||
|
};
|
||||||
|
const actions = {
|
||||||
|
search: async ({ state }) => {
|
||||||
|
let res = await api.shipList(state.condition.orderIs.join(','));
|
||||||
|
if (!res) {
|
||||||
|
ElMessage.error('查询发货订单列表失败');
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
},
|
||||||
|
load: async ({ commit }) => {
|
||||||
|
commit('setOpts', {
|
||||||
|
init: true,
|
||||||
|
company: [{ label: '顺丰', value: 'sf' }],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
save: async ({ rootState }, data) => {
|
||||||
|
let res = await api.sendAll(
|
||||||
|
data.map((item) => {
|
||||||
|
return {
|
||||||
|
companyCode: item.logistics.companyCode,
|
||||||
|
companyName: dict(rootState.order.opts.company, item.logistics.companyCode),
|
||||||
|
orderId: item.orderId,
|
||||||
|
trackingNo: item.trackingNo,
|
||||||
|
};
|
||||||
|
})
|
||||||
|
);
|
||||||
|
if (res) {
|
||||||
|
ElMessage.success('批量发货成功');
|
||||||
|
} else {
|
||||||
|
ElMessage.error('批量发货失败');
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
export default {
|
||||||
|
state,
|
||||||
|
getters,
|
||||||
|
mutations,
|
||||||
|
actions,
|
||||||
|
};
|
@ -0,0 +1,97 @@
|
|||||||
|
<template>
|
||||||
|
<div class="list-container">
|
||||||
|
<TableList
|
||||||
|
v-loading="loading"
|
||||||
|
:code="code"
|
||||||
|
:config="config"
|
||||||
|
:data="list"
|
||||||
|
:operation="[]"
|
||||||
|
@search="handleSearch"
|
||||||
|
>
|
||||||
|
<template #operation>
|
||||||
|
<el-button type="danger" @click="handleCancel">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleSave">确定</el-button>
|
||||||
|
</template>
|
||||||
|
</TableList>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="jsx">
|
||||||
|
const router = useRouter();
|
||||||
|
const store = useStore();
|
||||||
|
const loading = ref(false);
|
||||||
|
const code = computed(() => store.state.orderShip.code);
|
||||||
|
const list = ref([]);
|
||||||
|
const opts = computed(() => store.state.orderShip.opts);
|
||||||
|
if (!unref(opts).init) {
|
||||||
|
store.dispatch('orderShip/load');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 查询订单 */
|
||||||
|
const handleSearch = async () => {
|
||||||
|
loading.value = true;
|
||||||
|
list.value = await store.dispatch('orderShip/search');
|
||||||
|
loading.value = false;
|
||||||
|
};
|
||||||
|
onActivated(handleSearch);
|
||||||
|
/* 取消 */
|
||||||
|
const handleCancel = () => {
|
||||||
|
router.push({ name: 'OrderManagement' });
|
||||||
|
};
|
||||||
|
const handleSave = () => {
|
||||||
|
loading.value = true;
|
||||||
|
store.dispatch('orderShip/save', unref(list));
|
||||||
|
loading.value = false;
|
||||||
|
};
|
||||||
|
/* 保存 */
|
||||||
|
/* 列表配置 */
|
||||||
|
const config = reactive({
|
||||||
|
autoSearch: false,
|
||||||
|
page: false,
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
type: 'selection',
|
||||||
|
fixed: 'left',
|
||||||
|
width: 60,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '订单编号',
|
||||||
|
prop: 'orderNo',
|
||||||
|
minWidth: 300,
|
||||||
|
fixed: 'left',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '收货人',
|
||||||
|
prop: 'logistics.recipientName',
|
||||||
|
width: 140,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '手机号码',
|
||||||
|
prop: 'logistics.recipientPhone',
|
||||||
|
minWidth: 120,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '收货地址',
|
||||||
|
prop: 'logistics.recipientAddress',
|
||||||
|
width: 120,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '配送方式',
|
||||||
|
width: 120,
|
||||||
|
slots: {
|
||||||
|
default: ({ row }) => <ElSelect v-model={row.logistics.companyCode} opts={unref(opts).company} />,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '物流单号',
|
||||||
|
width: 120,
|
||||||
|
prop: 'logistics.trackingNo',
|
||||||
|
slots: {
|
||||||
|
default: ({ row }) => <ElInput v-model={row.logistics.trackingNo} />,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
Loading…
Reference in new issue