Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,42 @@
|
||||
import request from '@/utils/request.js';
|
||||
export const search = (params) => {
|
||||
return request({
|
||||
url: '/mall/trade/admin/tradeOrder/page',
|
||||
method: 'get',
|
||||
params,
|
||||
});
|
||||
};
|
||||
export const detail = (id) => {
|
||||
return request({
|
||||
url: '/uc/employee/' + id,
|
||||
method: 'get',
|
||||
});
|
||||
};
|
||||
export const create = (data) => {
|
||||
return request({
|
||||
url: '/uc/employee',
|
||||
method: 'post',
|
||||
data,
|
||||
});
|
||||
};
|
||||
export const update = (data) => {
|
||||
return request({
|
||||
url: '/uc/employee',
|
||||
method: 'put',
|
||||
data,
|
||||
});
|
||||
};
|
||||
export const remove = (idList) => {
|
||||
return request({
|
||||
url: '/uc/employee',
|
||||
method: 'delete',
|
||||
params: { idList },
|
||||
});
|
||||
};
|
||||
export const enable = (params) => {
|
||||
return request({
|
||||
url: '/uc/employee/enable',
|
||||
method: 'put',
|
||||
params,
|
||||
});
|
||||
};
|
Before Width: | Height: | Size: 971 KiB After Width: | Height: | Size: 971 KiB |
Before Width: | Height: | Size: 443 B After Width: | Height: | Size: 443 B |
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
Before Width: | Height: | Size: 877 KiB After Width: | Height: | Size: 877 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 200 B After Width: | Height: | Size: 200 B |
@ -0,0 +1,23 @@
|
||||
export default [
|
||||
{
|
||||
path: '/sales',
|
||||
name: 'SalesCenter',
|
||||
component: () => import('@/layouts/default.vue'),
|
||||
meta: {
|
||||
title: '销售中心',
|
||||
icon: 'money-dollar-circle-fill',
|
||||
layout: true,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'order',
|
||||
name: 'OrderManagement',
|
||||
component: () => import('@/views/sales/order/index.vue'),
|
||||
meta: {
|
||||
title: '订单管理',
|
||||
icon: 'barcode-box-fill',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
@ -0,0 +1,103 @@
|
||||
import * as api from '@/api/sales/order.js';
|
||||
import { ElMessage, ElMessageBox } from '@/plugins/element-plus';
|
||||
const state = () => ({
|
||||
code: 'OrderManagement',
|
||||
condition: {},
|
||||
list: [],
|
||||
total: 0,
|
||||
opts: {
|
||||
init: false,
|
||||
source: [],
|
||||
status: [],
|
||||
},
|
||||
});
|
||||
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),
|
||||
setOpts: (state, data) => (state.opts = data),
|
||||
};
|
||||
const actions = {
|
||||
search: async ({ state, commit, rootGetters }) => {
|
||||
let res = await api.search({ ...rootGetters['local/page'](state.code), ...state.condition });
|
||||
if (res) {
|
||||
commit('setList', res.records);
|
||||
commit('setTotal', res.total);
|
||||
} else {
|
||||
ElMessage.error('查询失败');
|
||||
commit('setList', []);
|
||||
}
|
||||
return res;
|
||||
},
|
||||
load: async ({ commit }) => {
|
||||
commit('setOpts', {
|
||||
init: true,
|
||||
source: [
|
||||
{ label: '未知来源', value: 1 },
|
||||
{ label: '安卓端APP', value: 2 },
|
||||
{ label: 'IOS端APP', value: 3 },
|
||||
],
|
||||
status: [
|
||||
{ label: '待支付', value: 1 },
|
||||
{ label: '已关闭', value: 2 },
|
||||
{ label: '待发货', value: 3 },
|
||||
{ label: '已发货', value: 4 },
|
||||
{ label: '已收货', value: 5 },
|
||||
{ label: '已完成', value: 6 },
|
||||
],
|
||||
});
|
||||
},
|
||||
detail: async (context, id) => {
|
||||
let res = await api.detail(id);
|
||||
if (!res) {
|
||||
ElMessage.error('加载详情失败');
|
||||
}
|
||||
return res;
|
||||
},
|
||||
save: async ({ dispatch }, data) => {
|
||||
let save = data.id ? api.update : api.create;
|
||||
let res = await save(data);
|
||||
if (res) {
|
||||
ElMessage.success('保存成功');
|
||||
dispatch('search');
|
||||
} else {
|
||||
ElMessage.error('保存失败');
|
||||
}
|
||||
return res;
|
||||
},
|
||||
remove: async ({ dispatch }, idList) => {
|
||||
if (!idList.length) {
|
||||
ElMessage.warning('请选择要删除的数据');
|
||||
} else {
|
||||
try {
|
||||
await ElMessageBox.confirm('数据删除后无法恢复,确定要删除吗?', '危险操作');
|
||||
let res = await api.remove(idList.join(','));
|
||||
if (res) {
|
||||
ElMessage.success('删除成功');
|
||||
dispatch('search');
|
||||
} else {
|
||||
ElMessage.error('删除失败');
|
||||
}
|
||||
} catch (e) {
|
||||
console.info('取消删除', e);
|
||||
}
|
||||
}
|
||||
},
|
||||
enable: async ({ dispatch }, data) => {
|
||||
let res = await api.enable(data);
|
||||
if (res) {
|
||||
ElMessage.success((data.isEnable ? '启用' : '禁用') + '成功');
|
||||
dispatch('search');
|
||||
} else {
|
||||
ElMessage.error((data.isEnable ? '启用' : '禁用') + '失败');
|
||||
}
|
||||
},
|
||||
};
|
||||
export default {
|
||||
state,
|
||||
getters,
|
||||
mutations,
|
||||
actions,
|
||||
};
|
@ -0,0 +1,150 @@
|
||||
<template>
|
||||
<TableList
|
||||
v-loading="loading"
|
||||
:code="code"
|
||||
:config="config"
|
||||
:data="list"
|
||||
:operation="['search', 'export']"
|
||||
:reset="handleReset"
|
||||
title="订单"
|
||||
:total="total"
|
||||
@export="handleExport"
|
||||
@search="handleSearch"
|
||||
>
|
||||
<template #search>
|
||||
<el-form inline>
|
||||
<el-form-item label="订单编号" prop="userName">
|
||||
<el-input v-model="state.condition.userName" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="userName">
|
||||
<el-input v-model="state.condition.userName" />
|
||||
</el-form-item>
|
||||
<el-form-item label="来源" prop="userName">
|
||||
<el-input v-model="state.condition.userName" />
|
||||
</el-form-item>
|
||||
<el-form-item label="提交时间" prop="userName">
|
||||
<el-input v-model="state.condition.userName" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
</TableList>
|
||||
</template>
|
||||
|
||||
<script setup lang="jsx">
|
||||
import ElButton from '@/components/extra/ElButton.vue';
|
||||
const { proxy } = getCurrentInstance();
|
||||
const router = useRouter();
|
||||
const store = useStore();
|
||||
const loading = ref(false);
|
||||
const code = computed(() => store.state.employee.code);
|
||||
const list = computed(() => store.state.employee.list);
|
||||
const total = computed(() => store.state.employee.total);
|
||||
const opts = computed(() => store.state.employee.opts);
|
||||
if (!unref(opts).init) {
|
||||
store.dispatch('order/load');
|
||||
}
|
||||
const state = reactive({
|
||||
condition: {
|
||||
userName: null,
|
||||
},
|
||||
});
|
||||
watch(
|
||||
() => state.condition,
|
||||
(value) => {
|
||||
store.commit('order/setCondition', _.cloneDeep(value));
|
||||
},
|
||||
{ immediate: true, deep: true }
|
||||
);
|
||||
const handleReset = () => {
|
||||
state.condition = {
|
||||
orderName: null,
|
||||
phone: null,
|
||||
};
|
||||
};
|
||||
const handleSearch = async () => {
|
||||
loading.value = true;
|
||||
await store.dispatch('order/search');
|
||||
loading.value = false;
|
||||
};
|
||||
const handleDetail = (row) => {
|
||||
router.push({
|
||||
name: 'OrderDetail',
|
||||
params: {
|
||||
id: row.id,
|
||||
},
|
||||
});
|
||||
};
|
||||
const handleExport = async () => {
|
||||
console.info('export');
|
||||
};
|
||||
const handleClose = async () => {
|
||||
console.info('close');
|
||||
};
|
||||
const config = reactive({
|
||||
// 表格列配置
|
||||
columns: [
|
||||
{
|
||||
type: 'selection',
|
||||
fixed: 'left',
|
||||
width: 60,
|
||||
},
|
||||
{
|
||||
label: '订单编号',
|
||||
prop: 'employeeName',
|
||||
minWidth: 160,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
label: '手机号',
|
||||
prop: 'userName',
|
||||
minWidth: 160,
|
||||
},
|
||||
{
|
||||
label: '订单金额',
|
||||
prop: 'phone',
|
||||
width: 160,
|
||||
},
|
||||
{
|
||||
label: '支付方式',
|
||||
prop: 'email',
|
||||
width: 160,
|
||||
},
|
||||
{
|
||||
label: '订单来源',
|
||||
width: 120,
|
||||
slots: {
|
||||
default: ({ row }) => proxy.$dict(unref(opts).source, row.source),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '订单状态',
|
||||
prop: 'remark',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
label: '提交时间',
|
||||
prop: 'updateTime',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
label: '操作',
|
||||
fixed: 'right',
|
||||
slots: {
|
||||
default: ({ row }) => (
|
||||
<div>
|
||||
<ElButton type="text" onClick={() => handleDetail(row)}>
|
||||
查看订单
|
||||
</ElButton>
|
||||
<ElButton type="text" onClick={() => handleClose(row)}>
|
||||
关闭订单
|
||||
</ElButton>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
width: 120,
|
||||
},
|
||||
],
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|