feat(core): 初始化项目基础架构和CMS功能模块

- 添加Docker相关配置文件(.dockerignore, .env.example, .gitignore)
- 实现服务端API代理功能,支持文件、模块和服务器API转发
- 创建文章详情页、栏目文章列表页和单页内容展示页面
- 集成Ant Design Vue组件库并实现SSR样式提取功能
- 定义API响应数据结构类型和应用布局组件
- 开发开发者应用中心和文章管理页面
- 实现CMS导航菜单获取和多租户切换功能
This commit is contained in:
2026-01-27 00:14:08 +08:00
commit 775841eed3
315 changed files with 47072 additions and 0 deletions

View File

@@ -0,0 +1,135 @@
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";
import {MODULES_API_URL} from "@/config/setting";
/**
* 导入分销商订单
*/
export async function importSdyDealerOrder(file: File) {
const formData = new FormData();
formData.append('file', file);
const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/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.orderNo || '',
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 || '导出失败,请重试');
}
}
/**
* 结算订单
*/
export async function updateSdyDealerOrder(data: ShopDealerOrder) {
const res = await request.put<ApiResult<unknown>>(
'/sdy/sdy-dealer-order',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}

View File

@@ -0,0 +1,75 @@
import type { PageParam } from '@/api';
/**
* 分销商订单记录表
*/
export interface ShopDealerOrder {
// 主键ID
id?: number;
// 客户名称
title?: string;
// 买家用户ID
userId?: number;
// 业务员
nickname?: string;
// 订单编号
orderNo?: string;
// 订单总金额(不含运费)
orderPrice?: string;
// 价格
price?: string;
// 结算金额
settledPrice?: string;
// 换算成度
degreePrice?: string;
// 汇率
rate?: number;
// 月份
month?: string;
// 实发金额
payPrice?: string;
// 分销商用户id(一级)
firstUserId?: number;
// 分销商用户id(二级)
secondUserId?: number;
// 分销商用户id(三级)
thirdUserId?: number;
// 一级分销商昵称
firstNickname?: string;
// 二级分销商昵称
secondNickname?: string;
// 三级分销商昵称
thirdNickname?: string;
// 分销佣金(一级)
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;
}