mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 15:49:19 +08:00
refacor: 重构目录架构
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
# 应用标题
|
||||
VITE_APP_TITLE=CD ECOMDMB
|
||||
|
||||
# 应用命名空间,用于缓存、store等功能的前缀,确保隔离
|
||||
VITE_APP_NAMESPACE=ce-ecom-dmb
|
||||
|
||||
# 对store进行加密的密钥,在将store持久化到localStorage时会使用该密钥进行加密
|
||||
VITE_APP_STORE_SECURE_KEY=please-replace-me-with-your-own-key
|
||||
@@ -0,0 +1,7 @@
|
||||
# public path
|
||||
VITE_BASE=/
|
||||
|
||||
# Basic interface address SPA
|
||||
VITE_GLOB_API_URL=/api
|
||||
|
||||
VITE_VISUALIZER=true
|
||||
@@ -0,0 +1,16 @@
|
||||
# 端口号
|
||||
VITE_PORT=5666
|
||||
|
||||
VITE_BASE=/
|
||||
|
||||
# 接口地址
|
||||
VITE_GLOB_API_URL=/api
|
||||
|
||||
# 是否开启 Nitro Mock服务,true 为开启,false 为关闭
|
||||
VITE_NITRO_MOCK=false
|
||||
|
||||
# 是否打开 devtools,true 为打开,false 为关闭
|
||||
VITE_DEVTOOLS=false
|
||||
|
||||
# 是否注入全局loading
|
||||
VITE_INJECT_APP_LOADING=true
|
||||
@@ -0,0 +1,19 @@
|
||||
VITE_BASE=/
|
||||
|
||||
# 接口地址
|
||||
VITE_GLOB_API_URL=/api
|
||||
|
||||
# 是否开启压缩,可以设置为 none, brotli, gzip
|
||||
VITE_COMPRESS=none
|
||||
|
||||
# 是否开启 PWA
|
||||
VITE_PWA=false
|
||||
|
||||
# vue-router 的模式
|
||||
VITE_ROUTER_HISTORY=history
|
||||
|
||||
# 是否注入全局loading
|
||||
VITE_INJECT_APP_LOADING=true
|
||||
|
||||
# 打包后是否生成dist.zip
|
||||
VITE_ARCHIVER=false
|
||||
@@ -0,0 +1,22 @@
|
||||
<!doctype html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta name="renderer" content="webkit" />
|
||||
<meta name="description" content="电商数据中台 - 订单导入与管理" />
|
||||
<meta name="keywords" content="电商 数据中台 订单管理" />
|
||||
<meta name="author" content="CD" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
|
||||
/>
|
||||
<!-- 由 vite 注入 VITE_APP_TITLE 变量,在 .env 文件内配置 -->
|
||||
<title><%= VITE_APP_TITLE %></title>
|
||||
<link rel="icon" href="/cd-logo.png" type="image/png" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"name": "@vben/web-antd",
|
||||
"version": "5.5.9",
|
||||
"homepage": "https://vben.pro",
|
||||
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
|
||||
"directory": "apps/web-antd"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "vben",
|
||||
"email": "ann.vben@gmail.com",
|
||||
"url": "https://github.com/anncwb"
|
||||
},
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "pnpm vite build --mode production",
|
||||
"build:analyze": "pnpm vite build --mode analyze",
|
||||
"dev": "pnpm vite --mode development",
|
||||
"preview": "vite preview",
|
||||
"typecheck": "vue-tsc --noEmit --skipLibCheck"
|
||||
},
|
||||
"imports": {
|
||||
"#/*": "./src/*"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vben/access": "workspace:*",
|
||||
"@vben/common-ui": "workspace:*",
|
||||
"@vben/constants": "workspace:*",
|
||||
"@vben/hooks": "workspace:*",
|
||||
"@vben/icons": "workspace:*",
|
||||
"@vben/layouts": "workspace:*",
|
||||
"@vben/locales": "workspace:*",
|
||||
"@vben/plugins": "workspace:*",
|
||||
"@vben/preferences": "workspace:*",
|
||||
"@vben/request": "workspace:*",
|
||||
"@vben/stores": "workspace:*",
|
||||
"@vben/styles": "workspace:*",
|
||||
"@vben/types": "workspace:*",
|
||||
"@vben/utils": "workspace:*",
|
||||
"@vueuse/core": "catalog:",
|
||||
"ant-design-vue": "catalog:",
|
||||
"dayjs": "catalog:",
|
||||
"papaparse": "^5.4.1",
|
||||
"pinia": "catalog:",
|
||||
"spark-md5": "^3.0.2",
|
||||
"vue": "catalog:",
|
||||
"vue-router": "catalog:",
|
||||
"vue-waterfall-plugin-next": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/papaparse": "^5.3.14",
|
||||
"@types/spark-md5": "^3.0.5"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from '@vben/tailwind-config/postcss';
|
||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 791 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"metadata": {
|
||||
"source": "CSV导入",
|
||||
"totalRecords": 3,
|
||||
"exportTime": "2024-01-15T10:30:00.000Z",
|
||||
"fieldMappings": {
|
||||
"商品": "product_name",
|
||||
"订单号": "order_id",
|
||||
"订单状态": "order_status",
|
||||
"商品数量(件)": "quantity",
|
||||
"商品id": "product_id",
|
||||
"商品规格": "product_spec",
|
||||
"售后状态": "after_sale_status",
|
||||
"商家实收金额(元)": "amount"
|
||||
},
|
||||
"customFieldNames": {},
|
||||
"shopName": "居家专营"
|
||||
},
|
||||
"data": [
|
||||
{
|
||||
"product_name": "【山姆特惠购】洗衣液香味持久留香强效洁净抑菌除污学生母婴家用",
|
||||
"order_id": "250908-427708925610575",
|
||||
"order_status": "待发货",
|
||||
"quantity": 1,
|
||||
"product_id": "787611070565",
|
||||
"product_spec": "摩擦生香/打造自然伪体香/72h优雅香随,超值推荐【10斤/1大桶】加量不加价",
|
||||
"after_sale_status": "无售后或售后取消",
|
||||
"amount": 29.9
|
||||
},
|
||||
{
|
||||
"product_name": "【山姆特惠购】洗衣液香味持久留香强效洁净抑菌除污学生母婴家用",
|
||||
"order_id": "250908-275702147461177",
|
||||
"order_status": "待发货",
|
||||
"quantity": 1,
|
||||
"product_id": "787611070565",
|
||||
"product_spec": "摩擦生香/打造自然伪体香/72h优雅香随,日用套装【4斤/1瓶】植萃护衣",
|
||||
"after_sale_status": "无售后或售后取消",
|
||||
"amount": 18.8
|
||||
},
|
||||
{
|
||||
"product_name": "【山姆特惠购】洗衣液香味持久留香强效洁净抑菌除污学生母婴家用",
|
||||
"order_id": "250908-419461895710461",
|
||||
"order_status": "待发货",
|
||||
"quantity": 1,
|
||||
"product_id": "787611070565",
|
||||
"product_spec": "摩擦生香/打造自然伪体香/72h优雅香随,单人套装【9斤/2件套】洁净抑菌",
|
||||
"after_sale_status": "无售后或售后取消",
|
||||
"amount": 29.9
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
/**
|
||||
* 通用组件共同的使用的基础组件,原先放在 adapter/form 内部,限制了使用范围,这里提取出来,方便其他地方使用
|
||||
* 可用于 vben-form、vben-modal、vben-drawer 等组件使用,
|
||||
*/
|
||||
|
||||
import type { Component } from 'vue';
|
||||
|
||||
import type { BaseFormComponentType } from '@vben/common-ui';
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { defineAsyncComponent, defineComponent, h, ref } from 'vue';
|
||||
|
||||
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
|
||||
import { notification } from 'ant-design-vue';
|
||||
|
||||
const AutoComplete = defineAsyncComponent(
|
||||
() => import('ant-design-vue/es/auto-complete'),
|
||||
);
|
||||
const Button = defineAsyncComponent(() => import('ant-design-vue/es/button'));
|
||||
const Checkbox = defineAsyncComponent(
|
||||
() => import('ant-design-vue/es/checkbox'),
|
||||
);
|
||||
const CheckboxGroup = defineAsyncComponent(() =>
|
||||
import('ant-design-vue/es/checkbox').then((res) => res.CheckboxGroup),
|
||||
);
|
||||
const DatePicker = defineAsyncComponent(
|
||||
() => import('ant-design-vue/es/date-picker'),
|
||||
);
|
||||
const Divider = defineAsyncComponent(() => import('ant-design-vue/es/divider'));
|
||||
const Input = defineAsyncComponent(() => import('ant-design-vue/es/input'));
|
||||
const InputNumber = defineAsyncComponent(
|
||||
() => import('ant-design-vue/es/input-number'),
|
||||
);
|
||||
const InputPassword = defineAsyncComponent(() =>
|
||||
import('ant-design-vue/es/input').then((res) => res.InputPassword),
|
||||
);
|
||||
const Mentions = defineAsyncComponent(
|
||||
() => import('ant-design-vue/es/mentions'),
|
||||
);
|
||||
const Radio = defineAsyncComponent(() => import('ant-design-vue/es/radio'));
|
||||
const RadioGroup = defineAsyncComponent(() =>
|
||||
import('ant-design-vue/es/radio').then((res) => res.RadioGroup),
|
||||
);
|
||||
const RangePicker = defineAsyncComponent(() =>
|
||||
import('ant-design-vue/es/date-picker').then((res) => res.RangePicker),
|
||||
);
|
||||
const Rate = defineAsyncComponent(() => import('ant-design-vue/es/rate'));
|
||||
const Select = defineAsyncComponent(() => import('ant-design-vue/es/select'));
|
||||
const Space = defineAsyncComponent(() => import('ant-design-vue/es/space'));
|
||||
const Switch = defineAsyncComponent(() => import('ant-design-vue/es/switch'));
|
||||
const Textarea = defineAsyncComponent(() =>
|
||||
import('ant-design-vue/es/input').then((res) => res.Textarea),
|
||||
);
|
||||
const TimePicker = defineAsyncComponent(
|
||||
() => import('ant-design-vue/es/time-picker'),
|
||||
);
|
||||
const TreeSelect = defineAsyncComponent(
|
||||
() => import('ant-design-vue/es/tree-select'),
|
||||
);
|
||||
const Upload = defineAsyncComponent(() => import('ant-design-vue/es/upload'));
|
||||
|
||||
const withDefaultPlaceholder = <T extends Component>(
|
||||
component: T,
|
||||
type: 'input' | 'select',
|
||||
componentProps: Recordable<any> = {},
|
||||
) => {
|
||||
return defineComponent({
|
||||
name: component.name,
|
||||
inheritAttrs: false,
|
||||
setup: (props: any, { attrs, expose, slots }) => {
|
||||
const placeholder =
|
||||
props?.placeholder ||
|
||||
attrs?.placeholder ||
|
||||
$t(`ui.placeholder.${type}`);
|
||||
// 透传组件暴露的方法
|
||||
const innerRef = ref();
|
||||
expose(
|
||||
new Proxy(
|
||||
{},
|
||||
{
|
||||
get: (_target, key) => innerRef.value?.[key],
|
||||
has: (_target, key) => key in (innerRef.value || {}),
|
||||
},
|
||||
),
|
||||
);
|
||||
return () =>
|
||||
h(
|
||||
component,
|
||||
{ ...componentProps, placeholder, ...props, ...attrs, ref: innerRef },
|
||||
slots,
|
||||
);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
// 这里需要自行根据业务组件库进行适配,需要用到的组件都需要在这里类型说明
|
||||
export type ComponentType =
|
||||
| 'ApiSelect'
|
||||
| 'ApiTreeSelect'
|
||||
| 'AutoComplete'
|
||||
| 'Checkbox'
|
||||
| 'CheckboxGroup'
|
||||
| 'DatePicker'
|
||||
| 'DefaultButton'
|
||||
| 'Divider'
|
||||
| 'IconPicker'
|
||||
| 'Input'
|
||||
| 'InputNumber'
|
||||
| 'InputPassword'
|
||||
| 'Mentions'
|
||||
| 'PrimaryButton'
|
||||
| 'Radio'
|
||||
| 'RadioGroup'
|
||||
| 'RangePicker'
|
||||
| 'Rate'
|
||||
| 'Select'
|
||||
| 'Space'
|
||||
| 'Switch'
|
||||
| 'Textarea'
|
||||
| 'TimePicker'
|
||||
| 'TreeSelect'
|
||||
| 'Upload'
|
||||
| BaseFormComponentType;
|
||||
|
||||
async function initComponentAdapter() {
|
||||
const components: Partial<Record<ComponentType, Component>> = {
|
||||
// 如果你的组件体积比较大,可以使用异步加载
|
||||
// Button: () =>
|
||||
// import('xxx').then((res) => res.Button),
|
||||
ApiSelect: withDefaultPlaceholder(
|
||||
{
|
||||
...ApiComponent,
|
||||
name: 'ApiSelect',
|
||||
},
|
||||
'select',
|
||||
{
|
||||
component: Select,
|
||||
loadingSlot: 'suffixIcon',
|
||||
visibleEvent: 'onDropdownVisibleChange',
|
||||
modelPropName: 'value',
|
||||
},
|
||||
),
|
||||
ApiTreeSelect: withDefaultPlaceholder(
|
||||
{
|
||||
...ApiComponent,
|
||||
name: 'ApiTreeSelect',
|
||||
},
|
||||
'select',
|
||||
{
|
||||
component: TreeSelect,
|
||||
fieldNames: { label: 'label', value: 'value', children: 'children' },
|
||||
loadingSlot: 'suffixIcon',
|
||||
modelPropName: 'value',
|
||||
optionsPropName: 'treeData',
|
||||
visibleEvent: 'onVisibleChange',
|
||||
},
|
||||
),
|
||||
AutoComplete,
|
||||
Checkbox,
|
||||
CheckboxGroup,
|
||||
DatePicker,
|
||||
// 自定义默认按钮
|
||||
DefaultButton: (props, { attrs, slots }) => {
|
||||
return h(Button, { ...props, attrs, type: 'default' }, slots);
|
||||
},
|
||||
Divider,
|
||||
IconPicker: withDefaultPlaceholder(IconPicker, 'select', {
|
||||
iconSlot: 'addonAfter',
|
||||
inputComponent: Input,
|
||||
modelValueProp: 'value',
|
||||
}),
|
||||
Input: withDefaultPlaceholder(Input, 'input'),
|
||||
InputNumber: withDefaultPlaceholder(InputNumber, 'input'),
|
||||
InputPassword: withDefaultPlaceholder(InputPassword, 'input'),
|
||||
Mentions: withDefaultPlaceholder(Mentions, 'input'),
|
||||
// 自定义主要按钮
|
||||
PrimaryButton: (props, { attrs, slots }) => {
|
||||
return h(Button, { ...props, attrs, type: 'primary' }, slots);
|
||||
},
|
||||
Radio,
|
||||
RadioGroup,
|
||||
RangePicker,
|
||||
Rate,
|
||||
Select: withDefaultPlaceholder(Select, 'select'),
|
||||
Space,
|
||||
Switch,
|
||||
Textarea: withDefaultPlaceholder(Textarea, 'input'),
|
||||
TimePicker,
|
||||
TreeSelect: withDefaultPlaceholder(TreeSelect, 'select'),
|
||||
Upload,
|
||||
};
|
||||
|
||||
// 将组件注册到全局共享状态中
|
||||
globalShareState.setComponents(components);
|
||||
|
||||
// 定义全局共享状态中的消息提示
|
||||
globalShareState.defineMessage({
|
||||
// 复制成功消息提示
|
||||
copyPreferencesSuccess: (title, content) => {
|
||||
notification.success({
|
||||
description: content,
|
||||
message: title,
|
||||
placement: 'bottomRight',
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export { initComponentAdapter };
|
||||
@@ -0,0 +1,49 @@
|
||||
import type {
|
||||
VbenFormSchema as FormSchema,
|
||||
VbenFormProps,
|
||||
} from '@vben/common-ui';
|
||||
|
||||
import type { ComponentType } from './component';
|
||||
|
||||
import { setupVbenForm, useVbenForm as useForm, z } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
|
||||
async function initSetupVbenForm() {
|
||||
setupVbenForm<ComponentType>({
|
||||
config: {
|
||||
// ant design vue组件库默认都是 v-model:value
|
||||
baseModelPropName: 'value',
|
||||
|
||||
// 一些组件是 v-model:checked 或者 v-model:fileList
|
||||
modelPropNameMap: {
|
||||
Checkbox: 'checked',
|
||||
Radio: 'checked',
|
||||
Switch: 'checked',
|
||||
Upload: 'fileList',
|
||||
},
|
||||
},
|
||||
defineRules: {
|
||||
// 输入项目必填国际化适配
|
||||
required: (value, _params, ctx) => {
|
||||
if (value === undefined || value === null || value.length === 0) {
|
||||
return $t('ui.formRules.required', [ctx.label]);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
// 选择项目必填国际化适配
|
||||
selectRequired: (value, _params, ctx) => {
|
||||
if (value === undefined || value === null) {
|
||||
return $t('ui.formRules.selectRequired', [ctx.label]);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const useVbenForm = useForm<ComponentType>;
|
||||
|
||||
export { initSetupVbenForm, useVbenForm, z };
|
||||
|
||||
export type VbenFormSchema = FormSchema<ComponentType>;
|
||||
export type { VbenFormProps };
|
||||
@@ -0,0 +1,208 @@
|
||||
import type { VxeTableGridOptions } from '@vben/plugins/vxe-table';
|
||||
|
||||
import { h } from 'vue';
|
||||
|
||||
import { setupVbenVxeTable, useVbenVxeGrid } from '@vben/plugins/vxe-table';
|
||||
|
||||
import { Button, Image, Select, TreeSelect } from 'ant-design-vue';
|
||||
import { CaretUpOutlined, CaretDownOutlined } from '@ant-design/icons-vue';
|
||||
|
||||
import { useVbenForm } from './form';
|
||||
|
||||
function createArrowHandlers(
|
||||
getData: () => any[],
|
||||
getIdx: (data: any[]) => number,
|
||||
colField: string,
|
||||
sourceRow: any,
|
||||
) {
|
||||
let timer: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
const copyTo = (targetRow: any) => {
|
||||
if (targetRow) targetRow[colField] = sourceRow[colField];
|
||||
};
|
||||
|
||||
const copyRange = (from: number, to: number, data: any[]) => {
|
||||
for (let i = from; i < to; i++) {
|
||||
copyTo(data[i]);
|
||||
}
|
||||
};
|
||||
|
||||
const withData = (fn: (data: any[], idx: number) => void) => {
|
||||
const data = getData();
|
||||
const idx = getIdx(data);
|
||||
fn(data, idx);
|
||||
};
|
||||
|
||||
const singleUp = () => {
|
||||
if (timer) { clearTimeout(timer); timer = null; }
|
||||
timer = setTimeout(() => {
|
||||
withData((data, idx) => { if (idx > 0) copyTo(data[idx - 1]); });
|
||||
timer = null;
|
||||
}, 200);
|
||||
};
|
||||
|
||||
const dblUp = () => {
|
||||
if (timer) { clearTimeout(timer); timer = null; }
|
||||
withData((data, idx) => { if (idx > 0) copyRange(0, idx, data); });
|
||||
};
|
||||
|
||||
const singleDown = () => {
|
||||
if (timer) { clearTimeout(timer); timer = null; }
|
||||
timer = setTimeout(() => {
|
||||
withData((data, idx) => { if (idx >= 0 && idx < data.length - 1) copyTo(data[idx + 1]); });
|
||||
timer = null;
|
||||
}, 200);
|
||||
};
|
||||
|
||||
const dblDown = () => {
|
||||
if (timer) { clearTimeout(timer); timer = null; }
|
||||
withData((data, idx) => { if (idx < data.length - 1) copyRange(idx + 1, data.length, data); });
|
||||
};
|
||||
|
||||
return { singleUp, dblUp, singleDown, dblDown };
|
||||
}
|
||||
|
||||
setupVbenVxeTable({
|
||||
configVxeTable: (vxeUI) => {
|
||||
vxeUI.setConfig({
|
||||
grid: {
|
||||
align: 'center',
|
||||
border: false,
|
||||
columnConfig: {
|
||||
resizable: true,
|
||||
},
|
||||
minHeight: 180,
|
||||
formConfig: {
|
||||
enabled: false,
|
||||
},
|
||||
proxyConfig: {
|
||||
autoLoad: true,
|
||||
response: {
|
||||
result: 'items',
|
||||
total: 'total',
|
||||
list: 'items',
|
||||
},
|
||||
showActiveMsg: true,
|
||||
showResponseMsg: false,
|
||||
},
|
||||
round: true,
|
||||
showOverflow: true,
|
||||
size: 'small',
|
||||
} as VxeTableGridOptions,
|
||||
});
|
||||
|
||||
vxeUI.renderer.add('CellImage', {
|
||||
renderTableDefault(_renderOpts, params) {
|
||||
const { column, row } = params;
|
||||
return h(Image, { src: row[column.field] });
|
||||
},
|
||||
});
|
||||
|
||||
vxeUI.renderer.add('CellLink', {
|
||||
renderTableDefault(renderOpts) {
|
||||
const { props } = renderOpts;
|
||||
return h(Button, { size: 'small', type: 'link' }, { default: () => props?.text });
|
||||
},
|
||||
});
|
||||
|
||||
function sharedGetData($table: any, $grid: any): any[] {
|
||||
return ($grid as any)?.getTableData?.()?.fullData
|
||||
|| ($table as any)?.getTableData?.()?.fullData
|
||||
|| ($table as any)?.tableData
|
||||
|| [];
|
||||
}
|
||||
|
||||
function sharedGetIdx(data: any[], row: any): number {
|
||||
const srcIdx = (row as any).__srcRowIndex;
|
||||
return typeof srcIdx === 'number'
|
||||
? data.findIndex((r: any) => r.__srcRowIndex === srcIdx)
|
||||
: data.indexOf(row);
|
||||
}
|
||||
|
||||
vxeUI.renderer.add('CellSelect', {
|
||||
renderTableDefault(renderOpts, params) {
|
||||
const { props } = renderOpts;
|
||||
const { row, column, $table, $grid } = params;
|
||||
const getData = () => sharedGetData($table, $grid);
|
||||
const getIdx = (data: any[]) => sharedGetIdx(data, row);
|
||||
const { singleUp, dblUp, singleDown, dblDown } = createArrowHandlers(getData, getIdx, column.field, row);
|
||||
const allOptions: any[] = props?.options || [];
|
||||
const filterField = props?.filterByRowField as string | undefined;
|
||||
const filterKey = props?.filterOptionKey as string | undefined;
|
||||
const rowFilterVal = filterField ? row[filterField] : undefined;
|
||||
const displayOptions = filterField && rowFilterVal && filterKey
|
||||
? allOptions.filter((opt: any) => String(opt[filterKey]) === String(rowFilterVal))
|
||||
: allOptions;
|
||||
return h('div', { style: 'display: flex; align-items: center; gap: 2px;' }, [
|
||||
h(Select, {
|
||||
value: row[column.field] ?? undefined,
|
||||
'onUpdate:value': (val: any) => { row[column.field] = val; },
|
||||
options: displayOptions,
|
||||
allowClear: props?.allowClear ?? true,
|
||||
placeholder: props?.placeholder || '',
|
||||
showSearch: props?.showSearch ?? false,
|
||||
filterOption: props?.filterOption,
|
||||
style: 'flex: 1; min-width: 0;',
|
||||
size: 'small',
|
||||
}),
|
||||
h('div', { style: 'display: flex; flex-direction: column; gap: 0; flex-shrink: 0; width: 18px;' }, [
|
||||
h(Button, {
|
||||
size: 'small', type: 'text',
|
||||
onClick: singleUp, onDblclick: dblUp,
|
||||
title: '单击复制上一行,双击复制上面全部',
|
||||
style: 'padding: 0; height: 11px; width: 18px; line-height: 11px; font-size: 8px; border-radius: 2px 2px 0 0; min-width: 0;',
|
||||
}, { default: () => h(CaretUpOutlined) }),
|
||||
h(Button, {
|
||||
size: 'small', type: 'text',
|
||||
onClick: singleDown, onDblclick: dblDown,
|
||||
title: '单击复制下一行,双击复制下面全部',
|
||||
style: 'padding: 0; height: 11px; width: 18px; line-height: 11px; font-size: 8px; border-radius: 0 0 2px 2px; min-width: 0;',
|
||||
}, { default: () => h(CaretDownOutlined) }),
|
||||
]),
|
||||
]);
|
||||
},
|
||||
});
|
||||
|
||||
vxeUI.renderer.add('CellTreeSelect', {
|
||||
renderTableDefault(renderOpts, params) {
|
||||
const { props } = renderOpts;
|
||||
const { row, column, $table, $grid } = params;
|
||||
const getData = () => sharedGetData($table, $grid);
|
||||
const getIdx = (data: any[]) => sharedGetIdx(data, row);
|
||||
const { singleUp, dblUp, singleDown, dblDown } = createArrowHandlers(getData, getIdx, column.field, row);
|
||||
return h('div', { style: 'display: flex; align-items: center; gap: 2px;' }, [
|
||||
h(TreeSelect, {
|
||||
value: row[column.field] ?? undefined,
|
||||
'onUpdate:value': (val: any) => { row[column.field] = val; },
|
||||
treeData: props?.treeData || [],
|
||||
fieldNames: props?.fieldNames || { label: 'name', value: 'id', children: 'children' },
|
||||
allowClear: props?.allowClear ?? true,
|
||||
placeholder: props?.placeholder || '',
|
||||
treeDefaultExpandAll: props?.treeDefaultExpandAll ?? false,
|
||||
style: 'flex: 1; min-width: 0;',
|
||||
size: 'small',
|
||||
}),
|
||||
h('div', { style: 'display: flex; flex-direction: column; gap: 0; flex-shrink: 0; width: 18px;' }, [
|
||||
h(Button, {
|
||||
size: 'small', type: 'text',
|
||||
onClick: singleUp, onDblclick: dblUp,
|
||||
title: '单击复制上一行,双击复制上面全部',
|
||||
style: 'padding: 0; height: 11px; width: 18px; line-height: 11px; font-size: 8px; border-radius: 2px 2px 0 0; min-width: 0;',
|
||||
}, { default: () => h(CaretUpOutlined) }),
|
||||
h(Button, {
|
||||
size: 'small', type: 'text',
|
||||
onClick: singleDown, onDblclick: dblDown,
|
||||
title: '单击复制下一行,双击复制下面全部',
|
||||
style: 'padding: 0; height: 11px; width: 18px; line-height: 11px; font-size: 8px; border-radius: 0 0 2px 2px; min-width: 0;',
|
||||
}, { default: () => h(CaretDownOutlined) }),
|
||||
]),
|
||||
]);
|
||||
},
|
||||
});
|
||||
},
|
||||
useVbenForm,
|
||||
});
|
||||
|
||||
export { useVbenVxeGrid };
|
||||
|
||||
export type * from '@vben/plugins/vxe-table';
|
||||
@@ -0,0 +1,40 @@
|
||||
import type { BiOrderStatCalcVO } from './types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export async function getBiOrderStatIncCalcStatusApi(shopId: number) {
|
||||
return requestClient.get<BiOrderStatCalcVO.IncStatus>(
|
||||
'/bi/order-stat/calc/inc/status',
|
||||
{ params: { shopId } },
|
||||
);
|
||||
}
|
||||
|
||||
export async function resumeBiOrderStatIncCalcApi(shopId: number) {
|
||||
return requestClient.post<BiOrderStatCalcVO.IncStatus>(
|
||||
'/bi/order-stat/calc/inc/resume',
|
||||
undefined,
|
||||
{ params: { shopId } },
|
||||
);
|
||||
}
|
||||
|
||||
export async function listBiOrderStatFullCalcTasksApi(
|
||||
shopId: number,
|
||||
limit = 20,
|
||||
) {
|
||||
return requestClient.get<BiOrderStatCalcVO.FullTask[]>(
|
||||
'/bi/order-stat/calc/full-task/list',
|
||||
{ params: { shopId, limit } },
|
||||
);
|
||||
}
|
||||
|
||||
/** 手动创建 BI 全量计算任务 */
|
||||
export async function createBiOrderStatFullCalcTaskApi(data: {
|
||||
shopId: number;
|
||||
dateFrom: string;
|
||||
dateTo: string;
|
||||
}) {
|
||||
return requestClient.post<BiOrderStatCalcVO.FullTask>(
|
||||
'/bi/order-stat/calc/full-task',
|
||||
data,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './apis';
|
||||
export type * from './types';
|
||||
@@ -0,0 +1 @@
|
||||
export type * from './types.vo';
|
||||
@@ -0,0 +1,33 @@
|
||||
export namespace BiOrderStatCalcVO {
|
||||
export interface IncStatus {
|
||||
shopId: number;
|
||||
status?: number;
|
||||
lastSummary?: string;
|
||||
lastError?: string;
|
||||
lastSuccessTime?: string;
|
||||
lastStatDate?: string;
|
||||
lastAppliedOrderId?: number;
|
||||
lastSkipped?: number;
|
||||
}
|
||||
|
||||
export interface FullTask {
|
||||
id: number;
|
||||
shopId: number;
|
||||
/** MANUAL / CONVERT / DIRTY_DAY(历史:COST_SYNC / SKU_MIGRATE) */
|
||||
triggerSource?: string;
|
||||
/** 上游任务 id;含义由 triggerSource 决定 */
|
||||
upstreamTaskId?: number;
|
||||
platformCode?: string;
|
||||
dateFrom: string;
|
||||
dateTo: string;
|
||||
currentDate?: string;
|
||||
totalDays: number;
|
||||
doneDays: number;
|
||||
failedDays: number;
|
||||
skippedDays?: number;
|
||||
status: string;
|
||||
lastError?: string;
|
||||
createTime?: string;
|
||||
finishTime?: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import type { BiOrderStatDirtyVO } from './types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/** BI 脏日健康度摘要 */
|
||||
export async function getBiOrderStatDirtyHealthApi() {
|
||||
return requestClient.get<BiOrderStatDirtyVO.HealthSummary>(
|
||||
'/bi/order-stat/dirty/health',
|
||||
);
|
||||
}
|
||||
|
||||
/** 待重算脏日列表 */
|
||||
export async function listBiOrderStatDirtyPendingApi(limit = 200) {
|
||||
return requestClient.get<BiOrderStatDirtyVO.PendingRow[]>(
|
||||
'/bi/order-stat/dirty/pending',
|
||||
{ params: { limit } },
|
||||
);
|
||||
}
|
||||
|
||||
/** 一键重算全部待处理脏日 */
|
||||
export async function applyBiOrderStatDirtyPendingApi() {
|
||||
return requestClient.post<BiOrderStatDirtyVO.ApplyResult>(
|
||||
'/bi/order-stat/dirty/apply-pending',
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1 @@
|
||||
export * from './types.vo';
|
||||
@@ -0,0 +1,34 @@
|
||||
export namespace BiOrderStatDirtyVO {
|
||||
export interface HealthSummary {
|
||||
pendingDayCount: number;
|
||||
pendingShopCount: number;
|
||||
oldestPendingDate?: string;
|
||||
hasRunning: boolean;
|
||||
}
|
||||
|
||||
export interface PendingRow {
|
||||
id: number;
|
||||
shopId: number;
|
||||
shopName?: string;
|
||||
statDate: string;
|
||||
reasons: string[];
|
||||
status: string;
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
export interface TaskBrief {
|
||||
biCalcTaskId?: number;
|
||||
shopId: number;
|
||||
dateFrom: string;
|
||||
dateTo: string;
|
||||
totalDays: number;
|
||||
status: string;
|
||||
}
|
||||
|
||||
export interface ApplyResult {
|
||||
applyBatchId: string;
|
||||
dirtyDayCount: number;
|
||||
taskCount: number;
|
||||
tasks: TaskBrief[];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import type { BiOrderStatIncHealthVO } from './types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/** BI 增量计算健康度摘要 */
|
||||
export async function getBiOrderStatIncHealthApi() {
|
||||
return requestClient.get<BiOrderStatIncHealthVO.HealthSummary>(
|
||||
'/bi/order-stat/inc/health',
|
||||
);
|
||||
}
|
||||
|
||||
/** BI 增量计算按店明细 */
|
||||
export async function listBiOrderStatIncShopsApi() {
|
||||
return requestClient.get<BiOrderStatIncHealthVO.ShopRow[]>(
|
||||
'/bi/order-stat/inc/shops',
|
||||
);
|
||||
}
|
||||
|
||||
/** 批量恢复暂停店 */
|
||||
export async function resumeBiOrderStatIncPausedApi() {
|
||||
return requestClient.post<BiOrderStatIncHealthVO.ResumePausedResult>(
|
||||
'/bi/order-stat/inc/resume-paused',
|
||||
);
|
||||
}
|
||||
|
||||
/** 恢复单店增量计算 */
|
||||
export async function resumeBiOrderStatIncShopApi(shopId: number) {
|
||||
return requestClient.post(
|
||||
'/bi/order-stat/inc/resume',
|
||||
undefined,
|
||||
{ params: { shopId } },
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './apis';
|
||||
export type * from './types';
|
||||
@@ -0,0 +1 @@
|
||||
export type * from './types.vo';
|
||||
@@ -0,0 +1,34 @@
|
||||
export namespace BiOrderStatIncHealthVO {
|
||||
export interface HealthSummary {
|
||||
shopCount: number;
|
||||
okCount: number;
|
||||
idleCount: number;
|
||||
laggedCount: number;
|
||||
pausedCount: number;
|
||||
worstLagMinutes?: number;
|
||||
lagThresholdMinutes: number;
|
||||
activityWindowHours: number;
|
||||
healthy: boolean;
|
||||
}
|
||||
|
||||
export interface ShopRow {
|
||||
shopId: number;
|
||||
shopName?: string;
|
||||
platformCode?: string;
|
||||
status?: number;
|
||||
/** OK / IDLE / LAGGED / PAUSED */
|
||||
healthKind: string;
|
||||
lagMinutes?: number;
|
||||
lastSuccessTime?: string;
|
||||
lastStatDate?: string;
|
||||
lastSummary?: string;
|
||||
lastError?: string;
|
||||
recentOrderActivity?: boolean;
|
||||
recentIncSuccess?: boolean;
|
||||
}
|
||||
|
||||
export interface ResumePausedResult {
|
||||
resumedCount: number;
|
||||
shopIds: number[];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './types';
|
||||
@@ -0,0 +1 @@
|
||||
export type { CompanyOverviewVO } from './types.vo';
|
||||
@@ -0,0 +1,193 @@
|
||||
/**
|
||||
* 全店铺概览 / 工作台汇总表 VO(对齐后端 CompanyOverviewVO)
|
||||
* @see top.xyquan.ecomdmbbackend.modules.bi.overview.model.vo.CompanyOverviewVO
|
||||
*/
|
||||
export namespace CompanyOverviewVO {
|
||||
/** 全店总销售额 */
|
||||
export interface Overview {
|
||||
totalSalesAmount?: number;
|
||||
/** 较上月同期增长百分比 */
|
||||
monthOverMonthGrowth?: number;
|
||||
totalOrderCount?: number;
|
||||
totalPromotionFee?: number;
|
||||
/** 平均费比(推广费/销售额,小数如 0.05) */
|
||||
averageFeeRatio?: number;
|
||||
totalNetProfitAfterTax?: number;
|
||||
totalTaxAmount?: number;
|
||||
shopSalesRatios?: ShopSalesRatio[];
|
||||
shopEfficiencyQuadrants?: ShopEfficiencyQuadrant[];
|
||||
shopSummary?: ShopOverview;
|
||||
categorySummary?: CategoryOverview;
|
||||
platformSummary?: PlatformOverview;
|
||||
totalROI?: number;
|
||||
totalProfitAfterTax?: number;
|
||||
totalTargetOrderCount?: number;
|
||||
totalTargetAmount?: number;
|
||||
orderCountAchievementRate?: number;
|
||||
salesAmountAchievementRate?: number;
|
||||
}
|
||||
|
||||
export interface ShopSalesRatio {
|
||||
shopId?: number;
|
||||
shopName?: string;
|
||||
salesAmount?: number;
|
||||
/** 占比百分比 */
|
||||
ratio?: number;
|
||||
}
|
||||
|
||||
export interface ShopEfficiencyQuadrant {
|
||||
shopId?: number;
|
||||
shopName?: string;
|
||||
roi?: number;
|
||||
netProfit?: number;
|
||||
/** 1–4 象限 */
|
||||
quadrant?: number;
|
||||
}
|
||||
|
||||
/** 平台维度概览 */
|
||||
export interface PlatformOverview {
|
||||
total?: PlatformSummary;
|
||||
platforms?: PlatformSummary[];
|
||||
}
|
||||
|
||||
/** 多店铺概览 */
|
||||
export interface ShopOverview {
|
||||
total?: ShopSummary;
|
||||
shops?: ShopSummary[];
|
||||
}
|
||||
|
||||
/** 多品类概览(商品表复用同一结构;categoryId 存商品 ID) */
|
||||
export interface CategoryOverview {
|
||||
total?: CategorySummary;
|
||||
categories?: CategorySummary[];
|
||||
}
|
||||
|
||||
/** 工作台底部汇总表 */
|
||||
export interface WorkbenchTableBundle {
|
||||
shopTable?: ShopOverview;
|
||||
platformTable?: PlatformOverview;
|
||||
categoryTable?: CategoryOverview;
|
||||
productTable?: CategoryOverview;
|
||||
/** SKU 汇总;categoryId=skuId */
|
||||
skuTable?: CategoryOverview;
|
||||
}
|
||||
|
||||
/** 店铺汇总行 */
|
||||
export interface ShopSummary {
|
||||
shopId?: number;
|
||||
shopName?: string;
|
||||
platform?: string;
|
||||
targetOrderCount?: number;
|
||||
orderCountAchievementRate?: number;
|
||||
targetAmount?: number;
|
||||
salesAmountAchievementRate?: number;
|
||||
/** 净销售额 = 成交 − 退款 */
|
||||
salesAmount?: number;
|
||||
/** 成交金额 */
|
||||
dealAmount?: number;
|
||||
/** 净销售单量 */
|
||||
salesOrderCount?: number;
|
||||
/** 成交单量 */
|
||||
dealOrderCount?: number;
|
||||
/** 成交量(件数) */
|
||||
dealQuantitySum?: number;
|
||||
/** 净销量(件数) */
|
||||
salesQuantitySum?: number;
|
||||
/** 净销售客单价 */
|
||||
salesAverageOrderValue?: number;
|
||||
/** 成交客单价 */
|
||||
dealAverageOrderValue?: number;
|
||||
productCost?: number;
|
||||
shippingCost?: number;
|
||||
otherCost?: number;
|
||||
/** 订单成本(商品成本+运费+其他成本,不含推广费、刷单费) */
|
||||
orderCost?: number;
|
||||
/** 退款金额(经营规模) */
|
||||
refundAmount?: number;
|
||||
/** 退款单量 */
|
||||
refundOrderCount?: number;
|
||||
/** 退款件数 */
|
||||
refundQuantitySum?: number;
|
||||
totalPromotionFee?: number;
|
||||
brushFee?: number;
|
||||
/** 费比(推广费/销售额,小数) */
|
||||
feeRatio?: number;
|
||||
grossProfit?: number;
|
||||
totalProfitBeforeTax?: number;
|
||||
salesTaxAmount?: number;
|
||||
profitAfterTax?: number;
|
||||
roi?: number;
|
||||
}
|
||||
|
||||
/** 品类/商品汇总行 */
|
||||
export interface CategorySummary {
|
||||
categoryId?: number | null;
|
||||
categoryName?: string;
|
||||
/** SKU 汇总:所属商品名 */
|
||||
productName?: string;
|
||||
/** SKU 汇总:规格编码(悬停) */
|
||||
skuCode?: string;
|
||||
salesAmount?: number;
|
||||
dealAmount?: number;
|
||||
salesOrderCount?: number;
|
||||
dealOrderCount?: number;
|
||||
dealQuantitySum?: number;
|
||||
salesQuantitySum?: number;
|
||||
salesAverageOrderValue?: number;
|
||||
dealAverageOrderValue?: number;
|
||||
productCost?: number;
|
||||
shippingCost?: number;
|
||||
otherCost?: number;
|
||||
orderCost?: number;
|
||||
/** 退款金额(经营规模) */
|
||||
refundAmount?: number;
|
||||
/** 退款单量 */
|
||||
refundOrderCount?: number;
|
||||
/** 退款件数 */
|
||||
refundQuantitySum?: number;
|
||||
totalPromotionFee?: number;
|
||||
brushFee?: number;
|
||||
feeRatio?: number;
|
||||
grossProfit?: number;
|
||||
totalProfitBeforeTax?: number;
|
||||
salesTaxAmount?: number;
|
||||
profitAfterTax?: number;
|
||||
roi?: number;
|
||||
}
|
||||
|
||||
/** 平台维度汇总行 */
|
||||
export interface PlatformSummary {
|
||||
platformCode?: string;
|
||||
platformName?: string;
|
||||
targetOrderCount?: number;
|
||||
orderCountAchievementRate?: number;
|
||||
targetAmount?: number;
|
||||
salesAmountAchievementRate?: number;
|
||||
salesAmount?: number;
|
||||
dealAmount?: number;
|
||||
salesOrderCount?: number;
|
||||
dealOrderCount?: number;
|
||||
dealQuantitySum?: number;
|
||||
salesQuantitySum?: number;
|
||||
salesAverageOrderValue?: number;
|
||||
dealAverageOrderValue?: number;
|
||||
productCost?: number;
|
||||
shippingCost?: number;
|
||||
otherCost?: number;
|
||||
orderCost?: number;
|
||||
/** 退款金额(经营规模) */
|
||||
refundAmount?: number;
|
||||
/** 退款单量 */
|
||||
refundOrderCount?: number;
|
||||
/** 退款件数 */
|
||||
refundQuantitySum?: number;
|
||||
totalPromotionFee?: number;
|
||||
brushFee?: number;
|
||||
feeRatio?: number;
|
||||
grossProfit?: number;
|
||||
totalProfitBeforeTax?: number;
|
||||
salesTaxAmount?: number;
|
||||
roi?: number;
|
||||
profitAfterTax?: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import type { WorkbenchDTO, WorkbenchVO } from './types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/** 经营概览 Tab:KPI/趋势/饼图 + 底部四表 */
|
||||
export async function getWorkbenchFinanceApi(data: WorkbenchDTO.Query) {
|
||||
return requestClient.post<WorkbenchVO.FinanceSlice>(
|
||||
'/bi/workbench/finance',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 多维分析 Tab */
|
||||
export async function getWorkbenchMultiAnalysisApi(data: WorkbenchDTO.Query) {
|
||||
return requestClient.post<WorkbenchVO.MultiPanel>(
|
||||
'/bi/workbench/multi-analysis',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 销售额排行 Tab */
|
||||
export async function getWorkbenchSalesRankApi(data: WorkbenchDTO.Query) {
|
||||
return requestClient.post<WorkbenchVO.MultiPanel>(
|
||||
'/bi/workbench/sales-rank',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 区间对比:单段日期,返回店铺汇总「合计」行(轻量) */
|
||||
export async function getWorkbenchPeriodCompareSliceApi(data: WorkbenchDTO.Query) {
|
||||
return requestClient.post<WorkbenchVO.PeriodCompareSlice>(
|
||||
'/bi/workbench/period-compare/slice',
|
||||
data,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './types.dto';
|
||||
export * from './types.vo';
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 工作台查询 DTO(与后端 WorkbenchQueryDTO 对齐)
|
||||
*/
|
||||
export namespace WorkbenchDTO {
|
||||
export interface Query {
|
||||
/** 日期范围 [开始, 结束],单元素表示当天 */
|
||||
dateRange: string[];
|
||||
/** 税率,默认 0.04 */
|
||||
taxRate?: number;
|
||||
/** 平台代码,不传表示全平台 */
|
||||
platformCode?: string;
|
||||
/** 店铺 ID,不传表示当前筛选下全部门店 */
|
||||
shopId?: number;
|
||||
}
|
||||
|
||||
/** 工作台四表导出(与后端 WorkbenchExportDTO 对齐) */
|
||||
export interface ExportPayload extends Query {
|
||||
shopIds?: number[];
|
||||
platformCodes?: string[];
|
||||
categoryIds?: number[];
|
||||
productIds?: number[];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* 工作台聚合 VO(与后端 Workbench*VO 对齐)
|
||||
*/
|
||||
import type { CompanyOverviewVO } from '#/api/bi/overview';
|
||||
|
||||
export namespace WorkbenchVO {
|
||||
export interface DimRow {
|
||||
key: string;
|
||||
name: string;
|
||||
/** 净销售额(元,两位小数):成交 − 退款 */
|
||||
salesYuan?: number;
|
||||
grossProfitYuan?: number;
|
||||
netProfitYuan?: number;
|
||||
refundYuan?: number;
|
||||
grossMarginPct?: number;
|
||||
netMarginPct?: number;
|
||||
}
|
||||
|
||||
export interface KpiItem {
|
||||
label: string;
|
||||
/** 主指标原始数值(金额为元;不含千分位) */
|
||||
value: number;
|
||||
unit: string;
|
||||
changePct?: number;
|
||||
up?: boolean;
|
||||
/** 同比去年变化 %(相对去年同期时段) */
|
||||
yoyChangePct?: number | null;
|
||||
/** 同比是否上涨 */
|
||||
yoyUp?: boolean | null;
|
||||
sub?: string;
|
||||
/** 主指标金额(元),用于换算万与悬停显示 */
|
||||
amountYuan?: number | null;
|
||||
/** true 时主数字建议按「万」展示 */
|
||||
preferWanDisplay?: boolean | null;
|
||||
}
|
||||
|
||||
export interface TrendPoint {
|
||||
date: string;
|
||||
/** 日成交金额(元):计入成交状态商家实收(不含已取消、未知) */
|
||||
dealYuan?: number;
|
||||
/** 日成交单量:与 KPI「成交单量」同口径 */
|
||||
dealOrderCount?: number;
|
||||
/** 日净销售额(元),与 KPI「净销售额」同口径 */
|
||||
salesYuan?: number;
|
||||
/** 日净销售单量:与 KPI「净销售单量」同口径 */
|
||||
salesOrderCount?: number;
|
||||
/** 日毛利润(元)= 净销售额 − 订单成本 */
|
||||
profitYuan?: number;
|
||||
/** 日净利润(元),与 KPI「净利润」及多维分析分摊口径一致 */
|
||||
netProfitYuan?: number;
|
||||
refundYuan?: number;
|
||||
}
|
||||
|
||||
/** 饼图扇区(平台销售额占比等) */
|
||||
export interface PieSlice {
|
||||
name: string;
|
||||
/** 金额(元,两位小数) */
|
||||
value?: number;
|
||||
/** 占净销售额合计的比例 % */
|
||||
pct?: number;
|
||||
}
|
||||
|
||||
export interface FinancePanel {
|
||||
kpis: KpiItem[];
|
||||
dealTrend: TrendPoint[];
|
||||
/** 各平台净销售额占比 */
|
||||
platformSalesShare: PieSlice[];
|
||||
/** 环比对比期起(yyyy-MM-dd) */
|
||||
momCompareDateStart?: string | null;
|
||||
momCompareDateEnd?: string | null;
|
||||
/** 同比对比期起止(yyyy-MM-dd) */
|
||||
yoyCompareDateStart?: string | null;
|
||||
yoyCompareDateEnd?: string | null;
|
||||
}
|
||||
|
||||
export interface MultiPanel {
|
||||
platform: DimRow[];
|
||||
shop: DimRow[];
|
||||
category: DimRow[];
|
||||
product: DimRow[];
|
||||
}
|
||||
|
||||
/** 经营概览 Tab 专用 */
|
||||
export interface FinanceSlice {
|
||||
finance: FinancePanel;
|
||||
summaryTables?: CompanyOverviewVO.WorkbenchTableBundle | null;
|
||||
}
|
||||
|
||||
/** 区间对比:单段日期对应的店铺汇总「合计」行(与 /period-compare/slice 对齐) */
|
||||
export interface PeriodCompareSlice {
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
total: CompanyOverviewVO.ShopSummary;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import type { PddAuthVO } from './types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 获取拼多多店铺授权跳转 URL(绑定指定内部店铺)
|
||||
*/
|
||||
export async function getPddAuthorizeUrlApi(shopId: number) {
|
||||
return requestClient.get<PddAuthVO.AuthorizeUrl>('/channel/pdd/auth/authorize-url', {
|
||||
params: { shopId },
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1 @@
|
||||
export * from './types.vo';
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* 拼多多授权相关 VO
|
||||
*/
|
||||
export namespace PddAuthVO {
|
||||
/** 授权跳转信息 */
|
||||
export interface AuthorizeUrl {
|
||||
/** 拼多多授权页完整 URL */
|
||||
authorizeUrl: string;
|
||||
/** 本次授权 state */
|
||||
state: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 拼多多平台类目(本地落库)API
|
||||
*/
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
import type { PddCatDTO, PddCatVO } from './types';
|
||||
|
||||
/** 触发全量同步 */
|
||||
export async function syncPddCatsApi() {
|
||||
return requestClient.post<void>('/channel/pdd/cat/sync');
|
||||
}
|
||||
|
||||
/** 同步状态 */
|
||||
export async function getPddCatSyncStatusApi() {
|
||||
return requestClient.get<PddCatVO.SyncStatus>('/channel/pdd/cat/sync/status');
|
||||
}
|
||||
|
||||
/** 子类目列表(懒加载树) */
|
||||
export async function listPddCatChildrenApi(data: PddCatDTO.ChildrenQuery) {
|
||||
return requestClient.post<PddCatVO.Cat[]>('/channel/pdd/cat/children', data);
|
||||
}
|
||||
|
||||
/** 按名称/路径搜索(跨层级) */
|
||||
export async function searchPddCatsApi(data: PddCatDTO.SearchQuery) {
|
||||
return requestClient.post<PddCatVO.Cat[]>('/channel/pdd/cat/search', data);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './apis';
|
||||
export type * from './types';
|
||||
@@ -0,0 +1,40 @@
|
||||
/** 拼多多类目 DTO / VO */
|
||||
|
||||
export namespace PddCatDTO {
|
||||
export interface ChildrenQuery {
|
||||
/** 父类目;0 或省略为顶级 */
|
||||
parentCatId?: number;
|
||||
}
|
||||
|
||||
export interface SearchQuery {
|
||||
keyword: string;
|
||||
/** 默认 true:仅叶子(可发布) */
|
||||
leafOnly?: boolean;
|
||||
/** 默认 50,最大 100 */
|
||||
limit?: number;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace PddCatVO {
|
||||
export interface Cat {
|
||||
catId: number;
|
||||
parentCatId?: number;
|
||||
catName?: string;
|
||||
level?: number;
|
||||
leaf?: boolean;
|
||||
/** 如 1/23/456 */
|
||||
pathIds?: string;
|
||||
/** 如 洗护/纸品/抽纸 */
|
||||
pathNames?: string;
|
||||
lastSyncTime?: string;
|
||||
}
|
||||
|
||||
export interface SyncStatus {
|
||||
status?: 'IDLE' | 'RUNNING' | 'SUCCESS' | 'FAILED' | string;
|
||||
startedAt?: string | null;
|
||||
finishedAt?: string | null;
|
||||
lastError?: string | null;
|
||||
syncedCount?: number | null;
|
||||
message?: string | null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import type {
|
||||
PageQueryDTO,
|
||||
PageResultVO,
|
||||
PddGoodsAdFeeImportVO,
|
||||
} from './types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export async function batchPddAdFeePipelineStatusApi(shopIds: number[]) {
|
||||
return requestClient.post<PddGoodsAdFeeImportVO.ShopStatus[]>(
|
||||
'/channel/pdd/goods/adfee/import-task/pipeline/status/batch',
|
||||
{ shopIds },
|
||||
);
|
||||
}
|
||||
|
||||
export async function listPddGoodsAdFeeImportTasksApi(
|
||||
params: PageQueryDTO<PddGoodsAdFeeImportVO.TaskFilters>,
|
||||
) {
|
||||
return requestClient.post<PageResultVO<PddGoodsAdFeeImportVO.ImportTask>>(
|
||||
'/channel/pdd/goods/adfee/import-task/list',
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
export async function getPddGoodsAdFeeImportTaskApi(taskId: number) {
|
||||
return requestClient.get<PddGoodsAdFeeImportVO.ImportTask>(
|
||||
`/channel/pdd/goods/adfee/import-task/detail/${taskId}`,
|
||||
);
|
||||
}
|
||||
|
||||
export async function listPddGoodsAdFeeImportFailedItemsApi(
|
||||
taskId: number,
|
||||
params: PageQueryDTO<void>,
|
||||
) {
|
||||
return requestClient.post<PageResultVO<PddGoodsAdFeeImportVO.ImportItem>>(
|
||||
`/channel/pdd/goods/adfee/import-task/${taskId}/failed-items`,
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
export async function retryPddGoodsAdFeeConvertApi(taskId: number) {
|
||||
return requestClient.post<void>(
|
||||
`/channel/pdd/goods/adfee/import-task/${taskId}/retry-convert`,
|
||||
);
|
||||
}
|
||||
|
||||
export type { PddGoodsAdFeeImportVO };
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1,62 @@
|
||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
|
||||
/**
|
||||
* 推广费导入任务与管线状态。
|
||||
*/
|
||||
export namespace PddGoodsAdFeeImportVO {
|
||||
export type ImportTask = {
|
||||
id: number;
|
||||
companyId: number;
|
||||
channelShopId: number;
|
||||
status: string;
|
||||
totalCount: number;
|
||||
successCount: number;
|
||||
failCount: number;
|
||||
authExpired?: number;
|
||||
message?: string;
|
||||
startedAt?: string;
|
||||
finishedAt?: string;
|
||||
createTime?: string;
|
||||
convertStatus?: string;
|
||||
convertSuccessCount?: number;
|
||||
convertFailCount?: number;
|
||||
convertMessage?: string;
|
||||
convertStartedAt?: string;
|
||||
convertFinishedAt?: string;
|
||||
};
|
||||
|
||||
export type ImportItem = {
|
||||
id: number;
|
||||
taskId: number;
|
||||
goodsId: string;
|
||||
feeDate: string;
|
||||
feeAmount: number;
|
||||
status: string;
|
||||
failCode?: string;
|
||||
failReason?: string;
|
||||
createTime?: string;
|
||||
};
|
||||
|
||||
export type PipelineStage = {
|
||||
status?: string | null;
|
||||
summary?: string | null;
|
||||
lastFinishedAt?: string | null;
|
||||
successCount?: number | null;
|
||||
failCount?: number | null;
|
||||
};
|
||||
|
||||
export type ShopStatus = {
|
||||
shopId: number;
|
||||
latestTaskId?: number | null;
|
||||
importStage?: PipelineStage;
|
||||
convertStage?: PipelineStage;
|
||||
};
|
||||
|
||||
export type TaskFilters = {
|
||||
channelShopId?: number;
|
||||
ecShopId?: number;
|
||||
status?: string;
|
||||
};
|
||||
}
|
||||
|
||||
export type { PageQueryDTO, PageResultVO };
|
||||
@@ -0,0 +1,41 @@
|
||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
import type { PddGoodsAdFeeDTO, PddGoodsAdFeeVO } from './types';
|
||||
|
||||
export async function getPddGoodsAdFeePageApi(
|
||||
params: PageQueryDTO<PddGoodsAdFeeDTO.Filters>,
|
||||
) {
|
||||
return requestClient.post<PageResultVO<PddGoodsAdFeeVO.Info>>(
|
||||
'/channel/pdd/goods/adfee/list',
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
export async function getPddGoodsAdFeeDetailApi(id: number) {
|
||||
return requestClient.get<PddGoodsAdFeeVO.Info>(
|
||||
`/channel/pdd/goods/adfee/detail/${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
export async function createPddGoodsAdFeeApi(data: PddGoodsAdFeeDTO.Create) {
|
||||
return requestClient.post<PddGoodsAdFeeVO.Info>(
|
||||
'/channel/pdd/goods/adfee/create',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
export async function updatePddGoodsAdFeeApi(
|
||||
id: number,
|
||||
data: PddGoodsAdFeeDTO.Update,
|
||||
) {
|
||||
return requestClient.put<PddGoodsAdFeeVO.Info>(
|
||||
`/channel/pdd/goods/adfee/update/${id}`,
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
export async function deletePddGoodsAdFeeApi(id: number) {
|
||||
return requestClient.delete<void>(`/channel/pdd/goods/adfee/delete/${id}`);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './apis';
|
||||
export type { PddGoodsAdFeeDTO, PddGoodsAdFeeVO } from './types';
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* 拼多多商品广告费 DTO / VO
|
||||
*/
|
||||
export namespace PddGoodsAdFeeDTO {
|
||||
export interface Filters {
|
||||
channelShopId?: number;
|
||||
goodsId?: string;
|
||||
feeDateStart?: string;
|
||||
feeDateEnd?: string;
|
||||
}
|
||||
|
||||
export interface Create {
|
||||
channelShopId: number;
|
||||
goodsId: string;
|
||||
feeDate: string;
|
||||
feeAmount: number;
|
||||
}
|
||||
|
||||
export interface Update {
|
||||
channelShopId: number;
|
||||
goodsId: string;
|
||||
feeDate: string;
|
||||
feeAmount: number;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace PddGoodsAdFeeVO {
|
||||
export interface Info {
|
||||
id: number;
|
||||
companyId?: number;
|
||||
goodsRowId?: number;
|
||||
channelShopId: number;
|
||||
channelShopName?: string;
|
||||
mallId?: number;
|
||||
goodsId: string;
|
||||
goodsName?: string;
|
||||
feeDate: string;
|
||||
feeAmount: number;
|
||||
lastSyncTime?: string;
|
||||
createTime?: string;
|
||||
updateTime?: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
import type {
|
||||
PddGoodsDTO,
|
||||
PddGoodsPublishDTO,
|
||||
PddGoodsPublishVO,
|
||||
PddGoodsVO,
|
||||
PddPublishDeskDTO,
|
||||
PddPublishDeskVO,
|
||||
} from './types';
|
||||
|
||||
/** 分页查询拼多多渠道商品 */
|
||||
export async function getPddGoodsPageApi(
|
||||
params: PageQueryDTO<PddGoodsDTO.Filters>,
|
||||
) {
|
||||
return requestClient.post<PageResultVO<PddGoodsVO.Info>>(
|
||||
'/channel/pdd/goods/list',
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
/** 拼多多商品详情(含 SKU) */
|
||||
export async function getPddGoodsDetailApi(id: number) {
|
||||
return requestClient.get<PddGoodsVO.Info>(`/channel/pdd/goods/detail/${id}`);
|
||||
}
|
||||
|
||||
/** 按渠道店铺同步商品 */
|
||||
export async function syncPddGoodsByShopApi(pddShopId: number) {
|
||||
return requestClient.post<PddGoodsVO.SyncResult>(
|
||||
`/channel/pdd/goods/sync/${pddShopId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 可发布类目 */
|
||||
export async function listPddPublishCatsApi(
|
||||
data: PddGoodsPublishDTO.ShopCatQuery,
|
||||
) {
|
||||
return requestClient.post<PddGoodsPublishVO.Cat[]>(
|
||||
'/channel/pdd/goods/publish/meta/cats',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 校验类目路径是否有发布权 */
|
||||
export async function checkPddPublishCatAuthApi(
|
||||
data: PddGoodsPublishDTO.CatAuthQuery,
|
||||
) {
|
||||
return requestClient.post<PddGoodsPublishVO.CatAuth>(
|
||||
'/channel/pdd/goods/publish/meta/check-cat-auth',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 运费模板列表 */
|
||||
export async function listPddPublishLogisticsApi(
|
||||
data: PddGoodsPublishDTO.LogisticsQuery,
|
||||
) {
|
||||
return requestClient.post<PddGoodsPublishVO.LogisticsPage>(
|
||||
'/channel/pdd/goods/publish/meta/logistics-templates',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 运费模板详情 */
|
||||
export async function getPddPublishLogisticsTemplateDetailApi(
|
||||
data: PddGoodsPublishDTO.CostTemplateDetailQuery,
|
||||
) {
|
||||
return requestClient.post<PddGoodsPublishVO.CostTemplateDetail>(
|
||||
'/channel/pdd/goods/publish/meta/logistics-template-detail',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 类目属性模板 */
|
||||
export async function getPddPublishCatTemplateApi(
|
||||
data: PddGoodsPublishDTO.CatTemplateQuery,
|
||||
) {
|
||||
return requestClient.post<PddGoodsPublishVO.CatTemplate>(
|
||||
'/channel/pdd/goods/publish/meta/cat-template',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 父规格列表 */
|
||||
export async function listPddPublishParentSpecsApi(
|
||||
data: PddGoodsPublishDTO.SpecQuery,
|
||||
) {
|
||||
return requestClient.post<PddGoodsPublishVO.ParentSpec[]>(
|
||||
'/channel/pdd/goods/publish/meta/specs',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 生成规格 ID */
|
||||
export async function createPddPublishSpecIdApi(
|
||||
data: PddGoodsPublishDTO.SpecIdCreate,
|
||||
) {
|
||||
return requestClient.post<PddGoodsPublishVO.SpecId>(
|
||||
'/channel/pdd/goods/publish/meta/spec-id',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 本系统文件转传拼多多图 */
|
||||
export async function transferPddPublishImageApi(
|
||||
data: PddGoodsPublishDTO.TransferImage,
|
||||
) {
|
||||
return requestClient.post<PddGoodsPublishVO.TransferImageResult>(
|
||||
'/channel/pdd/goods/publish/transfer-image',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 发布商品并入库 */
|
||||
export async function publishPddGoodsApi(data: PddGoodsPublishDTO.Publish) {
|
||||
return requestClient.post<PddGoodsPublishVO.PublishResult>(
|
||||
'/channel/pdd/goods/publish',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 发布工作台:草稿分页(含按店计数) */
|
||||
export async function listPddPublishDeskDraftsApi(
|
||||
params: PageQueryDTO<PddPublishDeskDTO.DraftFilters>,
|
||||
) {
|
||||
return requestClient.post<PddPublishDeskVO.DraftPage>(
|
||||
'/channel/pdd/goods/publish-desk/drafts/list',
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
export async function listPddPublishDeskShopCountsApi() {
|
||||
return requestClient.get<PddPublishDeskVO.ShopCount[]>(
|
||||
'/channel/pdd/goods/publish-desk/drafts/shop-counts',
|
||||
);
|
||||
}
|
||||
|
||||
export async function getPddPublishDeskDraftApi(id: number) {
|
||||
return requestClient.get<PddPublishDeskVO.Draft>(
|
||||
`/channel/pdd/goods/publish-desk/drafts/${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
export async function createPddPublishDeskDraftApi(
|
||||
data: PddPublishDeskDTO.DraftSave,
|
||||
) {
|
||||
return requestClient.post<PddPublishDeskVO.Draft>(
|
||||
'/channel/pdd/goods/publish-desk/drafts',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
export async function updatePddPublishDeskDraftApi(
|
||||
id: number,
|
||||
data: PddPublishDeskDTO.DraftSave,
|
||||
) {
|
||||
return requestClient.put<PddPublishDeskVO.Draft>(
|
||||
`/channel/pdd/goods/publish-desk/drafts/${id}`,
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
export async function deletePddPublishDeskDraftApi(id: number) {
|
||||
return requestClient.delete(`/channel/pdd/goods/publish-desk/drafts/${id}`);
|
||||
}
|
||||
|
||||
/** 将系统草稿推送到拼多多草稿箱 */
|
||||
export async function pushPddPublishDeskDraftApi(id: number) {
|
||||
return requestClient.post<PddPublishDeskVO.Draft>(
|
||||
`/channel/pdd/goods/publish-desk/drafts/${id}/push-platform`,
|
||||
);
|
||||
}
|
||||
|
||||
export async function clonePddPublishDeskDraftApi(
|
||||
data: PddPublishDeskDTO.Clone,
|
||||
) {
|
||||
return requestClient.post<PddPublishDeskVO.Draft[]>(
|
||||
'/channel/pdd/goods/publish-desk/drafts/clone',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
export async function createPddPublishDeskJobApi(
|
||||
data: PddPublishDeskDTO.JobCreate,
|
||||
) {
|
||||
return requestClient.post<PddPublishDeskVO.Job>(
|
||||
'/channel/pdd/goods/publish-desk/jobs',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
export async function getPddPublishDeskJobApi(id: number) {
|
||||
return requestClient.get<PddPublishDeskVO.Job>(
|
||||
`/channel/pdd/goods/publish-desk/jobs/${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
export async function retryPddPublishDeskJobFailedApi(id: number) {
|
||||
return requestClient.post<PddPublishDeskVO.Job>(
|
||||
`/channel/pdd/goods/publish-desk/jobs/${id}/retry-failed`,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1,66 @@
|
||||
export * from './publish';
|
||||
export * from './publish-desk';
|
||||
|
||||
export namespace PddGoodsDTO {
|
||||
export interface Filters {
|
||||
/** 渠道店铺ID(channel_pdd_shop.id) */
|
||||
shopId?: number;
|
||||
mallId?: number;
|
||||
goodsName?: string;
|
||||
goodsId?: string;
|
||||
/** 0否 1是 */
|
||||
isOnsale?: number;
|
||||
/** 0否 1是 */
|
||||
isMoreSku?: number;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace PddGoodsVO {
|
||||
export interface Sku {
|
||||
id?: number;
|
||||
goodsRowId?: number;
|
||||
goodsId?: string;
|
||||
skuId?: string;
|
||||
spec?: string;
|
||||
specDetails?: string;
|
||||
skuQuantity?: number;
|
||||
reserveQuantity?: number;
|
||||
isSkuOnsale?: number;
|
||||
outerGoodsId?: string;
|
||||
outerId?: string;
|
||||
}
|
||||
|
||||
export interface Info {
|
||||
id: number;
|
||||
companyId?: number;
|
||||
shopId?: number;
|
||||
mallId?: number;
|
||||
goodsId?: string;
|
||||
goodsName?: string;
|
||||
goodsQuantity?: number;
|
||||
goodsReserveQuantity?: number;
|
||||
imageUrl?: string;
|
||||
thumbUrl?: string;
|
||||
isMoreSku?: number;
|
||||
isOnsale?: number;
|
||||
/** 平台是否已删除 0否 1是 */
|
||||
isPlatformDeleted?: number;
|
||||
pddCreatedAt?: string;
|
||||
lastSyncTime?: string;
|
||||
createTime?: string;
|
||||
updateTime?: string;
|
||||
skus?: Sku[];
|
||||
}
|
||||
|
||||
export interface SyncResult {
|
||||
pddShopId: number;
|
||||
mallId?: number;
|
||||
syncedCount?: number;
|
||||
createdCount?: number;
|
||||
updatedCount?: number;
|
||||
skuCount?: number;
|
||||
skippedCount?: number;
|
||||
autoCreatedProductCount?: number;
|
||||
pageCount?: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/** 拼多多发布工作台类型 */
|
||||
export namespace PddPublishDeskDTO {
|
||||
export interface DraftFilters {
|
||||
/** <=0 表示未分配店铺 */
|
||||
pddShopId?: number;
|
||||
status?: string;
|
||||
keyword?: string;
|
||||
}
|
||||
|
||||
export interface DraftSave {
|
||||
pddShopId?: number;
|
||||
title: string;
|
||||
catId?: number;
|
||||
skuCount?: number;
|
||||
status?: string;
|
||||
payloadJson?: string;
|
||||
}
|
||||
|
||||
export interface CloneTarget {
|
||||
pddShopId: number;
|
||||
count: number;
|
||||
}
|
||||
|
||||
export interface Clone {
|
||||
sourceDraftId: number;
|
||||
targets: CloneTarget[];
|
||||
}
|
||||
|
||||
export interface JobCreate {
|
||||
draftIds: number[];
|
||||
}
|
||||
}
|
||||
|
||||
export namespace PddPublishDeskVO {
|
||||
export interface ShopCount {
|
||||
pddShopId?: number | null;
|
||||
draftCount: number;
|
||||
}
|
||||
|
||||
export interface Draft {
|
||||
id: number;
|
||||
companyId?: number;
|
||||
pddShopId?: number;
|
||||
shopName?: string;
|
||||
title: string;
|
||||
catId?: number;
|
||||
skuCount?: number;
|
||||
status: string;
|
||||
payloadJson?: string;
|
||||
sourceDraftId?: number;
|
||||
lastError?: string;
|
||||
pddGoodsCommitId?: number;
|
||||
pddGoodsId?: number;
|
||||
pddDraftPushedAt?: string;
|
||||
createdBy?: number;
|
||||
createTime?: string;
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
export interface DraftPage {
|
||||
total: number;
|
||||
page: number;
|
||||
pageSize: number;
|
||||
records: Draft[];
|
||||
shopCounts: ShopCount[];
|
||||
shopWithDraftCount?: number;
|
||||
totalPendingCount?: number;
|
||||
}
|
||||
|
||||
export interface JobItem {
|
||||
id: number;
|
||||
jobId: number;
|
||||
draftId: number;
|
||||
pddShopId?: number;
|
||||
shopName?: string;
|
||||
title: string;
|
||||
status: string;
|
||||
goodsId?: string;
|
||||
errorMessage?: string;
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
export interface Job {
|
||||
id: number;
|
||||
companyId?: number;
|
||||
status: string;
|
||||
totalCount: number;
|
||||
successCount: number;
|
||||
failCount: number;
|
||||
message?: string;
|
||||
startedAt?: string;
|
||||
finishedAt?: string;
|
||||
createTime?: string;
|
||||
items?: JobItem[];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
/** 拼多多商品发布相关类型 */
|
||||
export namespace PddGoodsPublishDTO {
|
||||
export interface Publish {
|
||||
pddShopId: number;
|
||||
primaryProductId: number;
|
||||
goodsName: string;
|
||||
goodsDesc?: string;
|
||||
catId: number;
|
||||
costTemplateId: number;
|
||||
marketPriceFen: number;
|
||||
shipmentLimitSecond: number;
|
||||
isFolt: boolean;
|
||||
isPreSale: boolean;
|
||||
isRefundable: boolean;
|
||||
secondHand: boolean;
|
||||
/** 满2件折扣 0-100,默认 95 */
|
||||
twoPiecesDiscount: number;
|
||||
/** fileId 字符串或已转传的 URL */
|
||||
carouselImages: string[];
|
||||
detailImages: string[];
|
||||
imageUrl?: string;
|
||||
goodsProperties?: GoodsProperty[];
|
||||
skus: PublishSku[];
|
||||
}
|
||||
|
||||
export interface GoodsProperty {
|
||||
refPid?: number;
|
||||
vid?: number;
|
||||
value?: string;
|
||||
valueUnit?: string;
|
||||
templatePid?: number;
|
||||
parentSpecId?: number;
|
||||
specId?: number;
|
||||
imgUrl?: string;
|
||||
note?: string;
|
||||
groupId?: number;
|
||||
}
|
||||
|
||||
export interface PublishSku {
|
||||
/** 可选:选内部 SKU;手填时可不传 */
|
||||
internalSkuId?: number;
|
||||
/** 商家编码;未选内部 SKU 时必填 */
|
||||
outSkuSn?: string;
|
||||
priceFen: number;
|
||||
multiPriceFen: number;
|
||||
quantity: number;
|
||||
weight: number;
|
||||
thumbImage: string;
|
||||
specIdList: string;
|
||||
isOnsale?: number;
|
||||
skuProperties?: SkuProperty[];
|
||||
}
|
||||
|
||||
export interface SkuProperty {
|
||||
refPid: number;
|
||||
vid: number;
|
||||
value?: string;
|
||||
punit?: string;
|
||||
}
|
||||
|
||||
export interface ShopCatQuery {
|
||||
pddShopId: number;
|
||||
parentCatId?: number;
|
||||
}
|
||||
|
||||
export interface CatAuthQuery {
|
||||
pddShopId: number;
|
||||
/** 根 → 叶 */
|
||||
catPath: number[];
|
||||
}
|
||||
|
||||
export interface LogisticsQuery {
|
||||
pddShopId: number;
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
goodsStatus?: number;
|
||||
}
|
||||
|
||||
export interface CostTemplateDetailQuery {
|
||||
pddShopId: number;
|
||||
costTemplateId: number;
|
||||
}
|
||||
|
||||
export interface CatTemplateQuery {
|
||||
pddShopId: number;
|
||||
catId: number;
|
||||
}
|
||||
|
||||
export interface SpecQuery {
|
||||
pddShopId: number;
|
||||
catId: number;
|
||||
}
|
||||
|
||||
export interface SpecIdCreate {
|
||||
pddShopId: number;
|
||||
parentSpecId: number;
|
||||
specName: string;
|
||||
}
|
||||
|
||||
export interface TransferImage {
|
||||
pddShopId: number;
|
||||
fileId: number;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace PddGoodsPublishVO {
|
||||
export interface Cat {
|
||||
catId: number;
|
||||
catName?: string;
|
||||
leaf?: boolean;
|
||||
}
|
||||
|
||||
export interface CatAuth {
|
||||
authorized: boolean;
|
||||
failedCatId?: number;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface LogisticsPage {
|
||||
totalCount?: number;
|
||||
templates?: LogisticsTemplate[];
|
||||
}
|
||||
|
||||
export interface LogisticsTemplate {
|
||||
templateId: number;
|
||||
templateName?: string;
|
||||
costType?: number;
|
||||
lastUpdatedTime?: number;
|
||||
}
|
||||
|
||||
export interface CostTemplateDetail {
|
||||
templateId?: number;
|
||||
templateName?: string;
|
||||
costType?: number;
|
||||
costTypeLabel?: string;
|
||||
additionalServiceType?: number;
|
||||
additionalServiceLabel?: string;
|
||||
sfFreeType?: number;
|
||||
sfFree?: boolean;
|
||||
freeDeliverHouse?: boolean;
|
||||
freeProvinces?: CostProvince[];
|
||||
paidRegions?: CostPaidRegion[];
|
||||
freeDeliverHouseAreas?: CostDeliverHouseArea[];
|
||||
}
|
||||
|
||||
export interface CostProvince {
|
||||
provinceId?: number;
|
||||
province?: string;
|
||||
}
|
||||
|
||||
export interface CostPaidRegion {
|
||||
provinces?: CostProvince[];
|
||||
provincesText?: string;
|
||||
firstStandard?: number;
|
||||
firstCostFen?: number;
|
||||
firstCostYuan?: string;
|
||||
addStandard?: number;
|
||||
addCostFen?: number;
|
||||
addCostYuan?: string;
|
||||
freeByCountEnabled?: boolean;
|
||||
freeMinCount?: number;
|
||||
freeByAmountEnabled?: boolean;
|
||||
freeMinAmountFen?: number;
|
||||
freeMinAmountYuan?: string;
|
||||
freeRuleText?: string;
|
||||
}
|
||||
|
||||
export interface CostDeliverHouseArea {
|
||||
province?: string;
|
||||
city?: string;
|
||||
town?: string;
|
||||
areaText?: string;
|
||||
}
|
||||
|
||||
export interface CatTemplate {
|
||||
id?: number;
|
||||
maxSkuNum?: number;
|
||||
inputMaxSpecNum?: number;
|
||||
singleSpecValueNum?: number;
|
||||
singleItem?: boolean;
|
||||
properties?: CatProperty[];
|
||||
}
|
||||
|
||||
export interface CatProperty {
|
||||
templatePid?: number;
|
||||
name?: string;
|
||||
nameAlias?: string;
|
||||
refPid?: number;
|
||||
specId?: number;
|
||||
parentId?: number;
|
||||
required?: boolean;
|
||||
sale?: boolean;
|
||||
controlType?: number;
|
||||
feature?: number;
|
||||
valueType?: number;
|
||||
valueUnit?: string;
|
||||
inputMaxNum?: number;
|
||||
chooseMaxNum?: number;
|
||||
values?: CatPropertyValue[];
|
||||
}
|
||||
|
||||
export interface CatPropertyValue {
|
||||
vid?: number;
|
||||
value?: string;
|
||||
specId?: number;
|
||||
extendInfo?: string;
|
||||
parent?: boolean;
|
||||
parentVids?: number[];
|
||||
}
|
||||
|
||||
export interface ParentSpec {
|
||||
catId?: number;
|
||||
parentSpecId: number;
|
||||
parentSpecName?: string;
|
||||
}
|
||||
|
||||
export interface SpecId {
|
||||
parentSpecId?: number;
|
||||
specName?: string;
|
||||
specId: number;
|
||||
}
|
||||
|
||||
export interface TransferImageResult {
|
||||
imageUrl: string;
|
||||
}
|
||||
|
||||
export interface PublishResult {
|
||||
goodsId: number;
|
||||
goodsCommitId?: number;
|
||||
matchedSpuId?: number;
|
||||
goods?: {
|
||||
id: number;
|
||||
productId?: number;
|
||||
goodsId?: string;
|
||||
goodsName?: string;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import type { PddOrderConvertVO } from './types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export async function getPddOrderConvertIncStatusApi(shopId: number) {
|
||||
return requestClient.get<PddOrderConvertVO.IncStatus>(
|
||||
'/channel/pdd/order/convert/inc/status',
|
||||
{ params: { shopId } },
|
||||
);
|
||||
}
|
||||
|
||||
export async function resumePddOrderConvertIncApi(shopId: number) {
|
||||
return requestClient.post<PddOrderConvertVO.IncStatus>(
|
||||
'/channel/pdd/order/convert/inc/resume',
|
||||
undefined,
|
||||
{ params: { shopId } },
|
||||
);
|
||||
}
|
||||
|
||||
export async function listPddOrderConvertFullTasksApi(
|
||||
shopId: number,
|
||||
limit = 20,
|
||||
) {
|
||||
return requestClient.get<PddOrderConvertVO.FullTask[]>(
|
||||
'/channel/pdd/order/convert/full-task/list',
|
||||
{ params: { shopId, limit } },
|
||||
);
|
||||
}
|
||||
|
||||
/** 手动创建全量转换任务(按渠道镜像扫日) */
|
||||
export async function createPddOrderConvertFullTaskApi(data: {
|
||||
shopId: number;
|
||||
dateFrom: string;
|
||||
dateTo: string;
|
||||
}) {
|
||||
return requestClient.post<PddOrderConvertVO.FullTask>(
|
||||
'/channel/pdd/order/convert/full-task',
|
||||
data,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './apis';
|
||||
export type * from './types';
|
||||
@@ -0,0 +1 @@
|
||||
export type * from './types.vo';
|
||||
@@ -0,0 +1,28 @@
|
||||
export namespace PddOrderConvertVO {
|
||||
export interface IncStatus {
|
||||
shopId: number;
|
||||
status?: number;
|
||||
lastSummary?: string;
|
||||
lastError?: string;
|
||||
lastSuccessTime?: string;
|
||||
lastCursorAt?: string;
|
||||
lastConvertedCount?: number;
|
||||
}
|
||||
|
||||
export interface FullTask {
|
||||
id: number;
|
||||
shopId: number;
|
||||
syncTaskId?: number;
|
||||
dateFrom: string;
|
||||
dateTo: string;
|
||||
currentDate?: string;
|
||||
totalDays: number;
|
||||
doneDays: number;
|
||||
failedDays: number;
|
||||
skippedDays?: number;
|
||||
status: string;
|
||||
lastError?: string;
|
||||
createTime?: string;
|
||||
finishTime?: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
import type { PddOrderSyncVO } from './types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 按成交日同步一天拼多多订单
|
||||
*/
|
||||
export async function syncPddOrdersByDayApi(data: {
|
||||
shopId: number;
|
||||
confirmDate: string;
|
||||
}) {
|
||||
return requestClient.post<PddOrderSyncVO.Result>('/channel/pdd/order/sync/day', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 增量同步
|
||||
*/
|
||||
export async function syncPddOrdersIncrementalApi(shopId: number) {
|
||||
return requestClient.post<PddOrderSyncVO.Result>(
|
||||
'/channel/pdd/order/sync/incremental',
|
||||
undefined,
|
||||
{ params: { shopId } },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建全量同步任务(异步按日)
|
||||
*/
|
||||
export async function createPddFullSyncTaskApi(data: {
|
||||
shopId: number;
|
||||
dateFrom: string;
|
||||
dateTo: string;
|
||||
}) {
|
||||
return requestClient.post<PddOrderSyncVO.FullTask>(
|
||||
'/channel/pdd/order/sync/full-task',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全量同步任务
|
||||
*/
|
||||
export async function getPddFullSyncTaskApi(taskId: number) {
|
||||
return requestClient.get<PddOrderSyncVO.FullTask>(
|
||||
`/channel/pdd/order/sync/full-task/${taskId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询店铺最新全量同步任务(进行中优先)
|
||||
*/
|
||||
export async function getPddLatestFullSyncTaskApi(shopId: number) {
|
||||
return requestClient.get<null | PddOrderSyncVO.FullTask>(
|
||||
'/channel/pdd/order/sync/full-task/latest',
|
||||
{ params: { shopId } },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询店铺全量同步任务列表(按 id 倒序)
|
||||
*/
|
||||
export async function listPddFullSyncTasksApi(shopId: number, limit = 20) {
|
||||
return requestClient.get<PddOrderSyncVO.FullTask[]>(
|
||||
'/channel/pdd/order/sync/full-task/list',
|
||||
{ params: { shopId, limit } },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消全量同步任务
|
||||
*/
|
||||
export async function cancelPddFullSyncTaskApi(taskId: number) {
|
||||
return requestClient.post<PddOrderSyncVO.FullTask>(
|
||||
`/channel/pdd/order/sync/full-task/${taskId}/cancel`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 续跑失败的全量同步任务
|
||||
*/
|
||||
export async function resumePddFullSyncTaskApi(taskId: number) {
|
||||
return requestClient.post<PddOrderSyncVO.FullTask>(
|
||||
`/channel/pdd/order/sync/full-task/${taskId}/resume`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询店铺同步状态摘要
|
||||
*/
|
||||
export async function batchPddOrderSyncStatusApi(shopIds: number[]) {
|
||||
return requestClient.post<PddOrderSyncVO.ShopStatus[]>(
|
||||
'/channel/pdd/order/sync/status/batch',
|
||||
{ shopIds },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 增量同步开关
|
||||
*/
|
||||
export async function togglePddIncrementalSyncApi(data: {
|
||||
shopId: number;
|
||||
enabled: boolean;
|
||||
}) {
|
||||
return requestClient.post<PddOrderSyncVO.IncrementalStatus>(
|
||||
'/channel/pdd/order/sync/incremental/toggle',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询增量同步开关状态
|
||||
*/
|
||||
export async function getPddIncrementalSyncStatusApi(shopId: number) {
|
||||
return requestClient.get<PddOrderSyncVO.IncrementalStatus>(
|
||||
'/channel/pdd/order/sync/incremental/status',
|
||||
{ params: { shopId } },
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1 @@
|
||||
export * from './types.vo';
|
||||
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* 拼多多订单同步 VO
|
||||
*/
|
||||
export namespace PddOrderSyncVO {
|
||||
export interface Result {
|
||||
mode: string;
|
||||
shopId: number;
|
||||
fetchedCount: number;
|
||||
upsertedCount: number;
|
||||
skippedCount: number;
|
||||
errors?: string[];
|
||||
}
|
||||
|
||||
export interface FullTask {
|
||||
id: number;
|
||||
shopId: number;
|
||||
dateFrom: string;
|
||||
dateTo: string;
|
||||
currentDate?: string;
|
||||
totalDays: number;
|
||||
doneDays: number;
|
||||
failedDays: number;
|
||||
status: string;
|
||||
lastError?: string;
|
||||
createTime?: string;
|
||||
finishTime?: string;
|
||||
}
|
||||
|
||||
/** OFF / OK / LAGGING / PAUSED */
|
||||
export type IncHealth = 'OFF' | 'OK' | 'LAGGING' | 'PAUSED';
|
||||
|
||||
export interface IncrementalStatus {
|
||||
shopId: number;
|
||||
enabled: boolean;
|
||||
cursorStatus?: number;
|
||||
lastError?: string;
|
||||
/** 最后一次同步摘要(成功说明或失败提示;展示优先于 lastError) */
|
||||
lastSummary?: string;
|
||||
lastCursorAt?: string;
|
||||
lastSuccessTime?: string;
|
||||
overlapSeconds?: number;
|
||||
health?: IncHealth;
|
||||
}
|
||||
|
||||
export interface PipelineIncStage {
|
||||
status?: number;
|
||||
lastSummary?: string;
|
||||
/** 最近增量成功 */
|
||||
lastSuccessTime?: string;
|
||||
/** 最近一次全量 SUCCESS 的 finish_time */
|
||||
lastFullSuccessTime?: string;
|
||||
}
|
||||
|
||||
export interface ShopStatus {
|
||||
shopId: number;
|
||||
fullTask?: null | FullTask;
|
||||
/** 最近一次全量同步 SUCCESS 的 finish_time */
|
||||
lastFullSyncSuccessTime?: string;
|
||||
incremental?: IncrementalStatus;
|
||||
convert?: null | PipelineIncStage;
|
||||
calc?: null | PipelineIncStage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import type { PddOrderDTO, PddOrderVO } from './types';
|
||||
|
||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/** 分页查询拼多多订单(数据量大时可能超过默认 10s) */
|
||||
export async function getPddOrderPageApi(
|
||||
params: PageQueryDTO<PddOrderDTO.Filters>,
|
||||
) {
|
||||
return requestClient.post<PageResultVO<PddOrderVO.Info>>(
|
||||
'/channel/pdd/order/list',
|
||||
params,
|
||||
{ timeout: 60_000 },
|
||||
);
|
||||
}
|
||||
|
||||
/** 拼多多订单详情(含明细) */
|
||||
export async function getPddOrderDetailApi(id: number) {
|
||||
return requestClient.get<PddOrderVO.Info>(`/channel/pdd/order/detail/${id}`);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './types.dto';
|
||||
export * from './types.vo';
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* 拼多多订单 DTO
|
||||
*/
|
||||
export namespace PddOrderDTO {
|
||||
export interface Filters {
|
||||
/** 渠道店铺 ID(channel_pdd_shop.id) */
|
||||
shopId?: number;
|
||||
orderSn?: string;
|
||||
orderStatus?: number;
|
||||
refundStatus?: number;
|
||||
afterSalesStatus?: number;
|
||||
createdTimeStart?: string;
|
||||
createdTimeEnd?: string;
|
||||
payTimeStart?: string;
|
||||
payTimeEnd?: string;
|
||||
confirmTimeStart?: string;
|
||||
confirmTimeEnd?: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* 拼多多订单 VO
|
||||
*/
|
||||
export namespace PddOrderVO {
|
||||
export interface Item {
|
||||
id: number;
|
||||
orderId: number;
|
||||
orderSn: string;
|
||||
goodsId?: string;
|
||||
skuId?: string;
|
||||
goodsName?: string;
|
||||
goodsSpec?: string;
|
||||
goodsImg?: string;
|
||||
goodsCount?: number;
|
||||
goodsPrice?: number;
|
||||
outerGoodsId?: string;
|
||||
outerId?: string;
|
||||
}
|
||||
|
||||
export interface Info {
|
||||
id: number;
|
||||
companyId: number;
|
||||
/** 渠道店铺 ID(channel_pdd_shop.id) */
|
||||
shopId: number;
|
||||
/** 渠道店铺名称(mall_name) */
|
||||
shopName?: string;
|
||||
orderSn: string;
|
||||
orderStatus?: number;
|
||||
refundStatus?: number;
|
||||
afterSalesStatus?: number;
|
||||
confirmStatus?: number;
|
||||
payAmount?: number;
|
||||
goodsAmount?: number;
|
||||
discountAmount?: number;
|
||||
postage?: number;
|
||||
platformDiscount?: number;
|
||||
sellerDiscount?: number;
|
||||
serviceFee?: number;
|
||||
serviceFeeDetail?: string;
|
||||
logisticsId?: number;
|
||||
trackingNumber?: string;
|
||||
createdTime?: string;
|
||||
payTime?: string;
|
||||
confirmTime?: string;
|
||||
shippingTime?: string;
|
||||
receiveTime?: string;
|
||||
province?: string;
|
||||
city?: string;
|
||||
town?: string;
|
||||
receiverNameMask?: string;
|
||||
receiverPhoneMask?: string;
|
||||
receiverAddressMask?: string;
|
||||
buyerMemo?: string;
|
||||
remark?: string;
|
||||
tradeType?: number;
|
||||
isPreSale?: number;
|
||||
groupStatus?: number;
|
||||
lastSyncTime?: string;
|
||||
createTime?: string;
|
||||
updateTime?: string;
|
||||
items?: Item[];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
import type { PddShopDTO, PddShopVO } from './types';
|
||||
|
||||
/** 分页查询拼多多渠道店铺 */
|
||||
export async function getPddShopPageApi(
|
||||
params: PageQueryDTO<PddShopDTO.Filters>,
|
||||
) {
|
||||
return requestClient.post<PageResultVO<PddShopVO.Info>>(
|
||||
'/channel/pdd/shop/list',
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
/** 拼多多渠道店铺详情(含授权信息,不含 token) */
|
||||
export async function getPddShopDetailApi(id: number) {
|
||||
return requestClient.get<PddShopVO.Info>(`/channel/pdd/shop/detail/${id}`);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1,41 @@
|
||||
export namespace PddShopDTO {
|
||||
export interface Filters {
|
||||
mallName?: string;
|
||||
merchantType?: number;
|
||||
mallCharacter?: number;
|
||||
pddAuthId?: number;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace PddShopVO {
|
||||
export interface AuthInfo {
|
||||
id: number;
|
||||
companyId?: number;
|
||||
ownerId?: string;
|
||||
expiresAt?: string;
|
||||
refreshTokenExpiresAt?: string;
|
||||
scope?: string;
|
||||
/** 0失效 1正常 2已撤销 */
|
||||
status?: number;
|
||||
createTime?: string;
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
export interface Info {
|
||||
id: number;
|
||||
companyId?: number;
|
||||
/** 绑定的经营店铺 id;未绑定则为空 */
|
||||
ecShopId?: null | number;
|
||||
pddAuthId?: null | number;
|
||||
auth?: AuthInfo | null;
|
||||
mallId?: number;
|
||||
mallName?: string;
|
||||
logo?: string;
|
||||
mallDesc?: string;
|
||||
merchantType?: number;
|
||||
mallCharacter?: number;
|
||||
lastSyncTime?: string;
|
||||
createTime?: string;
|
||||
updateTime?: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
import type { AccountDTO, AccountVO } from './types';
|
||||
|
||||
/**
|
||||
* 账户管理API
|
||||
*/
|
||||
|
||||
/**
|
||||
* 创建账户(拥有者)
|
||||
*/
|
||||
export async function admin_createAccountApi(data: AccountDTO.CreateAccountDTO) {
|
||||
return requestClient.post<AccountVO.AccountInfoVO>('/company/account/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询账户(拥有者)
|
||||
*/
|
||||
export async function admin_getAccountPageApi(params: PageQueryDTO<AccountDTO.AccountFilterDTO>) {
|
||||
return requestClient.post<PageResultVO<AccountVO.AccountInfoVO>>('/company/account/list', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新账户信息
|
||||
*/
|
||||
export async function admin_updateAccountApi(accountId: number, data: AccountDTO.UpdateAccountDTO) {
|
||||
return requestClient.put<AccountVO.AccountInfoVO>(`/company/account/update/${accountId}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除账户
|
||||
*/
|
||||
export async function admin_deleteAccountApi(accountId: number) {
|
||||
return requestClient.delete<void>(`/company/account/delete/${accountId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取账户详情
|
||||
*/
|
||||
export async function admin_getAccountDetailApi(accountId: number) {
|
||||
return requestClient.get<AccountVO.AccountInfoVO>(`/company/account/detail/${accountId}`);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 账户管理模块API导出
|
||||
*/
|
||||
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 账户管理模块类型定义导出
|
||||
*/
|
||||
|
||||
export * from './types.dto';
|
||||
export * from './types.vo';
|
||||
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* 账户管理模块DTO类型定义
|
||||
*/
|
||||
|
||||
export namespace AccountDTO {
|
||||
/** 创建账户参数 */
|
||||
export interface CreateAccountDTO {
|
||||
/** 密码 */
|
||||
password: string;
|
||||
/** 手机号 */
|
||||
phone: string;
|
||||
/** 真实姓名 */
|
||||
realName: string;
|
||||
/** 公司成员角色:owner=公司拥有者,member=成员 */
|
||||
companyRole?: 'member' | 'owner';
|
||||
/** 部门ID */
|
||||
departmentId?: number;
|
||||
/** 岗位ID */
|
||||
positionId?: number;
|
||||
/** 备注信息 */
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
/** 更新账户参数 */
|
||||
export interface UpdateAccountDTO {
|
||||
/** 手机号 */
|
||||
phone?: string;
|
||||
/** 真实姓名 */
|
||||
realName?: string;
|
||||
/** 部门ID */
|
||||
departmentId?: number;
|
||||
/** 岗位ID */
|
||||
positionId?: number;
|
||||
/** 公司成员角色:owner=公司拥有者,member=成员 */
|
||||
companyRole?: 'member' | 'owner';
|
||||
/** 状态(0-停用 1-正常) */
|
||||
status?: number;
|
||||
/** 备注信息 */
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
/** 账户过滤条件 */
|
||||
export interface AccountFilterDTO {
|
||||
/** 登录账号(模糊查询) */
|
||||
loginCode?: string;
|
||||
/** 用户姓名(模糊查询) */
|
||||
realName?: string;
|
||||
/** 手机号码(精确查询) */
|
||||
phone?: string;
|
||||
/** 公司ID */
|
||||
companyId?: number;
|
||||
/** 部门ID */
|
||||
departmentId?: number;
|
||||
/** 岗位ID */
|
||||
positionId?: number;
|
||||
/** 公司成员角色 */
|
||||
role?: 'member' | 'owner';
|
||||
/** 状态(0-停用 1-正常) */
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* 账户管理模块VO类型定义
|
||||
*/
|
||||
|
||||
export namespace AccountVO {
|
||||
/** 账户信息 */
|
||||
export interface AccountInfoVO {
|
||||
/** 用户ID */
|
||||
id: number;
|
||||
/** 公司ID */
|
||||
companyId?: number;
|
||||
/** 公司名称 */
|
||||
companyName?: string;
|
||||
/** 部门ID */
|
||||
departmentId?: number;
|
||||
/** 部门名称 */
|
||||
departmentName?: string;
|
||||
/** 岗位ID */
|
||||
positionId?: number;
|
||||
/** 岗位名称 */
|
||||
positionName?: string;
|
||||
/** 公司成员角色 code:owner / member */
|
||||
role?: 'member' | 'owner';
|
||||
/** 公司成员角色展示名 */
|
||||
roleName?: string;
|
||||
/** 登录账号 */
|
||||
loginCode: string;
|
||||
/** 手机号码 */
|
||||
phone?: string;
|
||||
/** 用户姓名 */
|
||||
realName: string;
|
||||
/** 头像路径 */
|
||||
avatar?: string;
|
||||
/** 头像图片ID */
|
||||
avatarImageId?: number;
|
||||
/** 密码安全级别 */
|
||||
pwdSecurityLevel?: number;
|
||||
/** 密码最后更新时间 */
|
||||
pwdUpdateTime?: string;
|
||||
/** 最后登录IP */
|
||||
lastLoginIp?: string;
|
||||
/** 最后登录时间 */
|
||||
lastLoginDate?: string;
|
||||
/** 冻结时间 */
|
||||
freezeDate?: string;
|
||||
/** 冻结原因 */
|
||||
freezeCause?: string;
|
||||
/** 状态 */
|
||||
status: number;
|
||||
/** 状态名称 */
|
||||
statusName?: string;
|
||||
/** 备注信息 */
|
||||
remark?: string;
|
||||
/** 创建时间 */
|
||||
createTime: string;
|
||||
/** 更新时间 */
|
||||
updateTime: string;
|
||||
/** 创建者 */
|
||||
createByName?: string;
|
||||
/** 更新者 */
|
||||
updateByName?: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
import type { CompanyDTO, CompanyVO } from './types';
|
||||
|
||||
/**
|
||||
* 公司管理API
|
||||
*/
|
||||
|
||||
/**
|
||||
* 分页获取公司列表
|
||||
*/
|
||||
export async function getCompanyPageApi(params: PageQueryDTO<CompanyDTO.CompanyFiltersDTO>) {
|
||||
return requestClient.post<PageResultVO<CompanyVO.CompanyInfoVO>>('/company/list', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建公司
|
||||
*/
|
||||
export async function createCompanyApi(data: CompanyDTO.CreateCompanyDTO) {
|
||||
return requestClient.post<CompanyVO.CompanyInfoVO>('/company/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新公司
|
||||
*/
|
||||
export async function updateCompanyApi(id: number, data: CompanyDTO.UpdateCompanyDTO) {
|
||||
return requestClient.put<CompanyVO.CompanyInfoVO>(`/company/update/${id}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除公司
|
||||
*/
|
||||
export async function deleteCompanyApi(id: number) {
|
||||
return requestClient.delete<void>(`/company/delete/${id}`);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 公司管理模块API导出
|
||||
*/
|
||||
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1,22 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
import type { CompanyMenuVO } from './types';
|
||||
|
||||
/**
|
||||
* 公司菜单管理 API(/api/company/menu)
|
||||
*/
|
||||
|
||||
export async function getCompanyMenuIdsApi(id: number) {
|
||||
return requestClient.get<number[]>(`/company/menu/ids/${id}`);
|
||||
}
|
||||
|
||||
export async function batchUpdateCompanyMenusApi(id: number, menuIds: number[]) {
|
||||
return requestClient.post<void>(`/company/menu/update/batch/${id}`, menuIds);
|
||||
}
|
||||
|
||||
export async function getCompanyMenusApi() {
|
||||
return requestClient.get('/company/menu/list');
|
||||
}
|
||||
|
||||
export async function getCompanyMenuTreeApi() {
|
||||
return requestClient.get<CompanyMenuVO.CompanyMenuInfo[]>(`/company/menu/tree`);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* 公司菜单模块类型定义导出
|
||||
*/
|
||||
|
||||
export * from './types.vo';
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 公司菜单模块VO类型定义
|
||||
*/
|
||||
import type { MenuVO } from '#/api/sys/menu/types';
|
||||
|
||||
export namespace CompanyMenuVO {
|
||||
/** 公司菜单信息 */
|
||||
export interface CompanyMenuInfo extends MenuVO.MenuInfo {
|
||||
/** 公司菜单中间表ID */
|
||||
companyMenuId?: number;
|
||||
/** 子菜单列表 */
|
||||
children?: CompanyMenuInfo[];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 公司权限管理 API(/api/company/permission)
|
||||
*/
|
||||
|
||||
/** 获取公司已分配权限 ID 列表 */
|
||||
export async function getCompanyPermissionIdsApi(companyId: number) {
|
||||
return requestClient.get<number[]>(`/company/permission/ids/${companyId}`);
|
||||
}
|
||||
|
||||
/** 批量更新公司权限 */
|
||||
export async function batchUpdateCompanyPermissionsApi(
|
||||
companyId: number,
|
||||
permissionIds: number[],
|
||||
) {
|
||||
return requestClient.post<void>(
|
||||
`/company/permission/update/batch/${companyId}`,
|
||||
permissionIds,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 公司管理模块类型定义导出
|
||||
*/
|
||||
|
||||
export * from './types.dto';
|
||||
export * from './types.vo';
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* 公司管理模块DTO类型定义
|
||||
*/
|
||||
|
||||
export namespace CompanyDTO {
|
||||
/** 创建公司参数 */
|
||||
export interface CreateCompanyDTO {
|
||||
/** 公司名称 */
|
||||
name: string;
|
||||
/** 公司地址 */
|
||||
address?: string;
|
||||
/** 邮箱 */
|
||||
email?: string;
|
||||
/** 公司拥有者姓名 */
|
||||
ownerName: string;
|
||||
/** 公司拥有者电话 */
|
||||
ownerPhone: string;
|
||||
/** logo图片ID */
|
||||
logoImageId?: number;
|
||||
/** 状态 (0-禁用 1-正常) */
|
||||
status?: number;
|
||||
/** 订阅到期时间 */
|
||||
expireTime?: string;
|
||||
}
|
||||
|
||||
/** 更新公司参数 */
|
||||
export interface UpdateCompanyDTO {
|
||||
/** 公司名称 */
|
||||
name: string;
|
||||
/** 公司地址 */
|
||||
address?: string;
|
||||
/** 邮箱 */
|
||||
email?: string;
|
||||
/** logo图片ID */
|
||||
logoImageId?: number;
|
||||
/** 状态 (0-禁用 1-正常) */
|
||||
status?: number;
|
||||
/** 订阅到期时间 */
|
||||
expireTime?: string;
|
||||
}
|
||||
|
||||
/** 公司过滤条件 */
|
||||
export interface CompanyFiltersDTO {
|
||||
/** 公司名称(模糊查询) */
|
||||
name?: string;
|
||||
/** 邮箱(精确查询) */
|
||||
email?: string;
|
||||
/** 状态 */
|
||||
status?: number;
|
||||
/** 过期状态查询 */
|
||||
expired?: boolean;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* 公司管理模块VO类型定义
|
||||
*/
|
||||
|
||||
export namespace CompanyVO {
|
||||
/** 公司信息 */
|
||||
export interface CompanyInfoVO {
|
||||
/** 公司ID */
|
||||
id: number;
|
||||
/** 公司名称 */
|
||||
name: string;
|
||||
/** 订阅到期时间 */
|
||||
expiration?: string;
|
||||
/** 公司地址 */
|
||||
address?: string;
|
||||
/** 联系人 */
|
||||
contactPerson?: string;
|
||||
/** 联系电话 */
|
||||
contactPhone?: string;
|
||||
/** 邮箱 */
|
||||
email?: string;
|
||||
/** logo */
|
||||
logo?: string;
|
||||
/** logo 图片 ID */
|
||||
logoImageId?: number;
|
||||
/** 状态 (0-禁用 1-正常) */
|
||||
status: number;
|
||||
/** 订阅到期时间 */
|
||||
expireTime?: string;
|
||||
/** 创建时间 */
|
||||
createTime: string;
|
||||
/** 更新时间 */
|
||||
updateTime: string;
|
||||
/** 是否过期 */
|
||||
expired?: boolean;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
|
||||
import { baseRequestClient, requestClient } from '#/api/request';
|
||||
|
||||
export namespace AuthApi {
|
||||
/** 修改密码参数 */
|
||||
export interface ChangePasswordParams {
|
||||
oldPassword: string;
|
||||
newPassword: string;
|
||||
}
|
||||
/** 登录接口参数 */
|
||||
export interface LoginParams {
|
||||
account: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
/** 注册接口参数 */
|
||||
export interface RegisterParams {
|
||||
loginCode?: string;
|
||||
phone?: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
/** 登录接口返回值 */
|
||||
export interface LoginResult {
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
accessTokenExpiresAt: number;
|
||||
refreshTokenExpiresAt: number;
|
||||
}
|
||||
|
||||
/** 用户信息 */
|
||||
export interface UserInfo {
|
||||
id: number;
|
||||
company?: {
|
||||
id: number;
|
||||
name: string;
|
||||
};
|
||||
departmentId?: number;
|
||||
positionId?: number;
|
||||
loginCode: string;
|
||||
phone?: string;
|
||||
realName: string;
|
||||
avatar?: string;
|
||||
role: string;
|
||||
pwdSecurityLevel?: number;
|
||||
pwdUpdateTime?: string;
|
||||
lastLoginIp?: string;
|
||||
lastLoginDate?: string;
|
||||
freezeDate?: string;
|
||||
freezeCause?: string;
|
||||
status: number;
|
||||
remark?: string;
|
||||
createTime: string;
|
||||
updateTime: string;
|
||||
}
|
||||
|
||||
export interface RefreshTokenResult {
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
accessTokenExpiresAt: number;
|
||||
refreshTokenExpiresAt: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户注册
|
||||
*/
|
||||
export async function registerApi(data: AuthApi.RegisterParams) {
|
||||
return requestClient.post<AuthApi.LoginResult>('/auth/register', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登录
|
||||
*/
|
||||
export async function loginApi(data: AuthApi.LoginParams) {
|
||||
return requestClient.post<AuthApi.LoginResult>('/auth/login', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新accessToken
|
||||
*/
|
||||
export async function refreshTokenApi() {
|
||||
const accessStore = useAccessStore();
|
||||
|
||||
if (!accessStore.refreshToken) {
|
||||
throw new Error('RefreshToken不存在,无法刷新token');
|
||||
}
|
||||
|
||||
return baseRequestClient.post<AuthApi.RefreshTokenResult>(
|
||||
'/auth/refresh',
|
||||
{
|
||||
refreshToken: accessStore.refreshToken,
|
||||
},
|
||||
{
|
||||
withCredentials: true,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户权限码
|
||||
*/
|
||||
export async function getAccessCodesApi() {
|
||||
return requestClient.get<string[]>('/auth/codes');
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换账户(超级管理员功能)
|
||||
*/
|
||||
export async function switchAccountApi(companyId: number, userId: number) {
|
||||
return requestClient.post<AuthApi.LoginResult>(
|
||||
`/super/auth/switch/company/${companyId}/user/${userId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换公司(重新签发 token)
|
||||
*/
|
||||
export async function switchCompanyApi(companyId: number) {
|
||||
return requestClient.post<AuthApi.LoginResult>(
|
||||
`/auth/switch-company/${companyId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
*/
|
||||
export async function changePasswordApi(data: AuthApi.ChangePasswordParams) {
|
||||
return requestClient.post('/user/change-password', data);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './auth';
|
||||
export * from './organization';
|
||||
export * from './user';
|
||||
@@ -0,0 +1,226 @@
|
||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CompanyApi {
|
||||
/** 公司信息 */
|
||||
export interface CompanyInfo {
|
||||
id: number;
|
||||
name: string;
|
||||
expiration?: string;
|
||||
address?: string;
|
||||
contactPerson?: string;
|
||||
contactPhone?: string;
|
||||
email?: string;
|
||||
logo?: string;
|
||||
status: number;
|
||||
expireTime?: string;
|
||||
createTime: string;
|
||||
updateTime: string;
|
||||
expired?: boolean;
|
||||
}
|
||||
|
||||
/** 创建公司参数 */
|
||||
export interface CreateCompanyParams {
|
||||
name: string;
|
||||
address?: string;
|
||||
contactPerson?: string;
|
||||
contactPhone?: string;
|
||||
email?: string;
|
||||
logo?: string;
|
||||
status?: number;
|
||||
expireTime?: string;
|
||||
}
|
||||
|
||||
/** 更新公司参数 */
|
||||
export interface UpdateCompanyParams {
|
||||
name: string;
|
||||
address?: string;
|
||||
contactPerson?: string;
|
||||
contactPhone?: string;
|
||||
email?: string;
|
||||
logo?: string;
|
||||
status?: number;
|
||||
expireTime?: string;
|
||||
}
|
||||
|
||||
/** 公司过滤条件 */
|
||||
export interface CompanyFilter {
|
||||
name?: string;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace DepartmentApi {
|
||||
/** 部门信息 */
|
||||
export interface DepartmentInfo {
|
||||
id: number;
|
||||
name: string;
|
||||
parentId?: number;
|
||||
companyId: number;
|
||||
remark?: string;
|
||||
status: number;
|
||||
createTime: string;
|
||||
updateTime: string;
|
||||
createBy?: number;
|
||||
updateBy?: number;
|
||||
children?: DepartmentInfo[];
|
||||
}
|
||||
|
||||
/** 创建部门参数 */
|
||||
export interface CreateDepartmentParams {
|
||||
name: string;
|
||||
parentId?: number;
|
||||
remark?: string;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 更新部门参数 */
|
||||
export interface UpdateDepartmentParams {
|
||||
name: string;
|
||||
parentId?: number;
|
||||
remark?: string;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 部门过滤条件 */
|
||||
export interface DepartmentFilter {
|
||||
name?: string;
|
||||
companyId?: number;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace PositionApi {
|
||||
/** 岗位信息 */
|
||||
export interface PositionInfo {
|
||||
id: number;
|
||||
name: string;
|
||||
code?: string;
|
||||
departmentId?: number;
|
||||
remark?: string;
|
||||
status: number;
|
||||
companyId: number;
|
||||
createTime: string;
|
||||
updateTime: string;
|
||||
createBy?: number;
|
||||
updateBy?: number;
|
||||
}
|
||||
|
||||
/** 创建岗位参数 */
|
||||
export interface CreatePositionParams {
|
||||
name: string;
|
||||
code?: string;
|
||||
departmentId?: number;
|
||||
remark?: string;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 更新岗位参数 */
|
||||
export interface UpdatePositionParams {
|
||||
name: string;
|
||||
code?: string;
|
||||
departmentId?: number;
|
||||
remark?: string;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 岗位过滤条件 */
|
||||
export interface PositionFilter {
|
||||
name?: string;
|
||||
companyId?: number;
|
||||
departmentId?: number;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
// 公司管理API
|
||||
export async function getCompanyPageApi(
|
||||
params: PageQueryDTO<CompanyApi.CompanyFilter>,
|
||||
) {
|
||||
return requestClient.post<PageResultVO<CompanyApi.CompanyInfo>>(
|
||||
'/company/list',
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
export async function createCompanyApi(data: CompanyApi.CreateCompanyParams) {
|
||||
return requestClient.post<CompanyApi.CompanyInfo>('/company/create', data);
|
||||
}
|
||||
|
||||
export async function updateCompanyApi(
|
||||
id: number,
|
||||
data: CompanyApi.UpdateCompanyParams,
|
||||
) {
|
||||
return requestClient.put<CompanyApi.CompanyInfo>(
|
||||
`/company/update/${id}`,
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
export async function deleteCompanyApi(id: number) {
|
||||
return requestClient.delete(`/company/delete/${id}`);
|
||||
}
|
||||
|
||||
// 部门管理API
|
||||
export async function getDepartmentPageApi(
|
||||
params: PageQueryDTO<DepartmentApi.DepartmentFilter>,
|
||||
) {
|
||||
return requestClient.post<PageResultVO<DepartmentApi.DepartmentInfo>>(
|
||||
'/department/list',
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
export async function createDepartmentApi(
|
||||
data: DepartmentApi.CreateDepartmentParams,
|
||||
) {
|
||||
return requestClient.post<DepartmentApi.DepartmentInfo>(
|
||||
'/department/create',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
export async function updateDepartmentApi(
|
||||
id: number,
|
||||
data: DepartmentApi.UpdateDepartmentParams,
|
||||
) {
|
||||
return requestClient.put<DepartmentApi.DepartmentInfo>(
|
||||
`/department/update/${id}`,
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
export async function deleteDepartmentApi(id: number) {
|
||||
return requestClient.delete(`/department/delete/${id}`);
|
||||
}
|
||||
|
||||
// 岗位管理API
|
||||
export async function getPositionPageApi(
|
||||
params: PageQueryDTO<PositionApi.PositionFilter>,
|
||||
) {
|
||||
return requestClient.post<PageResultVO<PositionApi.PositionInfo>>(
|
||||
'/position/list',
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
export async function createPositionApi(
|
||||
data: PositionApi.CreatePositionParams,
|
||||
) {
|
||||
return requestClient.post<PositionApi.PositionInfo>('/position/create', data);
|
||||
}
|
||||
|
||||
export async function updatePositionApi(
|
||||
id: number,
|
||||
data: PositionApi.UpdatePositionParams,
|
||||
) {
|
||||
return requestClient.put<PositionApi.PositionInfo>(
|
||||
`/position/update/${id}`,
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
export async function deletePositionApi(id: number) {
|
||||
return requestClient.delete(`/position/delete/${id}`);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import type { RouteRecordStringComponent, UserInfo } from '@vben/types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*/
|
||||
export async function getUserInfoApi() {
|
||||
return requestClient.get<UserInfo>('/user/info');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户菜单路由
|
||||
* 调用后端 UserController 的 /user/menu 接口
|
||||
* 根据用户角色返回对应的路由列表
|
||||
*/
|
||||
export async function getUserMenuApi() {
|
||||
return requestClient.get<RouteRecordStringComponent[]>('/user/menu');
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import type { CategoryOverviewDTO, CategoryOverviewVO } from './types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/** 获取品类概览统计数据 */
|
||||
export async function getCategoryOverviewApi(
|
||||
params: CategoryOverviewDTO.Query,
|
||||
) {
|
||||
return requestClient.post<CategoryOverviewVO.Overview>(
|
||||
'/bi/category/overview',
|
||||
params,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1,2 @@
|
||||
export type { CategoryOverviewDTO } from './types.dto';
|
||||
export type { CategoryOverviewVO } from './types.vo';
|
||||
@@ -0,0 +1,7 @@
|
||||
export namespace CategoryOverviewDTO {
|
||||
export interface Query {
|
||||
categoryId: number;
|
||||
dateRange: string[];
|
||||
taxRate?: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/** 品类概览 VO(与后端 CategoryOverviewVO 对齐) */
|
||||
export namespace CategoryOverviewVO {
|
||||
/** 与工作台经营 KPI 同形 */
|
||||
export interface KpiItem {
|
||||
label: string;
|
||||
value: number;
|
||||
unit: string;
|
||||
changePct?: number;
|
||||
up?: boolean;
|
||||
yoyChangePct?: number | null;
|
||||
yoyUp?: boolean | null;
|
||||
sub?: string;
|
||||
amountYuan?: number | null;
|
||||
preferWanDisplay?: boolean | null;
|
||||
}
|
||||
|
||||
export interface TrendPoint {
|
||||
date: string;
|
||||
dealYuan?: number;
|
||||
dealOrderCount?: number;
|
||||
salesYuan?: number;
|
||||
salesOrderCount?: number;
|
||||
profitYuan?: number;
|
||||
netProfitYuan?: number;
|
||||
refundYuan?: number;
|
||||
}
|
||||
|
||||
export interface PieSlice {
|
||||
name: string;
|
||||
value?: number;
|
||||
pct?: number;
|
||||
}
|
||||
|
||||
export interface ProductSalesRankItem {
|
||||
productId?: number;
|
||||
productName?: string;
|
||||
productCode?: string;
|
||||
orderCount?: number;
|
||||
salesAmount?: number;
|
||||
}
|
||||
|
||||
export interface ProductSummary {
|
||||
productId: number;
|
||||
productName: string;
|
||||
productCode?: string;
|
||||
salesAmount: number;
|
||||
dealAmount?: number;
|
||||
salesOrderCount?: number;
|
||||
dealOrderCount?: number;
|
||||
salesAverageOrderValue?: number;
|
||||
dealAverageOrderValue?: number;
|
||||
productCost?: number;
|
||||
shippingCost?: number;
|
||||
otherCost?: number;
|
||||
orderCost?: number;
|
||||
refundAmount?: number;
|
||||
totalPromotionFee?: number;
|
||||
brushFee?: number;
|
||||
feeRatio?: number;
|
||||
totalProfitBeforeTax?: number;
|
||||
salesTaxAmount?: number;
|
||||
profitAfterTax?: number;
|
||||
roi?: number;
|
||||
}
|
||||
|
||||
export interface ProductOverview {
|
||||
total: ProductSummary;
|
||||
products: ProductSummary[];
|
||||
}
|
||||
|
||||
export interface Overview {
|
||||
categoryId: number;
|
||||
categoryName: string;
|
||||
|
||||
kpis?: KpiItem[];
|
||||
dealTrend?: TrendPoint[];
|
||||
productSalesShare?: PieSlice[];
|
||||
momCompareDateStart?: string | null;
|
||||
momCompareDateEnd?: string | null;
|
||||
yoyCompareDateStart?: string | null;
|
||||
yoyCompareDateEnd?: string | null;
|
||||
|
||||
totalSalesAmount?: number;
|
||||
monthOverMonthGrowth?: number;
|
||||
totalOrderCount?: number;
|
||||
totalPromotionFee?: number;
|
||||
averageFeeRatio?: number;
|
||||
totalNetProfitAfterTax?: number;
|
||||
totalTaxAmount?: number;
|
||||
totalTargetOrderCount?: number;
|
||||
totalTargetAmount?: number;
|
||||
orderCountAchievementRate?: number;
|
||||
salesAmountAchievementRate?: number;
|
||||
totalROI?: number;
|
||||
averageOrderValue?: number;
|
||||
refundAmount?: number;
|
||||
totalProfitBeforeTax?: number;
|
||||
|
||||
productSalesTop10?: ProductSalesRankItem[];
|
||||
productOverview?: ProductOverview;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import type { ImportMappingDTO, ImportMappingVO } from './types';
|
||||
|
||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 导入映射管理API
|
||||
*/
|
||||
|
||||
/**
|
||||
* 创建导入映射模板
|
||||
*/
|
||||
export async function createImportMappingApi(
|
||||
data: ImportMappingDTO.CreateImportMappingDTO,
|
||||
) {
|
||||
return requestClient.post<ImportMappingVO.ImportMappingInfoVO>(
|
||||
'/ec/import/mapping/create',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新导入映射模板
|
||||
*/
|
||||
export async function updateImportMappingApi(
|
||||
id: number,
|
||||
data: ImportMappingDTO.UpdateImportMappingDTO,
|
||||
) {
|
||||
return requestClient.put<ImportMappingVO.ImportMappingInfoVO>(
|
||||
`/ec/import/mapping/update/${id}`,
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除导入映射
|
||||
*/
|
||||
export async function deleteImportMappingApi(id: number) {
|
||||
return requestClient.delete(`/ec/import/mapping/delete/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取导入映射列表
|
||||
*/
|
||||
export async function getImportMappingPageApi(
|
||||
params: PageQueryDTO<ImportMappingDTO.ImportMappingFilterDTO>,
|
||||
) {
|
||||
return requestClient.post<PageResultVO<ImportMappingVO.ImportMappingInfoVO>>(
|
||||
'/ec/import/mapping/list',
|
||||
params,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 导入映射模块API导出
|
||||
*/
|
||||
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* 导入映射模块类型定义导出
|
||||
*/
|
||||
|
||||
export * from './types.dto';
|
||||
export * from './types.vo';
|
||||
export * from './types.enum';
|
||||
@@ -0,0 +1,33 @@
|
||||
import type { ImportMappingType } from './types.enum';
|
||||
|
||||
/**
|
||||
* 导入映射模块DTO类型定义
|
||||
*/
|
||||
|
||||
export namespace ImportMappingDTO {
|
||||
/** 创建导入映射参数 */
|
||||
export interface CreateImportMappingDTO {
|
||||
/** 导入类型(PRODUCT-商品 ORDER-订单 ORDER_STATUS-订单状态) */
|
||||
type: ImportMappingType;
|
||||
/** 映射名称 */
|
||||
name: string;
|
||||
/** 字段映射(JSON格式) */
|
||||
mapping: string;
|
||||
}
|
||||
|
||||
/** 更新导入映射参数 */
|
||||
export interface UpdateImportMappingDTO {
|
||||
/** 映射名称 */
|
||||
name?: string;
|
||||
/** 字段映射(JSON格式) */
|
||||
mapping: string;
|
||||
}
|
||||
|
||||
/** 导入映射过滤条件 */
|
||||
export interface ImportMappingFilterDTO {
|
||||
/** 导入类型(PRODUCT-商品 ORDER-订单 ORDER_STATUS-订单状态) */
|
||||
type?: ImportMappingType;
|
||||
/** 映射名称(模糊查询) */
|
||||
name?: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 导入映射类型枚举
|
||||
*/
|
||||
export enum ImportMappingType {
|
||||
/** 商品 */
|
||||
PRODUCT = 'PRODUCT',
|
||||
/** 订单 */
|
||||
ORDER = 'ORDER',
|
||||
/** 订单状态 */
|
||||
ORDER_STATUS = 'ORDER_STATUS',
|
||||
/** 推广费 */
|
||||
PROMOTION_FEE = 'PROMOTION_FEE',
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入映射类型选项配置
|
||||
*/
|
||||
export const IMPORT_MAPPING_TYPE_OPTIONS = [
|
||||
{ label: '商品', value: ImportMappingType.PRODUCT },
|
||||
{ label: '订单', value: ImportMappingType.ORDER },
|
||||
{ label: '订单状态', value: ImportMappingType.ORDER_STATUS },
|
||||
{ label: '推广费', value: ImportMappingType.PROMOTION_FEE },
|
||||
];
|
||||
|
||||
/**
|
||||
* 根据导入映射类型枚举值获取中文名称
|
||||
*/
|
||||
export function getImportMappingTypeName(type: ImportMappingType): string {
|
||||
const option = IMPORT_MAPPING_TYPE_OPTIONS.find((opt) => opt.value === type);
|
||||
return option?.label || '未知类型';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import type { ImportMappingType } from './types.enum';
|
||||
|
||||
/**
|
||||
* 导入映射模块VO类型定义
|
||||
*/
|
||||
|
||||
export namespace ImportMappingVO {
|
||||
/** 导入映射信息 */
|
||||
export interface ImportMappingInfoVO {
|
||||
/** 映射ID */
|
||||
id: number;
|
||||
/** 所属公司ID */
|
||||
companyId?: number;
|
||||
/** 导入类型(PRODUCT-商品 ORDER-订单 ORDER_STATUS-订单状态) */
|
||||
type: ImportMappingType;
|
||||
/** 映射名称 */
|
||||
name: string;
|
||||
/** 字段映射(JSON格式) */
|
||||
mapping: string;
|
||||
/** 创建时间 */
|
||||
createTime: string;
|
||||
/** 更新时间 */
|
||||
updateTime: string;
|
||||
/** 创建人ID */
|
||||
createBy?: number;
|
||||
/** 更新人ID */
|
||||
updateBy?: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import type { ImportTaskDTO, ImportTaskVO } from './types';
|
||||
|
||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 导入任务管理API
|
||||
*/
|
||||
|
||||
/**
|
||||
* 创建导入任务
|
||||
*/
|
||||
export async function createImportTaskApi(
|
||||
data: ImportTaskDTO.CreateImportTaskDTO,
|
||||
) {
|
||||
return requestClient.post<ImportTaskVO.ImportTaskInfoVO>(
|
||||
'/ec/import/task/create',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取导入任务列表
|
||||
*/
|
||||
export async function getImportTaskPageApi(
|
||||
params: PageQueryDTO<ImportTaskDTO.ImportTaskFilterDTO>,
|
||||
) {
|
||||
return requestClient.post<PageResultVO<ImportTaskVO.ImportTaskInfoVO>>(
|
||||
'/ec/import/task/list',
|
||||
params,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 导入任务模块API导出
|
||||
*/
|
||||
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 导入任务模块类型定义导出
|
||||
*/
|
||||
|
||||
export * from './types.dto';
|
||||
export * from './types.vo';
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user