feat(sdy): 新增分销商订单管理功能
- 添加分销商订单模型定义及API接口- 实现分销商订单导入导出功能- 完善订单编辑页面字段展示和校验逻辑- 调整订单列表页展示字段及操作按钮- 移除三级分销相关字段和功能- 修改订单状态标签文案和样式 - 增加订单删除确认弹窗- 优化导入弹窗组件及上传逻辑 - 调整搜索组件布局并增加导入按钮 - 更新订单详情弹窗标题和结算按钮文案 - 移除订单详情查看功能及相关代码 - 调整表格列配置和数据渲染方式 - 修复未签约订单提示逻辑 - 移除语言参数传递逻辑- 增加新窗口打开链接工具函数引入
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
VITE_APP_NAME=后台管理(开发环境)
|
VITE_APP_NAME=后台管理(开发环境)
|
||||||
#VITE_API_URL=http://127.0.0.1:9200/api
|
VITE_API_URL=http://127.0.0.1:9200/api
|
||||||
#VITE_SERVER_API_URL=http://127.0.0.1:8000/api
|
#VITE_SERVER_API_URL=http://127.0.0.1:8000/api
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {SERVER_API_URL} from '@/config/setting';
|
|||||||
import { Company } from '@/api/system/company/model';
|
import { Company } from '@/api/system/company/model';
|
||||||
import { CmsWebsite } from '@/api/cms/cmsWebsite/model';
|
import { CmsWebsite } from '@/api/cms/cmsWebsite/model';
|
||||||
import {Menu} from "@/api/system/menu/model";
|
import {Menu} from "@/api/system/menu/model";
|
||||||
import {getLang} from "@/utils/common";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前登录的用户信息、菜单、权限、角色
|
* 获取当前登录的用户信息、菜单、权限、角色
|
||||||
@@ -28,9 +27,7 @@ export async function getSiteInfo() {
|
|||||||
const res = await request.get<ApiResult<CmsWebsite>>(
|
const res = await request.get<ApiResult<CmsWebsite>>(
|
||||||
'/shop/getShopInfo',
|
'/shop/getShopInfo',
|
||||||
{
|
{
|
||||||
params: {
|
params: {}
|
||||||
lang: getLang()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if (res.data.code === 0 && res.data.data) {
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
|||||||
120
src/api/sdy/sdyDealerOrder/index.ts
Normal file
120
src/api/sdy/sdyDealerOrder/index.ts
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type {ApiResult} from '@/api';
|
||||||
|
import type {ShopDealerOrder, ShopDealerOrderParam} from './model';
|
||||||
|
import {utils, writeFile} from 'xlsx';
|
||||||
|
import {message} from 'ant-design-vue';
|
||||||
|
import {getTenantId} from '@/utils/domain';
|
||||||
|
import {listShopDealerOrder} from "@/api/shop/shopDealerOrder";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入分销商订单
|
||||||
|
*/
|
||||||
|
export async function importSdyDealerOrder(file: File) {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append('file', file);
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
'/sdy/sdy-dealer-order/import',
|
||||||
|
formData
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出分销商订单
|
||||||
|
*/
|
||||||
|
export async function exportSdyDealerOrder(params?: ShopDealerOrderParam) {
|
||||||
|
// 显示导出加载提示
|
||||||
|
message.loading('正在准备导出数据...', 0);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 获取数据
|
||||||
|
const list = await listShopDealerOrder(params);
|
||||||
|
|
||||||
|
if (!list || list.length === 0) {
|
||||||
|
message.destroy();
|
||||||
|
message.warning('没有数据可以导出');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建导出数据
|
||||||
|
const array: (string | number)[][] = [
|
||||||
|
[
|
||||||
|
'订单ID',
|
||||||
|
'买家用户ID',
|
||||||
|
'订单总金额',
|
||||||
|
'一级分销商ID',
|
||||||
|
'一级佣金',
|
||||||
|
'二级分销商ID',
|
||||||
|
'二级佣金',
|
||||||
|
'三级分销商ID',
|
||||||
|
'三级佣金',
|
||||||
|
'订单状态',
|
||||||
|
'结算状态',
|
||||||
|
'结算时间',
|
||||||
|
'创建时间'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
list.forEach((order: ShopDealerOrder) => {
|
||||||
|
array.push([
|
||||||
|
order.orderId || '',
|
||||||
|
order.userId || '',
|
||||||
|
order.orderPrice || '0',
|
||||||
|
order.firstUserId || '',
|
||||||
|
order.firstMoney || '0',
|
||||||
|
order.secondUserId || '',
|
||||||
|
order.secondMoney || '0',
|
||||||
|
order.thirdUserId || '',
|
||||||
|
order.thirdMoney || '0',
|
||||||
|
order.isInvalid === 0 ? '有效' : '失效',
|
||||||
|
order.isSettled === 0 ? '未结算' : '已结算',
|
||||||
|
order.settleTime ? new Date(order.settleTime).toLocaleString() : '',
|
||||||
|
order.createTime || ''
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 创建工作簿
|
||||||
|
const sheetName = `shop_dealer_order_${getTenantId()}`;
|
||||||
|
const workbook = {
|
||||||
|
SheetNames: [sheetName],
|
||||||
|
Sheets: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
const sheet = utils.aoa_to_sheet(array);
|
||||||
|
workbook.Sheets[sheetName] = sheet;
|
||||||
|
|
||||||
|
// 设置列宽
|
||||||
|
sheet['!cols'] = [
|
||||||
|
{wch: 15}, // 订单ID
|
||||||
|
{wch: 12}, // 买家用户ID
|
||||||
|
{wch: 12}, // 订单总金额
|
||||||
|
{wch: 15}, // 一级分销商ID
|
||||||
|
{wch: 12}, // 一级佣金
|
||||||
|
{wch: 15}, // 二级分销商ID
|
||||||
|
{wch: 12}, // 二级佣金
|
||||||
|
{wch: 15}, // 三级分销商ID
|
||||||
|
{wch: 12}, // 三级佣金
|
||||||
|
{wch: 10}, // 订单状态
|
||||||
|
{wch: 10}, // 结算状态
|
||||||
|
{wch: 20}, // 结算时间
|
||||||
|
{wch: 20} // 创建时间
|
||||||
|
];
|
||||||
|
|
||||||
|
message.destroy();
|
||||||
|
message.loading('正在生成Excel文件...', 0);
|
||||||
|
|
||||||
|
// 延迟写入文件,确保消息提示显示
|
||||||
|
setTimeout(() => {
|
||||||
|
writeFile(workbook, `${sheetName}.xlsx`);
|
||||||
|
message.destroy();
|
||||||
|
message.success(`成功导出 ${list.length} 条记录`);
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
} catch (error: any) {
|
||||||
|
message.destroy();
|
||||||
|
message.error(error.message || '导出失败,请重试');
|
||||||
|
}
|
||||||
|
}
|
||||||
53
src/api/sdy/sdyDealerOrder/model/index.ts
Normal file
53
src/api/sdy/sdyDealerOrder/model/index.ts
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分销商订单记录表
|
||||||
|
*/
|
||||||
|
export interface ShopDealerOrder {
|
||||||
|
// 主键ID
|
||||||
|
id?: number;
|
||||||
|
// 买家用户ID
|
||||||
|
userId?: number;
|
||||||
|
// 订单ID
|
||||||
|
orderId?: number;
|
||||||
|
// 订单总金额(不含运费)
|
||||||
|
orderPrice?: string;
|
||||||
|
// 分销商用户id(一级)
|
||||||
|
firstUserId?: number;
|
||||||
|
// 分销商用户id(二级)
|
||||||
|
secondUserId?: number;
|
||||||
|
// 分销商用户id(三级)
|
||||||
|
thirdUserId?: number;
|
||||||
|
// 分销佣金(一级)
|
||||||
|
firstMoney?: string;
|
||||||
|
// 分销佣金(二级)
|
||||||
|
secondMoney?: string;
|
||||||
|
// 分销佣金(三级)
|
||||||
|
thirdMoney?: string;
|
||||||
|
// 订单是否失效(0未失效 1已失效)
|
||||||
|
isInvalid?: number;
|
||||||
|
// 佣金结算(0未结算 1已结算)
|
||||||
|
isSettled?: number;
|
||||||
|
// 结算时间
|
||||||
|
settleTime?: number;
|
||||||
|
// 商城ID
|
||||||
|
tenantId?: number;
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string;
|
||||||
|
// 修改时间
|
||||||
|
updateTime?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分销商订单记录表搜索条件
|
||||||
|
*/
|
||||||
|
export interface ShopDealerOrderParam extends PageParam {
|
||||||
|
id?: number;
|
||||||
|
orderId?: number;
|
||||||
|
orderNo?: string;
|
||||||
|
productName?: string;
|
||||||
|
userId?: number;
|
||||||
|
isInvalid?: number;
|
||||||
|
isSettled?: number;
|
||||||
|
keywords?: string;
|
||||||
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
import type { ApiResult, PageResult } from '@/api';
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
import type { ShopDealerOrder, ShopDealerOrderParam } from './model';
|
import type { ShopDealerOrder, ShopDealerOrderParam } from './model';
|
||||||
|
import { utils, writeFile } from 'xlsx';
|
||||||
|
import { message } from 'ant-design-vue';
|
||||||
|
import { getTenantId } from '@/utils/domain';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询分销商订单记录表
|
* 分页查询分销商订单记录表
|
||||||
@@ -103,3 +106,116 @@ export async function getShopDealerOrder(id: number) {
|
|||||||
}
|
}
|
||||||
return Promise.reject(new Error(res.data.message));
|
return Promise.reject(new Error(res.data.message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入分销商订单
|
||||||
|
*/
|
||||||
|
export async function importShopDealerOrder(file: File) {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append('file', file);
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
'/shop/shop-dealer-order/import',
|
||||||
|
formData
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出分销商订单
|
||||||
|
*/
|
||||||
|
export async function exportShopDealerOrder(params?: ShopDealerOrderParam) {
|
||||||
|
// 显示导出加载提示
|
||||||
|
message.loading('正在准备导出数据...', 0);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 获取数据
|
||||||
|
const list = await listShopDealerOrder(params);
|
||||||
|
|
||||||
|
if (!list || list.length === 0) {
|
||||||
|
message.destroy();
|
||||||
|
message.warning('没有数据可以导出');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建导出数据
|
||||||
|
const array: (string | number)[][] = [
|
||||||
|
[
|
||||||
|
'订单ID',
|
||||||
|
'买家用户ID',
|
||||||
|
'订单总金额',
|
||||||
|
'一级分销商ID',
|
||||||
|
'一级佣金',
|
||||||
|
'二级分销商ID',
|
||||||
|
'二级佣金',
|
||||||
|
'三级分销商ID',
|
||||||
|
'三级佣金',
|
||||||
|
'订单状态',
|
||||||
|
'结算状态',
|
||||||
|
'结算时间',
|
||||||
|
'创建时间'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
list.forEach((order: ShopDealerOrder) => {
|
||||||
|
array.push([
|
||||||
|
order.orderId || '',
|
||||||
|
order.userId || '',
|
||||||
|
order.orderPrice || '0',
|
||||||
|
order.firstUserId || '',
|
||||||
|
order.firstMoney || '0',
|
||||||
|
order.secondUserId || '',
|
||||||
|
order.secondMoney || '0',
|
||||||
|
order.thirdUserId || '',
|
||||||
|
order.thirdMoney || '0',
|
||||||
|
order.isInvalid === 0 ? '有效' : '失效',
|
||||||
|
order.isSettled === 0 ? '未结算' : '已结算',
|
||||||
|
order.settleTime ? new Date(order.settleTime).toLocaleString() : '',
|
||||||
|
order.createTime || ''
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 创建工作簿
|
||||||
|
const sheetName = `shop_dealer_order_${getTenantId()}`;
|
||||||
|
const workbook = {
|
||||||
|
SheetNames: [sheetName],
|
||||||
|
Sheets: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
const sheet = utils.aoa_to_sheet(array);
|
||||||
|
workbook.Sheets[sheetName] = sheet;
|
||||||
|
|
||||||
|
// 设置列宽
|
||||||
|
sheet['!cols'] = [
|
||||||
|
{ wch: 15 }, // 订单ID
|
||||||
|
{ wch: 12 }, // 买家用户ID
|
||||||
|
{ wch: 12 }, // 订单总金额
|
||||||
|
{ wch: 15 }, // 一级分销商ID
|
||||||
|
{ wch: 12 }, // 一级佣金
|
||||||
|
{ wch: 15 }, // 二级分销商ID
|
||||||
|
{ wch: 12 }, // 二级佣金
|
||||||
|
{ wch: 15 }, // 三级分销商ID
|
||||||
|
{ wch: 12 }, // 三级佣金
|
||||||
|
{ wch: 10 }, // 订单状态
|
||||||
|
{ wch: 10 }, // 结算状态
|
||||||
|
{ wch: 20 }, // 结算时间
|
||||||
|
{ wch: 20 } // 创建时间
|
||||||
|
];
|
||||||
|
|
||||||
|
message.destroy();
|
||||||
|
message.loading('正在生成Excel文件...', 0);
|
||||||
|
|
||||||
|
// 延迟写入文件,确保消息提示显示
|
||||||
|
setTimeout(() => {
|
||||||
|
writeFile(workbook, `${sheetName}.xlsx`);
|
||||||
|
message.destroy();
|
||||||
|
message.success(`成功导出 ${list.length} 条记录`);
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
} catch (error: any) {
|
||||||
|
message.destroy();
|
||||||
|
message.error(error.message || '导出失败,请重试');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ export interface ShopDealerOrder {
|
|||||||
id?: number;
|
id?: number;
|
||||||
// 买家用户ID
|
// 买家用户ID
|
||||||
userId?: number;
|
userId?: number;
|
||||||
|
// 买家用户昵称
|
||||||
|
nickname?: string;
|
||||||
// 订单ID
|
// 订单ID
|
||||||
orderId?: number;
|
orderId?: number;
|
||||||
// 订单总金额(不含运费)
|
// 订单总金额(不含运费)
|
||||||
@@ -24,12 +26,24 @@ export interface ShopDealerOrder {
|
|||||||
secondMoney?: string;
|
secondMoney?: string;
|
||||||
// 分销佣金(三级)
|
// 分销佣金(三级)
|
||||||
thirdMoney?: string;
|
thirdMoney?: string;
|
||||||
|
// 一级分销商昵称
|
||||||
|
firstNickname?: string;
|
||||||
|
// 二级分销商昵称
|
||||||
|
secondNickname?: string;
|
||||||
|
// 三级分销商昵称
|
||||||
|
thirdNickname?: string;
|
||||||
|
// 分销比例
|
||||||
|
rate?: number;
|
||||||
|
// 商品单价
|
||||||
|
price?: string;
|
||||||
// 订单是否失效(0未失效 1已失效)
|
// 订单是否失效(0未失效 1已失效)
|
||||||
isInvalid?: number;
|
isInvalid?: number;
|
||||||
// 佣金结算(0未结算 1已结算)
|
// 佣金结算(0未结算 1已结算)
|
||||||
isSettled?: number;
|
isSettled?: number;
|
||||||
// 结算时间
|
// 结算时间
|
||||||
settleTime?: number;
|
settleTime?: number;
|
||||||
|
// 订单备注
|
||||||
|
comments?: string;
|
||||||
// 商城ID
|
// 商城ID
|
||||||
tenantId?: number;
|
tenantId?: number;
|
||||||
// 创建时间
|
// 创建时间
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ export interface ShopDealerUser {
|
|||||||
freezeMoney?: string;
|
freezeMoney?: string;
|
||||||
// 累积提现佣金
|
// 累积提现佣金
|
||||||
totalMoney?: string;
|
totalMoney?: string;
|
||||||
|
// 佣金比例
|
||||||
|
rate?: string;
|
||||||
|
// 单价
|
||||||
|
price?: string;
|
||||||
// 推荐人用户ID
|
// 推荐人用户ID
|
||||||
refereeId?: number;
|
refereeId?: number;
|
||||||
// 成员数量(一级)
|
// 成员数量(一级)
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ import {
|
|||||||
FullscreenExitOutlined
|
FullscreenExitOutlined
|
||||||
} from '@ant-design/icons-vue';
|
} from '@ant-design/icons-vue';
|
||||||
import {storeToRefs} from 'pinia';
|
import {storeToRefs} from 'pinia';
|
||||||
import {copyText, openUrl} from '@/utils/common';
|
import {copyText, openNew, openUrl} from '@/utils/common';
|
||||||
import {useThemeStore} from '@/store/modules/theme';
|
import {useThemeStore} from '@/store/modules/theme';
|
||||||
import HeaderNotice from './header-notice.vue';
|
import HeaderNotice from './header-notice.vue';
|
||||||
import PasswordModal from './password-modal.vue';
|
import PasswordModal from './password-modal.vue';
|
||||||
|
|||||||
@@ -131,7 +131,6 @@ const { form, resetFields, assignFields } = useFormData<CmsLink>({
|
|||||||
name: '',
|
name: '',
|
||||||
url: '',
|
url: '',
|
||||||
sortNumber: 100,
|
sortNumber: 100,
|
||||||
lang: getLang(),
|
|
||||||
categoryId: undefined,
|
categoryId: undefined,
|
||||||
comments: undefined
|
comments: undefined
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -139,11 +139,11 @@ const datasource: DatasourceFunction = ({
|
|||||||
// 表格列配置
|
// 表格列配置
|
||||||
const columns = ref<ColumnItem[]>([
|
const columns = ref<ColumnItem[]>([
|
||||||
{
|
{
|
||||||
title: 'ID',
|
title: '用户ID',
|
||||||
dataIndex: 'applyId',
|
dataIndex: 'userId',
|
||||||
key: 'applyId',
|
key: 'userId',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 80,
|
width: 90,
|
||||||
fixed: 'left'
|
fixed: 'left'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -425,7 +425,7 @@ const customRow = (record: ShopDealerApply) => {
|
|||||||
},
|
},
|
||||||
// 行双击事件
|
// 行双击事件
|
||||||
onDblclick: () => {
|
onDblclick: () => {
|
||||||
// openEdit(record);
|
openEdit(record);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -438,67 +438,3 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
.sys-org-table {
|
|
||||||
:deep(.ant-table-thead > tr > th) {
|
|
||||||
background-color: #fafafa;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-table-tbody > tr:hover > td) {
|
|
||||||
background-color: #f8f9fa;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-item {
|
|
||||||
p {
|
|
||||||
margin: 4px 0;
|
|
||||||
color: #666;
|
|
||||||
}
|
|
||||||
|
|
||||||
strong {
|
|
||||||
color: #1890ff;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ele-text-primary {
|
|
||||||
color: #1890ff;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: #40a9ff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ele-text-info {
|
|
||||||
color: #13c2c2;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: #36cfc9;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ele-text-success {
|
|
||||||
color: #52c41a;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: #73d13d;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ele-text-warning {
|
|
||||||
color: #faad14;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: #ffc53d;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ele-text-danger {
|
|
||||||
color: #ff4d4f;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: #ff7875;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
79
src/views/sdy/shopDealerOrder/components/Import.vue
Normal file
79
src/views/sdy/shopDealerOrder/components/Import.vue
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
<!-- 经销商订单导入弹窗 -->
|
||||||
|
<template>
|
||||||
|
<ele-modal
|
||||||
|
:width="520"
|
||||||
|
:footer="null"
|
||||||
|
title="导入分销订单"
|
||||||
|
:visible="visible"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
>
|
||||||
|
<a-spin :spinning="loading">
|
||||||
|
<a-upload-dragger
|
||||||
|
accept=".xls,.xlsx"
|
||||||
|
:show-upload-list="false"
|
||||||
|
:customRequest="doUpload"
|
||||||
|
style="padding: 24px 0; margin-bottom: 16px"
|
||||||
|
>
|
||||||
|
<p class="ant-upload-drag-icon">
|
||||||
|
<cloud-upload-outlined/>
|
||||||
|
</p>
|
||||||
|
<p class="ant-upload-hint">将文件拖到此处,或点击上传</p>
|
||||||
|
</a-upload-dragger>
|
||||||
|
</a-spin>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import {ref} from 'vue';
|
||||||
|
import {message} from 'ant-design-vue/es';
|
||||||
|
import {CloudUploadOutlined} from '@ant-design/icons-vue';
|
||||||
|
import {importSdyDealerOrder} from "@/api/sdy/sdyDealerOrder";
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
// 是否打开弹窗
|
||||||
|
visible: boolean;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 导入请求状态
|
||||||
|
const loading = ref(false);
|
||||||
|
|
||||||
|
/* 上传 */
|
||||||
|
const doUpload = ({file}) => {
|
||||||
|
if (
|
||||||
|
![
|
||||||
|
'application/vnd.ms-excel',
|
||||||
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||||
|
].includes(file.type)
|
||||||
|
) {
|
||||||
|
message.error('只能选择 excel 文件');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (file.size / 1024 / 1024 > 10) {
|
||||||
|
message.error('大小不能超过 10MB');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
loading.value = true;
|
||||||
|
importSdyDealerOrder(file)
|
||||||
|
.then((msg) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.success(msg);
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 更新 visible */
|
||||||
|
const updateVisible = (value: boolean) => {
|
||||||
|
emit('update:visible', value);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
<!-- 搜索表单 -->
|
|
||||||
<template>
|
<template>
|
||||||
<div class="search-container">
|
<div class="flex items-center gap-20">
|
||||||
<!-- 搜索表单 -->
|
<!-- 搜索表单 -->
|
||||||
<a-form
|
<a-form
|
||||||
:model="searchForm"
|
:model="searchForm"
|
||||||
@@ -8,23 +7,6 @@
|
|||||||
class="search-form"
|
class="search-form"
|
||||||
@finish="handleSearch"
|
@finish="handleSearch"
|
||||||
>
|
>
|
||||||
<a-form-item label="订单编号">
|
|
||||||
<a-input
|
|
||||||
v-model:value="searchForm.orderId"
|
|
||||||
placeholder="请输入订单编号"
|
|
||||||
allow-clear
|
|
||||||
style="width: 160px"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item label="商品名称">
|
|
||||||
<a-input
|
|
||||||
v-model:value="searchForm.productName"
|
|
||||||
placeholder="请输入商品名称"
|
|
||||||
allow-clear
|
|
||||||
style="width: 160px"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item label="订单状态">
|
<a-form-item label="订单状态">
|
||||||
<a-select
|
<a-select
|
||||||
@@ -54,7 +36,7 @@
|
|||||||
<a-space>
|
<a-space>
|
||||||
<a-button type="primary" html-type="submit" class="ele-btn-icon">
|
<a-button type="primary" html-type="submit" class="ele-btn-icon">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<SearchOutlined />
|
<SearchOutlined/>
|
||||||
</template>
|
</template>
|
||||||
搜索
|
搜索
|
||||||
</a-button>
|
</a-button>
|
||||||
@@ -64,89 +46,110 @@
|
|||||||
</a-space>
|
</a-space>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
|
<a-divider type="vertical"/>
|
||||||
<!-- 操作按钮 -->
|
<a-space>
|
||||||
<div class="action-buttons">
|
<!-- <a-button @click="exportData" class="ele-btn-icon">-->
|
||||||
<a-space>
|
<!-- <template #icon>-->
|
||||||
<a-button
|
<!-- <ExportOutlined />-->
|
||||||
type="primary"
|
<!-- </template>-->
|
||||||
:disabled="!selection?.length"
|
<!-- 导出数据-->
|
||||||
@click="batchSettle"
|
<!-- </a-button>-->
|
||||||
class="ele-btn-icon"
|
<a-button @click="openImport" class="ele-btn-icon">
|
||||||
>
|
<template #icon>
|
||||||
<template #icon>
|
<UploadOutlined/>
|
||||||
<DollarOutlined />
|
</template>
|
||||||
</template>
|
导入数据
|
||||||
批量结算
|
</a-button>
|
||||||
</a-button>
|
<a-button
|
||||||
</a-space>
|
type="primary"
|
||||||
</div>
|
@click="batchSettle"
|
||||||
|
class="ele-btn-icon"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<DollarOutlined/>
|
||||||
|
</template>
|
||||||
|
批量结算
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 导入弹窗 -->
|
||||||
|
<Import v-model:visible="showImport" @done="emit('importDone')"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive } from 'vue';
|
import {reactive, ref} from 'vue';
|
||||||
import {
|
import {
|
||||||
SearchOutlined,
|
SearchOutlined,
|
||||||
DollarOutlined,
|
DollarOutlined,
|
||||||
ExportOutlined
|
UploadOutlined
|
||||||
} from '@ant-design/icons-vue';
|
} from '@ant-design/icons-vue';
|
||||||
import type { ShopDealerOrderParam } from '@/api/shop/shopDealerOrder/model';
|
import type {ShopDealerOrderParam} from '@/api/shop/shopDealerOrder/model';
|
||||||
|
import Import from './Import.vue';
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
// 选中的数据
|
// 选中的数据
|
||||||
selection?: any[];
|
selection?: any[];
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
selection: () => []
|
selection: () => []
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'search', where?: ShopDealerOrderParam): void;
|
||||||
|
(e: 'batchSettle'): void;
|
||||||
|
(e: 'export'): void;
|
||||||
|
(e: 'importDone'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 是否显示导入弹窗
|
||||||
|
const showImport = ref(false);
|
||||||
|
|
||||||
|
// 搜索表单
|
||||||
|
const searchForm = reactive<ShopDealerOrderParam>({
|
||||||
|
orderId: undefined,
|
||||||
|
orderNo: '',
|
||||||
|
productName: '',
|
||||||
|
isInvalid: undefined,
|
||||||
|
isSettled: undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
const handleSearch = () => {
|
||||||
|
const searchParams = {...searchForm};
|
||||||
|
// 清除空值
|
||||||
|
Object.keys(searchParams).forEach(key => {
|
||||||
|
if (searchParams[key] === '' || searchParams[key] === undefined) {
|
||||||
|
delete searchParams[key];
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'search', where?: ShopDealerOrderParam): void;
|
|
||||||
(e: 'batchSettle'): void;
|
|
||||||
(e: 'export'): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 搜索表单
|
|
||||||
const searchForm = reactive<ShopDealerOrderParam>({
|
|
||||||
orderId: undefined,
|
|
||||||
orderNo: '',
|
|
||||||
productName: '',
|
|
||||||
isInvalid: undefined,
|
|
||||||
isSettled: undefined
|
|
||||||
});
|
});
|
||||||
|
emit('search', searchParams);
|
||||||
|
};
|
||||||
|
|
||||||
// 搜索
|
// 重置搜索
|
||||||
const handleSearch = () => {
|
const resetSearch = () => {
|
||||||
const searchParams = { ...searchForm };
|
Object.keys(searchForm).forEach(key => {
|
||||||
// 清除空值
|
searchForm[key] = key === 'orderId' ? undefined : '';
|
||||||
Object.keys(searchParams).forEach(key => {
|
});
|
||||||
if (searchParams[key] === '' || searchParams[key] === undefined) {
|
emit('search', {});
|
||||||
delete searchParams[key];
|
};
|
||||||
}
|
|
||||||
});
|
|
||||||
emit('search', searchParams);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 重置搜索
|
// 批量结算
|
||||||
const resetSearch = () => {
|
const batchSettle = () => {
|
||||||
Object.keys(searchForm).forEach(key => {
|
emit('batchSettle');
|
||||||
searchForm[key] = key === 'orderId' ? undefined : '';
|
};
|
||||||
});
|
|
||||||
emit('search', {});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 批量结算
|
// 导出数据
|
||||||
const batchSettle = () => {
|
const exportData = () => {
|
||||||
emit('batchSettle');
|
emit('export');
|
||||||
};
|
};
|
||||||
|
|
||||||
// 导出数据
|
// 打开导入弹窗
|
||||||
const exportData = () => {
|
const openImport = () => {
|
||||||
emit('export');
|
showImport.value = true;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|||||||
@@ -5,9 +5,10 @@
|
|||||||
:visible="visible"
|
:visible="visible"
|
||||||
:maskClosable="false"
|
:maskClosable="false"
|
||||||
:maxable="maxable"
|
:maxable="maxable"
|
||||||
:title="isUpdate ? '编辑分销订单记录' : '添加分销订单记录'"
|
:title="isUpdate ? '分销订单' : '分销订单'"
|
||||||
:body-style="{ paddingBottom: '28px' }"
|
:body-style="{ paddingBottom: '28px' }"
|
||||||
@update:visible="updateVisible"
|
@update:visible="updateVisible"
|
||||||
|
:okText="`立即结算`"
|
||||||
@ok="save"
|
@ok="save"
|
||||||
>
|
>
|
||||||
<a-form
|
<a-form
|
||||||
@@ -19,53 +20,51 @@
|
|||||||
>
|
>
|
||||||
<!-- 订单基本信息 -->
|
<!-- 订单基本信息 -->
|
||||||
<a-divider orientation="left">
|
<a-divider orientation="left">
|
||||||
<span style="color: #1890ff; font-weight: 600;">订单基本信息</span>
|
<span style="color: #1890ff; font-weight: 600;">基本信息</span>
|
||||||
</a-divider>
|
</a-divider>
|
||||||
|
|
||||||
<a-row :gutter="16">
|
<a-row :gutter="16">
|
||||||
|
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-item label="买家用户ID" name="userId">
|
<a-form-item label="用户ID" name="userId">
|
||||||
<a-input-number
|
{{ form.userId }}
|
||||||
:min="1"
|
|
||||||
placeholder="请输入买家用户ID"
|
|
||||||
v-model:value="form.userId"
|
|
||||||
style="width: 100%"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-item label="订单ID" name="orderId">
|
<a-form-item label="客户名称" name="comments">
|
||||||
<a-input-number
|
{{ form.comments }}
|
||||||
:min="1"
|
</a-form-item>
|
||||||
placeholder="请输入订单ID"
|
</a-col>
|
||||||
v-model:value="form.orderId"
|
|
||||||
style="width: 100%"
|
<a-col :span="12">
|
||||||
/>
|
<a-form-item label="费率" name="rate">
|
||||||
|
{{ form.rate }}
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="结算电量" name="orderPrice">
|
||||||
|
{{ parseFloat(form.orderPrice || 0).toFixed(2) }}
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="实发金额" name="payPrice">
|
||||||
|
{{ (form.orderPrice * form.rate * 1000).toFixed(2) }}
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|
||||||
<a-form-item label="订单总金额" name="orderPrice">
|
|
||||||
<a-input-number
|
|
||||||
:min="0"
|
|
||||||
:precision="2"
|
|
||||||
placeholder="请输入订单总金额(不含运费)"
|
|
||||||
v-model:value="form.orderPrice"
|
|
||||||
style="width: 300px"
|
|
||||||
>
|
|
||||||
<template #addonAfter>元</template>
|
|
||||||
</a-input-number>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<!-- 分销商信息 -->
|
<!-- 分销商信息 -->
|
||||||
<a-divider orientation="left">
|
<a-divider orientation="left">
|
||||||
<span style="color: #1890ff; font-weight: 600;">分销商信息</span>
|
<span style="color: #1890ff; font-weight: 600;">推荐收益</span>
|
||||||
</a-divider>
|
</a-divider>
|
||||||
|
|
||||||
<!-- 一级分销商 -->
|
<!-- 一级分销商 -->
|
||||||
<div class="dealer-section">
|
<div class="dealer-section">
|
||||||
<h4 class="dealer-title">
|
<h4 class="dealer-title">
|
||||||
<a-tag color="red">一级分销商</a-tag>
|
<a-tag color="red">推荐收益</a-tag>
|
||||||
</h4>
|
</h4>
|
||||||
<a-row :gutter="16">
|
<a-row :gutter="16">
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
@@ -97,7 +96,7 @@
|
|||||||
<!-- 二级分销商 -->
|
<!-- 二级分销商 -->
|
||||||
<div class="dealer-section">
|
<div class="dealer-section">
|
||||||
<h4 class="dealer-title">
|
<h4 class="dealer-title">
|
||||||
<a-tag color="orange">二级分销商</a-tag>
|
<a-tag color="orange">简推收益</a-tag>
|
||||||
</h4>
|
</h4>
|
||||||
<a-row :gutter="16">
|
<a-row :gutter="16">
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
@@ -126,62 +125,6 @@
|
|||||||
</a-row>
|
</a-row>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 三级分销商 -->
|
|
||||||
<div class="dealer-section">
|
|
||||||
<h4 class="dealer-title">
|
|
||||||
<a-tag color="gold">三级分销商</a-tag>
|
|
||||||
</h4>
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="用户ID" name="thirdUserId">
|
|
||||||
<a-input-number
|
|
||||||
:min="1"
|
|
||||||
placeholder="请输入三级分销商用户ID"
|
|
||||||
v-model:value="form.thirdUserId"
|
|
||||||
style="width: 100%"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="分销佣金" name="thirdMoney">
|
|
||||||
<a-input-number
|
|
||||||
:min="0"
|
|
||||||
:precision="2"
|
|
||||||
placeholder="请输入三级分销佣金"
|
|
||||||
v-model:value="form.thirdMoney"
|
|
||||||
style="width: 100%"
|
|
||||||
>
|
|
||||||
<template #addonAfter>元</template>
|
|
||||||
</a-input-number>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 状态信息 -->
|
|
||||||
<a-divider orientation="left">
|
|
||||||
<span style="color: #1890ff; font-weight: 600;">状态信息</span>
|
|
||||||
</a-divider>
|
|
||||||
|
|
||||||
<a-row :gutter="16">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="订单状态" name="isInvalid">
|
|
||||||
<a-radio-group v-model:value="form.isInvalid">
|
|
||||||
<a-radio :value="0">有效</a-radio>
|
|
||||||
<a-radio :value="1">失效</a-radio>
|
|
||||||
</a-radio-group>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="结算状态" name="isSettled">
|
|
||||||
<a-radio-group v-model:value="form.isSettled">
|
|
||||||
<a-radio :value="0">未结算</a-radio>
|
|
||||||
<a-radio :value="1">已结算</a-radio>
|
|
||||||
</a-radio-group>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
|
|
||||||
<a-form-item label="结算时间" name="settleTime" v-if="form.isSettled === 1">
|
<a-form-item label="结算时间" name="settleTime" v-if="form.isSettled === 1">
|
||||||
<a-date-picker
|
<a-date-picker
|
||||||
v-model:value="form.settleTime"
|
v-model:value="form.settleTime"
|
||||||
@@ -238,6 +181,7 @@
|
|||||||
const form = reactive<ShopDealerOrder>({
|
const form = reactive<ShopDealerOrder>({
|
||||||
id: undefined,
|
id: undefined,
|
||||||
userId: undefined,
|
userId: undefined,
|
||||||
|
nickname: undefined,
|
||||||
orderId: undefined,
|
orderId: undefined,
|
||||||
orderPrice: undefined,
|
orderPrice: undefined,
|
||||||
firstUserId: undefined,
|
firstUserId: undefined,
|
||||||
@@ -246,6 +190,11 @@
|
|||||||
firstMoney: undefined,
|
firstMoney: undefined,
|
||||||
secondMoney: undefined,
|
secondMoney: undefined,
|
||||||
thirdMoney: undefined,
|
thirdMoney: undefined,
|
||||||
|
firstNickname: undefined,
|
||||||
|
secondNickname: undefined,
|
||||||
|
thirdNickname: undefined,
|
||||||
|
rate: undefined,
|
||||||
|
comments: undefined,
|
||||||
isInvalid: 0,
|
isInvalid: 0,
|
||||||
isSettled: 0,
|
isSettled: 0,
|
||||||
settleTime: undefined,
|
settleTime: undefined,
|
||||||
@@ -261,13 +210,6 @@
|
|||||||
|
|
||||||
// 表单验证规则
|
// 表单验证规则
|
||||||
const rules = reactive({
|
const rules = reactive({
|
||||||
userId: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入买家用户ID',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
orderId: [
|
orderId: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
@@ -275,13 +217,6 @@
|
|||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
orderPrice: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入订单总金额',
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
firstUserId: [
|
firstUserId: [
|
||||||
{
|
{
|
||||||
validator: (rule: any, value: any) => {
|
validator: (rule: any, value: any) => {
|
||||||
@@ -359,6 +294,10 @@
|
|||||||
if (!formRef.value) {
|
if (!formRef.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(form.userId == 0){
|
||||||
|
message.error('未签约');
|
||||||
|
return;
|
||||||
|
}
|
||||||
formRef.value
|
formRef.value
|
||||||
.validate()
|
.validate()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
<ele-pro-table
|
<ele-pro-table
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
row-key="shopDealerOrderId"
|
row-key="id"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:datasource="datasource"
|
:datasource="datasource"
|
||||||
:customRow="customRow"
|
:customRow="customRow"
|
||||||
@@ -15,7 +15,8 @@
|
|||||||
@search="reload"
|
@search="reload"
|
||||||
:selection="selection"
|
:selection="selection"
|
||||||
@batchSettle="batchSettle"
|
@batchSettle="batchSettle"
|
||||||
@export="exportData"
|
@export="handleExport"
|
||||||
|
@importDone="reload"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
@@ -26,6 +27,26 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template v-if="column.key === 'orderPrice'">
|
||||||
|
{{ parseFloat(record.orderPrice).toFixed(2) }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="column.key === 'orderPrice1000'">
|
||||||
|
{{ (record.orderPrice * 1000).toFixed(2) }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="column.key === 'price'">
|
||||||
|
{{ (record.price || 0).toFixed(2) }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="column.key === 'settledPrice'">
|
||||||
|
{{ (record.orderPrice * record.rate * 1000).toFixed(2) }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="column.key === 'payPrice'">
|
||||||
|
{{ (record.orderPrice * record.rate).toFixed(2) }}
|
||||||
|
</template>
|
||||||
|
|
||||||
<template v-if="column.key === 'dealerInfo'">
|
<template v-if="column.key === 'dealerInfo'">
|
||||||
<div class="dealer-info">
|
<div class="dealer-info">
|
||||||
<div v-if="record.firstUserId" class="dealer-level">
|
<div v-if="record.firstUserId" class="dealer-level">
|
||||||
@@ -44,40 +65,53 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="column.key === 'isInvalid'">
|
<template v-if="column.key === 'isInvalid'">
|
||||||
<a-tag v-if="record.isInvalid === 0" color="success">有效</a-tag>
|
<a-tag v-if="record.isInvalid === 0" color="success">已签约</a-tag>
|
||||||
<a-tag v-if="record.isInvalid === 1" color="error">失效</a-tag>
|
<a-tag v-if="record.isInvalid === 1" color="error" @click="invalidateOrder(record)">未签约</a-tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="column.key === 'isSettled'">
|
<template v-if="column.key === 'isSettled'">
|
||||||
<a-tag v-if="record.isSettled === 0" color="processing">未结算</a-tag>
|
<a-tag v-if="record.isSettled === 0" color="orange">未结算</a-tag>
|
||||||
<a-tag v-if="record.isSettled === 1" color="success">已结算</a-tag>
|
<a-tag v-if="record.isSettled === 1" color="success">已结算</a-tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template v-if="column.key === 'createTime'">
|
||||||
|
<div class="flex flex-col">
|
||||||
|
<a-tooltip title="创建时间">
|
||||||
|
<span class="text-gray-500">{{ record.createTime }}</span>
|
||||||
|
</a-tooltip>
|
||||||
|
<a-tooltip title="结算时间">
|
||||||
|
<span class="text-purple-500">{{ record.settleTime }}</span>
|
||||||
|
</a-tooltip>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template v-if="column.key === 'action'">
|
<template v-if="column.key === 'action'">
|
||||||
<a @click="viewDetail(record)" class="ele-text-info">
|
|
||||||
<EyeOutlined/>
|
|
||||||
详情
|
|
||||||
</a>
|
|
||||||
<template v-if="record.isSettled === 0 && record.isInvalid === 0">
|
<template v-if="record.isSettled === 0 && record.isInvalid === 0">
|
||||||
<a-divider type="vertical"/>
|
|
||||||
<a @click="settleOrder(record)" class="ele-text-success">
|
<a @click="settleOrder(record)" class="ele-text-success">
|
||||||
<DollarOutlined/>
|
|
||||||
结算
|
结算
|
||||||
</a>
|
</a>
|
||||||
</template>
|
|
||||||
<template v-if="record.isInvalid === 0">
|
|
||||||
<a-divider type="vertical"/>
|
<a-divider type="vertical"/>
|
||||||
<a-popconfirm
|
|
||||||
title="确定要标记此订单为失效吗?"
|
|
||||||
@confirm="invalidateOrder(record)"
|
|
||||||
placement="topRight"
|
|
||||||
>
|
|
||||||
<a class="ele-text-warning">
|
|
||||||
<CloseOutlined/>
|
|
||||||
失效
|
|
||||||
</a>
|
|
||||||
</a-popconfirm>
|
|
||||||
</template>
|
</template>
|
||||||
|
<!-- <template v-if="record.isInvalid === 0">-->
|
||||||
|
<!-- <a-popconfirm-->
|
||||||
|
<!-- title="确定要标记此订单为失效吗?"-->
|
||||||
|
<!-- @confirm="invalidateOrder(record)"-->
|
||||||
|
<!-- placement="topRight"-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- <a class="text-purple-500">-->
|
||||||
|
<!-- 验证-->
|
||||||
|
<!-- </a>-->
|
||||||
|
<!-- </a-popconfirm>-->
|
||||||
|
<!-- </template>-->
|
||||||
|
<a-popconfirm
|
||||||
|
title="确定要删除吗?"
|
||||||
|
@confirm="remove(record)"
|
||||||
|
placement="topRight"
|
||||||
|
>
|
||||||
|
<a class="text-red-500">
|
||||||
|
删除
|
||||||
|
</a>
|
||||||
|
</a-popconfirm>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</ele-pro-table>
|
</ele-pro-table>
|
||||||
@@ -93,12 +127,9 @@ import {createVNode, ref} from 'vue';
|
|||||||
import {message, Modal} from 'ant-design-vue';
|
import {message, Modal} from 'ant-design-vue';
|
||||||
import {
|
import {
|
||||||
ExclamationCircleOutlined,
|
ExclamationCircleOutlined,
|
||||||
EyeOutlined,
|
|
||||||
DollarOutlined,
|
DollarOutlined,
|
||||||
CloseOutlined
|
|
||||||
} from '@ant-design/icons-vue';
|
} from '@ant-design/icons-vue';
|
||||||
import type {EleProTable} from 'ele-admin-pro';
|
import type {EleProTable} from 'ele-admin-pro';
|
||||||
import {toDateString} from 'ele-admin-pro';
|
|
||||||
import type {
|
import type {
|
||||||
DatasourceFunction,
|
DatasourceFunction,
|
||||||
ColumnItem
|
ColumnItem
|
||||||
@@ -108,6 +139,7 @@ import {getPageTitle} from '@/utils/common';
|
|||||||
import ShopDealerOrderEdit from './components/shopDealerOrderEdit.vue';
|
import ShopDealerOrderEdit from './components/shopDealerOrderEdit.vue';
|
||||||
import {pageShopDealerOrder, removeShopDealerOrder, removeBatchShopDealerOrder} from '@/api/shop/shopDealerOrder';
|
import {pageShopDealerOrder, removeShopDealerOrder, removeBatchShopDealerOrder} from '@/api/shop/shopDealerOrder';
|
||||||
import type {ShopDealerOrder, ShopDealerOrderParam} from '@/api/shop/shopDealerOrder/model';
|
import type {ShopDealerOrder, ShopDealerOrderParam} from '@/api/shop/shopDealerOrder/model';
|
||||||
|
import {exportSdyDealerOrder} from "@/api/sdy/sdyDealerOrder";
|
||||||
|
|
||||||
// 表格实例
|
// 表格实例
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
@@ -118,11 +150,12 @@ const selection = ref<ShopDealerOrder[]>([]);
|
|||||||
const current = ref<ShopDealerOrder | null>(null);
|
const current = ref<ShopDealerOrder | null>(null);
|
||||||
// 是否显示编辑弹窗
|
// 是否显示编辑弹窗
|
||||||
const showEdit = ref(false);
|
const showEdit = ref(false);
|
||||||
// 是否显示批量移动弹窗
|
|
||||||
const showMove = ref(false);
|
|
||||||
// 加载状态
|
// 加载状态
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
|
|
||||||
|
// 当前搜索条件
|
||||||
|
const currentWhere = ref<ShopDealerOrderParam>({});
|
||||||
|
|
||||||
// 表格数据源
|
// 表格数据源
|
||||||
const datasource: DatasourceFunction = ({
|
const datasource: DatasourceFunction = ({
|
||||||
page,
|
page,
|
||||||
@@ -134,6 +167,8 @@ const datasource: DatasourceFunction = ({
|
|||||||
if (filters) {
|
if (filters) {
|
||||||
where.status = filters.status;
|
where.status = filters.status;
|
||||||
}
|
}
|
||||||
|
// 保存当前搜索条件用于导出
|
||||||
|
currentWhere.value = {...where};
|
||||||
return pageShopDealerOrder({
|
return pageShopDealerOrder({
|
||||||
...where,
|
...where,
|
||||||
...orders,
|
...orders,
|
||||||
@@ -145,86 +180,76 @@ const datasource: DatasourceFunction = ({
|
|||||||
// 表格列配置
|
// 表格列配置
|
||||||
const columns = ref<ColumnItem[]>([
|
const columns = ref<ColumnItem[]>([
|
||||||
{
|
{
|
||||||
title: '商品信息',
|
title: '用户ID',
|
||||||
key: 'productInfo',
|
|
||||||
align: 'left',
|
|
||||||
width: 200,
|
|
||||||
customRender: ({record}) => {
|
|
||||||
return `商品ID: ${record.productId || '-'}`;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '单价/数量',
|
|
||||||
key: 'priceInfo',
|
|
||||||
align: 'center',
|
|
||||||
width: 120,
|
|
||||||
customRender: ({record}) => {
|
|
||||||
return `¥${parseFloat(record.unitPrice || '0').toFixed(2)} × ${record.quantity || 1}`;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '订单信息',
|
|
||||||
key: 'orderInfo',
|
|
||||||
align: 'left',
|
|
||||||
width: 180
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '买家',
|
|
||||||
dataIndex: 'userId',
|
dataIndex: 'userId',
|
||||||
key: 'userId',
|
key: 'userId',
|
||||||
align: 'center',
|
width: 90,
|
||||||
width: 100,
|
|
||||||
customRender: ({text}) => `用户${text || '-'}`
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '分销商信息',
|
title: '客户名称',
|
||||||
key: 'dealerInfo',
|
dataIndex: 'comments',
|
||||||
align: 'left',
|
key: 'comments'
|
||||||
width: 300
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '订单状态',
|
title: '结算电量',
|
||||||
|
dataIndex: 'orderPrice',
|
||||||
|
key: 'orderPrice',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '换算成度',
|
||||||
|
dataIndex: 'orderPrice1000',
|
||||||
|
key: 'orderPrice1000',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '结算单价',
|
||||||
|
dataIndex: 'price',
|
||||||
|
key: 'price',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '结算金额',
|
||||||
|
dataIndex: 'settledPrice',
|
||||||
|
key: 'settledPrice',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '税费',
|
||||||
|
dataIndex: 'rate',
|
||||||
|
key: 'rate',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '实发金额',
|
||||||
|
dataIndex: 'payPrice',
|
||||||
|
key: 'payPrice',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '签约状态',
|
||||||
dataIndex: 'isInvalid',
|
dataIndex: 'isInvalid',
|
||||||
key: 'isInvalid',
|
key: 'isInvalid',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 100,
|
width: 100
|
||||||
filters: [
|
|
||||||
{text: '有效', value: 0},
|
|
||||||
{text: '失效', value: 1}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '结算状态',
|
title: '结算状态',
|
||||||
dataIndex: 'isSettled',
|
dataIndex: 'isSettled',
|
||||||
key: 'isSettled',
|
key: 'isSettled',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 100,
|
width: 100
|
||||||
filters: [
|
|
||||||
{text: '未结算', value: 0},
|
|
||||||
{text: '已结算', value: 1}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '结算时间',
|
|
||||||
dataIndex: 'settleTime',
|
|
||||||
key: 'settleTime',
|
|
||||||
align: 'center',
|
|
||||||
width: 120,
|
|
||||||
customRender: ({text}) => text ? toDateString(new Date(text), 'yyyy-MM-dd HH:mm') : '-'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '创建时间',
|
title: '创建时间',
|
||||||
dataIndex: 'createTime',
|
dataIndex: 'createTime',
|
||||||
key: 'createTime',
|
key: 'createTime',
|
||||||
align: 'center',
|
align: 'center'
|
||||||
width: 180,
|
|
||||||
sorter: true,
|
|
||||||
customRender: ({text}) => toDateString(text, 'yyyy-MM-dd HH:mm')
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
key: 'action',
|
key: 'action',
|
||||||
width: 240,
|
width: 180,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
hideInSetting: true
|
hideInSetting: true
|
||||||
@@ -237,64 +262,6 @@ const reload = (where?: ShopDealerOrderParam) => {
|
|||||||
tableRef?.value?.reload({where: where});
|
tableRef?.value?.reload({where: where});
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 查看订单详情 */
|
|
||||||
const viewDetail = (row: ShopDealerOrder) => {
|
|
||||||
Modal.info({
|
|
||||||
title: '分销订单详情',
|
|
||||||
width: 800,
|
|
||||||
content: createVNode('div', {style: 'max-height: 500px; overflow-y: auto;'}, [
|
|
||||||
createVNode('div', {class: 'detail-section'}, [
|
|
||||||
createVNode('h4', null, '订单基本信息'),
|
|
||||||
createVNode('p', null, `订单ID: ${row.orderId || '-'}`),
|
|
||||||
createVNode('p', null, `买家用户ID: ${row.userId || '-'}`),
|
|
||||||
createVNode('p', null, `订单金额: ¥${parseFloat(row.orderPrice || '0').toFixed(2)}`),
|
|
||||||
createVNode('p', null, `创建时间: ${row.createTime ? toDateString(row.createTime, 'yyyy-MM-dd HH:mm:ss') : '-'}`),
|
|
||||||
]),
|
|
||||||
createVNode('div', {class: 'detail-section', style: 'margin-top: 16px;'}, [
|
|
||||||
createVNode('h4', null, '分销商信息'),
|
|
||||||
...(row.firstUserId ? [
|
|
||||||
createVNode('div', {style: 'margin: 8px 0; padding: 8px; background: #fff2f0; border-left: 3px solid #ff4d4f;'}, [
|
|
||||||
createVNode('strong', null, '一级分销商'),
|
|
||||||
createVNode('p', null, `用户ID: ${row.firstUserId}`),
|
|
||||||
createVNode('p', null, `佣金: ¥${parseFloat(row.firstMoney || '0').toFixed(2)}`)
|
|
||||||
])
|
|
||||||
] : []),
|
|
||||||
...(row.secondUserId ? [
|
|
||||||
createVNode('div', {style: 'margin: 8px 0; padding: 8px; background: #fff7e6; border-left: 3px solid #fa8c16;'}, [
|
|
||||||
createVNode('strong', null, '二级分销商'),
|
|
||||||
createVNode('p', null, `用户ID: ${row.secondUserId}`),
|
|
||||||
createVNode('p', null, `佣金: ¥${parseFloat(row.secondMoney || '0').toFixed(2)}`)
|
|
||||||
])
|
|
||||||
] : []),
|
|
||||||
...(row.thirdUserId ? [
|
|
||||||
createVNode('div', {style: 'margin: 8px 0; padding: 8px; background: #fffbe6; border-left: 3px solid #fadb14;'}, [
|
|
||||||
createVNode('strong', null, '三级分销商'),
|
|
||||||
createVNode('p', null, `用户ID: ${row.thirdUserId}`),
|
|
||||||
createVNode('p', null, `佣金: ¥${parseFloat(row.thirdMoney || '0').toFixed(2)}`)
|
|
||||||
])
|
|
||||||
] : [])
|
|
||||||
]),
|
|
||||||
createVNode('div', {class: 'detail-section', style: 'margin-top: 16px;'}, [
|
|
||||||
createVNode('h4', null, '状态信息'),
|
|
||||||
createVNode('p', null, [
|
|
||||||
'订单状态: ',
|
|
||||||
createVNode('span', {
|
|
||||||
style: `color: ${row.isInvalid === 0 ? '#52c41a' : '#ff4d4f'}; font-weight: bold;`
|
|
||||||
}, row.isInvalid === 0 ? '有效' : '失效')
|
|
||||||
]),
|
|
||||||
createVNode('p', null, [
|
|
||||||
'结算状态: ',
|
|
||||||
createVNode('span', {
|
|
||||||
style: `color: ${row.isSettled === 1 ? '#52c41a' : '#1890ff'}; font-weight: bold;`
|
|
||||||
}, row.isSettled === 1 ? '已结算' : '未结算')
|
|
||||||
]),
|
|
||||||
createVNode('p', null, `结算时间: ${row.settleTime ? toDateString(new Date(row.settleTime), 'yyyy-MM-dd HH:mm:ss') : '-'}`),
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
okText: '关闭'
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 结算单个订单 */
|
/* 结算单个订单 */
|
||||||
const settleOrder = (row: ShopDealerOrder) => {
|
const settleOrder = (row: ShopDealerOrder) => {
|
||||||
const totalCommission = (parseFloat(row.firstMoney || '0') +
|
const totalCommission = (parseFloat(row.firstMoney || '0') +
|
||||||
@@ -373,13 +340,9 @@ const batchSettle = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* 导出数据 */
|
/* 导出数据 */
|
||||||
const exportData = () => {
|
const handleExport = () => {
|
||||||
const hide = message.loading('正在导出数据...', 0);
|
// 调用导出API,传入当前搜索条件
|
||||||
// 这里调用导出API
|
exportSdyDealerOrder(currentWhere.value);
|
||||||
setTimeout(() => {
|
|
||||||
hide();
|
|
||||||
message.success('数据导出成功');
|
|
||||||
}, 2000);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
/* 打开编辑弹窗 */
|
||||||
|
|||||||
@@ -187,13 +187,11 @@ import {
|
|||||||
QrcodeOutlined,
|
QrcodeOutlined,
|
||||||
ShopOutlined,
|
ShopOutlined,
|
||||||
ClockCircleOutlined,
|
ClockCircleOutlined,
|
||||||
SettingOutlined,
|
|
||||||
AccountBookOutlined,
|
AccountBookOutlined,
|
||||||
FileTextOutlined,
|
FileTextOutlined,
|
||||||
ClearOutlined,
|
ClearOutlined,
|
||||||
UngroupOutlined,
|
UngroupOutlined,
|
||||||
MoneyCollectOutlined,
|
MoneyCollectOutlined
|
||||||
ReloadOutlined
|
|
||||||
} from '@ant-design/icons-vue';
|
} from '@ant-design/icons-vue';
|
||||||
import {message} from 'ant-design-vue/es';
|
import {message} from 'ant-design-vue/es';
|
||||||
import {openNew} from "@/utils/common";
|
import {openNew} from "@/utils/common";
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
<!-- 搜索表单 -->
|
|
||||||
<template>
|
<template>
|
||||||
<div class="search-container">
|
<div class="search-container">
|
||||||
<!-- 搜索表单 -->
|
<!-- 搜索表单 -->
|
||||||
@@ -70,7 +69,6 @@
|
|||||||
<a-space>
|
<a-space>
|
||||||
<a-button
|
<a-button
|
||||||
type="primary"
|
type="primary"
|
||||||
:disabled="!selection?.length"
|
|
||||||
@click="batchSettle"
|
@click="batchSettle"
|
||||||
class="ele-btn-icon"
|
class="ele-btn-icon"
|
||||||
>
|
>
|
||||||
@@ -79,29 +77,36 @@
|
|||||||
</template>
|
</template>
|
||||||
批量结算
|
批量结算
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button
|
<a-button @click="exportData" class="ele-btn-icon">
|
||||||
:disabled="!selection?.length"
|
|
||||||
@click="exportData"
|
|
||||||
class="ele-btn-icon"
|
|
||||||
>
|
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<ExportOutlined />
|
<ExportOutlined />
|
||||||
</template>
|
</template>
|
||||||
导出数据
|
导出数据
|
||||||
</a-button>
|
</a-button>
|
||||||
|
<a-button @click="openImport" class="ele-btn-icon">
|
||||||
|
<template #icon>
|
||||||
|
<UploadOutlined />
|
||||||
|
</template>
|
||||||
|
导入数据
|
||||||
|
</a-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 导入弹窗 -->
|
||||||
|
<Import v-model:visible="showImport" @done="emit('importDone')" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import {
|
import {
|
||||||
SearchOutlined,
|
SearchOutlined,
|
||||||
DollarOutlined,
|
DollarOutlined,
|
||||||
ExportOutlined
|
ExportOutlined,
|
||||||
|
UploadOutlined
|
||||||
} from '@ant-design/icons-vue';
|
} from '@ant-design/icons-vue';
|
||||||
import type { ShopDealerOrderParam } from '@/api/shop/shopDealerOrder/model';
|
import type { ShopDealerOrderParam } from '@/api/shop/shopDealerOrder/model';
|
||||||
|
import Import from './Import.vue';
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
@@ -117,8 +122,12 @@
|
|||||||
(e: 'search', where?: ShopDealerOrderParam): void;
|
(e: 'search', where?: ShopDealerOrderParam): void;
|
||||||
(e: 'batchSettle'): void;
|
(e: 'batchSettle'): void;
|
||||||
(e: 'export'): void;
|
(e: 'export'): void;
|
||||||
|
(e: 'importDone'): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
// 是否显示导入弹窗
|
||||||
|
const showImport = ref(false);
|
||||||
|
|
||||||
// 搜索表单
|
// 搜索表单
|
||||||
const searchForm = reactive<ShopDealerOrderParam>({
|
const searchForm = reactive<ShopDealerOrderParam>({
|
||||||
orderId: undefined,
|
orderId: undefined,
|
||||||
@@ -157,6 +166,11 @@
|
|||||||
const exportData = () => {
|
const exportData = () => {
|
||||||
emit('export');
|
emit('export');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 打开导入弹窗
|
||||||
|
const openImport = () => {
|
||||||
|
showImport.value = true;
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|||||||
@@ -15,7 +15,8 @@
|
|||||||
@search="reload"
|
@search="reload"
|
||||||
:selection="selection"
|
:selection="selection"
|
||||||
@batchSettle="batchSettle"
|
@batchSettle="batchSettle"
|
||||||
@export="exportData"
|
@export="handleExport"
|
||||||
|
@importDone="reload"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
@@ -106,7 +107,7 @@ import type {
|
|||||||
import Search from './components/search.vue';
|
import Search from './components/search.vue';
|
||||||
import {getPageTitle} from '@/utils/common';
|
import {getPageTitle} from '@/utils/common';
|
||||||
import ShopDealerOrderEdit from './components/shopDealerOrderEdit.vue';
|
import ShopDealerOrderEdit from './components/shopDealerOrderEdit.vue';
|
||||||
import {pageShopDealerOrder, removeShopDealerOrder, removeBatchShopDealerOrder} from '@/api/shop/shopDealerOrder';
|
import {pageShopDealerOrder, removeShopDealerOrder, removeBatchShopDealerOrder, exportShopDealerOrder} from '@/api/shop/shopDealerOrder';
|
||||||
import type {ShopDealerOrder, ShopDealerOrderParam} from '@/api/shop/shopDealerOrder/model';
|
import type {ShopDealerOrder, ShopDealerOrderParam} from '@/api/shop/shopDealerOrder/model';
|
||||||
|
|
||||||
// 表格实例
|
// 表格实例
|
||||||
@@ -123,6 +124,9 @@ const showMove = ref(false);
|
|||||||
// 加载状态
|
// 加载状态
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
|
|
||||||
|
// 当前搜索条件
|
||||||
|
const currentWhere = ref<ShopDealerOrderParam>({});
|
||||||
|
|
||||||
// 表格数据源
|
// 表格数据源
|
||||||
const datasource: DatasourceFunction = ({
|
const datasource: DatasourceFunction = ({
|
||||||
page,
|
page,
|
||||||
@@ -134,6 +138,8 @@ const datasource: DatasourceFunction = ({
|
|||||||
if (filters) {
|
if (filters) {
|
||||||
where.status = filters.status;
|
where.status = filters.status;
|
||||||
}
|
}
|
||||||
|
// 保存当前搜索条件用于导出
|
||||||
|
currentWhere.value = { ...where };
|
||||||
return pageShopDealerOrder({
|
return pageShopDealerOrder({
|
||||||
...where,
|
...where,
|
||||||
...orders,
|
...orders,
|
||||||
@@ -373,13 +379,9 @@ const batchSettle = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* 导出数据 */
|
/* 导出数据 */
|
||||||
const exportData = () => {
|
const handleExport = () => {
|
||||||
const hide = message.loading('正在导出数据...', 0);
|
// 调用导出API,传入当前搜索条件
|
||||||
// 这里调用导出API
|
exportShopDealerOrder(currentWhere.value);
|
||||||
setTimeout(() => {
|
|
||||||
hide();
|
|
||||||
message.success('数据导出成功');
|
|
||||||
}, 2000);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
/* 打开编辑弹窗 */
|
||||||
@@ -503,4 +505,4 @@ export default {
|
|||||||
:deep(.ant-tag) {
|
:deep(.ant-tag) {
|
||||||
margin: 2px 4px 2px 0;
|
margin: 2px 4px 2px 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
# 分销商用户管理模块
|
|
||||||
|
|
||||||
## 功能说明
|
|
||||||
|
|
||||||
本模块提供了完整的分销商用户管理功能,包括:
|
|
||||||
|
|
||||||
### 基础功能
|
|
||||||
- ✅ 用户列表查看
|
|
||||||
- ✅ 用户信息编辑
|
|
||||||
- ✅ 用户详情查看
|
|
||||||
- ✅ 用户删除(单个/批量)
|
|
||||||
- ✅ 关键词搜索
|
|
||||||
|
|
||||||
### 导入导出功能
|
|
||||||
- ✅ Excel 数据导出
|
|
||||||
- ✅ Excel 数据导入
|
|
||||||
- ✅ 导入数据验证
|
|
||||||
- ✅ 错误处理
|
|
||||||
|
|
||||||
## 导入导出使用说明
|
|
||||||
|
|
||||||
### 导出功能
|
|
||||||
1. 点击"导出xls"按钮
|
|
||||||
2. 系统会根据当前搜索条件导出数据
|
|
||||||
3. 导出的Excel文件包含以下字段:
|
|
||||||
- 用户ID
|
|
||||||
- 姓名
|
|
||||||
- 手机号
|
|
||||||
- 可提现佣金
|
|
||||||
- 冻结佣金
|
|
||||||
- 累计提现
|
|
||||||
- 推荐人ID
|
|
||||||
- 一级成员数
|
|
||||||
- 二级成员数
|
|
||||||
- 三级成员数
|
|
||||||
- 专属二维码
|
|
||||||
- 状态
|
|
||||||
- 创建时间
|
|
||||||
- 更新时间
|
|
||||||
|
|
||||||
### 导入功能
|
|
||||||
1. 点击"导入xls"按钮
|
|
||||||
2. 拖拽或选择Excel文件(支持.xls和.xlsx格式)
|
|
||||||
3. 文件大小限制:10MB以内
|
|
||||||
4. 导入格式要求:
|
|
||||||
- 必填字段:用户ID、姓名、手机号
|
|
||||||
- 佣金字段请填写数字,不要包含货币符号
|
|
||||||
- 状态字段:正常 或 已删除
|
|
||||||
- 推荐人ID必须是已存在的用户ID
|
|
||||||
|
|
||||||
### 数据格式示例
|
|
||||||
|
|
||||||
| 用户ID | 姓名 | 手机号 | 可提现佣金 | 冻结佣金 | 累计提现 | 推荐人ID | 一级成员数 | 二级成员数 | 三级成员数 | 专属二维码 | 状态 |
|
|
||||||
|--------|------|--------|------------|----------|----------|----------|------------|------------|------------|------------|------|
|
|
||||||
| 1001 | 张三 | 13800138000 | 100.50 | 50.00 | 200.00 | 1000 | 5 | 3 | 2 | DEALER_1001_xxx | 正常 |
|
|
||||||
| 1002 | 李四 | 13900139000 | 200.00 | 0.00 | 150.00 | | 2 | 1 | 0 | | 正常 |
|
|
||||||
|
|
||||||
## 技术实现
|
|
||||||
|
|
||||||
### 文件结构
|
|
||||||
```
|
|
||||||
src/views/shop/shopDealerUser/
|
|
||||||
├── index.vue # 主页面
|
|
||||||
├── components/
|
|
||||||
│ ├── search.vue # 搜索组件(包含导入导出功能)
|
|
||||||
│ ├── Import.vue # 导入弹窗组件
|
|
||||||
│ └── shopDealerUserEdit.vue # 编辑弹窗组件
|
|
||||||
└── README.md # 说明文档
|
|
||||||
```
|
|
||||||
|
|
||||||
### API 接口
|
|
||||||
```typescript
|
|
||||||
// 导入接口
|
|
||||||
POST /shop/shop-dealer-user/import
|
|
||||||
Content-Type: multipart/form-data
|
|
||||||
|
|
||||||
// 导出接口
|
|
||||||
GET /shop/shop-dealer-user/export
|
|
||||||
Response-Type: blob
|
|
||||||
```
|
|
||||||
|
|
||||||
### 依赖库
|
|
||||||
- `xlsx`: Excel文件处理
|
|
||||||
- `dayjs`: 日期格式化
|
|
||||||
- `ant-design-vue`: UI组件库
|
|
||||||
|
|
||||||
## 注意事项
|
|
||||||
|
|
||||||
1. **数据安全**:导入功能会直接操作数据库,请确保导入的数据准确无误
|
|
||||||
2. **性能考虑**:大量数据导入时可能需要较长时间,请耐心等待
|
|
||||||
3. **错误处理**:导入失败时会显示具体错误信息,请根据提示修正数据
|
|
||||||
4. **权限控制**:确保用户有相应的导入导出权限
|
|
||||||
|
|
||||||
## 更新日志
|
|
||||||
|
|
||||||
### v1.0.0 (2024-12-19)
|
|
||||||
- ✅ 实现基础的导入导出功能
|
|
||||||
- ✅ 添加数据验证和错误处理
|
|
||||||
- ✅ 优化用户体验和界面交互
|
|
||||||
- ✅ 完善文档说明
|
|
||||||
Reference in New Issue
Block a user