From 8203f436cd9a64d85e96e63042f5523ef7e978aa Mon Sep 17 00:00:00 2001 From: haohao <1036606149@qq.com> Date: Sun, 26 Oct 2025 18:26:41 +0800 Subject: [PATCH 01/61] =?UTF-8?q?feat:=20=E3=80=90antd=E3=80=91=E3=80=90io?= =?UTF-8?q?t=E3=80=91=E8=AE=BE=E5=A4=87=E5=88=86=E7=BB=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/iot/device/group/data.ts | 51 ++++++++++++------- .../src/views/iot/device/group/index.vue | 13 +---- .../group/modules/device-group-form.vue | 5 ++ 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/apps/web-antd/src/views/iot/device/group/data.ts b/apps/web-antd/src/views/iot/device/group/data.ts index 0bc313e52..01b4cc3f9 100644 --- a/apps/web-antd/src/views/iot/device/group/data.ts +++ b/apps/web-antd/src/views/iot/device/group/data.ts @@ -1,10 +1,11 @@ import type { VbenFormSchema } from '#/adapter/form'; import type { VxeTableGridOptions } from '#/adapter/vxe-table'; -import { DICT_TYPE } from '@vben/constants'; +import { CommonStatusEnum, DICT_TYPE } from '@vben/constants'; +import { getDictOptions } from '@vben/hooks'; import { z } from '#/adapter/form'; -import { getSimpleDeviceGroupList } from '#/api/iot/device/group'; +import { getRangePickerDefaultProps } from '#/utils'; /** 新增/修改设备分组的表单 */ export function useFormSchema(): VbenFormSchema[] { @@ -30,16 +31,15 @@ export function useFormSchema(): VbenFormSchema[] { .max(64, '分组名称长度不能超过 64 个字符'), }, { - fieldName: 'parentId', - label: '父级分组', - component: 'ApiTreeSelect', + fieldName: 'status', + label: '分组状态', + component: 'RadioGroup', componentProps: { - api: getSimpleDeviceGroupList, - labelField: 'name', - valueField: 'id', - placeholder: '请选择父级分组', - allowClear: true, + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + buttonStyle: 'solid', + optionType: 'button', }, + rules: z.number().default(CommonStatusEnum.ENABLE), }, { fieldName: 'description', @@ -65,6 +65,15 @@ export function useGridFormSchema(): VbenFormSchema[] { allowClear: true, }, }, + { + fieldName: 'createTime', + label: '创建时间', + component: 'RangePicker', + componentProps: { + ...getRangePickerDefaultProps(), + allowClear: true, + }, + }, ]; } @@ -72,14 +81,13 @@ export function useGridFormSchema(): VbenFormSchema[] { export function useGridColumns(): VxeTableGridOptions['columns'] { return [ { - field: 'name', - title: '分组名称', - minWidth: 200, - treeNode: true, + field: 'id', + title: 'ID', + minWidth: 100, }, { - field: 'description', - title: '分组描述', + field: 'name', + title: '分组名称', minWidth: 200, }, { @@ -92,9 +100,9 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { }, }, { - field: 'deviceCount', - title: '设备数量', - minWidth: 100, + field: 'description', + title: '分组描述', + minWidth: 200, }, { field: 'createTime', @@ -102,6 +110,11 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { minWidth: 180, formatter: 'formatDateTime', }, + { + field: 'deviceCount', + title: '设备数量', + minWidth: 100, + }, { title: '操作', width: 200, diff --git a/apps/web-antd/src/views/iot/device/group/index.vue b/apps/web-antd/src/views/iot/device/group/index.vue index f6a0992f8..ebf33e9be 100644 --- a/apps/web-antd/src/views/iot/device/group/index.vue +++ b/apps/web-antd/src/views/iot/device/group/index.vue @@ -3,7 +3,6 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { IotDeviceGroupApi } from '#/api/iot/device/group'; import { Page, useVbenModal } from '@vben/common-ui'; -import { handleTree } from '@vben/utils'; import { message } from 'ant-design-vue'; @@ -62,24 +61,14 @@ const [Grid, gridApi] = useVbenVxeGrid({ columns: useGridColumns(), height: 'auto', keepSource: true, - treeConfig: { - transform: true, - rowField: 'id', - parentField: 'parentId', - }, proxyConfig: { ajax: { query: async ({ page }, formValues) => { - const data = await getDeviceGroupPage({ + return await getDeviceGroupPage({ pageNo: page.currentPage, pageSize: page.pageSize, ...formValues, }); - // 转换为树形结构 - return { - ...data, - list: handleTree(data.list, 'id', 'parentId'), - }; }, }, }, diff --git a/apps/web-antd/src/views/iot/device/group/modules/device-group-form.vue b/apps/web-antd/src/views/iot/device/group/modules/device-group-form.vue index fe010aba1..28168c0b4 100644 --- a/apps/web-antd/src/views/iot/device/group/modules/device-group-form.vue +++ b/apps/web-antd/src/views/iot/device/group/modules/device-group-form.vue @@ -39,6 +39,7 @@ const [Form, formApi] = useVbenForm({ }, schema: useFormSchema(), showCollapseButton: false, + showDefaultActions: false, }); const [Modal, modalApi] = useVbenModal({ @@ -70,9 +71,13 @@ const [Modal, modalApi] = useVbenModal({ async onOpenChange(isOpen: boolean) { if (!isOpen) { formData.value = undefined; + formApi.resetForm(); return; } + // 重置表单 + await formApi.resetForm(); + const data = modalApi.getData(); // 如果没有数据或没有 id,表示是新增 if (!data || !data.id) { From fb481994bca5f3318a44372c185b5dc77f3b71b6 Mon Sep 17 00:00:00 2001 From: haohao <1036606149@qq.com> Date: Sun, 26 Oct 2025 19:04:54 +0800 Subject: [PATCH 02/61] =?UTF-8?q?feat:=20=E3=80=90antd=E3=80=91=E3=80=90io?= =?UTF-8?q?t=E3=80=91=E4=BA=A7=E5=93=81=E5=88=86=E7=B1=BB=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/iot/product/category/data.ts | 51 +++++++------------ .../src/views/iot/product/category/index.vue | 18 +------ .../category/modules/ProductCategoryForm.vue | 33 +++++------- 3 files changed, 32 insertions(+), 70 deletions(-) diff --git a/apps/web-antd/src/views/iot/product/category/data.ts b/apps/web-antd/src/views/iot/product/category/data.ts index 2604b0406..4857bc7d2 100644 --- a/apps/web-antd/src/views/iot/product/category/data.ts +++ b/apps/web-antd/src/views/iot/product/category/data.ts @@ -1,10 +1,11 @@ import type { VbenFormSchema } from '#/adapter/form'; import type { VxeTableGridOptions } from '#/adapter/vxe-table'; -import { DICT_TYPE } from '@vben/constants'; +import { CommonStatusEnum, DICT_TYPE } from '@vben/constants'; +import { getDictOptions } from '@vben/hooks'; import { z } from '#/adapter/form'; -import { getSimpleProductCategoryList } from '#/api/iot/product/category'; +import { getRangePickerDefaultProps } from '#/utils'; /** 新增/修改产品分类的表单 */ export function useFormSchema(): VbenFormSchema[] { @@ -19,51 +20,37 @@ export function useFormSchema(): VbenFormSchema[] { }, { fieldName: 'name', - label: '分类名称', + label: '分类名字', component: 'Input', componentProps: { - placeholder: '请输入分类名称', + placeholder: '请输入分类名字', }, rules: z .string() - .min(1, '分类名称不能为空') - .max(64, '分类名称长度不能超过 64 个字符'), - }, - { - fieldName: 'parentId', - label: '父级分类', - component: 'ApiTreeSelect', - componentProps: { - api: getSimpleProductCategoryList, - labelField: 'name', - valueField: 'id', - placeholder: '请选择父级分类', - allowClear: true, - }, + .min(1, '分类名字不能为空') + .max(64, '分类名字长度不能超过 64 个字符'), }, { fieldName: 'sort', - label: '排序', + label: '分类排序', component: 'InputNumber', componentProps: { - placeholder: '请输入排序', + placeholder: '请输入分类排序', class: 'w-full', min: 0, }, - rules: 'required', + rules: z.number().min(0, '分类排序不能为空'), }, { fieldName: 'status', - label: '状态', + label: '分类状态', component: 'RadioGroup', - defaultValue: 1, componentProps: { - options: [ - { label: '开启', value: 1 }, - { label: '关闭', value: 0 }, - ], + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + buttonStyle: 'solid', + optionType: 'button', }, - rules: 'required', + rules: z.number().default(CommonStatusEnum.ENABLE), }, { fieldName: 'description', @@ -82,10 +69,10 @@ export function useGridFormSchema(): VbenFormSchema[] { return [ { fieldName: 'name', - label: '分类名称', + label: '分类名字', component: 'Input', componentProps: { - placeholder: '请输入分类名称', + placeholder: '请输入分类名字', allowClear: true, }, }, @@ -94,9 +81,8 @@ export function useGridFormSchema(): VbenFormSchema[] { label: '创建时间', component: 'RangePicker', componentProps: { - placeholder: ['开始日期', '结束日期'], + ...getRangePickerDefaultProps(), allowClear: true, - class: 'w-full', }, }, ]; @@ -114,7 +100,6 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { field: 'name', title: '名字', minWidth: 200, - treeNode: true, }, { field: 'sort', diff --git a/apps/web-antd/src/views/iot/product/category/index.vue b/apps/web-antd/src/views/iot/product/category/index.vue index 7344bd5de..476c5991e 100644 --- a/apps/web-antd/src/views/iot/product/category/index.vue +++ b/apps/web-antd/src/views/iot/product/category/index.vue @@ -3,7 +3,6 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { IotProductCategoryApi } from '#/api/iot/product/category'; import { Page, useVbenModal } from '@vben/common-ui'; -import { handleTree } from '@vben/utils'; import { message } from 'ant-design-vue'; @@ -70,16 +69,11 @@ const [Grid, gridApi] = useVbenVxeGrid({ proxyConfig: { ajax: { query: async ({ page }, formValues) => { - const data = await getProductCategoryPage({ + return await getProductCategoryPage({ pageNo: page.currentPage, pageSize: page.pageSize, ...formValues, }); - // 转换为树形结构 - return { - ...data, - list: handleTree(data.list, 'id', 'parentId'), - }; }, }, }, @@ -91,16 +85,6 @@ const [Grid, gridApi] = useVbenVxeGrid({ refresh: true, search: true, }, - treeConfig: { - parentField: 'parentId', - rowField: 'id', - transform: true, - expandAll: true, - reserve: true, - trigger: 'default', - iconOpen: '', - iconClose: '', - }, } as VxeTableGridOptions, }); diff --git a/apps/web-antd/src/views/iot/product/category/modules/ProductCategoryForm.vue b/apps/web-antd/src/views/iot/product/category/modules/ProductCategoryForm.vue index b508b481e..d80ee2602 100644 --- a/apps/web-antd/src/views/iot/product/category/modules/ProductCategoryForm.vue +++ b/apps/web-antd/src/views/iot/product/category/modules/ProductCategoryForm.vue @@ -63,13 +63,17 @@ const [Modal, modalApi] = useVbenModal({ async onOpenChange(isOpen: boolean) { if (!isOpen) { formData.value = undefined; + formApi.resetForm(); return; } - // 加载数据 - let data = modalApi.getData< - IotProductCategoryApi.ProductCategory & { parentId?: number } - >(); - if (!data) { + + // 重置表单 + await formApi.resetForm(); + + const data = modalApi.getData(); + // 如果没有数据或没有 id,表示是新增 + if (!data || !data.id) { + formData.value = undefined; // 新增模式:设置默认值 await formApi.setValues({ sort: 0, @@ -77,23 +81,12 @@ const [Modal, modalApi] = useVbenModal({ }); return; } + + // 编辑模式:加载数据 modalApi.lock(); try { - if (data.id) { - // 编辑模式:加载完整数据 - data = await getProductCategory(data.id); - } else if (data.parentId) { - // 新增下级分类:设置父级ID - await formApi.setValues({ - parentId: data.parentId, - sort: 0, - status: 1, - }); - return; - } - // 设置到 values - formData.value = data; - await formApi.setValues(data); + formData.value = await getProductCategory(data.id); + await formApi.setValues(formData.value); } finally { modalApi.unlock(); } From b7d32e315b40824cce52cc724d0e5c4ad49f6a41 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 27 Oct 2025 08:44:07 +0800 Subject: [PATCH 03/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E3=80=91use-dict-select.ts=20=E7=9A=84=20API?= =?UTF-8?q?=20=E5=AF=BC=E5=85=A5=E9=97=AE=E9=A2=98=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=9C=A8=20import=20*?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/form-create/rules/use-dict-select.ts | 8 +++++--- .../src/components/form-create/rules/use-dict-select.ts | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/web-antd/src/components/form-create/rules/use-dict-select.ts b/apps/web-antd/src/components/form-create/rules/use-dict-select.ts index 0054cd41e..c486b6716 100644 --- a/apps/web-antd/src/components/form-create/rules/use-dict-select.ts +++ b/apps/web-antd/src/components/form-create/rules/use-dict-select.ts @@ -1,8 +1,10 @@ +import type { SystemDictTypeApi } from '#/api/system/dict/type'; + import { onMounted, ref } from 'vue'; import { buildUUID, cloneDeep } from '@vben/utils'; -import * as DictDataApi from '#/api/system/dict/type'; +import { getSimpleDictTypeList } from '#/api/system/dict/type'; import { localeProps, makeRequiredRule, @@ -18,12 +20,12 @@ export function useDictSelectRule() { const rules = cloneDeep(selectRule); const dictOptions = ref<{ label: string; value: string }[]>([]); // 字典类型下拉数据 onMounted(async () => { - const data = await DictDataApi.getSimpleDictTypeList(); + const data = await getSimpleDictTypeList(); if (!data || data.length === 0) { return; } dictOptions.value = - data?.map((item: DictDataApi.SystemDictTypeApi.DictType) => ({ + data?.map((item: SystemDictTypeApi.DictType) => ({ label: item.name, value: item.type, })) ?? []; diff --git a/apps/web-ele/src/components/form-create/rules/use-dict-select.ts b/apps/web-ele/src/components/form-create/rules/use-dict-select.ts index c9c438e8b..104277195 100644 --- a/apps/web-ele/src/components/form-create/rules/use-dict-select.ts +++ b/apps/web-ele/src/components/form-create/rules/use-dict-select.ts @@ -1,8 +1,10 @@ +import type { SystemDictTypeApi } from '#/api/system/dict/type'; + import { onMounted, ref } from 'vue'; import { buildUUID, cloneDeep } from '@vben/utils'; -import * as DictDataApi from '#/api/system/dict/type'; +import { getSimpleDictTypeList } from '#/api/system/dict/type'; import { localeProps, makeRequiredRule, @@ -18,12 +20,12 @@ export const useDictSelectRule = () => { const rules = cloneDeep(selectRule); const dictOptions = ref<{ label: string; value: string }[]>([]); // 字典类型下拉数据 onMounted(async () => { - const data = await DictDataApi.getSimpleDictTypeList(); + const data = await getSimpleDictTypeList(); if (!data || data.length === 0) { return; } dictOptions.value = - data?.map((item: DictDataApi.SystemDictTypeApi.DictType) => ({ + data?.map((item: SystemDictTypeApi.DictType) => ({ label: item.name, value: item.type, })) ?? []; From d2db16c8c6304929436bbad269c52eef79fa1e10 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 27 Oct 2025 09:13:32 +0800 Subject: [PATCH 04/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E3=80=91=E5=87=8F=E5=B0=91=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=9A=84=20import=20*=20=E7=9A=84=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/iot/ota/task/record/index.ts | 1 + .../bpm/model/form/modules/extra-setting.vue | 4 +-- .../detail/modules/operation-button.vue | 34 +++++++++++------- apps/web-antd/src/views/crm/backlog/index.vue | 36 ++++++++++--------- .../views/iot/ota/modules/detail/index.vue | 13 ++++--- .../iot/ota/modules/firmware-detail/index.vue | 13 ++++--- .../iot/ota/modules/task/OtaTaskDetail.vue | 23 ++++++------ .../iot/ota/modules/task/OtaTaskForm.vue | 9 +++-- .../iot/ota/modules/task/OtaTaskList.vue | 4 +-- .../components/product-category-select.vue | 4 +-- .../promotion/diy/page/decorate/index.vue | 9 +++-- .../promotion/diy/template/decorate/index.vue | 17 ++++----- .../statistics/product/modules/rank-card.vue | 4 +-- .../trade/afterSale/modules/disagree-form.vue | 4 +-- .../views/mall/trade/order/detail/index.vue | 25 +++++++------ .../promotion/diy/page/decorate/index.vue | 9 +++-- 16 files changed, 115 insertions(+), 94 deletions(-) diff --git a/apps/web-antd/src/api/iot/ota/task/record/index.ts b/apps/web-antd/src/api/iot/ota/task/record/index.ts index 8d41d1b74..2d66a422f 100644 --- a/apps/web-antd/src/api/iot/ota/task/record/index.ts +++ b/apps/web-antd/src/api/iot/ota/task/record/index.ts @@ -22,6 +22,7 @@ export namespace IoTOtaTaskRecordApi { } } +// TODO @AI:这里应该拿到 IoTOtaTaskRecordApi 里 /** IoT OTA 升级任务记录 */ export interface OtaTaskRecord { id?: number; diff --git a/apps/web-antd/src/views/bpm/model/form/modules/extra-setting.vue b/apps/web-antd/src/views/bpm/model/form/modules/extra-setting.vue index c07d73ff0..2a4361cba 100644 --- a/apps/web-antd/src/views/bpm/model/form/modules/extra-setting.vue +++ b/apps/web-antd/src/views/bpm/model/form/modules/extra-setting.vue @@ -26,7 +26,7 @@ import { } from 'ant-design-vue'; import dayjs from 'dayjs'; -import * as FormApi from '#/api/bpm/form'; +import { getForm } from '#/api/bpm/form'; import { HttpRequestSetting, parseFormFields, @@ -229,7 +229,7 @@ watch( () => modelData.value.formId, async (newFormId) => { if (newFormId && modelData.value.formType === BpmModelFormType.NORMAL) { - const data = await FormApi.getForm(newFormId); + const data = await getForm(newFormId); const result: Array<{ field: string; title: string }> = []; if (data.fields) { unParsedFormFields.value = data.fields; diff --git a/apps/web-antd/src/views/bpm/processInstance/detail/modules/operation-button.vue b/apps/web-antd/src/views/bpm/processInstance/detail/modules/operation-button.vue index 14179827e..d403fcb5f 100644 --- a/apps/web-antd/src/views/bpm/processInstance/detail/modules/operation-button.vue +++ b/apps/web-antd/src/views/bpm/processInstance/detail/modules/operation-button.vue @@ -4,6 +4,7 @@ import type { FormInstance } from 'ant-design-vue'; import type { Rule } from 'ant-design-vue/es/form'; import type { BpmProcessInstanceApi } from '#/api/bpm/processInstance'; +import type { SystemUserApi } from '#/api/system/user'; import { computed, nextTick, reactive, ref, watch } from 'vue'; import { useRouter } from 'vue-router'; @@ -42,8 +43,17 @@ import { cancelProcessInstanceByStartUser, getNextApprovalNodes, } from '#/api/bpm/processInstance'; -import * as TaskApi from '#/api/bpm/task'; -import * as UserApi from '#/api/system/user'; +import { + approveTask, + copyTask, + delegateTask, + getTaskListByReturn, + rejectTask, + returnTask, + signCreateTask, + signDeleteTask, + transferTask, +} from '#/api/bpm/task'; import { setConfAndFields2 } from '#/components/form-create'; import { $t } from '#/locales'; @@ -57,7 +67,7 @@ const props = defineProps<{ normalFormApi: any; // 流程表单 formCreate Api processDefinition: any; // 流程定义信息 processInstance: any; // 流程实例信息 - userOptions: UserApi.SystemUserApi.User[]; + userOptions: SystemUserApi.User[]; writableFields: string[]; // 流程表单可以编辑的字段 }>(); // 当前登录的编号 const emit = defineEmits(['success']); @@ -249,7 +259,7 @@ async function openPopover(type: string) { } if (type === 'return') { // 获取退回节点 - returnList.value = await TaskApi.getTaskListByReturn(runningTask.value.id); + returnList.value = await getTaskListByReturn(runningTask.value.id); if (returnList.value.length === 0) { message.warning('当前没有可退回的节点'); return; @@ -375,7 +385,7 @@ async function handleAudit(pass: boolean, formRef: FormInstance | undefined) { await formCreateApi.validate(); data.variables = approveForm.value.value; } - await TaskApi.approveTask(data); + await approveTask(data); popOverVisible.value.approve = false; nextAssigneesActivityNode.value = []; // 清理 Timeline 组件中的自定义审批人数据 @@ -389,7 +399,7 @@ async function handleAudit(pass: boolean, formRef: FormInstance | undefined) { id: runningTask.value.id, reason: rejectReasonForm.reason, }; - await TaskApi.rejectTask(data); + await rejectTask(data); popOverVisible.value.reject = false; message.success('审批不通过成功'); } @@ -415,7 +425,7 @@ async function handleCopy() { reason: copyForm.copyReason, copyUserIds: copyForm.copyUserIds, }; - await TaskApi.copyTask(data); + await copyTask(data); copyFormRef.value.resetFields(); popOverVisible.value.copy = false; message.success($t('ui.actionMessage.operationSuccess')); @@ -439,7 +449,7 @@ async function handleTransfer() { reason: transferForm.reason, assigneeUserId: transferForm.assigneeUserId, }; - await TaskApi.transferTask(data); + await transferTask(data); transferFormRef.value.resetFields(); popOverVisible.value.transfer = false; message.success($t('ui.actionMessage.operationSuccess')); @@ -463,7 +473,7 @@ async function handleDelegate() { reason: delegateForm.reason, delegateUserId: delegateForm.delegateUserId, }; - await TaskApi.delegateTask(data); + await delegateTask(data); popOverVisible.value.delegate = false; delegateFormRef.value.resetFields(); message.success($t('ui.actionMessage.operationSuccess')); @@ -488,7 +498,7 @@ async function handlerAddSign(type: string) { reason: addSignForm.reason, userIds: addSignForm.addSignUserIds, }; - await TaskApi.signCreateTask(data); + await signCreateTask(data); message.success($t('ui.actionMessage.operationSuccess')); addSignFormRef.value.resetFields(); popOverVisible.value.addSign = false; @@ -512,7 +522,7 @@ async function handleReturn() { reason: returnForm.returnReason, targetTaskDefinitionKey: returnForm.targetTaskDefinitionKey, }; - await TaskApi.returnTask(data); + await returnTask(data); popOverVisible.value.return = false; returnFormRef.value.resetFields(); message.success($t('ui.actionMessage.operationSuccess')); @@ -574,7 +584,7 @@ async function handlerDeleteSign() { id: deleteSignForm.deleteSignTaskId, reason: deleteSignForm.reason, }; - await TaskApi.signDeleteTask(data); + await signDeleteTask(data); message.success('减签成功'); deleteSignFormRef.value.resetFields(); popOverVisible.value.deleteSign = false; diff --git a/apps/web-antd/src/views/crm/backlog/index.vue b/apps/web-antd/src/views/crm/backlog/index.vue index 7c51c3890..b461f18a7 100644 --- a/apps/web-antd/src/views/crm/backlog/index.vue +++ b/apps/web-antd/src/views/crm/backlog/index.vue @@ -5,11 +5,18 @@ import { Page } from '@vben/common-ui'; import { Badge, Card, List } from 'ant-design-vue'; -import * as ClueApi from '#/api/crm/clue'; -import * as ContractApi from '#/api/crm/contract'; -import * as CustomerApi from '#/api/crm/customer'; -import * as ReceivableApi from '#/api/crm/receivable'; -import * as ReceivablePlanApi from '#/api/crm/receivable/plan'; +import { getFollowClueCount } from '#/api/crm/clue'; +import { + getAuditContractCount, + getRemindContractCount, +} from '#/api/crm/contract'; +import { + getFollowCustomerCount, + getPutPoolRemindCustomerCount, + getTodayContactCustomerCount, +} from '#/api/crm/customer'; +import { getAuditReceivableCount } from '#/api/crm/receivable'; +import { getReceivablePlanRemindCount } from '#/api/crm/receivable/plan'; import { useLeftSides } from './data'; import ClueFollowList from './modules/clue-follow-list.vue'; @@ -64,17 +71,14 @@ function sideClick(item: { menu: string }) { /** 获取数量 */ async function getCount() { - customerTodayContactCount.value = - await CustomerApi.getTodayContactCustomerCount(); - customerPutPoolRemindCount.value = - await CustomerApi.getPutPoolRemindCustomerCount(); - customerFollowCount.value = await CustomerApi.getFollowCustomerCount(); - clueFollowCount.value = await ClueApi.getFollowClueCount(); - contractAuditCount.value = await ContractApi.getAuditContractCount(); - contractRemindCount.value = await ContractApi.getRemindContractCount(); - receivableAuditCount.value = await ReceivableApi.getAuditReceivableCount(); - receivablePlanRemindCount.value = - await ReceivablePlanApi.getReceivablePlanRemindCount(); + customerTodayContactCount.value = await getTodayContactCustomerCount(); + customerPutPoolRemindCount.value = await getPutPoolRemindCustomerCount(); + customerFollowCount.value = await getFollowCustomerCount(); + clueFollowCount.value = await getFollowClueCount(); + contractAuditCount.value = await getAuditContractCount(); + contractRemindCount.value = await getRemindContractCount(); + receivableAuditCount.value = await getAuditReceivableCount(); + receivablePlanRemindCount.value = await getReceivablePlanRemindCount(); } /** 激活时 */ diff --git a/apps/web-antd/src/views/iot/ota/modules/detail/index.vue b/apps/web-antd/src/views/iot/ota/modules/detail/index.vue index a19a03117..ca6613146 100644 --- a/apps/web-antd/src/views/iot/ota/modules/detail/index.vue +++ b/apps/web-antd/src/views/iot/ota/modules/detail/index.vue @@ -8,8 +8,8 @@ import { formatDate } from '@vben/utils'; import { Card, Col, Descriptions, Row } from 'ant-design-vue'; -import * as IoTOtaFirmwareApi from '#/api/iot/ota/firmware'; -import * as IoTOtaTaskRecordApi from '#/api/iot/ota/task/record'; +import { getOtaFirmware } from '#/api/iot/ota/firmware'; +import { getOtaTaskRecordStatusStatistics } from '#/api/iot/ota/task/record'; import { IoTOtaTaskRecordStatusEnum } from '#/views/iot/utils/constants'; import OtaTaskList from '../task/OtaTaskList.vue'; @@ -30,7 +30,7 @@ const firmwareStatistics = ref>({}); async function getFirmwareInfo() { firmwareLoading.value = true; try { - firmware.value = await IoTOtaFirmwareApi.getOtaFirmware(firmwareId.value); + firmware.value = await getOtaFirmware(firmwareId.value); } finally { firmwareLoading.value = false; } @@ -40,10 +40,9 @@ async function getFirmwareInfo() { async function getStatistics() { firmwareStatisticsLoading.value = true; try { - firmwareStatistics.value = - await IoTOtaTaskRecordApi.getOtaTaskRecordStatusStatistics( - firmwareId.value, - ); + firmwareStatistics.value = await getOtaTaskRecordStatusStatistics( + firmwareId.value, + ); } finally { firmwareStatisticsLoading.value = false; } diff --git a/apps/web-antd/src/views/iot/ota/modules/firmware-detail/index.vue b/apps/web-antd/src/views/iot/ota/modules/firmware-detail/index.vue index 8bd43420c..04533924d 100644 --- a/apps/web-antd/src/views/iot/ota/modules/firmware-detail/index.vue +++ b/apps/web-antd/src/views/iot/ota/modules/firmware-detail/index.vue @@ -8,8 +8,8 @@ import { formatDate } from '@vben/utils'; import { Card, Col, Descriptions, Row } from 'ant-design-vue'; -import * as IoTOtaFirmwareApi from '#/api/iot/ota/firmware'; -import * as IoTOtaTaskRecordApi from '#/api/iot/ota/task/record'; +import { getOtaFirmware } from '#/api/iot/ota/firmware'; +import { getOtaTaskRecordStatusStatistics } from '#/api/iot/ota/task/record'; import { IoTOtaTaskRecordStatusEnum } from '#/views/iot/utils/constants'; import OtaTaskList from '../task/OtaTaskList.vue'; @@ -30,7 +30,7 @@ const firmwareStatistics = ref>({}); async function getFirmwareInfo() { firmwareLoading.value = true; try { - firmware.value = await IoTOtaFirmwareApi.getOtaFirmware(firmwareId.value); + firmware.value = await getOtaFirmware(firmwareId.value); } finally { firmwareLoading.value = false; } @@ -40,10 +40,9 @@ async function getFirmwareInfo() { async function getStatistics() { firmwareStatisticsLoading.value = true; try { - firmwareStatistics.value = - await IoTOtaTaskRecordApi.getOtaTaskRecordStatusStatistics( - firmwareId.value, - ); + firmwareStatistics.value = await getOtaTaskRecordStatusStatistics( + firmwareId.value, + ); } finally { firmwareStatisticsLoading.value = false; } diff --git a/apps/web-antd/src/views/iot/ota/modules/task/OtaTaskDetail.vue b/apps/web-antd/src/views/iot/ota/modules/task/OtaTaskDetail.vue index 8a19d63d7..8768c2bf6 100644 --- a/apps/web-antd/src/views/iot/ota/modules/task/OtaTaskDetail.vue +++ b/apps/web-antd/src/views/iot/ota/modules/task/OtaTaskDetail.vue @@ -21,8 +21,12 @@ import { Tag, } from 'ant-design-vue'; -import * as IoTOtaTaskApi from '#/api/iot/ota/task'; -import * as IoTOtaTaskRecordApi from '#/api/iot/ota/task/record'; +import { getOtaTask } from '#/api/iot/ota/task'; +import { + cancelOtaTaskRecord, + getOtaTaskRecordPage, + getOtaTaskRecordStatusStatistics, +} from '#/api/iot/ota/task/record'; import { IoTOtaTaskRecordStatusEnum } from '#/views/iot/utils/constants'; /** OTA 任务详情组件 */ @@ -119,7 +123,7 @@ async function getTaskInfo() { } taskLoading.value = true; try { - task.value = await IoTOtaTaskApi.getOtaTask(taskId.value); + task.value = await getOtaTask(taskId.value); } finally { taskLoading.value = false; } @@ -132,11 +136,10 @@ async function getStatistics() { } taskStatisticsLoading.value = true; try { - taskStatistics.value = - await IoTOtaTaskRecordApi.getOtaTaskRecordStatusStatistics( - undefined, - taskId.value, - ); + taskStatistics.value = await getOtaTaskRecordStatusStatistics( + undefined, + taskId.value, + ); } finally { taskStatisticsLoading.value = false; } @@ -150,7 +153,7 @@ async function getRecordList() { recordLoading.value = true; try { queryParams.taskId = taskId.value; - const data = await IoTOtaTaskRecordApi.getOtaTaskRecordPage(queryParams); + const data = await getOtaTaskRecordPage(queryParams); recordList.value = data.list || []; recordTotal.value = data.total || 0; } finally { @@ -181,7 +184,7 @@ async function handleCancelUpgrade(record: OtaTaskRecord) { content: '确认要取消该设备的升级任务吗?', async onOk() { try { - await IoTOtaTaskRecordApi.cancelOtaTaskRecord(record.id!); + await cancelOtaTaskRecord(record.id!); message.success('取消成功'); await getRecordList(); await getStatistics(); diff --git a/apps/web-antd/src/views/iot/ota/modules/task/OtaTaskForm.vue b/apps/web-antd/src/views/iot/ota/modules/task/OtaTaskForm.vue index 0971ac2ef..bb3818cc5 100644 --- a/apps/web-antd/src/views/iot/ota/modules/task/OtaTaskForm.vue +++ b/apps/web-antd/src/views/iot/ota/modules/task/OtaTaskForm.vue @@ -8,8 +8,8 @@ import { useVbenModal } from '@vben/common-ui'; import { Form, Input, message, Select, Spin } from 'ant-design-vue'; -import * as DeviceApi from '#/api/iot/device/device'; -import * as IoTOtaTaskApi from '#/api/iot/ota/task'; +import { getDeviceListByProductId } from '#/api/iot/device/device'; +import { createOtaTask } from '#/api/iot/ota/task'; import { IoTOtaTaskDeviceScopeEnum } from '#/views/iot/utils/constants'; /** IoT OTA 升级任务表单 */ @@ -82,7 +82,7 @@ const [Modal, modalApi] = useVbenModal({ try { await formRef.value.validate(); modalApi.lock(); - await IoTOtaTaskApi.createOtaTask(formData.value); + await createOtaTask(formData.value); message.success('创建成功'); await modalApi.close(); emit('success'); @@ -98,8 +98,7 @@ const [Modal, modalApi] = useVbenModal({ // 加载设备列表 formLoading.value = true; try { - devices.value = - (await DeviceApi.getDeviceListByProductId(props.productId)) || []; + devices.value = (await getDeviceListByProductId(props.productId)) || []; } finally { formLoading.value = false; } diff --git a/apps/web-antd/src/views/iot/ota/modules/task/OtaTaskList.vue b/apps/web-antd/src/views/iot/ota/modules/task/OtaTaskList.vue index 130f344fc..14f8cfa98 100644 --- a/apps/web-antd/src/views/iot/ota/modules/task/OtaTaskList.vue +++ b/apps/web-antd/src/views/iot/ota/modules/task/OtaTaskList.vue @@ -19,7 +19,7 @@ import { Tag, } from 'ant-design-vue'; -import * as IoTOtaTaskApi from '#/api/iot/ota/task'; +import { getOtaTaskPage } from '#/api/iot/ota/task'; import { IoTOtaTaskStatusEnum } from '#/views/iot/utils/constants'; import OtaTaskDetail from './OtaTaskDetail.vue'; @@ -52,7 +52,7 @@ const taskDetailRef = ref(); // 任务详情引用 async function getTaskList() { taskLoading.value = true; try { - const data = await IoTOtaTaskApi.getOtaTaskPage(queryParams); + const data = await getOtaTaskPage(queryParams); taskList.value = data.list; taskTotal.value = data.total; } finally { diff --git a/apps/web-antd/src/views/mall/product/category/components/product-category-select.vue b/apps/web-antd/src/views/mall/product/category/components/product-category-select.vue index b54c6f0d2..64904f88c 100644 --- a/apps/web-antd/src/views/mall/product/category/components/product-category-select.vue +++ b/apps/web-antd/src/views/mall/product/category/components/product-category-select.vue @@ -3,7 +3,7 @@ import { computed, onMounted, ref } from 'vue'; import { handleTree } from '@vben/utils'; -import * as ProductCategoryApi from '#/api/mall/product/category'; +import { getCategoryList } from '#/api/mall/product/category'; /** 商品分类选择组件 */ defineOptions({ name: 'ProductCategorySelect' }); @@ -43,7 +43,7 @@ const selectCategoryId = computed({ const categoryList = ref([]); // 分类树 onMounted(async () => { // 获得分类树 - const data = await ProductCategoryApi.getCategoryList({ + const data = await getCategoryList({ parentId: props.parentId, }); categoryList.value = handleTree(data, 'id', 'parentId'); diff --git a/apps/web-antd/src/views/mall/promotion/diy/page/decorate/index.vue b/apps/web-antd/src/views/mall/promotion/diy/page/decorate/index.vue index d2ba2441e..322ad56c8 100644 --- a/apps/web-antd/src/views/mall/promotion/diy/page/decorate/index.vue +++ b/apps/web-antd/src/views/mall/promotion/diy/page/decorate/index.vue @@ -6,7 +6,10 @@ import { useRoute } from 'vue-router'; import { message } from 'ant-design-vue'; -import * as DiyPageApi from '#/api/mall/promotion/diy/page'; +import { + getDiyPageProperty, + updateDiyPageProperty, +} from '#/api/mall/promotion/diy/page'; import { DiyEditor, PAGE_LIBS } from '#/views/mall/promotion/components'; /** 装修页面表单 */ @@ -23,7 +26,7 @@ async function getPageDetail(id: any) { duration: 0, }); try { - formData.value = await DiyPageApi.getDiyPageProperty(id); + formData.value = await getDiyPageProperty(id); } finally { hideLoading(); } @@ -36,7 +39,7 @@ async function submitForm() { duration: 0, }); try { - await DiyPageApi.updateDiyPageProperty(unref(formData)!); + await updateDiyPageProperty(unref(formData)!); message.success('保存成功'); } finally { hideLoading(); diff --git a/apps/web-antd/src/views/mall/promotion/diy/template/decorate/index.vue b/apps/web-antd/src/views/mall/promotion/diy/template/decorate/index.vue index efe233077..261d1f5e3 100644 --- a/apps/web-antd/src/views/mall/promotion/diy/template/decorate/index.vue +++ b/apps/web-antd/src/views/mall/promotion/diy/template/decorate/index.vue @@ -13,8 +13,11 @@ import { isEmpty } from '@vben/utils'; import { message, Radio, RadioGroup, Tooltip } from 'ant-design-vue'; -import * as DiyPageApi from '#/api/mall/promotion/diy/page'; -import * as DiyTemplateApi from '#/api/mall/promotion/diy/template'; +import { updateDiyPageProperty } from '#/api/mall/promotion/diy/page'; +import { + getDiyTemplateProperty, + updateDiyTemplateProperty, +} from '#/api/mall/promotion/diy/template'; import { DiyEditor, PAGE_LIBS } from '#/views/mall/promotion/components'; /** 装修模板表单 */ @@ -54,7 +57,7 @@ async function getPageDetail(id: any) { duration: 0, }); try { - formData.value = await DiyTemplateApi.getDiyTemplateProperty(id); + formData.value = await getDiyTemplateProperty(id); // 拼接手机预览链接 const domain = import.meta.env.VITE_MALL_H5_DOMAIN; @@ -112,20 +115,18 @@ async function submitForm() { // 情况一:基础设置 if (i === 0) { // 提交模板属性 - await DiyTemplateApi.updateDiyTemplateProperty( - isEmpty(data) ? formData.value! : data, - ); + await updateDiyTemplateProperty(isEmpty(data) ? formData.value! : data); continue; } // 提交页面属性 // 情况二:提交当前正在编辑的页面 if (currentFormData.value?.name.includes(templateItem.name)) { - await DiyPageApi.updateDiyPageProperty(currentFormData.value!); + await updateDiyPageProperty(currentFormData.value!); continue; } // 情况三:提交页面编辑缓存 if (!isEmpty(data)) { - await DiyPageApi.updateDiyPageProperty(data!); + await updateDiyPageProperty(data!); } } message.success('保存成功'); diff --git a/apps/web-antd/src/views/mall/statistics/product/modules/rank-card.vue b/apps/web-antd/src/views/mall/statistics/product/modules/rank-card.vue index a2f9fdea5..ea58c3986 100644 --- a/apps/web-antd/src/views/mall/statistics/product/modules/rank-card.vue +++ b/apps/web-antd/src/views/mall/statistics/product/modules/rank-card.vue @@ -11,7 +11,7 @@ import { formatDateTime } from '@vben/utils'; import { Card } from 'ant-design-vue'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; -import * as ProductStatisticsApi from '#/api/mall/statistics/product'; +import { getProductStatisticsRankPage } from '#/api/mall/statistics/product'; import ShortcutDateRangePicker from '#/components/shortcut-date-range-picker/shortcut-date-range-picker.vue'; /** 商品排行 */ @@ -104,7 +104,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ proxyConfig: { ajax: { query: async ({ page, sorts }) => { - return await ProductStatisticsApi.getProductStatisticsRankPage({ + return await getProductStatisticsRankPage({ pageNo: page.currentPage, pageSize: page.pageSize, times: searchTimes.value.length > 0 ? searchTimes.value : undefined, diff --git a/apps/web-antd/src/views/mall/trade/afterSale/modules/disagree-form.vue b/apps/web-antd/src/views/mall/trade/afterSale/modules/disagree-form.vue index 3fa89a4d1..434d31ec4 100644 --- a/apps/web-antd/src/views/mall/trade/afterSale/modules/disagree-form.vue +++ b/apps/web-antd/src/views/mall/trade/afterSale/modules/disagree-form.vue @@ -9,7 +9,7 @@ import { $t } from '@vben/locales'; import { message } from 'ant-design-vue'; import { useVbenForm } from '#/adapter/form'; -import * as AfterSaleApi from '#/api/mall/trade/afterSale/index'; +import { disagreeAfterSale } from '#/api/mall/trade/afterSale'; import { useDisagreeFormSchema } from '../data'; @@ -40,7 +40,7 @@ const [Modal, modalApi] = useVbenModal({ try { const data = (await formApi.getValues()) as MallAfterSaleApi.DisagreeRequest; - await AfterSaleApi.disagreeAfterSale(data); + await disagreeAfterSale(data); // 关闭并提示 await modalApi.close(); emit('success'); diff --git a/apps/web-antd/src/views/mall/trade/order/detail/index.vue b/apps/web-antd/src/views/mall/trade/order/detail/index.vue index e0e17325a..89a2a1bfa 100644 --- a/apps/web-antd/src/views/mall/trade/order/detail/index.vue +++ b/apps/web-antd/src/views/mall/trade/order/detail/index.vue @@ -18,9 +18,13 @@ import { useTabs } from '@vben/hooks'; import { Card, message, Tag } from 'ant-design-vue'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; -import * as DeliveryExpressApi from '#/api/mall/trade/delivery/express'; -import * as DeliveryPickUpStoreApi from '#/api/mall/trade/delivery/pickUpStore'; -import * as TradeOrderApi from '#/api/mall/trade/order'; +import { getSimpleDeliveryExpressList } from '#/api/mall/trade/delivery/express'; +import { getDeliveryPickUpStore } from '#/api/mall/trade/delivery/pickUpStore'; +import { + getExpressTrackList, + getOrder, + pickUpOrder, +} from '#/api/mall/trade/order'; import { useDescription } from '#/components/description'; import { DictTag } from '#/components/dict-tag'; import { TableAction } from '#/components/table-action'; @@ -157,7 +161,7 @@ const [PriceFormModal, priceFormModalApi] = useVbenModal({ async function getDetail() { loading.value = true; try { - const res = await TradeOrderApi.getOrder(orderId.value); + const res = await getOrder(orderId.value); if (res === null) { message.error('交易订单不存在'); handleBack(); @@ -169,12 +173,9 @@ async function getDetail() { // 如果配送方式为快递,则查询物流公司 if (res.deliveryType === DeliveryTypeEnum.EXPRESS.type) { - deliveryExpressList.value = - await DeliveryExpressApi.getSimpleDeliveryExpressList(); + deliveryExpressList.value = await getSimpleDeliveryExpressList(); if (res.logisticsId) { - expressTrackList.value = await TradeOrderApi.getExpressTrackList( - res.id!, - ); + expressTrackList.value = await getExpressTrackList(res.id!); expressTrackGridApi.setGridOptions({ data: expressTrackList.value || [], }); @@ -183,9 +184,7 @@ async function getDetail() { res.deliveryType === DeliveryTypeEnum.PICK_UP.type && res.pickUpStoreId ) { - pickUpStore.value = await DeliveryPickUpStoreApi.getDeliveryPickUpStore( - res.pickUpStoreId, - ); + pickUpStore.value = await getDeliveryPickUpStore(res.pickUpStoreId); } } finally { loading.value = false; @@ -217,7 +216,7 @@ const handlePickUp = async () => { duration: 0, }); try { - await TradeOrderApi.pickUpOrder(order.value.id!); + await pickUpOrder(order.value.id!); message.success('核销成功'); await getDetail(); } finally { diff --git a/apps/web-ele/src/views/mall/promotion/diy/page/decorate/index.vue b/apps/web-ele/src/views/mall/promotion/diy/page/decorate/index.vue index a15e3b99c..2dddd5941 100644 --- a/apps/web-ele/src/views/mall/promotion/diy/page/decorate/index.vue +++ b/apps/web-ele/src/views/mall/promotion/diy/page/decorate/index.vue @@ -6,7 +6,10 @@ import { useRoute } from 'vue-router'; import { ElLoading, ElMessage } from 'element-plus'; -import * as DiyPageApi from '#/api/mall/promotion/diy/page'; +import { + getDiyPageProperty, + updateDiyPageProperty, +} from '#/api/mall/promotion/diy/page'; import { DiyEditor, PAGE_LIBS } from '#/views/mall/promotion/components'; /** 装修页面表单 */ @@ -22,7 +25,7 @@ async function getPageDetail(id: any) { text: '加载中...', }); try { - formData.value = await DiyPageApi.getDiyPageProperty(id); + formData.value = await getDiyPageProperty(id); } finally { loadingInstance.close(); } @@ -34,7 +37,7 @@ async function submitForm() { text: '保存中...', }); try { - await DiyPageApi.updateDiyPageProperty(unref(formData)!); + await updateDiyPageProperty(unref(formData)!); ElMessage.success('保存成功'); } finally { loadingInstance.close(); From 86c68b5466403f4a6550999d0a12ff64d30f8e57 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 27 Oct 2025 09:34:45 +0800 Subject: [PATCH 05/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E3=80=91=E5=87=8F=E5=B0=91=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=9A=84=20import=20*=20=E7=9A=84=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/modules/member-statistics-card.vue | 8 ++--- .../mall/home/modules/operation-data-card.vue | 30 +++++++++---------- .../mall/home/modules/trade-trend-card.vue | 8 ++--- .../components/product-category-select.vue | 1 - .../components/mobile/coupon-card/index.vue | 4 +-- .../components/mobile/product-card/index.vue | 4 +-- .../components/mobile/product-list/index.vue | 4 +-- .../mobile/promotion-article/index.vue | 4 +-- .../mobile/promotion-article/property.vue | 4 +-- .../mobile/promotion-combination/index.vue | 8 ++--- .../mobile/promotion-combination/property.vue | 4 +-- .../mobile/promotion-point/index.vue | 8 ++--- .../mobile/promotion-seckill/index.vue | 8 ++--- .../components/reward-rule-coupon-select.vue | 2 +- .../views/mall/statistics/member/index.vue | 8 ++--- .../statistics/member/modules/area-card.vue | 8 ++--- .../statistics/member/modules/funnel-card.vue | 4 +-- .../statistics/member/modules/sex-card.vue | 8 ++--- .../member/modules/terminal-card.vue | 8 ++--- .../product/modules/summary-card.vue | 27 ++++++++++------- .../src/views/mall/statistics/trade/index.vue | 8 ++--- .../statistics/trade/modules/trend-card.vue | 28 ++++++++++------- .../home/modules/member-statistics-card.vue | 14 ++++----- .../mall/home/modules/operation-data-card.vue | 24 +++++++-------- .../mall/home/modules/trade-trend-card.vue | 8 ++--- .../components/product-category-select.vue | 5 ++-- .../views/mall/statistics/member/index.vue | 8 ++--- .../statistics/member/modules/area-card.vue | 8 ++--- .../statistics/member/modules/funnel-card.vue | 4 +-- .../statistics/member/modules/sex-card.vue | 8 ++--- .../member/modules/terminal-card.vue | 8 ++--- .../statistics/product/modules/rank-card.vue | 4 +-- .../product/modules/summary-card.vue | 27 +++++++++-------- .../src/views/mall/statistics/trade/index.vue | 8 ++--- .../statistics/trade/modules/trend-card.vue | 27 ++++++++++------- 35 files changed, 185 insertions(+), 164 deletions(-) diff --git a/apps/web-antd/src/views/mall/home/modules/member-statistics-card.vue b/apps/web-antd/src/views/mall/home/modules/member-statistics-card.vue index 3b7e0db48..770249117 100644 --- a/apps/web-antd/src/views/mall/home/modules/member-statistics-card.vue +++ b/apps/web-antd/src/views/mall/home/modules/member-statistics-card.vue @@ -10,7 +10,7 @@ import { EchartsUI, useEcharts } from '@vben/plugins/echarts'; import { Card, Radio, RadioGroup, Spin } from 'ant-design-vue'; import dayjs from 'dayjs'; -import * as MemberStatisticsApi from '#/api/mall/statistics/member'; +import { getMemberRegisterCountList } from '#/api/mall/statistics/member'; import { getMemberStatisticsChartOptions, @@ -71,13 +71,13 @@ async function handleTimeRangeTypeChange() { } } // 发送时间范围选中事件 - await getMemberRegisterCountList(beginTime, endTime); + await loadMemberRegisterCountList(beginTime, endTime); } -async function getMemberRegisterCountList(beginTime: Dayjs, endTime: Dayjs) { +async function loadMemberRegisterCountList(beginTime: Dayjs, endTime: Dayjs) { loading.value = true; try { - const list = await MemberStatisticsApi.getMemberRegisterCountList( + const list = await getMemberRegisterCountList( beginTime.toDate(), endTime.toDate(), ); diff --git a/apps/web-antd/src/views/mall/home/modules/operation-data-card.vue b/apps/web-antd/src/views/mall/home/modules/operation-data-card.vue index 22d9c855e..a0f46c2aa 100644 --- a/apps/web-antd/src/views/mall/home/modules/operation-data-card.vue +++ b/apps/web-antd/src/views/mall/home/modules/operation-data-card.vue @@ -6,9 +6,9 @@ import { CountTo } from '@vben/common-ui'; import { Card } from 'ant-design-vue'; -import * as ProductSpuApi from '#/api/mall/product/spu'; -import * as PayStatisticsApi from '#/api/mall/statistics/pay'; -import * as TradeStatisticsApi from '#/api/mall/statistics/trade'; +import { getTabsCount } from '#/api/mall/product/spu'; +import { getWalletRechargePrice } from '#/api/mall/statistics/pay'; +import { getOrderCount } from '#/api/mall/statistics/trade'; /** 运营数据卡片 */ defineOptions({ name: 'OperationDataCard' }); @@ -51,8 +51,8 @@ const data = reactive({ }); /** 查询订单数据 */ -async function getOrderData() { - const orderCount = await TradeStatisticsApi.getOrderCount(); +async function loadOrderData() { + const orderCount = await getOrderCount(); if (orderCount.undelivered) { data.orderUndelivered.value = orderCount.undelivered; } @@ -68,16 +68,16 @@ async function getOrderData() { } /** 查询商品数据 */ -async function getProductData() { - const productCount = await ProductSpuApi.getTabsCount(); +async function loadProductData() { + const productCount = await getTabsCount(); data.productForSale.value = productCount['0'] || 0; data.productInWarehouse.value = productCount['1'] || 0; data.productAlertStock.value = productCount['3'] || 0; } /** 查询钱包充值数据 */ -async function getWalletRechargeData() { - const paySummary = await PayStatisticsApi.getWalletRechargePrice(); +async function loadWalletRechargeData() { + const paySummary = await getWalletRechargePrice(); data.rechargePrice.value = paySummary.rechargePrice; } @@ -88,16 +88,16 @@ function handleClick(routerName: string) { /** 激活时 */ onActivated(() => { - getOrderData(); - getProductData(); - getWalletRechargeData(); + loadOrderData(); + loadProductData(); + loadWalletRechargeData(); }); /** 初始化 */ onMounted(() => { - getOrderData(); - getProductData(); - getWalletRechargeData(); + loadOrderData(); + loadProductData(); + loadWalletRechargeData(); }); diff --git a/apps/web-antd/src/views/mall/home/modules/trade-trend-card.vue b/apps/web-antd/src/views/mall/home/modules/trade-trend-card.vue index 1d5a1cf6a..2c9d72583 100644 --- a/apps/web-antd/src/views/mall/home/modules/trade-trend-card.vue +++ b/apps/web-antd/src/views/mall/home/modules/trade-trend-card.vue @@ -11,7 +11,7 @@ import { fenToYuan } from '@vben/utils'; import { Card, Radio, RadioGroup, Spin } from 'ant-design-vue'; import dayjs from 'dayjs'; -import * as TradeStatisticsApi from '#/api/mall/statistics/trade'; +import { getOrderCountTrendComparison } from '#/api/mall/statistics/trade'; import { getTradeTrendChartOptions, @@ -76,15 +76,15 @@ async function handleTimeRangeTypeChange() { } } // 发送时间范围选中事件 - await getOrderCountTrendComparison(beginTime, endTime); + await loadOrderCountTrendComparison(beginTime, endTime); } /** 查询订单数量趋势对照数据 */ -async function getOrderCountTrendComparison(beginTime: Dayjs, endTime: Dayjs) { +async function loadOrderCountTrendComparison(beginTime: Dayjs, endTime: Dayjs) { loading.value = true; try { // 1. 查询数据 - const list = await TradeStatisticsApi.getOrderCountTrendComparison( + const list = await getOrderCountTrendComparison( timeRangeType.value, beginTime.toDate(), endTime.toDate(), diff --git a/apps/web-antd/src/views/mall/product/category/components/product-category-select.vue b/apps/web-antd/src/views/mall/product/category/components/product-category-select.vue index 64904f88c..dedb2d2fa 100644 --- a/apps/web-antd/src/views/mall/product/category/components/product-category-select.vue +++ b/apps/web-antd/src/views/mall/product/category/components/product-category-select.vue @@ -42,7 +42,6 @@ const selectCategoryId = computed({ /** 初始化 */ const categoryList = ref([]); // 分类树 onMounted(async () => { - // 获得分类树 const data = await getCategoryList({ parentId: props.parentId, }); diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/coupon-card/index.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/coupon-card/index.vue index 23216b9a8..e5abe0662 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/coupon-card/index.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/coupon-card/index.vue @@ -5,7 +5,7 @@ import type { MallCouponTemplateApi } from '#/api/mall/promotion/coupon/couponTe import { onMounted, ref, watch } from 'vue'; -import * as CouponTemplateApi from '#/api/mall/promotion/coupon/couponTemplate'; + import { CouponDiscount, @@ -23,7 +23,7 @@ watch( () => props.property.couponIds, async () => { if (props.property.couponIds?.length > 0) { - couponList.value = await CouponTemplateApi.getCouponTemplateList( + couponList.value = await getCouponTemplateList( props.property.couponIds, ); } diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/index.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/index.vue index 13f1c0fbc..16f91e1e1 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/index.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/index.vue @@ -9,7 +9,7 @@ import { fenToYuan } from '@vben/utils'; import { Image } from 'ant-design-vue'; -import * as ProductSpuApi from '#/api/mall/product/spu'; +import { getSpuDetailList } from '#/api/mall/product/spu'; /** 商品卡片 */ defineOptions({ name: 'ProductCard' }); @@ -20,7 +20,7 @@ const spuList = ref([]); watch( () => props.property.spuIds, async () => { - spuList.value = await ProductSpuApi.getSpuDetailList(props.property.spuIds); + spuList.value = await getSpuDetailList(props.property.spuIds); }, { immediate: true, diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/product-list/index.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/product-list/index.vue index a1322b217..d334376ee 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/product-list/index.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/product-list/index.vue @@ -7,7 +7,7 @@ import { onMounted, ref, watch } from 'vue'; import { fenToYuan } from '@vben/utils'; -import * as ProductSpuApi from '#/api/mall/product/spu'; +import { getSpuDetailList } from '#/api/mall/product/spu'; /** 商品栏 */ defineOptions({ name: 'ProductList' }); @@ -18,7 +18,7 @@ const spuList = ref([]); watch( () => props.property.spuIds, async () => { - spuList.value = await ProductSpuApi.getSpuDetailList(props.property.spuIds); + spuList.value = await getSpuDetailList(props.property.spuIds); }, { immediate: true, diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/index.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/index.vue index 10e9f5aa3..ef8861f68 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/index.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/index.vue @@ -5,7 +5,7 @@ import type { MallArticleApi } from '#/api/mall/promotion/article'; import { ref, watch } from 'vue'; -import * as ArticleApi from '#/api/mall/promotion/article/index'; + /** 营销文章 */ defineOptions({ name: 'PromotionArticle' }); @@ -18,7 +18,7 @@ watch( () => props.property.id, async () => { if (props.property.id) { - article.value = await ArticleApi.getArticle(props.property.id); + article.value = await getArticle(props.property.id); } }, { diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/property.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/property.vue index fb6852fb2..32cc45a28 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/property.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/property.vue @@ -9,7 +9,7 @@ import { useVModel } from '@vueuse/core'; import { Form, FormItem, Select } from 'ant-design-vue'; -import * as ArticleApi from '#/api/mall/promotion/article/index'; + import ComponentContainerProperty from '../../component-container-property.vue'; @@ -27,7 +27,7 @@ const loading = ref(false); // 查询文章列表 const queryArticleList = async (title?: string) => { loading.value = true; - const { list } = await ArticleApi.getArticlePage({ + const { list } = await getArticlePage({ title, pageNo: 1, pageSize: 10, diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/index.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/index.vue index 08ff86d1e..f2ec9d50b 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/index.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/index.vue @@ -10,8 +10,8 @@ import { fenToYuan } from '@vben/utils'; import { Image } from 'ant-design-vue'; -import * as ProductSpuApi from '#/api/mall/product/spu'; -import * as CombinationActivityApi from '#/api/mall/promotion/combination/combinationActivity'; +import { getSpuDetailList } from '#/api/mall/product/spu'; +import { getCombinationActivityListByIds, getCombinationActivityPage } from '#/api/mall/promotion/combination/combinationActivity'; /** 拼团卡片 */ defineOptions({ name: 'PromotionCombination' }); @@ -34,7 +34,7 @@ watch( if (Array.isArray(activityIds) && activityIds.length > 0) { // 获取拼团活动详情列表 combinationActivityList.value = - await CombinationActivityApi.getCombinationActivityListByIds( + await getCombinationActivityListByIds( activityIds, ); @@ -44,7 +44,7 @@ watch( .map((activity) => activity.spuId) .filter((spuId): spuId is number => typeof spuId === 'number'); if (spuIdList.value.length > 0) { - spuList.value = await ProductSpuApi.getSpuDetailList(spuIdList.value); + spuList.value = await getSpuDetailList(spuIdList.value); } // 更新 SPU 的最低价格 diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/property.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/property.vue index 3732af95a..affbba5a3 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/property.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/property.vue @@ -24,7 +24,7 @@ import { Tooltip, } from 'ant-design-vue'; -import * as CombinationActivityApi from '#/api/mall/promotion/combination/combinationActivity'; +import { getCombinationActivityListByIds, getCombinationActivityPage } from '#/api/mall/promotion/combination/combinationActivity'; import UploadImg from '#/components/upload/image-upload.vue'; import CombinationShowcase from '#/views/mall/promotion/combination/components/combination-showcase.vue'; import { ColorInput } from '#/views/mall/promotion/components'; @@ -38,7 +38,7 @@ const formData = useVModel(props, 'modelValue', emit); // 活动列表 const activityList = ref([]); onMounted(async () => { - const { list } = await CombinationActivityApi.getCombinationActivityPage({ + const { list } = await getCombinationActivityPage({ pageNo: 1, pageSize: 10, status: CommonStatusEnum.ENABLE, diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-point/index.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-point/index.vue index 174b20218..676120fdc 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-point/index.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-point/index.vue @@ -9,8 +9,8 @@ import { fenToYuan } from '@vben/utils'; import { Image } from 'ant-design-vue'; -import * as ProductSpuApi from '#/api/mall/product/spu'; -import * as PointActivityApi from '#/api/mall/promotion/point'; +import { getSpuDetailList } from '#/api/mall/product/spu'; + /** 积分商城卡片 */ defineOptions({ name: 'PromotionPoint' }); @@ -31,7 +31,7 @@ watch( if (Array.isArray(activityIds) && activityIds.length > 0) { // 获取积分商城活动详情列表 pointActivityList.value = - await PointActivityApi.getPointActivityListByIds(activityIds); + await getPointActivityListByIds(activityIds); // 获取积分商城活动的 SPU 详情列表 spuList.value = []; @@ -39,7 +39,7 @@ watch( (activity) => activity.spuId, ); if (spuIdList.value.length > 0) { - spuList.value = (await ProductSpuApi.getSpuDetailList( + spuList.value = (await getSpuDetailList( spuIdList.value, )) as MallPointActivityApi.SpuExtensionWithPoint[]; } diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-seckill/index.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-seckill/index.vue index 0c1226df7..236cd4563 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-seckill/index.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-seckill/index.vue @@ -10,8 +10,8 @@ import { fenToYuan } from '@vben/utils'; import { Image } from 'ant-design-vue'; -import * as ProductSpuApi from '#/api/mall/product/spu'; -import * as SeckillActivityApi from '#/api/mall/promotion/seckill/seckillActivity'; +import { getSpuDetailList } from '#/api/mall/product/spu'; +import { getSeckillActivityListByIds } from '#/api/mall/promotion/seckill/seckillActivity'; /** 秒杀卡片 */ defineOptions({ name: 'PromotionSeckill' }); @@ -32,7 +32,7 @@ watch( if (Array.isArray(activityIds) && activityIds.length > 0) { // 获取秒杀活动详情列表 seckillActivityList.value = - await SeckillActivityApi.getSeckillActivityListByIds(activityIds); + await getSeckillActivityListByIds(activityIds); // 获取秒杀活动的 SPU 详情列表 spuList.value = []; @@ -40,7 +40,7 @@ watch( .map((activity) => activity.spuId) .filter((spuId): spuId is number => typeof spuId === 'number'); if (spuIdList.value.length > 0) { - spuList.value = await ProductSpuApi.getSpuDetailList(spuIdList.value); + spuList.value = await getSpuDetailList(spuIdList.value); } // 更新 SPU 的最低价格 diff --git a/apps/web-antd/src/views/mall/promotion/rewardActivity/components/reward-rule-coupon-select.vue b/apps/web-antd/src/views/mall/promotion/rewardActivity/components/reward-rule-coupon-select.vue index 20be01d5b..e2844fc11 100644 --- a/apps/web-antd/src/views/mall/promotion/rewardActivity/components/reward-rule-coupon-select.vue +++ b/apps/web-antd/src/views/mall/promotion/rewardActivity/components/reward-rule-coupon-select.vue @@ -55,7 +55,7 @@ async function initGiveCouponList() { // return; // } // const tempLateIds = Object.keys(rewardRule.value.giveCouponTemplateCounts); - // const data = await CouponTemplateApi.getCouponTemplateList(tempLateIds); + // const data = await getCouponTemplateList(tempLateIds); // if (!data) { // return; // } diff --git a/apps/web-antd/src/views/mall/statistics/member/index.vue b/apps/web-antd/src/views/mall/statistics/member/index.vue index da8c8b243..8ccd67237 100644 --- a/apps/web-antd/src/views/mall/statistics/member/index.vue +++ b/apps/web-antd/src/views/mall/statistics/member/index.vue @@ -8,7 +8,7 @@ import { fenToYuan } from '@vben/utils'; import { Col, Row } from 'ant-design-vue'; -import * as MemberStatisticsApi from '#/api/mall/statistics/member'; +import { getMemberSummary } from '#/api/mall/statistics/member'; import MemberAreaCard from './modules/area-card.vue'; import MemberFunnelCard from './modules/funnel-card.vue'; @@ -22,15 +22,15 @@ const loading = ref(true); // 加载中 const summary = ref(); // 会员统计数据 /** 查询会员统计 */ -async function getMemberSummary() { - summary.value = await MemberStatisticsApi.getMemberSummary(); +async function loadMemberSummary() { + summary.value = await getMemberSummary(); } /** 初始化 */ onMounted(async () => { loading.value = true; try { - await getMemberSummary(); + await loadMemberSummary(); } finally { loading.value = false; } diff --git a/apps/web-antd/src/views/mall/statistics/member/modules/area-card.vue b/apps/web-antd/src/views/mall/statistics/member/modules/area-card.vue index 9f2440ff4..dc7c67e1a 100644 --- a/apps/web-antd/src/views/mall/statistics/member/modules/area-card.vue +++ b/apps/web-antd/src/views/mall/statistics/member/modules/area-card.vue @@ -10,7 +10,7 @@ import { EchartsUI, useEcharts } from '@vben/plugins/echarts'; import { Card, Spin } from 'ant-design-vue'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; -import * as MemberStatisticsApi from '#/api/mall/statistics/member'; +import { getMemberAreaStatisticsList } from '#/api/mall/statistics/member'; import { getAreaChartOptions, getAreaTableColumns } from './area-chart-options'; @@ -44,10 +44,10 @@ const [Grid, gridApi] = useVbenVxeGrid({ }); /** 按照省份,查询会员统计列表 */ -async function getMemberAreaStatisticsList() { +async function loadMemberAreaStatisticsList() { loading.value = true; try { - const list = await MemberStatisticsApi.getMemberAreaStatisticsList(); + const list = await getMemberAreaStatisticsList(); areaStatisticsList.value = list.map( (item: MallMemberStatisticsApi.AreaStatistics) => ({ ...item, @@ -80,7 +80,7 @@ function areaReplace(areaName: string): string { /** 初始化 */ onMounted(() => { - getMemberAreaStatisticsList(); + loadMemberAreaStatisticsList(); }); diff --git a/apps/web-antd/src/views/mall/statistics/member/modules/funnel-card.vue b/apps/web-antd/src/views/mall/statistics/member/modules/funnel-card.vue index 72437d9fe..fc1a7a4a0 100644 --- a/apps/web-antd/src/views/mall/statistics/member/modules/funnel-card.vue +++ b/apps/web-antd/src/views/mall/statistics/member/modules/funnel-card.vue @@ -7,7 +7,7 @@ import { fenToYuan } from '@vben/utils'; import { Card } from 'ant-design-vue'; -import * as MemberStatisticsApi from '#/api/mall/statistics/member'; +import { getMemberAnalyse } from '#/api/mall/statistics/member'; import { ShortcutDateRangePicker } from '#/components/shortcut-date-range-picker'; /** 会员概览卡片 */ @@ -23,7 +23,7 @@ async function loadData(times: [Dayjs, Dayjs]) { } loading.value = true; try { - analyseData.value = await MemberStatisticsApi.getMemberAnalyse({ + analyseData.value = await getMemberAnalyse({ times, }); } finally { diff --git a/apps/web-antd/src/views/mall/statistics/member/modules/sex-card.vue b/apps/web-antd/src/views/mall/statistics/member/modules/sex-card.vue index 2938b8eb3..567ecc424 100644 --- a/apps/web-antd/src/views/mall/statistics/member/modules/sex-card.vue +++ b/apps/web-antd/src/views/mall/statistics/member/modules/sex-card.vue @@ -11,7 +11,7 @@ import { EchartsUI, useEcharts } from '@vben/plugins/echarts'; import { Card, Spin } from 'ant-design-vue'; -import * as MemberStatisticsApi from '#/api/mall/statistics/member'; +import { getMemberSexStatisticsList } from '#/api/mall/statistics/member'; import { getSexChartOptions } from './sex-chart-options'; @@ -23,10 +23,10 @@ const chartRef = ref(); const { renderEcharts } = useEcharts(chartRef); /** 按照性别,查询会员统计列表 */ -async function getMemberSexStatisticsList() { +async function loadMemberSexStatisticsList() { loading.value = true; try { - const list = await MemberStatisticsApi.getMemberSexStatisticsList(); + const list = await getMemberSexStatisticsList(); const dictDataList = getDictOptions(DICT_TYPE.SYSTEM_USER_SEX, 'number'); dictDataList.push({ label: '未知', value: null } as any); const chartData = dictDataList.map((dictData: any) => { @@ -49,7 +49,7 @@ async function getMemberSexStatisticsList() { /** 初始化 */ onMounted(() => { - getMemberSexStatisticsList(); + loadMemberSexStatisticsList(); }); diff --git a/apps/web-antd/src/views/mall/statistics/member/modules/terminal-card.vue b/apps/web-antd/src/views/mall/statistics/member/modules/terminal-card.vue index fc5075504..bb3103704 100644 --- a/apps/web-antd/src/views/mall/statistics/member/modules/terminal-card.vue +++ b/apps/web-antd/src/views/mall/statistics/member/modules/terminal-card.vue @@ -8,7 +8,7 @@ import { EchartsUI, useEcharts } from '@vben/plugins/echarts'; import { Card, Spin } from 'ant-design-vue'; -import * as MemberStatisticsApi from '#/api/mall/statistics/member'; +import { getMemberTerminalStatisticsList } from '#/api/mall/statistics/member'; import { getTerminalChartOptions } from './terminal-chart-options'; @@ -20,10 +20,10 @@ const chartRef = ref(); const { renderEcharts } = useEcharts(chartRef); /** 按照终端,查询会员统计列表 */ -const getMemberTerminalStatisticsList = async () => { +const loadMemberTerminalStatisticsList = async () => { loading.value = true; try { - const list = await MemberStatisticsApi.getMemberTerminalStatisticsList(); + const list = await getMemberTerminalStatisticsList(); const dictDataList = getDictOptions('terminal', 'number'); const chartData = dictDataList.map((dictData: any) => { const userCount = list.find( @@ -43,7 +43,7 @@ const getMemberTerminalStatisticsList = async () => { /** 初始化 */ onMounted(() => { - getMemberTerminalStatisticsList(); + loadMemberTerminalStatisticsList(); }); diff --git a/apps/web-antd/src/views/mall/statistics/product/modules/summary-card.vue b/apps/web-antd/src/views/mall/statistics/product/modules/summary-card.vue index dfc076368..9f2fde400 100644 --- a/apps/web-antd/src/views/mall/statistics/product/modules/summary-card.vue +++ b/apps/web-antd/src/views/mall/statistics/product/modules/summary-card.vue @@ -21,8 +21,13 @@ import { import { Button, Card, Col, Row, Spin } from 'ant-design-vue'; import dayjs from 'dayjs'; -import * as ProductStatisticsApi from '#/api/mall/statistics/product'; +import { + exportProductStatisticsExcel, + getProductStatisticsAnalyse, + getProductStatisticsList, +} from '#/api/mall/statistics/product'; import ShortcutDateRangePicker from '#/components/shortcut-date-range-picker/shortcut-date-range-picker.vue'; +import { $t } from '#/locales'; import { getProductSummaryChartOptions } from './summary-chart-options'; @@ -51,7 +56,7 @@ const calculateRelativeRate = (value?: number, reference?: number): string => { /** 处理日期范围变化 */ const handleDateRangeChange = (times?: [Dayjs, Dayjs]) => { if (times?.length !== 2) { - getProductTrendData(); + loadProductTrendData(); return; } // 处理时间: 开始与截止在同一天的, 折线图出不来, 需要延长一天 @@ -65,29 +70,29 @@ const handleDateRangeChange = (times?: [Dayjs, Dayjs]) => { ]; // 查询数据 - getProductTrendData(); + loadProductTrendData(); }; /** 处理商品状况查询 */ -const getProductTrendData = async () => { +const loadProductTrendData = async () => { trendLoading.value = true; try { - await Promise.all([getProductTrendSummary(), getProductStatisticsList()]); + await Promise.all([loadProductTrendSummary(), loadProductStatisticsList()]); } finally { trendLoading.value = false; } }; /** 查询商品状况数据统计 */ -async function getProductTrendSummary() { - trendSummary.value = await ProductStatisticsApi.getProductStatisticsAnalyse({ +async function loadProductTrendSummary() { + trendSummary.value = await getProductStatisticsAnalyse({ times: searchTimes.value.length > 0 ? searchTimes.value : undefined, }); } /** 查询商品状况数据列表 */ -async function getProductStatisticsList() { - const list = await ProductStatisticsApi.getProductStatisticsList({ +async function loadProductStatisticsList() { + const list = await getProductStatisticsList({ times: searchTimes.value.length > 0 ? searchTimes.value : undefined, }); @@ -104,7 +109,7 @@ async function handleExport() { }); // 发起导出 exportLoading.value = true; - const data = await ProductStatisticsApi.exportProductStatisticsExcel({ + const data = await exportProductStatisticsExcel({ times: searchTimes.value.length > 0 ? searchTimes.value : undefined, }); // 处理下载 @@ -125,7 +130,7 @@ async function handleExport() { - 导出 + {{ $t('page.action.export') }} diff --git a/apps/web-antd/src/views/mall/statistics/trade/index.vue b/apps/web-antd/src/views/mall/statistics/trade/index.vue index 8cc2aa71c..6e87786f9 100644 --- a/apps/web-antd/src/views/mall/statistics/trade/index.vue +++ b/apps/web-antd/src/views/mall/statistics/trade/index.vue @@ -9,7 +9,7 @@ import { fenToYuan } from '@vben/utils'; import { Col, Row } from 'ant-design-vue'; -import * as TradeStatisticsApi from '#/api/mall/statistics/trade'; +import { getTradeStatisticsSummary } from '#/api/mall/statistics/trade'; import TradeTrendCard from './modules/trend-card.vue'; @@ -31,14 +31,14 @@ function calculateRelativeRate(value?: number, reference?: number): string { } /** 查询交易统计 */ -async function getTradeStatisticsSummary() { - summary.value = await TradeStatisticsApi.getTradeStatisticsSummary(); +async function loadTradeStatisticsSummary() { + summary.value = await getTradeStatisticsSummary(); } /** 初始化 */ onMounted(async () => { loading.value = true; - await getTradeStatisticsSummary(); + await loadTradeStatisticsSummary(); loading.value = false; }); diff --git a/apps/web-antd/src/views/mall/statistics/trade/modules/trend-card.vue b/apps/web-antd/src/views/mall/statistics/trade/modules/trend-card.vue index 78117cde7..1dd4fc24b 100644 --- a/apps/web-antd/src/views/mall/statistics/trade/modules/trend-card.vue +++ b/apps/web-antd/src/views/mall/statistics/trade/modules/trend-card.vue @@ -21,8 +21,13 @@ import { import { Button, Card, Col, Row, Spin } from 'ant-design-vue'; import dayjs from 'dayjs'; -import * as TradeStatisticsApi from '#/api/mall/statistics/trade'; +import { + exportTradeStatisticsExcel, + getTradeStatisticsAnalyse, + getTradeStatisticsList, +} from '#/api/mall/statistics/trade'; import ShortcutDateRangePicker from '#/components/shortcut-date-range-picker/shortcut-date-range-picker.vue'; +import { $t } from '#/locales'; import { getTradeTrendChartOptions } from './trend-chart-options'; @@ -51,7 +56,7 @@ const calculateRelativeRate = (value?: number, reference?: number): string => { /** 处理日期范围变化 */ const handleDateRangeChange = (times?: [Dayjs, Dayjs]) => { if (times?.length !== 2) { - getTradeTrendData(); + loadTradeTrendData(); return; } // 处理时间: 开始与截止在同一天的, 折线图出不来, 需要延长一天 @@ -65,29 +70,32 @@ const handleDateRangeChange = (times?: [Dayjs, Dayjs]) => { ]; // 查询数据 - getTradeTrendData(); + loadTradeTrendData(); }; /** 处理交易状况查询 */ -async function getTradeTrendData() { +async function loadTradeTrendData() { trendLoading.value = true; try { - await Promise.all([getTradeStatisticsAnalyse(), getTradeStatisticsList()]); + await Promise.all([ + loadTradeStatisticsAnalyse(), + loadTradeStatisticsList(), + ]); } finally { trendLoading.value = false; } } /** 查询交易状况数据统计 */ -async function getTradeStatisticsAnalyse() { - trendSummary.value = await TradeStatisticsApi.getTradeStatisticsAnalyse({ +async function loadTradeStatisticsAnalyse() { + trendSummary.value = await getTradeStatisticsAnalyse({ times: searchTimes.value.length > 0 ? searchTimes.value : undefined, }); } /** 查询交易状况数据列表 */ -async function getTradeStatisticsList() { - const list = await TradeStatisticsApi.getTradeStatisticsList({ +async function loadTradeStatisticsList() { + const list = await getTradeStatisticsList({ times: searchTimes.value.length > 0 ? searchTimes.value : undefined, }); @@ -104,7 +112,7 @@ async function handleExport() { }); // 发起导出 exportLoading.value = true; - const data = await TradeStatisticsApi.exportTradeStatisticsExcel({ + const data = await exportTradeStatisticsExcel({ times: searchTimes.value.length > 0 ? searchTimes.value : undefined, }); // 处理下载 diff --git a/apps/web-ele/src/views/mall/home/modules/member-statistics-card.vue b/apps/web-ele/src/views/mall/home/modules/member-statistics-card.vue index e9e83c86e..91661214d 100644 --- a/apps/web-ele/src/views/mall/home/modules/member-statistics-card.vue +++ b/apps/web-ele/src/views/mall/home/modules/member-statistics-card.vue @@ -7,10 +7,10 @@ import { onMounted, ref } from 'vue'; import { EchartsUI, useEcharts } from '@vben/plugins/echarts'; -import { ElCard, ElRadio, ElRadioGroup } from 'element-plus'; import dayjs from 'dayjs'; +import { ElCard, ElRadio, ElRadioGroup } from 'element-plus'; -import * as MemberStatisticsApi from '#/api/mall/statistics/member'; +import { getMemberRegisterCountList } from '#/api/mall/statistics/member'; import { getMemberStatisticsChartOptions, @@ -41,7 +41,7 @@ const timeRangeConfig = { const timeRangeType = ref(TimeRangeTypeEnum.DAY30); // 日期快捷选择按钮, 默认 30 天 /** 时间范围类型单选按钮选中 */ -const handleTimeRangeTypeChange = async () => { +async function handleTimeRangeTypeChange() { // 设置时间范围 let beginTime: Dayjs; let endTime: Dayjs; @@ -71,13 +71,13 @@ const handleTimeRangeTypeChange = async () => { } } // 发送时间范围选中事件 - await getMemberRegisterCountList(beginTime, endTime); -}; + await loadMemberRegisterCountList(beginTime, endTime); +} -async function getMemberRegisterCountList(beginTime: Dayjs, endTime: Dayjs) { +async function loadMemberRegisterCountList(beginTime: Dayjs, endTime: Dayjs) { loading.value = true; try { - const list = await MemberStatisticsApi.getMemberRegisterCountList( + const list = await getMemberRegisterCountList( beginTime.toDate(), endTime.toDate(), ); diff --git a/apps/web-ele/src/views/mall/home/modules/operation-data-card.vue b/apps/web-ele/src/views/mall/home/modules/operation-data-card.vue index f193e62f1..4f6354bfe 100644 --- a/apps/web-ele/src/views/mall/home/modules/operation-data-card.vue +++ b/apps/web-ele/src/views/mall/home/modules/operation-data-card.vue @@ -6,9 +6,9 @@ import { CountTo } from '@vben/common-ui'; import { ElCard } from 'element-plus'; -import * as ProductSpuApi from '#/api/mall/product/spu'; -import * as PayStatisticsApi from '#/api/mall/statistics/pay'; -import * as TradeStatisticsApi from '#/api/mall/statistics/trade'; +import { getTabsCount } from '#/api/mall/product/spu'; +import { getWalletRechargePrice } from '#/api/mall/statistics/pay'; +import { getOrderCount } from '#/api/mall/statistics/trade'; /** 运营数据卡片 */ defineOptions({ name: 'OperationDataCard' }); @@ -51,8 +51,8 @@ const data = reactive({ }); /** 查询订单数据 */ -async function getOrderData() { - const orderCount = await TradeStatisticsApi.getOrderCount(); +async function loadOrderData() { + const orderCount = await getOrderCount(); if (orderCount.undelivered) { data.orderUndelivered.value = orderCount.undelivered; } @@ -68,16 +68,16 @@ async function getOrderData() { } /** 查询商品数据 */ -async function getProductData() { - const productCount = await ProductSpuApi.getTabsCount(); +async function loadProductData() { + const productCount = await getTabsCount(); data.productForSale.value = productCount['0'] || 0; data.productInWarehouse.value = productCount['1'] || 0; data.productAlertStock.value = productCount['3'] || 0; } /** 查询钱包充值数据 */ -async function getWalletRechargeData() { - const paySummary = await PayStatisticsApi.getWalletRechargePrice(); +async function loadWalletRechargeData() { + const paySummary = await getWalletRechargePrice(); data.rechargePrice.value = paySummary.rechargePrice; } @@ -88,9 +88,9 @@ function handleClick(routerName: string) { /** 激活时 */ onActivated(() => { - getOrderData(); - getProductData(); - getWalletRechargeData(); + loadOrderData(); + loadProductData(); + loadWalletRechargeData(); }); /** 初始化 */ diff --git a/apps/web-ele/src/views/mall/home/modules/trade-trend-card.vue b/apps/web-ele/src/views/mall/home/modules/trade-trend-card.vue index 0f63f3a9c..70bca614e 100644 --- a/apps/web-ele/src/views/mall/home/modules/trade-trend-card.vue +++ b/apps/web-ele/src/views/mall/home/modules/trade-trend-card.vue @@ -11,7 +11,7 @@ import { fenToYuan } from '@vben/utils'; import dayjs from 'dayjs'; import { ElCard, ElRadio, ElRadioGroup } from 'element-plus'; -import * as TradeStatisticsApi from '#/api/mall/statistics/trade'; +import { getOrderCountTrendComparison } from '#/api/mall/statistics/trade'; import { getTradeTrendChartOptions, @@ -76,15 +76,15 @@ async function handleTimeRangeTypeChange() { } } // 发送时间范围选中事件 - await getOrderCountTrendComparison(beginTime, endTime); + await loadOrderCountTrendComparison(beginTime, endTime); } /** 查询订单数量趋势对照数据 */ -async function getOrderCountTrendComparison(beginTime: Dayjs, endTime: Dayjs) { +async function loadOrderCountTrendComparison(beginTime: Dayjs, endTime: Dayjs) { loading.value = true; try { // 1. 查询数据 - const list = await TradeStatisticsApi.getOrderCountTrendComparison( + const list = await getOrderCountTrendComparison( timeRangeType.value, beginTime.toDate(), endTime.toDate(), diff --git a/apps/web-ele/src/views/mall/product/category/components/product-category-select.vue b/apps/web-ele/src/views/mall/product/category/components/product-category-select.vue index 441542b5d..23169691e 100644 --- a/apps/web-ele/src/views/mall/product/category/components/product-category-select.vue +++ b/apps/web-ele/src/views/mall/product/category/components/product-category-select.vue @@ -3,7 +3,7 @@ import { computed, onMounted, ref } from 'vue'; import { handleTree } from '@vben/utils'; -import * as ProductCategoryApi from '#/api/mall/product/category'; +import { getCategoryList } from '#/api/mall/product/category'; /** 商品分类选择组件 */ defineOptions({ name: 'ProductCategorySelect' }); @@ -42,8 +42,7 @@ const selectCategoryId = computed({ /** 初始化 */ const categoryList = ref([]); // 分类树 onMounted(async () => { - // 获得分类树 - const data = await ProductCategoryApi.getCategoryList({ + const data = await getCategoryList({ parentId: props.parentId, }); categoryList.value = handleTree(data, 'id', 'parentId'); diff --git a/apps/web-ele/src/views/mall/statistics/member/index.vue b/apps/web-ele/src/views/mall/statistics/member/index.vue index 8b99dbde2..5a1a9221a 100644 --- a/apps/web-ele/src/views/mall/statistics/member/index.vue +++ b/apps/web-ele/src/views/mall/statistics/member/index.vue @@ -8,7 +8,7 @@ import { fenToYuan } from '@vben/utils'; import { ElCol, ElRow } from 'element-plus'; -import * as MemberStatisticsApi from '#/api/mall/statistics/member'; +import { getMemberSummary } from '#/api/mall/statistics/member'; import MemberAreaCard from './modules/area-card.vue'; import MemberFunnelCard from './modules/funnel-card.vue'; @@ -22,15 +22,15 @@ const loading = ref(true); // 加载中 const summary = ref(); // 会员统计数据 /** 查询会员统计 */ -async function getMemberSummary() { - summary.value = await MemberStatisticsApi.getMemberSummary(); +async function loadMemberSummary() { + summary.value = await getMemberSummary(); } /** 初始化 */ onMounted(async () => { loading.value = true; try { - await getMemberSummary(); + await loadMemberSummary(); } finally { loading.value = false; } diff --git a/apps/web-ele/src/views/mall/statistics/member/modules/area-card.vue b/apps/web-ele/src/views/mall/statistics/member/modules/area-card.vue index 43d41aac7..9e2c820ed 100644 --- a/apps/web-ele/src/views/mall/statistics/member/modules/area-card.vue +++ b/apps/web-ele/src/views/mall/statistics/member/modules/area-card.vue @@ -10,7 +10,7 @@ import { EchartsUI, useEcharts } from '@vben/plugins/echarts'; import { ElCard } from 'element-plus'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; -import * as MemberStatisticsApi from '#/api/mall/statistics/member'; +import { getMemberAreaStatisticsList } from '#/api/mall/statistics/member'; import { getAreaChartOptions, getAreaTableColumns } from './area-chart-options'; @@ -44,10 +44,10 @@ const [Grid, gridApi] = useVbenVxeGrid({ }); /** 按照省份,查询会员统计列表 */ -async function getMemberAreaStatisticsList() { +async function loadMemberAreaStatisticsList() { loading.value = true; try { - const list = await MemberStatisticsApi.getMemberAreaStatisticsList(); + const list = await getMemberAreaStatisticsList(); areaStatisticsList.value = list.map( (item: MallMemberStatisticsApi.AreaStatistics) => ({ ...item, @@ -80,7 +80,7 @@ function areaReplace(areaName: string): string { /** 初始化 */ onMounted(() => { - getMemberAreaStatisticsList(); + loadMemberAreaStatisticsList(); }); diff --git a/apps/web-ele/src/views/mall/statistics/member/modules/funnel-card.vue b/apps/web-ele/src/views/mall/statistics/member/modules/funnel-card.vue index e2d3252e2..845fd8502 100644 --- a/apps/web-ele/src/views/mall/statistics/member/modules/funnel-card.vue +++ b/apps/web-ele/src/views/mall/statistics/member/modules/funnel-card.vue @@ -7,7 +7,7 @@ import { fenToYuan } from '@vben/utils'; import { ElCard } from 'element-plus'; -import * as MemberStatisticsApi from '#/api/mall/statistics/member'; +import { getMemberAnalyse } from '#/api/mall/statistics/member'; import { ShortcutDateRangePicker } from '#/components/shortcut-date-range-picker'; /** 会员概览卡片 */ @@ -23,7 +23,7 @@ async function loadData(times: [Dayjs, Dayjs]) { } loading.value = true; try { - analyseData.value = await MemberStatisticsApi.getMemberAnalyse({ + analyseData.value = await getMemberAnalyse({ times, }); } finally { diff --git a/apps/web-ele/src/views/mall/statistics/member/modules/sex-card.vue b/apps/web-ele/src/views/mall/statistics/member/modules/sex-card.vue index 54a254dee..a41d8b469 100644 --- a/apps/web-ele/src/views/mall/statistics/member/modules/sex-card.vue +++ b/apps/web-ele/src/views/mall/statistics/member/modules/sex-card.vue @@ -11,7 +11,7 @@ import { EchartsUI, useEcharts } from '@vben/plugins/echarts'; import { ElCard } from 'element-plus'; -import * as MemberStatisticsApi from '#/api/mall/statistics/member'; +import { getMemberSexStatisticsList } from '#/api/mall/statistics/member'; import { getSexChartOptions } from './sex-chart-options'; @@ -23,10 +23,10 @@ const chartRef = ref(); const { renderEcharts } = useEcharts(chartRef); /** 按照性别,查询会员统计列表 */ -async function getMemberSexStatisticsList() { +async function loadMemberSexStatisticsList() { loading.value = true; try { - const list = await MemberStatisticsApi.getMemberSexStatisticsList(); + const list = await getMemberSexStatisticsList(); const dictDataList = getDictOptions(DICT_TYPE.SYSTEM_USER_SEX, 'number'); dictDataList.push({ label: '未知', value: null } as any); const chartData = dictDataList.map((dictData: any) => { @@ -49,7 +49,7 @@ async function getMemberSexStatisticsList() { /** 初始化 */ onMounted(() => { - getMemberSexStatisticsList(); + loadMemberSexStatisticsList(); }); diff --git a/apps/web-ele/src/views/mall/statistics/member/modules/terminal-card.vue b/apps/web-ele/src/views/mall/statistics/member/modules/terminal-card.vue index 624dcf25c..50c088c19 100644 --- a/apps/web-ele/src/views/mall/statistics/member/modules/terminal-card.vue +++ b/apps/web-ele/src/views/mall/statistics/member/modules/terminal-card.vue @@ -8,7 +8,7 @@ import { EchartsUI, useEcharts } from '@vben/plugins/echarts'; import { ElCard } from 'element-plus'; -import * as MemberStatisticsApi from '#/api/mall/statistics/member'; +import { getMemberTerminalStatisticsList } from '#/api/mall/statistics/member'; import { getTerminalChartOptions } from './terminal-chart-options'; @@ -20,10 +20,10 @@ const chartRef = ref(); const { renderEcharts } = useEcharts(chartRef); /** 按照终端,查询会员统计列表 */ -const getMemberTerminalStatisticsList = async () => { +const loadMemberTerminalStatisticsList = async () => { loading.value = true; try { - const list = await MemberStatisticsApi.getMemberTerminalStatisticsList(); + const list = await getMemberTerminalStatisticsList(); const dictDataList = getDictOptions('terminal', 'number'); const chartData = dictDataList.map((dictData: any) => { const userCount = list.find( @@ -43,7 +43,7 @@ const getMemberTerminalStatisticsList = async () => { /** 初始化 */ onMounted(() => { - getMemberTerminalStatisticsList(); + loadMemberTerminalStatisticsList(); }); diff --git a/apps/web-ele/src/views/mall/statistics/product/modules/rank-card.vue b/apps/web-ele/src/views/mall/statistics/product/modules/rank-card.vue index 2c6fbca6a..0a7e34e74 100644 --- a/apps/web-ele/src/views/mall/statistics/product/modules/rank-card.vue +++ b/apps/web-ele/src/views/mall/statistics/product/modules/rank-card.vue @@ -11,7 +11,7 @@ import { formatDateTime } from '@vben/utils'; import { ElCard } from 'element-plus'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; -import * as ProductStatisticsApi from '#/api/mall/statistics/product'; +import { getProductStatisticsRankPage } from '#/api/mall/statistics/product'; import ShortcutDateRangePicker from '#/components/shortcut-date-range-picker/shortcut-date-range-picker.vue'; /** 商品排行 */ @@ -104,7 +104,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ proxyConfig: { ajax: { query: async ({ page, sorts }) => { - return await ProductStatisticsApi.getProductStatisticsRankPage({ + return await getProductStatisticsRankPage({ pageNo: page.currentPage, pageSize: page.pageSize, times: searchTimes.value.length > 0 ? searchTimes.value : undefined, diff --git a/apps/web-ele/src/views/mall/statistics/product/modules/summary-card.vue b/apps/web-ele/src/views/mall/statistics/product/modules/summary-card.vue index 38b174e81..156aace69 100644 --- a/apps/web-ele/src/views/mall/statistics/product/modules/summary-card.vue +++ b/apps/web-ele/src/views/mall/statistics/product/modules/summary-card.vue @@ -21,8 +21,13 @@ import { import dayjs from 'dayjs'; import { ElButton, ElCard, ElCol, ElRow } from 'element-plus'; -import * as ProductStatisticsApi from '#/api/mall/statistics/product'; +import { + exportProductStatisticsExcel, + getProductStatisticsAnalyse, + getProductStatisticsList, +} from '#/api/mall/statistics/product'; import ShortcutDateRangePicker from '#/components/shortcut-date-range-picker/shortcut-date-range-picker.vue'; +import { $t } from '#/locales'; import { getProductSummaryChartOptions } from './summary-chart-options'; @@ -51,7 +56,7 @@ const calculateRelativeRate = (value?: number, reference?: number): string => { /** 处理日期范围变化 */ const handleDateRangeChange = (times?: [Dayjs, Dayjs]) => { if (times?.length !== 2) { - getProductTrendData(); + loadProductTrendData(); return; } // 处理时间: 开始与截止在同一天的, 折线图出不来, 需要延长一天 @@ -65,29 +70,29 @@ const handleDateRangeChange = (times?: [Dayjs, Dayjs]) => { ]; // 查询数据 - getProductTrendData(); + loadProductTrendData(); }; /** 处理商品状况查询 */ -const getProductTrendData = async () => { +const loadProductTrendData = async () => { trendLoading.value = true; try { - await Promise.all([getProductTrendSummary(), getProductStatisticsList()]); + await Promise.all([loadProductTrendSummary(), loadProductStatisticsList()]); } finally { trendLoading.value = false; } }; /** 查询商品状况数据统计 */ -async function getProductTrendSummary() { - trendSummary.value = await ProductStatisticsApi.getProductStatisticsAnalyse({ +async function loadProductTrendSummary() { + trendSummary.value = await getProductStatisticsAnalyse({ times: searchTimes.value.length > 0 ? searchTimes.value : undefined, }); } /** 查询商品状况数据列表 */ -async function getProductStatisticsList() { - const list = await ProductStatisticsApi.getProductStatisticsList({ +async function loadProductStatisticsList() { + const list = await getProductStatisticsList({ times: searchTimes.value.length > 0 ? searchTimes.value : undefined, }); @@ -104,13 +109,11 @@ async function handleExport() { }); // 发起导出 exportLoading.value = true; - const data = await ProductStatisticsApi.exportProductStatisticsExcel({ + const data = await exportProductStatisticsExcel({ times: searchTimes.value.length > 0 ? searchTimes.value : undefined, }); // 处理下载 downloadFileFromBlobPart({ fileName: '商品状况.xlsx', source: data }); - } catch { - // 用户取消导出 } finally { exportLoading.value = false; } diff --git a/apps/web-ele/src/views/mall/statistics/trade/index.vue b/apps/web-ele/src/views/mall/statistics/trade/index.vue index 153de4d0c..334c95b95 100644 --- a/apps/web-ele/src/views/mall/statistics/trade/index.vue +++ b/apps/web-ele/src/views/mall/statistics/trade/index.vue @@ -9,7 +9,7 @@ import { fenToYuan } from '@vben/utils'; import { ElCol, ElRow } from 'element-plus'; -import * as TradeStatisticsApi from '#/api/mall/statistics/trade'; +import { getTradeStatisticsSummary } from '#/api/mall/statistics/trade'; import TradeTrendCard from './modules/trend-card.vue'; @@ -31,14 +31,14 @@ function calculateRelativeRate(value?: number, reference?: number): string { } /** 查询交易统计 */ -async function getTradeStatisticsSummary() { - summary.value = await TradeStatisticsApi.getTradeStatisticsSummary(); +async function loadTradeStatisticsSummary() { + summary.value = await getTradeStatisticsSummary(); } /** 初始化 */ onMounted(async () => { loading.value = true; - await getTradeStatisticsSummary(); + await loadTradeStatisticsSummary(); loading.value = false; }); diff --git a/apps/web-ele/src/views/mall/statistics/trade/modules/trend-card.vue b/apps/web-ele/src/views/mall/statistics/trade/modules/trend-card.vue index 0e5df93a5..3173e0bdd 100644 --- a/apps/web-ele/src/views/mall/statistics/trade/modules/trend-card.vue +++ b/apps/web-ele/src/views/mall/statistics/trade/modules/trend-card.vue @@ -21,7 +21,11 @@ import { import dayjs from 'dayjs'; import { ElButton, ElCard, ElCol, ElRow } from 'element-plus'; -import * as TradeStatisticsApi from '#/api/mall/statistics/trade'; +import { + exportTradeStatisticsExcel, + getTradeStatisticsAnalyse, + getTradeStatisticsList, +} from '#/api/mall/statistics/trade'; import ShortcutDateRangePicker from '#/components/shortcut-date-range-picker/shortcut-date-range-picker.vue'; import { getTradeTrendChartOptions } from './trend-chart-options'; @@ -51,7 +55,7 @@ const calculateRelativeRate = (value?: number, reference?: number): string => { /** 处理日期范围变化 */ const handleDateRangeChange = (times?: [Dayjs, Dayjs]) => { if (times?.length !== 2) { - getTradeTrendData(); + loadTradeTrendData(); return; } // 处理时间: 开始与截止在同一天的, 折线图出不来, 需要延长一天 @@ -65,29 +69,32 @@ const handleDateRangeChange = (times?: [Dayjs, Dayjs]) => { ]; // 查询数据 - getTradeTrendData(); + loadTradeTrendData(); }; /** 处理交易状况查询 */ -async function getTradeTrendData() { +async function loadTradeTrendData() { trendLoading.value = true; try { - await Promise.all([getTradeStatisticsAnalyse(), getTradeStatisticsList()]); + await Promise.all([ + loadTradeStatisticsAnalyse(), + loadTradeStatisticsList(), + ]); } finally { trendLoading.value = false; } } /** 查询交易状况数据统计 */ -async function getTradeStatisticsAnalyse() { - trendSummary.value = await TradeStatisticsApi.getTradeStatisticsAnalyse({ +async function loadTradeStatisticsAnalyse() { + trendSummary.value = await getTradeStatisticsAnalyse({ times: searchTimes.value.length > 0 ? searchTimes.value : undefined, }); } /** 查询交易状况数据列表 */ -async function getTradeStatisticsList() { - const list = await TradeStatisticsApi.getTradeStatisticsList({ +async function loadTradeStatisticsList() { + const list = await getTradeStatisticsList({ times: searchTimes.value.length > 0 ? searchTimes.value : undefined, }); @@ -104,7 +111,7 @@ async function handleExport() { }); // 发起导出 exportLoading.value = true; - const data = await TradeStatisticsApi.exportTradeStatisticsExcel({ + const data = await exportTradeStatisticsExcel({ times: searchTimes.value.length > 0 ? searchTimes.value : undefined, }); // 处理下载 From b262dc7303848baff5b0a02a6965834ed7b49407 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 27 Oct 2025 12:59:53 +0800 Subject: [PATCH 06/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20index.vue=20=E7=9A=84=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../promotion/components/diy-editor/index.vue | 168 +++++++++-------- .../promotion/components/diy-editor/util.ts | 61 +++---- .../promotion/components/diy-editor/index.vue | 169 +++++++++--------- .../promotion/components/diy-editor/util.ts | 61 +++---- 4 files changed, 213 insertions(+), 246 deletions(-) diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/index.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/index.vue index a3ebac5ff..bd1c87670 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/index.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/index.vue @@ -1,7 +1,7 @@ + diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/Popover/property.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/Popover/property.vue index f7d85cda2..3f479b8c2 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/Popover/property.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/Popover/property.vue @@ -1,3 +1,4 @@ + diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/coupon-card/index.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/coupon-card/index.vue index e5abe0662..39668774c 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/coupon-card/index.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/coupon-card/index.vue @@ -5,8 +5,6 @@ import type { MallCouponTemplateApi } from '#/api/mall/promotion/coupon/couponTe import { onMounted, ref, watch } from 'vue'; - - import { CouponDiscount, CouponDiscountDesc, @@ -23,9 +21,7 @@ watch( () => props.property.couponIds, async () => { if (props.property.couponIds?.length > 0) { - couponList.value = await getCouponTemplateList( - props.property.couponIds, - ); + couponList.value = await getCouponTemplateList(props.property.couponIds); } }, { diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/coupon-card/property.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/coupon-card/property.vue index 67e4a545b..3f479b8c2 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/coupon-card/property.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/coupon-card/property.vue @@ -1,5 +1,4 @@ + diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/floating-action-button/property.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/floating-action-button/property.vue index f7d85cda2..3f479b8c2 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/floating-action-button/property.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/floating-action-button/property.vue @@ -1,3 +1,4 @@ + diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/components/hot-zone-edit-dialog/index.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/components/hot-zone-edit-dialog/index.vue index df0c9d510..3f479b8c2 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/components/hot-zone-edit-dialog/index.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/components/hot-zone-edit-dialog/index.vue @@ -1,8 +1,4 @@ + diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/magic-cube/property.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/magic-cube/property.vue index ed9f0defc..3f479b8c2 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/magic-cube/property.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/magic-cube/property.vue @@ -1,6 +1,4 @@ + diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/menu-list/property.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/menu-list/property.vue index 67473946a..3f479b8c2 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/menu-list/property.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/menu-list/property.vue @@ -1,4 +1,4 @@ + diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/index.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/index.vue index cfbc7517a..e92f0a5aa 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/index.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/index.vue @@ -122,8 +122,8 @@ watch( button { width: 6px; height: 6px; - border-radius: 6px; background: #ff6000; + border-radius: 6px; } } diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/property.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/property.vue index 67e4a545b..3f479b8c2 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/property.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/property.vue @@ -1,5 +1,4 @@ + diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/components/cell-property.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/components/cell-property.vue index d922eb64a..faed4f2e9 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/components/cell-property.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/components/cell-property.vue @@ -6,13 +6,7 @@ import type { Rect } from '#/views/mall/promotion/components/magic-cube-editor/u import { computed, ref } from 'vue'; import { useVModel } from '@vueuse/core'; -import { - FormItem, - Input, - Radio, - RadioGroup, - Slider, -} from 'ant-design-vue'; +import { FormItem, Input, Radio, RadioGroup, Slider } from 'ant-design-vue'; import appNavBarMp from '#/assets/imgs/diy/app-nav-bar-mp.png'; import UploadImg from '#/components/upload/image-upload.vue'; @@ -86,7 +80,7 @@ const handleHotAreaSelected = ( @@ -140,8 +130,3 @@ const handleHotAreaSelected = ( - - - - - diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/property.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/property.vue index 21f3849af..9bca36269 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/property.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/property.vue @@ -24,7 +24,7 @@ const props = defineProps<{ modelValue: NavigationBarProperty }>(); const emit = defineEmits(['update:modelValue']); // 表单校验 -const rules = { +const rules: Record = { name: [{ required: true, message: '请输入页面名称', trigger: 'blur' }], }; diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/notice-bar/property.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/notice-bar/property.vue index 67473946a..3f479b8c2 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/notice-bar/property.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/notice-bar/property.vue @@ -1,4 +1,4 @@ + diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/page-config/property.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/page-config/property.vue index 498f334be..135d303d2 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/page-config/property.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/page-config/property.vue @@ -2,7 +2,6 @@ import type { PageConfigProperty } from './config'; import { useVModel } from '@vueuse/core'; - import { Form, FormItem, Textarea } from 'ant-design-vue'; import UploadImg from '#/components/upload/image-upload.vue'; diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/property.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/property.vue index 67e4a545b..3f479b8c2 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/property.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/property.vue @@ -1,5 +1,4 @@ + diff --git a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/product-list/property.vue b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/product-list/property.vue index 598f304d1..b61965680 100644 --- a/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/product-list/property.vue +++ b/apps/web-antd/src/views/mall/promotion/components/diy-editor/components/mobile/product-list/property.vue @@ -4,7 +4,6 @@ import type { ProductListProperty } from './config'; import { IconifyIcon } from '@vben/icons'; import { useVModel } from '@vueuse/core'; - import { Card, Checkbox, @@ -34,7 +33,11 @@ const formData = useVModel(props, 'modelValue', emit); - - From a4f7a51ba0ca45312212fb7c2954a40069d7a932 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 28 Oct 2025 19:08:39 +0800 Subject: [PATCH 23/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?editor=20=E7=9A=84=20floating-action-button=20=E7=BB=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobile/floating-action-button/config.ts | 27 +++++++------------ .../mobile/floating-action-button/index.vue | 24 +++++++---------- .../floating-action-button/property.vue | 6 ++--- 3 files changed, 23 insertions(+), 34 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/floating-action-button/config.ts b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/floating-action-button/config.ts index 22b98581c..d93b1f462 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/floating-action-button/config.ts +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/floating-action-button/config.ts @@ -1,28 +1,21 @@ import type { DiyComponent } from '../../../util'; -// 悬浮按钮属性 +/** 悬浮按钮属性 */ export interface FloatingActionButtonProperty { - // 展开方向 - direction: 'horizontal' | 'vertical'; - // 是否显示文字 - showText: boolean; - // 按钮列表 - list: FloatingActionButtonItemProperty[]; + direction: 'horizontal' | 'vertical'; // 展开方向 + showText: boolean; // 是否显示文字 + list: FloatingActionButtonItemProperty[]; // 按钮列表 } -// 悬浮按钮项属性 +/** 悬浮按钮项属性 */ export interface FloatingActionButtonItemProperty { - // 图片地址 - imgUrl: string; - // 跳转连接 - url: string; - // 文字 - text: string; - // 文字颜色 - textColor: string; + imgUrl: string; // 图片地址 + url: string; // 跳转连接 + text: string; // 文字 + textColor: string; // 文字颜色 } -// 定义组件 +/** 定义组件 */ export const component = { id: 'FloatingActionButton', name: '悬浮按钮', diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/floating-action-button/index.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/floating-action-button/index.vue index eb6563766..d0c2ae410 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/floating-action-button/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/floating-action-button/index.vue @@ -5,23 +5,20 @@ import { ref } from 'vue'; import { IconifyIcon } from '@vben/icons'; -import { ElImage, ElMessage } from 'element-plus'; +import { ElButton, ElImage } from 'element-plus'; /** 悬浮按钮 */ defineOptions({ name: 'FloatingActionButton' }); -// 定义属性 + +/** 定义属性 */ defineProps<{ property: FloatingActionButtonProperty }>(); -// 是否展开 -const expanded = ref(false); -// 处理展开/折叠 -const handleToggleFab = () => { - expanded.value = !expanded.value; -}; +const expanded = ref(false); // 是否展开 -const handleActive = (index: number) => { - ElMessage.success(`点击了${index}`); -}; +/** 处理展开/折叠 */ +function handleToggleFab() { + expanded.value = !expanded.value; +} - - From 4de005061047e46b593c891a44cbdc83a5cc8d3e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 28 Oct 2025 19:22:27 +0800 Subject: [PATCH 24/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?editor=20=E7=9A=84=20hot-zone=20=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8850%=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hot-zone-edit-dialog/controller.ts | 27 ++++--- .../components/hot-zone-edit-dialog/index.vue | 79 +++++++++++-------- .../components/mobile/hot-zone/config.ts | 29 +++---- .../components/mobile/hot-zone/index.vue | 1 + .../components/mobile/hot-zone/property.vue | 9 ++- .../views/mall/promotion/components/index.ts | 1 + 6 files changed, 77 insertions(+), 69 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/components/hot-zone-edit-dialog/controller.ts b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/components/hot-zone-edit-dialog/controller.ts index 2bac4c39e..b4000eccc 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/components/hot-zone-edit-dialog/controller.ts +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/components/hot-zone-edit-dialog/controller.ts @@ -2,10 +2,9 @@ import type { StyleValue } from 'vue'; import type { HotZoneItemProperty } from '../../config'; -// 热区的最小宽高 -export const HOT_ZONE_MIN_SIZE = 100; +export const HOT_ZONE_MIN_SIZE = 100; // 热区的最小宽高 -// 控制的类型 +/** 控制的类型 */ export enum CONTROL_TYPE_ENUM { LEFT, TOP, @@ -13,14 +12,14 @@ export enum CONTROL_TYPE_ENUM { HEIGHT, } -// 定义热区的控制点 +/** 定义热区的控制点 */ export interface ControlDot { position: string; types: CONTROL_TYPE_ENUM[]; style: StyleValue; } -// 热区的8个控制点 +/** 热区的 8 个控制点 */ export const CONTROL_DOT_LIST = [ { position: '左上角', @@ -98,10 +97,10 @@ export const CONTROL_DOT_LIST = [ ] as ControlDot[]; // region 热区的缩放 -// 热区的缩放比例 -export const HOT_ZONE_SCALE_RATE = 2; -// 缩小:缩回适合手机屏幕的大小 -export const zoomOut = (list?: HotZoneItemProperty[]) => { +export const HOT_ZONE_SCALE_RATE = 2; // 热区的缩放比例 + +/** 缩小:缩回适合手机屏幕的大小 */ +export function zoomOut(list?: HotZoneItemProperty[]) { return ( list?.map((hotZone) => ({ ...hotZone, @@ -111,9 +110,10 @@ export const zoomOut = (list?: HotZoneItemProperty[]) => { height: (hotZone.height /= HOT_ZONE_SCALE_RATE), })) || [] ); -}; -// 放大:作用是为了方便在电脑屏幕上编辑 -export const zoomIn = (list?: HotZoneItemProperty[]) => { +} + +/** 放大:作用是为了方便在电脑屏幕上编辑 */ +export function zoomIn(list?: HotZoneItemProperty[]) { return ( list?.map((hotZone) => ({ ...hotZone, @@ -123,7 +123,8 @@ export const zoomIn = (list?: HotZoneItemProperty[]) => { height: (hotZone.height *= HOT_ZONE_SCALE_RATE), })) || [] ); -}; +} + // endregion /** diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/components/hot-zone-edit-dialog/index.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/components/hot-zone-edit-dialog/index.vue index f59459a3f..ee2b85a08 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/components/hot-zone-edit-dialog/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/components/hot-zone-edit-dialog/index.vue @@ -10,6 +10,8 @@ import { IconifyIcon } from '@vben/icons'; import { ElButton, ElDialog, ElImage } from 'element-plus'; +import { AppLinkSelectDialog } from '#/views/mall/promotion/components'; + import { CONTROL_DOT_LIST, CONTROL_TYPE_ENUM, @@ -22,7 +24,7 @@ import { /** 热区编辑对话框 */ defineOptions({ name: 'HotZoneEditDialog' }); -// 定义属性 +/** 定义属性 */ const props = defineProps({ modelValue: { type: Array, @@ -33,51 +35,53 @@ const props = defineProps({ default: '', }, }); + const emit = defineEmits(['update:modelValue']); + const formData = ref([]); -// 弹窗的是否显示 -const dialogVisible = ref(false); -// 打开弹窗 +const dialogVisible = ref(false); // 弹窗的是否显示 + +/** 打开弹窗 */ const open = () => { // 放大 formData.value = zoomIn(props.modelValue); dialogVisible.value = true; }; -// 提供 open 方法,用于打开弹窗 -defineExpose({ open }); -// 热区容器 -const container = ref(); +defineExpose({ open }); // 提供 open 方法,用于打开弹窗 -// 增加热区 -const handleAdd = () => { +const container = ref(); // 热区容器 + +/** 增加热区 */ +function handleAdd() { formData.value.push({ width: HOT_ZONE_MIN_SIZE, height: HOT_ZONE_MIN_SIZE, top: 0, left: 0, } as HotZoneItemProperty); -}; -// 删除热区 -const handleRemove = (hotZone: HotZoneItemProperty) => { - formData.value = formData.value.filter((item) => item !== hotZone); -}; +} -// 移动热区 -const handleMove = (item: HotZoneItemProperty, e: MouseEvent) => { +/** 删除热区 */ +function handleRemove(hotZone: HotZoneItemProperty) { + formData.value = formData.value.filter((item) => item !== hotZone); +} + +/** 移动热区 */ +function handleMove(item: HotZoneItemProperty, e: MouseEvent) { useDraggable(item, e, (left, top, _, __, moveWidth, moveHeight) => { setLeft(item, left + moveWidth); setTop(item, top + moveHeight); }); -}; +} -// 调整热区大小、位置 -const handleResize = ( +/** 调整热区大小、位置 */ +function handleResize( item: HotZoneItemProperty, ctrlDot: ControlDot, e: MouseEvent, -) => { +) { useDraggable(item, e, (left, top, width, height, moveWidth, moveHeight) => { ctrlDot.types.forEach((type) => { switch (type) { @@ -112,23 +116,25 @@ const handleResize = ( } }); }); -}; +} -// 设置X轴坐标 -const setLeft = (item: HotZoneItemProperty, left: number) => { +/** 设置 X 轴坐标 */ +function setLeft(item: HotZoneItemProperty, left: number) { // 不能超出容器 if (left >= 0 && left <= container.value!.offsetWidth - item.width) { item.left = left; } -}; -// 设置Y轴坐标 -const setTop = (item: HotZoneItemProperty, top: number) => { +} + +/** 设置Y轴坐标 */ +function setTop(item: HotZoneItemProperty, top: number) { // 不能超出容器 if (top >= 0 && top <= container.value!.offsetHeight - item.height) { item.top = top; } -}; -// 设置宽度 +} + +/** 设置宽度 */ const setWidth = (item: HotZoneItemProperty, width: number) => { // 不能小于最小宽度 && 不能超出容器右边 if ( @@ -138,7 +144,8 @@ const setWidth = (item: HotZoneItemProperty, width: number) => { item.width = width; } }; -// 设置高度 + +/** 设置高度 */ const setHeight = (item: HotZoneItemProperty, height: number) => { // 不能小于最小高度 && 不能超出容器底部 if ( @@ -149,13 +156,12 @@ const setHeight = (item: HotZoneItemProperty, height: number) => { } }; -// 处理对话框关闭 +/** 处理对话框关闭 */ const handleSubmit = () => { - // 会自动触发handleClose dialogVisible.value = false; }; -// 处理对话框关闭 +/** 处理对话框关闭 */ const handleClose = () => { // 缩小 const list = zoomOut(formData.value); @@ -164,12 +170,16 @@ const handleClose = () => { const activeHotZone = ref(); const appLinkDialogRef = ref(); + const handleShowAppLinkDialog = (hotZone: HotZoneItemProperty) => { activeHotZone.value = hotZone; appLinkDialogRef.value.open(hotZone.url); }; + const handleAppLinkChange = (appLink: AppLink) => { - if (!appLink || !activeHotZone.value) return; + if (!appLink || !activeHotZone.value) { + return; + } activeHotZone.value.name = appLink.name; activeHotZone.value.url = appLink.path; }; @@ -231,6 +241,7 @@ const handleAppLinkChange = (appLink: AppLink) => { + (); diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/property.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/property.vue index bb3ebb667..9702db917 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/property.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/property.vue @@ -15,12 +15,14 @@ import HotZoneEditDialog from './components/hot-zone-edit-dialog/index.vue'; defineOptions({ name: 'HotZoneProperty' }); const props = defineProps<{ modelValue: HotZoneProperty }>(); + const emit = defineEmits(['update:modelValue']); + const formData = useVModel(props, 'modelValue', emit); -// 热区编辑对话框 -const editDialogRef = ref(); -// 打开热区编辑对话框 +const editDialogRef = ref(); // 热区编辑对话框 + +/** 打开热区编辑对话框 */ const handleOpenEditDialog = () => { editDialogRef.value.open(); }; @@ -49,6 +51,7 @@ const handleOpenEditDialog = () => { 设置热区 + Date: Tue, 28 Oct 2025 20:22:53 +0800 Subject: [PATCH 25/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?editor=20=E7=9A=84=20app-link-input=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8850%=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/app-link-input/index.vue | 25 +++++++++++++------ ...nk-select-dialog.vue => select-dialog.vue} | 15 +++++++---- .../views/mall/promotion/components/index.ts | 2 +- 3 files changed, 28 insertions(+), 14 deletions(-) rename apps/web-ele/src/views/mall/promotion/components/app-link-input/{app-link-select-dialog.vue => select-dialog.vue} (98%) diff --git a/apps/web-ele/src/views/mall/promotion/components/app-link-input/index.vue b/apps/web-ele/src/views/mall/promotion/components/app-link-input/index.vue index 2118dda5b..e1060efaa 100644 --- a/apps/web-ele/src/views/mall/promotion/components/app-link-input/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/app-link-input/index.vue @@ -1,14 +1,15 @@ diff --git a/apps/web-ele/src/views/mall/promotion/components/app-link-input/app-link-select-dialog.vue b/apps/web-ele/src/views/mall/promotion/components/app-link-input/select-dialog.vue similarity index 98% rename from apps/web-ele/src/views/mall/promotion/components/app-link-input/app-link-select-dialog.vue rename to apps/web-ele/src/views/mall/promotion/components/app-link-input/select-dialog.vue index b2362962a..7962dc165 100644 --- a/apps/web-ele/src/views/mall/promotion/components/app-link-input/app-link-select-dialog.vue +++ b/apps/web-ele/src/views/mall/promotion/components/app-link-input/select-dialog.vue @@ -39,9 +39,10 @@ const detailSelectDialog = ref<{ type: undefined, }); // 详情选择对话框 -/** 打开弹窗 */ const dialogVisible = ref(false); -const open = (link: string) => { + +/** 打开弹窗 */ +function open(link: string) { activeAppLink.value.path = link; dialogVisible.value = true; // 滚动到当前的链接 @@ -55,14 +56,16 @@ const open = (link: string) => { }), ); if (group) { + // TODO @AI:await 方式; // 使用 nextTick 的原因:可能 Dom 还没生成,导致滚动失败 nextTick(() => handleGroupSelected(group.name)); } -}; +} + defineExpose({ open }); /** 处理 APP 链接选中 */ -const handleAppLinkSelected = (appLink: AppLink) => { +function handleAppLinkSelected(appLink: AppLink) { if (!isSameLink(appLink.path, activeAppLink.value.path)) { activeAppLink.value = appLink; } @@ -82,7 +85,7 @@ const handleAppLinkSelected = (appLink: AppLink) => { break; } } -}; +} function handleSubmit() { dialogVisible.value = false; @@ -92,6 +95,7 @@ function handleSubmit() { /** * 处理右侧链接列表滚动 + * * @param {object} param0 滚动事件参数 * @param {number} param0.scrollTop 滚动条的位置 */ @@ -214,6 +218,7 @@ function handleProductCategorySelected(id: number) { 取 消 + Date: Tue, 28 Oct 2025 20:31:12 +0800 Subject: [PATCH 26/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?editor=20=E7=9A=84=20hot-zone=20=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8870%=EF=BC=89=E4=BD=BF=E7=94=A8=20Modal=20?= =?UTF-8?q?=E6=9B=BF=E4=BB=A3=20el-dialog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/hot-zone-edit-dialog/index.vue | 44 ++++++++----------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/components/hot-zone-edit-dialog/index.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/components/hot-zone-edit-dialog/index.vue index ee2b85a08..175f36866 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/components/hot-zone-edit-dialog/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/hot-zone/components/hot-zone-edit-dialog/index.vue @@ -6,9 +6,10 @@ import type { AppLink } from '#/views/mall/promotion/components/app-link-input/d import { ref } from 'vue'; +import { useVbenModal } from '@vben/common-ui'; import { IconifyIcon } from '@vben/icons'; -import { ElButton, ElDialog, ElImage } from 'element-plus'; +import { ElButton, ElImage } from 'element-plus'; import { AppLinkSelectDialog } from '#/views/mall/promotion/components'; @@ -40,14 +41,19 @@ const emit = defineEmits(['update:modelValue']); const formData = ref([]); -const dialogVisible = ref(false); // 弹窗的是否显示 +const [Modal, modalApi] = useVbenModal({ + onClosed() { + const list = zoomOut(formData.value); + emit('update:modelValue', list); + }, +}); /** 打开弹窗 */ -const open = () => { +function open() { // 放大 formData.value = zoomIn(props.modelValue); - dialogVisible.value = true; -}; + modalApi.open(); +} defineExpose({ open }); // 提供 open 方法,用于打开弹窗 @@ -156,16 +162,9 @@ const setHeight = (item: HotZoneItemProperty, height: number) => { } }; -/** 处理对话框关闭 */ +/** 处理对话框确定 */ const handleSubmit = () => { - dialogVisible.value = false; -}; - -/** 处理对话框关闭 */ -const handleClose = () => { - // 缩小 - const list = zoomOut(formData.value); - emit('update:modelValue', list); + modalApi.close(); }; const activeHotZone = ref(); @@ -186,12 +185,7 @@ const handleAppLinkChange = (appLink: AppLink) => { - + Date: Tue, 28 Oct 2025 21:03:18 +0800 Subject: [PATCH 27/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?editor=20=E7=9A=84=20hot-zone=20=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8870%=EF=BC=89=E4=BD=BF=E7=94=A8=20Modal=20?= =?UTF-8?q?=E6=9B=BF=E4=BB=A3=20el-dialog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app-link-input/select-dialog.vue | 65 +++++++++---------- 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/app-link-input/select-dialog.vue b/apps/web-ele/src/views/mall/promotion/components/app-link-input/select-dialog.vue index 7962dc165..818f8764b 100644 --- a/apps/web-ele/src/views/mall/promotion/components/app-link-input/select-dialog.vue +++ b/apps/web-ele/src/views/mall/promotion/components/app-link-input/select-dialog.vue @@ -5,9 +5,10 @@ import type { AppLink } from './data'; import { nextTick, ref } from 'vue'; +import { useVbenModal } from '@vben/common-ui'; import { getUrlNumberValue } from '@vben/utils'; -import { ElScrollbar } from 'element-plus'; +import { ElButton, ElScrollbar, ElTooltip } from 'element-plus'; import ProductCategorySelect from '#/views/mall/product/category/components/product-category-select.vue'; @@ -39,12 +40,20 @@ const detailSelectDialog = ref<{ type: undefined, }); // 详情选择对话框 -const dialogVisible = ref(false); +const [Modal, modalApi] = useVbenModal({ + onConfirm() { + emit('change', activeAppLink.value.path); + emit('appLinkChange', activeAppLink.value); + modalApi.close(); + }, +}); + +defineExpose({ open }); /** 打开弹窗 */ -function open(link: string) { +async function open(link: string) { activeAppLink.value.path = link; - dialogVisible.value = true; + modalApi.open(); // 滚动到当前的链接 const group = APP_LINK_GROUP_LIST.find((group) => group.links.some((linkItem) => { @@ -56,14 +65,12 @@ function open(link: string) { }), ); if (group) { - // TODO @AI:await 方式; // 使用 nextTick 的原因:可能 Dom 还没生成,导致滚动失败 - nextTick(() => handleGroupSelected(group.name)); + await nextTick(); + handleGroupSelected(group.name); } } -defineExpose({ open }); - /** 处理 APP 链接选中 */ function handleAppLinkSelected(appLink: AppLink) { if (!isSameLink(appLink.path, activeAppLink.value.path)) { @@ -87,12 +94,6 @@ function handleAppLinkSelected(appLink: AppLink) { } } -function handleSubmit() { - dialogVisible.value = false; - emit('change', activeAppLink.value.path); - emit('appLinkChange', activeAppLink.value); -} - /** * 处理右侧链接列表滚动 * @@ -156,15 +157,17 @@ function handleProductCategorySelected(id: number) { } - From 05dc2c7eb2ddf6015fa448700b526d475f3f92ec Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 28 Oct 2025 22:56:01 +0800 Subject: [PATCH 28/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?editor=20=E7=9A=84=20hot-zone=20=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8880%=EF=BC=89=E8=BF=9B=E4=B8=80=E6=AD=A5?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=20Modal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/app-link-input/select-dialog.vue | 8 +++----- .../components/hot-zone-edit-dialog/index.vue | 15 ++++----------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/app-link-input/select-dialog.vue b/apps/web-ele/src/views/mall/promotion/components/app-link-input/select-dialog.vue index 818f8764b..445060aee 100644 --- a/apps/web-ele/src/views/mall/promotion/components/app-link-input/select-dialog.vue +++ b/apps/web-ele/src/views/mall/promotion/components/app-link-input/select-dialog.vue @@ -48,8 +48,6 @@ const [Modal, modalApi] = useVbenModal({ }, }); -defineExpose({ open }); - /** 打开弹窗 */ async function open(link: string) { activeAppLink.value.path = link; @@ -71,6 +69,8 @@ async function open(link: string) { } } +defineExpose({ open }); + /** 处理 APP 链接选中 */ function handleAppLinkSelected(appLink: AppLink) { if (!isSameLink(appLink.path, activeAppLink.value.path)) { @@ -139,7 +139,7 @@ function scrollToGroupBtn(group: string) { /** 是否为相同的链接(不比较参数,只比较链接) */ function isSameLink(link1: string, link2: string) { - return link2 ? link1.split('?')[0] === link2.split('?')[0] : false; + return link2 ? link1?.split('?')[0] === link2.split('?')[0] : false; } /** 处理详情选择 */ @@ -166,7 +166,6 @@ function handleProductCategorySelected(id: number) { view-class="flex flex-col" class="border-r border-gray-200 pr-2" > - - ([]); const [Modal, modalApi] = useVbenModal({ - onClosed() { + showCancelButton: false, + onConfirm() { const list = zoomOut(formData.value); emit('update:modelValue', list); + modalApi.close(); }, }); @@ -162,11 +164,6 @@ const setHeight = (item: HotZoneItemProperty, height: number) => { } }; -/** 处理对话框确定 */ -const handleSubmit = () => { - modalApi.close(); -}; - const activeHotZone = ref(); const appLinkDialogRef = ref(); @@ -224,15 +221,11 @@ const handleAppLinkChange = (appLink: AppLink) => { > - - - From fa383159ea89af03414dfc77befc853caf35ac1b Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 29 Oct 2025 09:52:01 +0800 Subject: [PATCH 31/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?editor=20=E7=9A=84=20magic-cube=20=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/mobile/magic-cube/config.ts | 41 +++++++------------ .../components/mobile/magic-cube/index.vue | 8 ++-- .../components/mobile/magic-cube/property.vue | 10 ++--- 3 files changed, 23 insertions(+), 36 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/magic-cube/config.ts b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/magic-cube/config.ts index ef03fc9a6..13b1c4721 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/magic-cube/config.ts +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/magic-cube/config.ts @@ -2,39 +2,26 @@ import type { ComponentStyle, DiyComponent } from '../../../util'; /** 广告魔方属性 */ export interface MagicCubeProperty { - // 上圆角 - borderRadiusTop: number; - // 下圆角 - borderRadiusBottom: number; - // 间隔 - space: number; - // 导航菜单列表 - list: MagicCubeItemProperty[]; - // 组件样式 - style: ComponentStyle; + borderRadiusTop: number; // 上圆角 + borderRadiusBottom: number; // 下圆角 + space: number; // 间隔 + list: MagicCubeItemProperty[]; // 导航菜单列表 + style: ComponentStyle; // 组件样式 } /** 广告魔方项目属性 */ export interface MagicCubeItemProperty { - // 图标链接 - imgUrl: string; - // 链接 - url: string; - // 宽 - width: number; - // 高 - height: number; - // 上 - top: number; - // 左 - left: number; - // 右 - right: number; - // 下 - bottom: number; + imgUrl: string; // 图标链接 + url: string; // 链接 + width: number; // 宽 + height: number; // 高 + top: number; // 上 + left: number; // 左 + right: number; // 右 + bottom: number; // 下 } -// 定义组件 +/** 定义组件 */ export const component = { id: 'MagicCube', name: '广告魔方', diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/magic-cube/index.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/magic-cube/index.vue index 5a3aa7e57..1965bde82 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/magic-cube/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/magic-cube/index.vue @@ -9,9 +9,11 @@ import { ElImage } from 'element-plus'; /** 广告魔方 */ defineOptions({ name: 'MagicCube' }); + const props = defineProps<{ property: MagicCubeProperty }>(); -// 一个方块的大小 -const CUBE_SIZE = 93.75; + +const CUBE_SIZE = 93.75; // 一个方块的大小 + /** * 计算方块的行数 * 行数用于计算魔方的总体高度,存在以下情况: @@ -80,5 +82,3 @@ const rowCount = computed(() => { - - diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/magic-cube/property.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/magic-cube/property.vue index 1f23095c6..ddccd8d0f 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/magic-cube/property.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/magic-cube/property.vue @@ -18,11 +18,14 @@ import ComponentContainerProperty from '../../component-container-property.vue'; defineOptions({ name: 'MagicCubeProperty' }); const props = defineProps<{ modelValue: MagicCubeProperty }>(); + const emit = defineEmits(['update:modelValue']); + const formData = useVModel(props, 'modelValue', emit); -// 选中的热区 -const selectedHotAreaIndex = ref(-1); +const selectedHotAreaIndex = ref(-1); // 选中的热区 + +/** 处理热区被选中事件 */ const handleHotAreaSelected = (_: any, index: number) => { selectedHotAreaIndex.value = index; }; @@ -30,7 +33,6 @@ const handleHotAreaSelected = (_: any, index: number) => { - - From cb9fc7ad3ff80b704f9aeaa51c77bc1dfe3e6a3b Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 29 Oct 2025 13:56:10 +0800 Subject: [PATCH 32/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?editor=20=E7=9A=84=20magic-cube-editor=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/magic-cube-editor/index.vue | 58 +++++++++---------- .../components/magic-cube-editor/util.ts | 38 ++++++------ 2 files changed, 43 insertions(+), 53 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/magic-cube-editor/index.vue b/apps/web-ele/src/views/mall/promotion/components/magic-cube-editor/index.vue index d260ded9c..0e30219f3 100644 --- a/apps/web-ele/src/views/mall/promotion/components/magic-cube-editor/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/magic-cube-editor/index.vue @@ -7,16 +7,16 @@ import { IconifyIcon } from '@vben/icons'; import { createRect, isContains, isOverlap } from './util'; -// TODO @AI: 改成标准注释 -// 魔方编辑器 -// 有两部分组成: -// 1. 魔方矩阵:位于底层,由方块组件的二维表格,用于创建热区 -// 操作方法: -// 1.1 点击其中一个方块就会进入热区选择模式 -// 1.2 再次点击另外一个方块时,结束热区选择模式 -// 1.3 在两个方块中间的区域创建热区 -// 如果两次点击的都是同一方块,就只创建一个格子的热区 -// 2. 热区:位于顶层,采用绝对定位,覆盖在魔方矩阵上面。 +/** + * 魔方编辑器,有两部分组成: + * 1. 魔方矩阵:位于底层,由方块组件的二维表格,用于创建热区 + * 操作方法: + * 1.1 点击其中一个方块就会进入热区选择模式 + * 1.2 再次点击另外一个方块时,结束热区选择模式 + * 1.3 在两个方块中间的区域创建热区 + * 如果两次点击的都是同一方块,就只创建一个格子的热区 + * 2. 热区:位于顶层,采用绝对定位,覆盖在魔方矩阵上面。 + */ defineOptions({ name: 'MagicCubeEditor' }); /** 定义属性 */ @@ -29,12 +29,10 @@ const props = defineProps({ type: Number, default: 4, }, // 行数,默认 4 行 - cols: { type: Number, default: 4, }, // 列数,默认 4 列 - cubeSize: { type: Number, default: 75, @@ -70,6 +68,7 @@ watch( ); const hotAreas = ref([]); // 热区列表 + /** 初始化热区 */ watch( () => props.modelValue, @@ -86,20 +85,20 @@ const isHotAreaSelectMode = () => !!hotAreaBeginCube.value; // 是否开启了 * @param currentRow 当前行号 * @param currentCol 当前列号 */ -const handleCubeClick = (currentRow: number, currentCol: number) => { +function handleCubeClick(currentRow: number, currentCol: number) { const currentCube = cubes.value[currentRow]?.[currentCol]; if (!currentCube) { return; } - // 情况1:进入热区选择模式 + // 情况 1:进入热区选择模式 if (!isHotAreaSelectMode()) { hotAreaBeginCube.value = currentCube; hotAreaBeginCube.value!.active = true; return; } - // 情况2:结束热区选择模式 + // 情况 2:结束热区选择模式 hotAreas.value.push(createRect(hotAreaBeginCube.value!, currentCube)); // 结束热区选择模式 exitHotAreaSelectMode(); @@ -111,7 +110,7 @@ const handleCubeClick = (currentRow: number, currentCol: number) => { } // 发送热区变动通知 emitUpdateModelValue(); -}; +} /** * 处理鼠标经过方块 @@ -119,7 +118,7 @@ const handleCubeClick = (currentRow: number, currentCol: number) => { * @param currentRow 当前行号 * @param currentCol 当前列号 */ -const handleCellHover = (currentRow: number, currentCol: number) => { +function handleCellHover(currentRow: number, currentCol: number) { // 当前没有进入热区选择模式 if (!isHotAreaSelectMode()) { return; @@ -138,7 +137,6 @@ const handleCellHover = (currentRow: number, currentCol: number) => { if (isOverlap(hotArea, currentSelectedArea)) { // 结束热区选择模式 exitHotAreaSelectMode(); - return; } } @@ -147,13 +145,9 @@ const handleCellHover = (currentRow: number, currentCol: number) => { eachCube((_, __, cube) => { cube.active = isContains(currentSelectedArea, cube); }); -}; +} -/** - * 处理热区删除 - * - * @param index 热区索引 - */ +/** 处理热区删除 */ function handleDeleteHotArea(index: number) { hotAreas.value.splice(index, 1); // 结束热区选择模式 @@ -165,14 +159,14 @@ function handleDeleteHotArea(index: number) { const emitUpdateModelValue = () => emit('update:modelValue', hotAreas.value); // 发送热区变动通知 const selectedHotAreaIndex = ref(0); // 热区选中 -const handleHotAreaSelected = (hotArea: Rect, index: number) => { + +/** 处理热区选中 */ +function handleHotAreaSelected(hotArea: Rect, index: number) { selectedHotAreaIndex.value = index; emit('hotAreaSelected', hotArea, index); -}; +} -/** - * 结束热区选择模式 - */ +/** 结束热区选择模式 */ function exitHotAreaSelectMode() { // 移除方块激活标记 eachCube((_, __, cube) => { @@ -246,9 +240,9 @@ const eachCube = (callback: (x: number, y: number, cube: Cube) => void) => { > - {{ - `${hotArea.width}×${hotArea.height}` - }} + + {{ `${hotArea.width}×${hotArea.height}`}} + diff --git a/apps/web-ele/src/views/mall/promotion/components/magic-cube-editor/util.ts b/apps/web-ele/src/views/mall/promotion/components/magic-cube-editor/util.ts index 1ee8fb5a4..152ce0cbe 100644 --- a/apps/web-ele/src/views/mall/promotion/components/magic-cube-editor/util.ts +++ b/apps/web-ele/src/views/mall/promotion/components/magic-cube-editor/util.ts @@ -1,52 +1,49 @@ -// 坐标点 +/** 坐标点 */ export interface Point { x: number; y: number; } -// 矩形 +/** 矩形 */ export interface Rect { - // 左上角 X 轴坐标 - left: number; - // 左上角 Y 轴坐标 - top: number; - // 右下角 X 轴坐标 - right: number; - // 右下角 Y 轴坐标 - bottom: number; - // 矩形宽度 - width: number; - // 矩形高度 - height: number; + left: number; // 左上角 X 轴坐标 + top: number; // 左上角 Y 轴坐标 + right: number; // 右下角 X 轴坐标 + bottom: number; // 右下角 Y 轴坐标 + width: number; // 矩形宽度 + height: number; // 矩形高度 } /** * 判断两个矩形是否重叠 + * * @param a 矩形 A * @param b 矩形 B */ -export const isOverlap = (a: Rect, b: Rect): boolean => { +export function isOverlap(a: Rect, b: Rect): boolean { return ( a.left < b.left + b.width && a.left + a.width > b.left && a.top < b.top + b.height && a.height + a.top > b.top ); -}; +} + /** * 检查坐标点是否在矩形内 * @param hotArea 矩形 * @param point 坐标 */ -export const isContains = (hotArea: Rect, point: Point): boolean => { +export function isContains(hotArea: Rect, point: Point): boolean { return ( point.x >= hotArea.left && point.x < hotArea.right && point.y >= hotArea.top && point.y < hotArea.bottom ); -}; +} +// TODO @AI:linter 修复 /** * 在两个坐标点中间,创建一个矩形 * @@ -59,7 +56,7 @@ export const isContains = (hotArea: Rect, point: Point): boolean => { * @param a 坐标点一 * @param b 坐标点二 */ -export const createRect = (a: Point, b: Point): Rect => { +export function createRect(a: Point, b: Point): Rect { // 计算矩形的范围 const [left, left2] = [a.x, b.x].sort(); const [top, top2] = [a.y, b.y].sort(); @@ -67,6 +64,5 @@ export const createRect = (a: Point, b: Point): Rect => { const bottom = top2 + 1; const height = bottom - top; const width = right - left; - return { left, right, top, bottom, height, width }; -}; +} From 38df83e2812cb9d116a68a6057ac21a965e33b7e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 30 Oct 2025 00:11:56 +0800 Subject: [PATCH 33/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?editor=20=E7=9A=84=20magic-cube-editor=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../promotion/components/magic-cube-editor/index.vue | 7 ++++++- .../mall/promotion/components/magic-cube-editor/util.ts | 9 ++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/magic-cube-editor/index.vue b/apps/web-ele/src/views/mall/promotion/components/magic-cube-editor/index.vue index 0e30219f3..b985a8142 100644 --- a/apps/web-ele/src/views/mall/promotion/components/magic-cube-editor/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/magic-cube-editor/index.vue @@ -241,7 +241,7 @@ const eachCube = (callback: (x: number, y: number, cube: Cube) => void) => { - {{ `${hotArea.width}×${hotArea.height}`}} + {{ `${hotArea.width}×${hotArea.height}` }} @@ -259,6 +259,11 @@ const eachCube = (callback: (x: number, y: number, cube: Cube) => void) => { text-align: center; cursor: pointer; border: 1px solid var(--el-border-color); + line-height: 1; + + :deep(.iconify) { + display: inline-block; + } &.active { background: var(--el-color-primary-light-9); diff --git a/apps/web-ele/src/views/mall/promotion/components/magic-cube-editor/util.ts b/apps/web-ele/src/views/mall/promotion/components/magic-cube-editor/util.ts index 152ce0cbe..6e3eb7cd2 100644 --- a/apps/web-ele/src/views/mall/promotion/components/magic-cube-editor/util.ts +++ b/apps/web-ele/src/views/mall/promotion/components/magic-cube-editor/util.ts @@ -43,7 +43,6 @@ export function isContains(hotArea: Rect, point: Point): boolean { ); } -// TODO @AI:linter 修复 /** * 在两个坐标点中间,创建一个矩形 * @@ -58,8 +57,12 @@ export function isContains(hotArea: Rect, point: Point): boolean { */ export function createRect(a: Point, b: Point): Rect { // 计算矩形的范围 - const [left, left2] = [a.x, b.x].sort(); - const [top, top2] = [a.y, b.y].sort(); + let [left, left2] = [a.x, b.x].sort(); + left = left ?? 0; + left2 = left2 ?? 0; + let [top, top2] = [a.y, b.y].sort(); + top = top ?? 0; + top2 = top2 ?? 0; const right = left2 + 1; const bottom = top2 + 1; const height = bottom - top; From 83d3188477f995a6570125a94ac361b8ce7395de Mon Sep 17 00:00:00 2001 From: puhui999 Date: Fri, 31 Oct 2025 10:44:22 +0800 Subject: [PATCH 34/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=20=E5=95=86?= =?UTF-8?q?=E5=9F=8E=E3=80=91=E7=A7=92=E6=9D=80=E6=B4=BB=E5=8A=A8=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E4=BC=98=E5=8C=96=EF=BC=88antd=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/promotion/seckill/activity/data.ts | 112 ++++++++++ .../mall/promotion/seckill/activity/index.vue | 2 +- .../seckill/activity/modules/form.vue | 191 +++++++++++++----- 3 files changed, 258 insertions(+), 47 deletions(-) diff --git a/apps/web-antd/src/views/mall/promotion/seckill/activity/data.ts b/apps/web-antd/src/views/mall/promotion/seckill/activity/data.ts index 77124baed..a5c5a8450 100644 --- a/apps/web-antd/src/views/mall/promotion/seckill/activity/data.ts +++ b/apps/web-antd/src/views/mall/promotion/seckill/activity/data.ts @@ -4,6 +4,9 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import { DICT_TYPE } from '@vben/constants'; import { getDictOptions } from '@vben/hooks'; +import { z } from '#/adapter/form'; +import { getSimpleSeckillConfigList } from '#/api/mall/promotion/seckill/seckillConfig'; + /** 列表的搜索表单 */ export function useGridFormSchema(): VbenFormSchema[] { return [ @@ -29,6 +32,115 @@ export function useGridFormSchema(): VbenFormSchema[] { ]; } +/** 新增/编辑的表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + // 隐藏的 ID 字段 + { + component: 'Input', + fieldName: 'id', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'name', + label: '秒杀活动名称', + component: 'Input', + componentProps: { + placeholder: '请输入活动名称', + }, + rules: 'required', + formItemClass: 'col-span-2', + }, + { + fieldName: 'startTime', + label: '活动开始时间', + component: 'DatePicker', + componentProps: { + placeholder: '请选择活动开始时间', + showTime: false, + format: 'YYYY-MM-DD', + valueFormat: 'x', + class: 'w-full', + }, + rules: 'required', + }, + { + fieldName: 'endTime', + label: '活动结束时间', + component: 'DatePicker', + componentProps: { + placeholder: '请选择活动结束时间', + showTime: false, + format: 'YYYY-MM-DD', + valueFormat: 'x', + class: 'w-full', + }, + rules: 'required', + }, + { + fieldName: 'configIds', + label: '秒杀时段', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择秒杀时段', + mode: 'multiple', + api: getSimpleSeckillConfigList, + labelField: 'name', + valueField: 'id', + class: 'w-full', + }, + rules: 'required', + formItemClass: 'col-span-2', + }, + { + fieldName: 'totalLimitCount', + label: '总限购数量', + component: 'InputNumber', + componentProps: { + placeholder: '请输入总限购数量', + min: 0, + class: 'w-full', + }, + rules: z.number().min(0).default(0), + }, + { + fieldName: 'singleLimitCount', + label: '单次限购数量', + component: 'InputNumber', + componentProps: { + placeholder: '请输入单次限购数量', + min: 0, + class: 'w-full', + }, + rules: z.number().min(0).default(0), + }, + { + fieldName: 'sort', + label: '排序', + component: 'InputNumber', + componentProps: { + placeholder: '请输入排序', + min: 0, + class: 'w-full', + }, + rules: z.number().min(0).default(0), + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + rows: 4, + }, + formItemClass: 'col-span-2', + }, + ]; +} + /** 列表的字段 */ export function useGridColumns(): VxeTableGridOptions['columns'] { return [ diff --git a/apps/web-antd/src/views/mall/promotion/seckill/activity/index.vue b/apps/web-antd/src/views/mall/promotion/seckill/activity/index.vue index 83538bdd1..dfed233c2 100644 --- a/apps/web-antd/src/views/mall/promotion/seckill/activity/index.vue +++ b/apps/web-antd/src/views/mall/promotion/seckill/activity/index.vue @@ -5,7 +5,6 @@ import type { MallSeckillActivityApi } from '#/api/mall/promotion/seckill/seckil import { onMounted } from 'vue'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; -import { $t } from '@vben/locales'; import { message, Tag } from 'ant-design-vue'; @@ -16,6 +15,7 @@ import { getSeckillActivityPage, } from '#/api/mall/promotion/seckill/seckillActivity'; import { getSimpleSeckillConfigList } from '#/api/mall/promotion/seckill/seckillConfig'; +import { $t } from '#/locales'; import { useGridColumns, useGridFormSchema } from './data'; import { formatConfigNames, formatTimeRange, setConfigList } from './formatter'; diff --git a/apps/web-antd/src/views/mall/promotion/seckill/activity/modules/form.vue b/apps/web-antd/src/views/mall/promotion/seckill/activity/modules/form.vue index 7aef17ae8..ceef1485b 100644 --- a/apps/web-antd/src/views/mall/promotion/seckill/activity/modules/form.vue +++ b/apps/web-antd/src/views/mall/promotion/seckill/activity/modules/form.vue @@ -1,11 +1,11 @@ From 3802a87659351fcaee0675fc2589a3d5dcfe605d Mon Sep 17 00:00:00 2001 From: puhui999 Date: Fri, 31 Oct 2025 15:48:18 +0800 Subject: [PATCH 35/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=20=E5=95=86?= =?UTF-8?q?=E5=9F=8E=E3=80=91=E4=BC=98=E6=83=A0=E5=88=B8=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=BF=81=E7=A7=BB=EF=BC=88antd=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../coupon/components/coupon-select.vue | 116 ++++++++++++++++++ .../mall/promotion/coupon/components/data.ts | 101 +++++++++++++++ .../mall/promotion/coupon/components/index.ts | 1 + 3 files changed, 218 insertions(+) create mode 100644 apps/web-antd/src/views/mall/promotion/coupon/components/coupon-select.vue diff --git a/apps/web-antd/src/views/mall/promotion/coupon/components/coupon-select.vue b/apps/web-antd/src/views/mall/promotion/coupon/components/coupon-select.vue new file mode 100644 index 000000000..e43e3319b --- /dev/null +++ b/apps/web-antd/src/views/mall/promotion/coupon/components/coupon-select.vue @@ -0,0 +1,116 @@ + + + diff --git a/apps/web-antd/src/views/mall/promotion/coupon/components/data.ts b/apps/web-antd/src/views/mall/promotion/coupon/components/data.ts index 35a823b79..2b45327bd 100644 --- a/apps/web-antd/src/views/mall/promotion/coupon/components/data.ts +++ b/apps/web-antd/src/views/mall/promotion/coupon/components/data.ts @@ -1,13 +1,42 @@ import type { VbenFormSchema } from '#/adapter/form'; import type { VxeGridProps } from '#/adapter/vxe-table'; +import { DICT_TYPE } from '@vben/constants'; +import { getDictOptions } from '@vben/hooks'; + import { discountFormat, remainedCountFormat, + takeLimitCountFormat, usePriceFormat, validityTypeFormat, } from '../formatter'; +/** 优惠券选择弹窗的搜索表单 schema */ +export function useCouponSelectFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'name', + label: '优惠券名称', + componentProps: { + placeholder: '请输入优惠券名称', + allowClear: true, + }, + }, + { + component: 'Select', + fieldName: 'discountType', + label: '优惠类型', + componentProps: { + options: getDictOptions(DICT_TYPE.PROMOTION_DISCOUNT_TYPE, 'number'), + placeholder: '请选择优惠类型', + allowClear: true, + }, + }, + ]; +} + /** 搜索表单的 schema */ export function useFormSchema(): VbenFormSchema[] { return [ @@ -23,6 +52,78 @@ export function useFormSchema(): VbenFormSchema[] { ]; } +/** 优惠券选择弹窗的表格列配置 */ +export function useCouponSelectGridColumns(): VxeGridProps['columns'] { + return [ + { type: 'checkbox', width: 55 }, + { + title: '优惠券名称', + field: 'name', + minWidth: 140, + }, + { + title: '类型', + field: 'productScope', + minWidth: 80, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.PROMOTION_PRODUCT_SCOPE }, + }, + }, + { + title: '优惠', + field: 'discount', + minWidth: 100, + slots: { default: 'discount' }, + }, + { + title: '领取方式', + field: 'takeType', + minWidth: 100, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.PROMOTION_COUPON_TAKE_TYPE }, + }, + }, + { + title: '使用时间', + field: 'validityType', + minWidth: 185, + align: 'center', + formatter: ({ row }) => validityTypeFormat(row), + }, + { + title: '发放数量', + field: 'totalCount', + align: 'center', + minWidth: 100, + }, + { + title: '剩余数量', + minWidth: 100, + align: 'center', + formatter: ({ row }) => remainedCountFormat(row), + }, + { + title: '领取上限', + field: 'takeLimitCount', + minWidth: 100, + align: 'center', + formatter: ({ row }) => takeLimitCountFormat(row), + }, + { + title: '状态', + field: 'status', + align: 'center', + minWidth: 80, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.COMMON_STATUS }, + }, + }, + ]; +} + /** 表格列配置 */ export function useGridColumns(): VxeGridProps['columns'] { return [ diff --git a/apps/web-antd/src/views/mall/promotion/coupon/components/index.ts b/apps/web-antd/src/views/mall/promotion/coupon/components/index.ts index 00a6c3f32..99fca49f3 100644 --- a/apps/web-antd/src/views/mall/promotion/coupon/components/index.ts +++ b/apps/web-antd/src/views/mall/promotion/coupon/components/index.ts @@ -1,2 +1,3 @@ +export { default as CouponSelect } from './coupon-select.vue'; export * from './data'; export { default as CouponSendForm } from './send-form.vue'; From 0956c79aa50f7a90308ea3ac76326091d0d5162c Mon Sep 17 00:00:00 2001 From: puhui999 Date: Fri, 31 Oct 2025 20:51:25 +0800 Subject: [PATCH 36/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=20=E5=95=86?= =?UTF-8?q?=E5=9F=8E=E3=80=91spu=20sku=20=E9=80=89=E6=8B=A9=E5=99=A8?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=88antd=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sku-table-select.vue | 54 ++- .../spu/components/spu-table-select.vue | 225 ++++++++++++ .../spu/form/modules/spu-table-select.vue | 346 ------------------ 3 files changed, 249 insertions(+), 376 deletions(-) rename apps/web-antd/src/views/mall/product/spu/{form/modules => components}/sku-table-select.vue (71%) create mode 100644 apps/web-antd/src/views/mall/product/spu/components/spu-table-select.vue delete mode 100644 apps/web-antd/src/views/mall/product/spu/form/modules/spu-table-select.vue diff --git a/apps/web-antd/src/views/mall/product/spu/form/modules/sku-table-select.vue b/apps/web-antd/src/views/mall/product/spu/components/sku-table-select.vue similarity index 71% rename from apps/web-antd/src/views/mall/product/spu/form/modules/sku-table-select.vue rename to apps/web-antd/src/views/mall/product/spu/components/sku-table-select.vue index 0900c360e..3ff82032f 100644 --- a/apps/web-antd/src/views/mall/product/spu/form/modules/sku-table-select.vue +++ b/apps/web-antd/src/views/mall/product/spu/components/sku-table-select.vue @@ -8,7 +8,7 @@ import { computed, ref } from 'vue'; import { useVbenModal } from '@vben/common-ui'; import { fenToYuan } from '@vben/utils'; -import { Input, message } from 'ant-design-vue'; +import { message } from 'ant-design-vue'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { getSpu } from '#/api/mall/product/spu'; @@ -21,18 +21,13 @@ const emit = defineEmits<{ change: [sku: MallSpuApi.Sku]; }>(); -const selectedSkuId = ref(); const spuId = ref(); -/** 配置列 */ -// TODO @puhui999:貌似列太宽了? +/** 表格列配置 */ const gridColumns = computed(() => [ { - field: 'id', - title: '#', - width: 60, - align: 'center', - slots: { default: 'radio-column' }, + type: 'radio', + width: 55, }, { field: 'picUrl', @@ -72,6 +67,9 @@ const [Grid, gridApi] = useVbenVxeGrid({ height: 400, border: true, showOverflow: true, + radioConfig: { + reserve: true, + }, proxyConfig: { ajax: { query: async () => { @@ -93,46 +91,42 @@ const [Grid, gridApi] = useVbenVxeGrid({ }, }, }, + gridEvents: { + radioChange: handleRadioChange, + }, }); /** 处理选中 */ -function handleSelected(row: MallSpuApi.Sku) { - emit('change', row); - modalApi.close(); - selectedSkuId.value = undefined; +function handleRadioChange() { + const selectedRow = gridApi.grid.getRadioRecord() as MallSpuApi.Sku; + if (selectedRow) { + emit('change', selectedRow); + modalApi.close(); + } } const [Modal, modalApi] = useVbenModal({ destroyOnClose: true, onOpenChange: async (isOpen: boolean) => { if (!isOpen) { - selectedSkuId.value = undefined; + gridApi.grid.clearRadioRow(); spuId.value = undefined; return; } + const data = modalApi.getData(); - // TODO @puhui999:这里要不 if return,让括号的层级简单点。 - if (data?.spuId) { - spuId.value = data.spuId; - // 触发数据查询 - await gridApi.query(); + if (!data?.spuId) { + return; } + + spuId.value = data.spuId; + await gridApi.query(); }, }); diff --git a/apps/web-antd/src/views/mall/product/spu/components/spu-table-select.vue b/apps/web-antd/src/views/mall/product/spu/components/spu-table-select.vue new file mode 100644 index 000000000..0098c9813 --- /dev/null +++ b/apps/web-antd/src/views/mall/product/spu/components/spu-table-select.vue @@ -0,0 +1,225 @@ + + + + diff --git a/apps/web-antd/src/views/mall/product/spu/form/modules/spu-table-select.vue b/apps/web-antd/src/views/mall/product/spu/form/modules/spu-table-select.vue deleted file mode 100644 index 19cb654d2..000000000 --- a/apps/web-antd/src/views/mall/product/spu/form/modules/spu-table-select.vue +++ /dev/null @@ -1,346 +0,0 @@ - - - - From dd37e58a411639aa6870d10437ae641f5dcff3e6 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Fri, 31 Oct 2025 22:59:42 +0800 Subject: [PATCH 37/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=20=E5=95=86?= =?UTF-8?q?=E5=9F=8E=E3=80=91=E5=95=86=E5=93=81=E6=A9=B1=E7=AA=97=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=88antd=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/product/spu/components/index.ts | 3 + .../product/spu/components/spu-showcase.vue | 154 ++++++++++++++++++ .../spu/components/spu-table-select.vue | 7 + packages/icons/src/iconify/index.ts | 4 + 4 files changed, 168 insertions(+) create mode 100644 apps/web-antd/src/views/mall/product/spu/components/index.ts create mode 100644 apps/web-antd/src/views/mall/product/spu/components/spu-showcase.vue diff --git a/apps/web-antd/src/views/mall/product/spu/components/index.ts b/apps/web-antd/src/views/mall/product/spu/components/index.ts new file mode 100644 index 000000000..122cbcea0 --- /dev/null +++ b/apps/web-antd/src/views/mall/product/spu/components/index.ts @@ -0,0 +1,3 @@ +export { default as SkuTableSelect } from './sku-table-select.vue'; +export { default as SpuShowcase } from './spu-showcase.vue'; +export { default as SpuTableSelect } from './spu-table-select.vue'; diff --git a/apps/web-antd/src/views/mall/product/spu/components/spu-showcase.vue b/apps/web-antd/src/views/mall/product/spu/components/spu-showcase.vue new file mode 100644 index 000000000..1d75f8a8f --- /dev/null +++ b/apps/web-antd/src/views/mall/product/spu/components/spu-showcase.vue @@ -0,0 +1,154 @@ + + + + + + diff --git a/apps/web-antd/src/views/mall/product/spu/components/spu-table-select.vue b/apps/web-antd/src/views/mall/product/spu/components/spu-table-select.vue index 0098c9813..e503a95f8 100644 --- a/apps/web-antd/src/views/mall/product/spu/components/spu-table-select.vue +++ b/apps/web-antd/src/views/mall/product/spu/components/spu-table-select.vue @@ -216,6 +216,13 @@ onMounted(async () => { categoryList.value = await getCategoryList({}); categoryTreeList.value = handleTree(categoryList.value, 'id', 'parentId'); }); + +/** 对外暴露的方法 */ +defineExpose({ + open: (data?: MallSpuApi.Spu | MallSpuApi.Spu[]) => { + modalApi.setData(data).open(); + }, +}); - - From 27b35ac0cfa9216f49389848a40031e947475e4e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 1 Nov 2025 08:42:55 +0800 Subject: [PATCH 41/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?editor=20=E7=9A=84=20menu-list=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/mobile/menu-list/config.ts | 27 +++++++------------ .../components/mobile/menu-list/index.vue | 13 ++++----- .../components/mobile/menu-list/property.vue | 6 ++--- 3 files changed, 19 insertions(+), 27 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-list/config.ts b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-list/config.ts index 6567c553d..375546ae3 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-list/config.ts +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-list/config.ts @@ -4,28 +4,21 @@ import { cloneDeep } from '@vben/utils'; /** 列表导航属性 */ export interface MenuListProperty { - // 导航菜单列表 - list: MenuListItemProperty[]; - // 组件样式 - style: ComponentStyle; + list: MenuListItemProperty[]; // 导航菜单列表 + style: ComponentStyle; // 组件样式 } /** 列表导航项目属性 */ export interface MenuListItemProperty { - // 图标链接 - iconUrl: string; - // 标题 - title: string; - // 标题颜色 - titleColor: string; - // 副标题 - subtitle: string; - // 副标题颜色 - subtitleColor: string; - // 链接 - url: string; + iconUrl: string; // 图标链接 + title: string; // 标题 + titleColor: string; // 标题颜色 + subtitle: string; // 副标题 + subtitleColor: string; // 副标题颜色 + url: string; // 链接 } +/** 空的列表导航项目属性 */ export const EMPTY_MENU_LIST_ITEM_PROPERTY = { title: '标题', titleColor: '#333', @@ -33,7 +26,7 @@ export const EMPTY_MENU_LIST_ITEM_PROPERTY = { subtitleColor: '#bbb', }; -// 定义组件 +/** 定义组件 */ export const component = { id: 'MenuList', name: '列表导航', diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-list/index.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-list/index.vue index 12670dcb0..0a05a6c7b 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-list/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-list/index.vue @@ -7,6 +7,7 @@ import { ElImage } from 'element-plus'; /** 列表导航 */ defineOptions({ name: 'MenuList' }); + defineProps<{ property: MenuListProperty }>(); @@ -19,14 +20,14 @@ defineProps<{ property: MenuListProperty }>(); >
- {{ - item.title - }} + + {{ item.title }} +
- {{ - item.subtitle - }} + + {{ item.subtitle }} +
diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-list/property.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-list/property.vue index c5b076936..2c5991501 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-list/property.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-list/property.vue @@ -18,7 +18,9 @@ import { EMPTY_MENU_LIST_ITEM_PROPERTY } from './config'; defineOptions({ name: 'MenuListProperty' }); const props = defineProps<{ modelValue: MenuListProperty }>(); + const emit = defineEmits(['update:modelValue']); + const formData = useVModel(props, 'modelValue', emit); @@ -26,8 +28,6 @@ const formData = useVModel(props, 'modelValue', emit); 菜单设置 拖动左侧的小圆点可以调整顺序 - - - - From 12968a3d66b9725f0e83a85e5d515ded04756f1f Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 1 Nov 2025 08:47:47 +0800 Subject: [PATCH 42/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?editor=20=E7=9A=84=20menu-swiper=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/mobile/menu-swiper/config.ts | 54 ++++++++----------- .../components/mobile/menu-swiper/index.vue | 30 +++++------ .../mobile/menu-swiper/property.vue | 6 +-- 3 files changed, 35 insertions(+), 55 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/config.ts b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/config.ts index 27138ebee..fa83498c8 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/config.ts +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/config.ts @@ -4,40 +4,28 @@ import { cloneDeep } from '@vben/utils'; /** 菜单导航属性 */ export interface MenuSwiperProperty { - // 布局: 图标+文字 | 图标 - layout: 'icon' | 'iconText'; - // 行数 - row: number; - // 列数 - column: number; - // 导航菜单列表 - list: MenuSwiperItemProperty[]; - // 组件样式 - style: ComponentStyle; -} -/** 菜单导航项目属性 */ -export interface MenuSwiperItemProperty { - // 图标链接 - iconUrl: string; - // 标题 - title: string; - // 标题颜色 - titleColor: string; - // 链接 - url: string; - // 角标 - badge: { - // 角标背景颜色 - bgColor: string; - // 是否显示 - show: boolean; - // 角标文字 - text: string; - // 角标文字颜色 - textColor: string; - }; + layout: 'icon' | 'iconText'; // 布局:图标+文字 | 图标 + row: number; // 行数 + column: number; // 列数 + list: MenuSwiperItemProperty[]; // 导航菜单列表 + style: ComponentStyle; // 组件样式 } +/** 菜单导航项目属性 */ +export interface MenuSwiperItemProperty { + iconUrl: string; // 图标链接 + title: string; // 标题 + titleColor: string; // 标题颜色 + url: string; // 链接 + badge: { + bgColor: string; // 角标背景颜色 + show: boolean; // 是否显示 + text: string; // 角标文字 + textColor: string; // 角标文字颜色 + }; // 角标 +} + +/** 空菜单导航项目属性 */ export const EMPTY_MENU_SWIPER_ITEM_PROPERTY = { title: '标题', titleColor: '#333', @@ -48,7 +36,7 @@ export const EMPTY_MENU_SWIPER_ITEM_PROPERTY = { }, } as MenuSwiperItemProperty; -// 定义组件 +/** 定义组件 */ export const component = { id: 'MenuSwiper', name: '菜单导航', diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/index.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/index.vue index 0d69c7c86..fb4304522 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/index.vue @@ -7,22 +7,19 @@ import { ElCarousel, ElCarouselItem, ElImage } from 'element-plus'; /** 菜单导航 */ defineOptions({ name: 'MenuSwiper' }); -const props = defineProps<{ property: MenuSwiperProperty }>(); -// 标题的高度 -const TITLE_HEIGHT = 20; -// 图标的高度 -const ICON_SIZE = 32; -// 垂直间距:一行上下的间距 -const SPACE_Y = 16; -// 分页 -const pages = ref([]); -// 轮播图高度 -const carouselHeight = ref(0); -// 行高 -const rowHeight = ref(0); -// 列宽 -const columnWidth = ref(''); +const props = defineProps<{ property: MenuSwiperProperty }>(); + +const TITLE_HEIGHT = 20; // 标题的高度 +const ICON_SIZE = 32; // 图标的高度 +const SPACE_Y = 16; // 垂直间距:一行上下的间距 + +const pages = ref([]); // 分页 +const carouselHeight = ref(0); // 轮播图高度 + +const rowHeight = ref(0); // 行高 +const columnWidth = ref(''); // 列宽 + watch( () => props.property, () => { @@ -75,9 +72,7 @@ watch( class="relative flex flex-col items-center justify-center" :style="{ width: columnWidth, height: `${rowHeight}px` }" > -
-
- (); + const emit = defineEmits(['update:modelValue']); + const formData = useVModel(props, 'modelValue', emit); - - From 5e1c7bb54cb94b6252c46fee2fa7415a7e9d6f0c Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 1 Nov 2025 09:21:26 +0800 Subject: [PATCH 43/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?editor=20=E7=9A=84=20navigation-bar=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/cell-property.vue | 25 +++-- .../mobile/navigation-bar/config.ts | 65 ++++-------- .../mobile/navigation-bar/index.vue | 18 ++-- .../mobile/navigation-bar/property.vue | 100 ++++++++++-------- 4 files changed, 103 insertions(+), 105 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/components/cell-property.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/components/cell-property.vue index 585a0f0a7..366723d88 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/components/cell-property.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/components/cell-property.vue @@ -22,7 +22,7 @@ import { MagicCubeEditor, } from '#/views/mall/promotion/components'; -// 导航栏属性面板 +/** 导航栏单元格属性面板 */ defineOptions({ name: 'NavigationBarCellProperty' }); const props = defineProps({ @@ -35,13 +35,19 @@ const props = defineProps({ default: () => [], }, }); + const emit = defineEmits(['update:modelValue']); + const cellList = useVModel(props, 'modelValue', emit); -// 单元格数量:小程序6个(右侧胶囊按钮占了2个),其它平台8个 +/** + * 计算单元格数量 + * 1. 小程序:6 个(因为右侧有胶囊按钮占据 2 个格子的空间) + * 2. 其它平台:8 个(全部空间可用) + */ const cellCount = computed(() => (props.isMp ? 6 : 8)); -// 转换为Rect格式的数据 +/** 转换为 Rect 格式的数据:MagicCubeEditor 组件需要 Rect 格式的数据来渲染热区 */ const rectList = computed(() => { return cellList.value.map((cell) => ({ left: cell.left, @@ -53,18 +59,19 @@ const rectList = computed(() => { })); }); -// 选中的热区 -const selectedHotAreaIndex = ref(0); -const handleHotAreaSelected = ( +const selectedHotAreaIndex = ref(0); // 选中的热区 + +/** 处理热区被选中事件 */ +function handleHotAreaSelected( cellValue: NavigationBarCellProperty, index: number, -) => { +) { selectedHotAreaIndex.value = index; if (!cellValue.type) { cellValue.type = 'text'; cellValue.textColor = '#111111'; } -}; +} - - diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/config.ts b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/config.ts index fd675b16e..f898ce9e8 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/config.ts +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/config.ts @@ -2,56 +2,35 @@ import type { DiyComponent } from '../../../util'; /** 顶部导航栏属性 */ export interface NavigationBarProperty { - // 背景类型 - bgType: 'color' | 'img'; - // 背景颜色 - bgColor: string; - // 图片链接 - bgImg: string; - // 样式类型:默认 | 沉浸式 - styleType: 'inner' | 'normal'; - // 常驻显示 - alwaysShow: boolean; - // 小程序单元格列表 - mpCells: NavigationBarCellProperty[]; - // 其它平台单元格列表 - otherCells: NavigationBarCellProperty[]; - // 本地变量 + bgType: 'color' | 'img'; // 背景类型 + bgColor: string; // 背景颜色 + bgImg: string; // 图片链接 + styleType: 'inner' | 'normal'; // 样式类型:默认 | 沉浸式 + alwaysShow: boolean; // 常驻显示 + mpCells: NavigationBarCellProperty[]; // 小程序单元格列表 + otherCells: NavigationBarCellProperty[]; // 其它平台单元格列表 _local: { - // 预览顶部导航(小程序) - previewMp: boolean; - // 预览顶部导航(非小程序) - previewOther: boolean; - }; + previewMp: boolean; // 预览顶部导航(小程序) + previewOther: boolean; // 预览顶部导航(非小程序) + }; // 本地变量 } /** 顶部导航栏 - 单元格 属性 */ export interface NavigationBarCellProperty { - // 类型:文字 | 图片 | 搜索框 - type: 'image' | 'search' | 'text'; - // 宽度 - width: number; - // 高度 - height: number; - // 顶部位置 - top: number; - // 左侧位置 - left: number; - // 文字内容 - text: string; - // 文字颜色 - textColor: string; - // 图片地址 - imgUrl: string; - // 图片链接 - url: string; - // 搜索框:提示文字 - placeholder: string; - // 搜索框:边框圆角半径 - borderRadius: number; + type: 'image' | 'search' | 'text'; // 类型:文字 | 图片 | 搜索框 + width: number; // 宽度 + height: number; // 高度 + top: number; // 顶部位置 + left: number; // 左侧位置 + text: string; // 文字内容 + textColor: string; // 文字颜色 + imgUrl: string; // 图片地址 + url: string; // 图片链接 + placeholder: string; // 搜索框:提示文字 + borderRadius: number; // 搜索框:边框圆角半径 } -// 定义组件 +/** 定义组件 */ export const component = { id: 'NavigationBar', name: '顶部导航栏', diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/index.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/index.vue index 9e3b17a07..3460ee53e 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/index.vue @@ -18,7 +18,7 @@ defineOptions({ name: 'NavigationBar' }); const props = defineProps<{ property: NavigationBarProperty }>(); -// 背景 +/** 计算背景样式 */ const bgStyle = computed(() => { const background = props.property.bgType === 'img' && props.property.bgImg @@ -26,27 +26,31 @@ const bgStyle = computed(() => { : props.property.bgColor; return { background }; }); -// 单元格列表 + +/** 获取当前预览的单元格列表 */ const cellList = computed(() => props.property._local?.previewMp ? props.property.mpCells : props.property.otherCells, ); -// 单元格宽度 + +/** 计算单元格宽度 */ const cellWidth = computed(() => { return props.property._local?.previewMp ? (375 - 80 - 86) / 6 : (375 - 90) / 8; }); -// 获得单元格样式 -const getCellStyle = (cell: NavigationBarCellProperty) => { + +/** 获取单元格样式 */ +function getCellStyle(cell: NavigationBarCellProperty) { return { width: `${cell.width * cellWidth.value + (cell.width - 1) * 10}px`, left: `${cell.left * cellWidth.value + (cell.left + 1) * 10}px`, position: 'absolute', } as StyleValue; -}; -// 获得搜索框属性 +} + +/** 获取搜索框属性配置 */ const getSearchProp = computed(() => (cell: NavigationBarCellProperty) => { return { height: 30, diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/property.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/property.vue index ce3e3f698..9703be641 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/property.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/navigation-bar/property.vue @@ -2,19 +2,31 @@ import type { NavigationBarProperty } from './config'; import { useVModel } from '@vueuse/core'; +import { + ElCard, + ElCheckbox, + ElForm, + ElFormItem, + ElRadio, + ElRadioGroup, + ElTooltip, +} from 'element-plus'; + +import UploadImg from '#/components/upload/image-upload.vue'; +import { ColorInput } from '#/views/mall/promotion/components'; import NavigationBarCellProperty from './components/cell-property.vue'; -// 导航栏属性面板 +/** 导航栏属性面板 */ defineOptions({ name: 'NavigationBarProperty' }); + const props = defineProps<{ modelValue: NavigationBarProperty }>(); const emit = defineEmits(['update:modelValue']); -// 表单校验 const rules = { name: [{ required: true, message: '请输入页面名称', trigger: 'blur' }], -}; +}; // 表单校验 const formData = useVModel(props, 'modelValue', emit); if (!formData.value._local) { @@ -23,47 +35,47 @@ if (!formData.value._local) { - - From a7d24de1260dcf3f4d19dd93e30834cabe7e9708 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 1 Nov 2025 09:40:03 +0800 Subject: [PATCH 44/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?editor=20=E7=9A=84=20notice-bar=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/mobile/notice-bar/config.ts | 23 +++++++------------ .../components/mobile/notice-bar/property.vue | 13 ++++------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/notice-bar/config.ts b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/notice-bar/config.ts index 2d4acffb2..d9b68333e 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/notice-bar/config.ts +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/notice-bar/config.ts @@ -2,27 +2,20 @@ import type { ComponentStyle, DiyComponent } from '../../../util'; /** 公告栏属性 */ export interface NoticeBarProperty { - // 图标地址 - iconUrl: string; - // 公告内容列表 - contents: NoticeContentProperty[]; - // 背景颜色 - backgroundColor: string; - // 文字颜色 - textColor: string; - // 组件样式 - style: ComponentStyle; + iconUrl: string; // 图标地址 + contents: NoticeContentProperty[]; // 公告内容列表 + backgroundColor: string; // 背景颜色 + textColor: string; // 文字颜色 + style: ComponentStyle; // 组件样式 } /** 内容属性 */ export interface NoticeContentProperty { - // 内容文字 - text: string; - // 链接地址 - url: string; + text: string; // 内容文字 + url: string; // 链接地址 } -// 定义组件 +/** 定义组件 */ export const component = { id: 'NoticeBar', name: '公告栏', diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/notice-bar/property.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/notice-bar/property.vue index 055aa2e10..35a936ec7 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/notice-bar/property.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/notice-bar/property.vue @@ -13,18 +13,17 @@ import { import ComponentContainerProperty from '../../component-container-property.vue'; -// 通知栏属性面板 +/** 公告栏属性面板 */ defineOptions({ name: 'NoticeBarProperty' }); + const props = defineProps<{ modelValue: NoticeBarProperty }>(); const emit = defineEmits(['update:modelValue']); -// 表单校验 +const formData = useVModel(props, 'modelValue', emit); const rules = { content: [{ required: true, message: '请输入公告', trigger: 'blur' }], -}; - -const formData = useVModel(props, 'modelValue', emit); +}; // 表单校验 - - + \ No newline at end of file From 48292b1a9832e4fc662b9836d1656dbd5f16dbc1 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 1 Nov 2025 10:07:25 +0800 Subject: [PATCH 45/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?editor=20=E7=9A=84=20page-config=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/mobile/notice-bar/property.vue | 2 +- .../components/mobile/page-config/config.ts | 11 ++++------- .../components/mobile/page-config/property.vue | 12 ++++-------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/notice-bar/property.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/notice-bar/property.vue index 35a936ec7..5fdb1f06b 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/notice-bar/property.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/notice-bar/property.vue @@ -58,4 +58,4 @@ const rules = { - \ No newline at end of file + diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/page-config/config.ts b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/page-config/config.ts index 73032a84a..a00e6458b 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/page-config/config.ts +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/page-config/config.ts @@ -2,15 +2,12 @@ import type { DiyComponent } from '../../../util'; /** 页面设置属性 */ export interface PageConfigProperty { - // 页面描述 - description: string; - // 页面背景颜色 - backgroundColor: string; - // 页面背景图片 - backgroundImage: string; + description: string; // 页面描述 + backgroundColor: string; // 页面背景颜色 + backgroundImage: string; // 页面背景图片 } -// 定义页面组件 +/** 定义页面组件 */ export const component = { id: 'PageConfig', name: '页面设置', diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/page-config/property.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/page-config/property.vue index 9d904c0e8..27aa37bec 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/page-config/property.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/page-config/property.vue @@ -7,24 +7,22 @@ import { ElForm, ElFormItem, ElInput } from 'element-plus'; import UploadImg from '#/components/upload/image-upload.vue'; import { ColorInput } from '#/views/mall/promotion/components'; -// 导航栏属性面板 +/** 导航栏属性面板 */ defineOptions({ name: 'PageConfigProperty' }); + const props = defineProps<{ modelValue: PageConfigProperty }>(); const emit = defineEmits(['update:modelValue']); -// 表单校验 -const rules = {}; - const formData = useVModel(props, 'modelValue', emit); - - From 98e30787844378a7b0365c52d0c48e939c6559b6 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 1 Nov 2025 10:16:40 +0800 Subject: [PATCH 46/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?editor=20=E7=9A=84=20popover=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobile/{Popover => popover}/config.ts | 14 ++++++-------- .../mobile/{Popover => popover}/index.vue | 18 +++++++++--------- .../mobile/{Popover => popover}/property.vue | 6 +++--- 3 files changed, 18 insertions(+), 20 deletions(-) rename apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/{Popover => popover}/config.ts (58%) rename apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/{Popover => popover}/index.vue (81%) rename apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/{Popover => popover}/property.vue (96%) diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/Popover/config.ts b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/popover/config.ts similarity index 58% rename from apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/Popover/config.ts rename to apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/popover/config.ts index 6f365b735..52bbeacdb 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/Popover/config.ts +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/popover/config.ts @@ -2,19 +2,17 @@ import type { DiyComponent } from '../../../util'; /** 弹窗广告属性 */ export interface PopoverProperty { - list: PopoverItemProperty[]; + list: PopoverItemProperty[]; // 弹窗列表 } +/** 弹窗广告项目属性 */ export interface PopoverItemProperty { - // 图片地址 - imgUrl: string; - // 跳转连接 - url: string; - // 显示类型:仅显示一次、每次启动都会显示 - showType: 'always' | 'once'; + imgUrl: string; // 图片地址 + url: string; // 跳转连接 + showType: 'always' | 'once'; // 显示类型:仅显示一次、每次启动都会显示 } -// 定义组件 +/** 定义组件 */ export const component = { id: 'Popover', name: '弹窗广告', diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/Popover/index.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/popover/index.vue similarity index 81% rename from apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/Popover/index.vue rename to apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/popover/index.vue index bc724eca9..694f77ed2 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/Popover/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/popover/index.vue @@ -9,18 +9,20 @@ import { ElImage } from 'element-plus'; /** 弹窗广告 */ defineOptions({ name: 'Popover' }); -// 定义属性 -defineProps<{ property: PopoverProperty }>(); -// 处理选中 -const activeIndex = ref(0); -const handleActive = (index: number) => { +const props = defineProps<{ property: PopoverProperty }>(); + +const activeIndex = ref(0); // 选中 index + +/** 处理选中 */ +function handleActive(index: number) { activeIndex.value = index; -}; +} + - - diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/Popover/property.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/popover/property.vue similarity index 96% rename from apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/Popover/property.vue rename to apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/popover/property.vue index 7f41d413c..189b6b068 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/Popover/property.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/popover/property.vue @@ -13,11 +13,13 @@ import { import UploadImg from '#/components/upload/image-upload.vue'; import { AppLinkInput, Draggable } from '#/views/mall/promotion/components'; -// 弹窗广告属性面板 +/** 弹窗广告属性面板 */ defineOptions({ name: 'PopoverProperty' }); const props = defineProps<{ modelValue: PopoverProperty }>(); + const emit = defineEmits(['update:modelValue']); + const formData = useVModel(props, 'modelValue', emit); @@ -53,5 +55,3 @@ const formData = useVModel(props, 'modelValue', emit); - - From 1a8b9873e017f7d800a869da6a8e53361a392663 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 1 Nov 2025 10:45:06 +0800 Subject: [PATCH 47/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?editor=20=E7=9A=84=20product-card=20=E4=BC=98=E5=8C=96=2050%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/mobile/product-card/config.ts | 81 +++++++------------ .../components/mobile/product-card/index.vue | 36 ++++----- .../mobile/product-card/property.vue | 8 +- 3 files changed, 48 insertions(+), 77 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/config.ts b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/config.ts index d165b01f6..a9e84977b 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/config.ts +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/config.ts @@ -2,63 +2,40 @@ import type { ComponentStyle, DiyComponent } from '../../../util'; /** 商品卡片属性 */ export interface ProductCardProperty { - // 布局类型:单列大图 | 单列小图 | 双列 - layoutType: 'oneColBigImg' | 'oneColSmallImg' | 'twoCol'; - // 商品字段 + layoutType: 'oneColBigImg' | 'oneColSmallImg' | 'twoCol'; // 布局类型:单列大图 | 单列小图 | 双列 fields: { - // 商品简介 - introduction: ProductCardFieldProperty; - // 商品市场价 - marketPrice: ProductCardFieldProperty; - // 商品名称 - name: ProductCardFieldProperty; - // 商品价格 - price: ProductCardFieldProperty; - // 商品销量 - salesCount: ProductCardFieldProperty; - // 商品库存 - stock: ProductCardFieldProperty; - }; - // 角标 + introduction: ProductCardFieldProperty; // 商品简介 + marketPrice: ProductCardFieldProperty; // 商品市场价 + name: ProductCardFieldProperty; // 商品名称 + price: ProductCardFieldProperty; // 商品价格 + salesCount: ProductCardFieldProperty; // 商品销量 + stock: ProductCardFieldProperty; // 商品库存 + }; // 商品字段 badge: { - // 角标图片 - imgUrl: string; - // 是否显示 - show: boolean; - }; - // 按钮 + imgUrl: string; // 角标图片 + show: boolean; // 是否显示 + }; // 角标 btnBuy: { - // 文字按钮:背景渐变起始颜色 - bgBeginColor: string; - // 文字按钮:背景渐变结束颜色 - bgEndColor: string; - // 图片按钮:图片地址 - imgUrl: string; - // 文字 - text: string; - // 类型:文字 | 图片 - type: 'img' | 'text'; - }; - // 上圆角 - borderRadiusTop: number; - // 下圆角 - borderRadiusBottom: number; - // 间距 - space: number; - // 商品编号列表 - spuIds: number[]; - // 组件样式 - style: ComponentStyle; -} -// 商品字段 -export interface ProductCardFieldProperty { - // 是否显示 - show: boolean; - // 颜色 - color: string; + bgBeginColor: string; // 文字按钮:背景渐变起始颜色 + bgEndColor: string; // 文字按钮:背景渐变结束颜色 + imgUrl: string; // 图片按钮:图片地址 + text: string; // 文字 + type: 'img' | 'text'; // 类型:文字 | 图片 + }; // 按钮 + borderRadiusTop: number; // 上圆角 + borderRadiusBottom: number; // 下圆角 + space: number; // 间距 + spuIds: number[]; // 商品编号列表 + style: ComponentStyle; // 组件样式 } -// 定义组件 +/** 商品字段属性 */ +export interface ProductCardFieldProperty { + show: boolean; // 是否显示 + color: string; // 颜色 +} + +/** 定义组件 */ export const component = { id: 'ProductCard', name: '商品卡片', diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/index.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/index.vue index b1cf736e8..b66c27c6a 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/index.vue @@ -13,10 +13,11 @@ import * as ProductSpuApi from '#/api/mall/product/spu'; /** 商品卡片 */ defineOptions({ name: 'ProductCard' }); -// 定义属性 + const props = defineProps<{ property: ProductCardProperty }>(); -// 商品列表 + const spuList = ref([]); + watch( () => props.property.spuIds, async () => { @@ -28,28 +29,21 @@ watch( }, ); -/** - * 计算商品的间距 - * @param index 商品索引 - */ -const calculateSpace = (index: number) => { - // 商品的列数 - const columns = props.property.layoutType === 'twoCol' ? 2 : 1; - // 第一列没有左边距 - const marginLeft = index % columns === 0 ? '0' : `${props.property.space}px`; - // 第一行没有上边距 - const marginTop = index < columns ? '0' : `${props.property.space}px`; - +/** 计算商品的间距 */ +function calculateSpace(index: number) { + const columns = props.property.layoutType === 'twoCol' ? 2 : 1; // 商品的列数 + const marginLeft = index % columns === 0 ? '0' : `${props.property.space}px`; // 第一列没有左边距 + const marginTop = index < columns ? '0' : `${props.property.space}px`; // 第一行没有上边距 return { marginLeft, marginTop }; -}; +} -// 容器 const containerRef = ref(); -// 计算商品的宽度 + +/** 计算商品的宽度 */ const calculateWidth = () => { let width = '100%'; - // 双列时每列的宽度为:(总宽度 - 间距)/ 2 if (props.property.layoutType === 'twoCol') { + // 双列时每列的宽度为:(总宽度 - 间距)/ 2 width = `${(containerRef.value.offsetWidth - props.property.space) / 2}px`; } return { width }; @@ -136,14 +130,14 @@ const calculateWidth = () => { class="text-[16px]" :style="{ color: property.fields.price.color }" > - ¥{{ fenToYuan(spu.price as any) }} + ¥{{ fenToYuan(spu.price!) }} ¥{{ fenToYuan(spu.marketPrice) }} + >¥{{ fenToYuan(spu.marketPrice!) }}
@@ -186,5 +180,3 @@ const calculateWidth = () => {
- - diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/property.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/property.vue index 728ae7827..a05a4bc85 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/property.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/product-card/property.vue @@ -22,11 +22,15 @@ import { ColorInput } from '#/views/mall/promotion/components'; // TODO: 添加组件 // import SpuShowcase from '#/views/mall/product/spu/components/spu-showcase.vue'; -// 商品卡片属性面板 +import ComponentContainerProperty from '../../component-container-property.vue'; + +/** 商品卡片属性面板 */ defineOptions({ name: 'ProductCardProperty' }); const props = defineProps<{ modelValue: ProductCardProperty }>(); + const emit = defineEmits(['update:modelValue']); + const formData = useVModel(props, 'modelValue', emit); @@ -174,5 +178,3 @@ const formData = useVModel(props, 'modelValue', emit); - - From 7f192823d73b6fc72e6bc0c4efa67c1b7a63db06 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 1 Nov 2025 11:05:04 +0800 Subject: [PATCH 48/61] =?UTF-8?q?review=EF=BC=9A=E3=80=90antd=E3=80=91?= =?UTF-8?q?=E3=80=90mall=E3=80=91=E5=95=86=E5=93=81=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/promotion/reward/rewardActivity.ts | 1 + .../spu/components/sku-table-select.vue | 21 ++++++------------- .../product/spu/components/spu-showcase.vue | 12 ++++++----- .../spu/components/spu-table-select.vue | 20 ++++++++++-------- .../src/views/mall/product/spu/form/data.ts | 1 + .../product/spu/form/modules/sku-list.vue | 6 +++--- .../coupon/components/coupon-select.vue | 1 + .../mall/promotion/rewardActivity/data.ts | 8 ------- .../mall/promotion/rewardActivity/index.vue | 7 +++---- .../promotion/rewardActivity/modules/form.vue | 4 ++-- .../mall/promotion/seckill/activity/data.ts | 1 - 11 files changed, 35 insertions(+), 47 deletions(-) diff --git a/apps/web-antd/src/api/mall/promotion/reward/rewardActivity.ts b/apps/web-antd/src/api/mall/promotion/reward/rewardActivity.ts index 2faf443b8..e59cad300 100644 --- a/apps/web-antd/src/api/mall/promotion/reward/rewardActivity.ts +++ b/apps/web-antd/src/api/mall/promotion/reward/rewardActivity.ts @@ -18,6 +18,7 @@ export namespace MallRewardActivityApi { export interface RewardActivity { id?: number; // 活动编号 name?: string; // 活动名称 + status?: number; // 活动状态 startTime?: Date; // 开始时间 endTime?: Date; // 结束时间 startAndEndTime?: Date[]; // 开始和结束时间(仅前端使用) diff --git a/apps/web-antd/src/views/mall/product/spu/components/sku-table-select.vue b/apps/web-antd/src/views/mall/product/spu/components/sku-table-select.vue index 3ff82032f..2679a9d4f 100644 --- a/apps/web-antd/src/views/mall/product/spu/components/sku-table-select.vue +++ b/apps/web-antd/src/views/mall/product/spu/components/sku-table-select.vue @@ -8,8 +8,6 @@ import { computed, ref } from 'vue'; import { useVbenModal } from '@vben/common-ui'; import { fenToYuan } from '@vben/utils'; -import { message } from 'ant-design-vue'; - import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { getSpu } from '#/api/mall/product/spu'; @@ -61,6 +59,7 @@ const gridColumns = computed(() => [ }, ]); +// TODO @芋艿:要不要直接非 pager? const [Grid, gridApi] = useVbenVxeGrid({ gridOptions: { columns: gridColumns.value, @@ -76,17 +75,11 @@ const [Grid, gridApi] = useVbenVxeGrid({ if (!spuId.value) { return { items: [], total: 0 }; } - try { - const spu = await getSpu(spuId.value); - return { - items: spu.skus || [], - total: spu.skus?.length || 0, - }; - } catch (error) { - message.error('加载 SKU 数据失败'); - console.error(error); - return { items: [], total: 0 }; - } + const spu = await getSpu(spuId.value); + return { + items: spu.skus || [], + total: spu.skus?.length || 0, + }; }, }, }, @@ -113,12 +106,10 @@ const [Modal, modalApi] = useVbenModal({ spuId.value = undefined; return; } - const data = modalApi.getData(); if (!data?.spuId) { return; } - spuId.value = data.spuId; await gridApi.query(); }, diff --git a/apps/web-antd/src/views/mall/product/spu/components/spu-showcase.vue b/apps/web-antd/src/views/mall/product/spu/components/spu-showcase.vue index 1d75f8a8f..6b0547c20 100644 --- a/apps/web-antd/src/views/mall/product/spu/components/spu-showcase.vue +++ b/apps/web-antd/src/views/mall/product/spu/components/spu-showcase.vue @@ -28,17 +28,19 @@ const emit = defineEmits(['update:modelValue', 'change']); const productSpus = ref([]); const spuTableSelectRef = ref>(); +const isMultiple = computed(() => props.limit !== 1); // 是否为多选模式 /** 计算是否可以添加 */ const canAdd = computed(() => { - if (props.disabled) return false; - if (!props.limit) return true; + if (props.disabled) { + return false; + } + if (!props.limit) { + return true; + } return productSpus.value.length < props.limit; }); -/** 是否为多选模式 */ -const isMultiple = computed(() => props.limit !== 1); - /** 监听 modelValue 变化,加载商品详情 */ watch( () => props.modelValue, diff --git a/apps/web-antd/src/views/mall/product/spu/components/spu-table-select.vue b/apps/web-antd/src/views/mall/product/spu/components/spu-table-select.vue index e503a95f8..46bfb1e92 100644 --- a/apps/web-antd/src/views/mall/product/spu/components/spu-table-select.vue +++ b/apps/web-antd/src/views/mall/product/spu/components/spu-table-select.vue @@ -26,6 +26,7 @@ const emit = defineEmits<{ change: [spu: MallSpuApi.Spu | MallSpuApi.Spu[]]; }>(); +// TODO @芋艿:要不要加类型; const categoryList = ref([]); const categoryTreeList = ref([]); @@ -71,13 +72,11 @@ const formSchema = computed(() => [ /** 表格列配置 */ const gridColumns = computed(() => { const columns: VxeGridProps['columns'] = []; - if (props.multiple) { columns.push({ type: 'checkbox', width: 55 }); } else { columns.push({ type: 'radio', width: 55 }); } - columns.push( { field: 'id', @@ -109,7 +108,6 @@ const gridColumns = computed(() => { }, }, ); - return columns; }); @@ -129,14 +127,15 @@ const [Grid, gridApi] = useVbenVxeGrid({ reserve: true, } : undefined, - radioConfig: !props.multiple - ? { + radioConfig: props.multiple + ? undefined + : { reserve: true, - } - : undefined, + }, proxyConfig: { ajax: { async query({ page }: any, formValues: any) { + // TODO @芋艿:怎么简化下。 const data = await getSpuPage({ pageNo: page.currentPage, pageSize: page.pageSize, @@ -145,7 +144,6 @@ const [Grid, gridApi] = useVbenVxeGrid({ categoryId: formValues.categoryId || undefined, createTime: formValues.createTime || undefined, }); - return { items: data.list || [], total: data.total || 0, @@ -165,6 +163,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ }); /** 多选:处理选中变化 */ +// TODO @芋艿:要不要清理掉? function handleCheckboxChange() { // vxe-table 自动管理选中状态,无需手动处理 } @@ -180,13 +179,16 @@ function handleRadioChange() { const [Modal, modalApi] = useVbenModal({ destroyOnClose: true, + // TODO @芋艿:看看怎么简化 onConfirm: props.multiple ? () => { - const selectedRows = gridApi.grid.getCheckboxRecords() as MallSpuApi.Spu[]; + const selectedRows = + gridApi.grid.getCheckboxRecords() as MallSpuApi.Spu[]; emit('change', selectedRows); modalApi.close(); } : undefined, + // TODO @芋艿:看看怎么简化? async onOpenChange(isOpen: boolean) { if (!isOpen) { gridApi.grid.clearCheckboxRow(); diff --git a/apps/web-antd/src/views/mall/product/spu/form/data.ts b/apps/web-antd/src/views/mall/product/spu/form/data.ts index d2ff7eeb5..3ca6e5c79 100644 --- a/apps/web-antd/src/views/mall/product/spu/form/data.ts +++ b/apps/web-antd/src/views/mall/product/spu/form/data.ts @@ -102,6 +102,7 @@ export function useInfoFormSchema(): VbenFormSchema[] { } /** 价格库存的表单 */ +// TODO @puhui999:貌似太宽了。。。屏幕小的,整个 table 展示补全哈~~ export function useSkuFormSchema( propertyList: any[] = [], isDetail: boolean = false, diff --git a/apps/web-antd/src/views/mall/product/spu/form/modules/sku-list.vue b/apps/web-antd/src/views/mall/product/spu/form/modules/sku-list.vue index 8c3b4a1f1..348f5f22a 100644 --- a/apps/web-antd/src/views/mall/product/spu/form/modules/sku-list.vue +++ b/apps/web-antd/src/views/mall/product/spu/form/modules/sku-list.vue @@ -212,7 +212,9 @@ function build( const result: MallSpuApi.Property[][] = []; const rest = build(propertyValuesList.slice(1)); const firstList = propertyValuesList[0]; - if (!firstList) return []; + if (!firstList) { + return []; + } for (const element of firstList) { for (const element_ of rest) { @@ -289,8 +291,6 @@ defineExpose({ - - From 2e505269220c1e9b3085f83b2e52e3e655e18fe1 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 1 Nov 2025 12:09:10 +0800 Subject: [PATCH 51/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?editor=20=E7=9A=84=20promotion-article=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobile/promotion-article/config.ts | 8 +++---- .../mobile/promotion-article/index.vue | 10 ++++----- .../mobile/promotion-article/property.vue | 21 +++++++++---------- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/config.ts b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/config.ts index 9a1fc4194..ac47bf4b5 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/config.ts +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/config.ts @@ -2,13 +2,11 @@ import type { ComponentStyle, DiyComponent } from '../../../util'; /** 营销文章属性 */ export interface PromotionArticleProperty { - // 文章编号 - id: number; - // 组件样式 - style: ComponentStyle; + id: number; // 文章编号 + style: ComponentStyle; // 组件样式 } -// 定义组件 +/** 定义组件 */ export const component = { id: 'PromotionArticle', name: '营销文章', diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/index.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/index.vue index 10e9f5aa3..09f1ff673 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/index.vue @@ -9,10 +9,10 @@ import * as ArticleApi from '#/api/mall/promotion/article/index'; /** 营销文章 */ defineOptions({ name: 'PromotionArticle' }); -// 定义属性 -const props = defineProps<{ property: PromotionArticleProperty }>(); -// 商品列表 -const article = ref(); + +const props = defineProps<{ property: PromotionArticleProperty }>(); // 定义属性 + +const article = ref(); // 商品列表 watch( () => props.property.id, @@ -29,5 +29,3 @@ watch( - - diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/property.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/property.vue index 7a701c54f..d70503b17 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/property.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-article/property.vue @@ -12,18 +12,19 @@ import * as ArticleApi from '#/api/mall/promotion/article/index'; import ComponentContainerProperty from '../../component-container-property.vue'; -// 营销文章属性面板 +/** 营销文章属性面板 */ defineOptions({ name: 'PromotionArticleProperty' }); const props = defineProps<{ modelValue: PromotionArticleProperty }>(); -const emit = defineEmits(['update:modelValue']); -const formData = useVModel(props, 'modelValue', emit); -// 文章列表 -const articles = ref([]); -// 加载中 -const loading = ref(false); -// 查询文章列表 +const emit = defineEmits(['update:modelValue']); + +const formData = useVModel(props, 'modelValue', emit); + +const articles = ref([]); // 文章列表 +const loading = ref(false); // 加载中 + +/** 查询文章列表 */ const queryArticleList = async (title?: string) => { loading.value = true; const { list } = await ArticleApi.getArticlePage({ @@ -35,7 +36,7 @@ const queryArticleList = async (title?: string) => { loading.value = false; }; -// 初始化 +/** 初始化 */ onMounted(() => { queryArticleList(); }); @@ -65,5 +66,3 @@ onMounted(() => { - - From 4bb631fb24fd755b380002e564f95270e81654a6 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 1 Nov 2025 19:58:34 +0800 Subject: [PATCH 52/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?editor=20=E7=9A=84=20promotion-combination=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobile/promotion-combination/config.ts | 76 +++++++------------ .../mobile/promotion-combination/index.vue | 39 ++++------ .../mobile/promotion-combination/property.vue | 42 +++++----- 3 files changed, 59 insertions(+), 98 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/config.ts b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/config.ts index f0497dc19..f9db86b73 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/config.ts +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/config.ts @@ -2,64 +2,40 @@ import type { ComponentStyle, DiyComponent } from '../../../util'; /** 拼团属性 */ export interface PromotionCombinationProperty { - // 布局类型:单列 | 三列 - layoutType: 'oneColBigImg' | 'oneColSmallImg' | 'twoCol'; - // 商品字段 + layoutType: 'oneColBigImg' | 'oneColSmallImg' | 'twoCol'; // 布局类型:单列 | 三列 fields: { - // 商品简介 - introduction: PromotionCombinationFieldProperty; - // 市场价 - marketPrice: PromotionCombinationFieldProperty; - // 商品名称 - name: PromotionCombinationFieldProperty; - // 商品价格 - price: PromotionCombinationFieldProperty; - // 商品销量 - salesCount: PromotionCombinationFieldProperty; - // 商品库存 - stock: PromotionCombinationFieldProperty; - }; - // 角标 + introduction: PromotionCombinationFieldProperty; // 商品简介 + marketPrice: PromotionCombinationFieldProperty; // 市场价 + name: PromotionCombinationFieldProperty; // 商品名称 + price: PromotionCombinationFieldProperty; // 商品价格 + salesCount: PromotionCombinationFieldProperty; // 商品销量 + stock: PromotionCombinationFieldProperty; // 商品库存 + }; // 商品字段 badge: { - // 角标图片 - imgUrl: string; - // 是否显示 - show: boolean; - }; - // 按钮 + imgUrl: string; // 角标图片 + show: boolean; // 是否显示 + }; // 角标 btnBuy: { - // 文字按钮:背景渐变起始颜色 - bgBeginColor: string; - // 文字按钮:背景渐变结束颜色 - bgEndColor: string; - // 图片按钮:图片地址 - imgUrl: string; - // 文字 - text: string; - // 类型:文字 | 图片 - type: 'img' | 'text'; - }; - // 上圆角 - borderRadiusTop: number; - // 下圆角 - borderRadiusBottom: number; - // 间距 - space: number; - // 拼团活动编号 - activityIds: number[]; - // 组件样式 - style: ComponentStyle; + bgBeginColor: string; // 文字按钮:背景渐变起始颜色 + bgEndColor: string; // 文字按钮:背景渐变结束颜色 + imgUrl: string; // 图片按钮:图片地址 + text: string; // 文字 + type: 'img' | 'text'; // 类型:文字 | 图片 + }; // 按钮 + borderRadiusTop: number; // 上圆角 + borderRadiusBottom: number; // 下圆角 + space: number; // 间距 + activityIds: number[]; // 拼团活动编号 + style: ComponentStyle; // 组件样式 } -// 商品字段 +/** 商品字段属性 */ export interface PromotionCombinationFieldProperty { - // 是否显示 - show: boolean; - // 颜色 - color: string; + show: boolean; // 是否显示 + color: string; // 颜色 } -// 定义组件 +/** 定义组件 */ export const component = { id: 'PromotionCombination', name: '拼团', diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/index.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/index.vue index 82f1f5bd7..4be26abf4 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/index.vue @@ -15,9 +15,9 @@ import * as CombinationActivityApi from '#/api/mall/promotion/combination/combin /** 拼团卡片 */ defineOptions({ name: 'PromotionCombination' }); -// 定义属性 + const props = defineProps<{ property: PromotionCombinationProperty }>(); -// 商品列表 + const spuList = ref([]); const spuIdList = ref([]); const combinationActivityList = ref< @@ -30,7 +30,7 @@ watch( try { // 新添加的拼团组件,是没有活动ID的 const activityIds = props.property.activityIds; - // 检查活动ID的有效性 + // 检查活动 ID 的有效性 if (Array.isArray(activityIds) && activityIds.length > 0) { // 获取拼团活动详情列表 combinationActivityList.value = @@ -70,28 +70,21 @@ watch( }, ); -/** - * 计算商品的间距 - * @param index 商品索引 - */ -const calculateSpace = (index: number) => { - // 商品的列数 - const columns = props.property.layoutType === 'twoCol' ? 2 : 1; - // 第一列没有左边距 - const marginLeft = index % columns === 0 ? '0' : `${props.property.space}px`; - // 第一行没有上边距 - const marginTop = index < columns ? '0' : `${props.property.space}px`; - +/** 计算商品的间距 */ +function calculateSpace(index: number) { + const columns = props.property.layoutType === 'twoCol' ? 2 : 1; // 商品的列数 + const marginLeft = index % columns === 0 ? '0' : `${props.property.space}px`; // 第一列没有左边距 + const marginTop = index < columns ? '0' : `${props.property.space}px`; // 第一行没有上边距 return { marginLeft, marginTop }; -}; +} -// 容器 const containerRef = ref(); -// 计算商品的宽度 + +/** 计算商品的宽度 */ const calculateWidth = () => { let width = '100%'; - // 双列时每列的宽度为:(总宽度 - 间距)/ 2 if (props.property.layoutType === 'twoCol') { + // 双列时每列的宽度为:(总宽度 - 间距)/ 2 width = `${(containerRef.value.offsetWidth - props.property.space) / 2}px`; } return { width }; @@ -117,7 +110,7 @@ const calculateWidth = () => { >
{
- ¥{{ fenToYuan(spu.marketPrice) }} + ¥{{ fenToYuan(spu.marketPrice!) }}
@@ -229,5 +222,3 @@ const calculateWidth = () => {
- - diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/property.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/property.vue index 273580f44..fe222be0b 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/property.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/promotion-combination/property.vue @@ -1,17 +1,15 @@ @@ -186,5 +182,3 @@ onMounted(async () => { - - From b3e1dab487f6858d7a67152b969f5fe936332dac Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 1 Nov 2025 21:09:29 +0800 Subject: [PATCH 53/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90ele=E3=80=91?= =?UTF-8?q?=E3=80=90mall=E3=80=91product/spu=20=E7=9A=84=20components=20?= =?UTF-8?q?=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/spu/components/spu-showcase.vue | 27 +--- .../spu/components/spu-table-select.vue | 135 ++++++++---------- apps/web-ele/src/api/mall/product/category.ts | 2 +- .../mall/product/spu/components/index.ts | 1 - .../spu/components/sku-table-select.vue | 18 +-- .../product/spu/components/spu-showcase.vue | 22 +-- .../spu/components/spu-table-select.vue | 127 +++++++--------- .../src/views/mall/product/spu/data.ts | 2 - 8 files changed, 134 insertions(+), 200 deletions(-) diff --git a/apps/web-antd/src/views/mall/product/spu/components/spu-showcase.vue b/apps/web-antd/src/views/mall/product/spu/components/spu-showcase.vue index 6b0547c20..e1abcb255 100644 --- a/apps/web-antd/src/views/mall/product/spu/components/spu-showcase.vue +++ b/apps/web-antd/src/views/mall/product/spu/components/spu-showcase.vue @@ -26,8 +26,8 @@ const props = withDefaults(defineProps(), { const emit = defineEmits(['update:modelValue', 'change']); -const productSpus = ref([]); -const spuTableSelectRef = ref>(); +const productSpus = ref([]); // 已选择的商品列表 +const spuTableSelectRef = ref>(); // 商品选择表格组件引用 const isMultiple = computed(() => props.limit !== 1); // 是否为多选模式 /** 计算是否可以添加 */ @@ -47,12 +47,10 @@ watch( async (newValue) => { // eslint-disable-next-line unicorn/no-nested-ternary const ids = Array.isArray(newValue) ? newValue : newValue ? [newValue] : []; - if (ids.length === 0) { productSpus.value = []; return; } - // 只有商品发生变化时才重新查询 if ( productSpus.value.length === 0 || @@ -103,16 +101,16 @@ function emitSpuChange() {
+
+
@@ -140,17 +139,3 @@ function emitSpuChange() { @change="handleSpuSelected" /> - - diff --git a/apps/web-antd/src/views/mall/product/spu/components/spu-table-select.vue b/apps/web-antd/src/views/mall/product/spu/components/spu-table-select.vue index 46bfb1e92..236d4c264 100644 --- a/apps/web-antd/src/views/mall/product/spu/components/spu-table-select.vue +++ b/apps/web-antd/src/views/mall/product/spu/components/spu-table-select.vue @@ -2,6 +2,7 @@ diff --git a/apps/web-ele/src/api/mall/product/category.ts b/apps/web-ele/src/api/mall/product/category.ts index 12d7202f4..7ec8bf833 100644 --- a/apps/web-ele/src/api/mall/product/category.ts +++ b/apps/web-ele/src/api/mall/product/category.ts @@ -50,7 +50,7 @@ export function getCategoryList(params: any) { ); } -// 获得商品分类列表 +/** 获得商品分类列表 */ export function getCategorySimpleList() { return requestClient.get( '/product/category/list', diff --git a/apps/web-ele/src/views/mall/product/spu/components/index.ts b/apps/web-ele/src/views/mall/product/spu/components/index.ts index f73d34334..122cbcea0 100644 --- a/apps/web-ele/src/views/mall/product/spu/components/index.ts +++ b/apps/web-ele/src/views/mall/product/spu/components/index.ts @@ -1,4 +1,3 @@ export { default as SkuTableSelect } from './sku-table-select.vue'; export { default as SpuShowcase } from './spu-showcase.vue'; export { default as SpuTableSelect } from './spu-table-select.vue'; - diff --git a/apps/web-ele/src/views/mall/product/spu/components/sku-table-select.vue b/apps/web-ele/src/views/mall/product/spu/components/sku-table-select.vue index af6fdbc1c..11f9f887d 100644 --- a/apps/web-ele/src/views/mall/product/spu/components/sku-table-select.vue +++ b/apps/web-ele/src/views/mall/product/spu/components/sku-table-select.vue @@ -59,6 +59,15 @@ const gridColumns = computed(() => [ }, ]); +/** 处理选中 */ +function handleRadioChange() { + const selectedRow = gridApi.grid.getRadioRecord() as MallSpuApi.Sku; + if (selectedRow) { + emit('change', selectedRow); + modalApi.close(); + } +} + // TODO @芋艿:要不要直接非 pager? const [Grid, gridApi] = useVbenVxeGrid({ gridOptions: { @@ -89,15 +98,6 @@ const [Grid, gridApi] = useVbenVxeGrid({ }, }); -/** 处理选中 */ -function handleRadioChange() { - const selectedRow = gridApi.grid.getRadioRecord() as MallSpuApi.Sku; - if (selectedRow) { - emit('change', selectedRow); - modalApi.close(); - } -} - const [Modal, modalApi] = useVbenModal({ destroyOnClose: true, onOpenChange: async (isOpen: boolean) => { diff --git a/apps/web-ele/src/views/mall/product/spu/components/spu-showcase.vue b/apps/web-ele/src/views/mall/product/spu/components/spu-showcase.vue index dfa305aad..05568e5b0 100644 --- a/apps/web-ele/src/views/mall/product/spu/components/spu-showcase.vue +++ b/apps/web-ele/src/views/mall/product/spu/components/spu-showcase.vue @@ -26,8 +26,8 @@ const props = withDefaults(defineProps(), { const emit = defineEmits(['update:modelValue', 'change']); -const productSpus = ref([]); -const spuTableSelectRef = ref>(); +const productSpus = ref([]); // 已选择的商品列表 +const spuTableSelectRef = ref>(); // 商品选择表格组件引用 const isMultiple = computed(() => props.limit !== 1); // 是否为多选模式 /** 计算是否可以添加 */ @@ -101,7 +101,7 @@ function emitSpuChange() {
@@ -125,7 +125,7 @@ function emitSpuChange() {
@@ -140,17 +140,3 @@ function emitSpuChange() { @change="handleSpuSelected" /> - - diff --git a/apps/web-ele/src/views/mall/product/spu/components/spu-table-select.vue b/apps/web-ele/src/views/mall/product/spu/components/spu-table-select.vue index 76e2d9294..84a5b44c4 100644 --- a/apps/web-ele/src/views/mall/product/spu/components/spu-table-select.vue +++ b/apps/web-ele/src/views/mall/product/spu/components/spu-table-select.vue @@ -2,6 +2,7 @@ diff --git a/apps/web-ele/src/views/mall/product/spu/data.ts b/apps/web-ele/src/views/mall/product/spu/data.ts index 1037fa4f3..f667c6948 100644 --- a/apps/web-ele/src/views/mall/product/spu/data.ts +++ b/apps/web-ele/src/views/mall/product/spu/data.ts @@ -7,8 +7,6 @@ import { handleTree } from '@vben/utils'; import { getCategoryList } from '#/api/mall/product/category'; import { getRangePickerDefaultProps } from '#/utils'; -// TODO @霖:所有 mall 的 search 少了,请输入 xxx;表单也是类似 - /** 列表的搜索表单 */ export function useGridFormSchema(): VbenFormSchema[] { return [ From c6d6d1c1e87e9f93b853fa0ae7ec9af0f6c15bff Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 1 Nov 2025 21:18:49 +0800 Subject: [PATCH 54/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90ele=E3=80=91?= =?UTF-8?q?=E3=80=90mall=E3=80=91draggable=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../promotion/components/draggable/index.vue | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/draggable/index.vue b/apps/web-ele/src/views/mall/promotion/components/draggable/index.vue index ad7f9f3df..d2901f395 100644 --- a/apps/web-ele/src/views/mall/promotion/components/draggable/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/draggable/index.vue @@ -1,6 +1,4 @@ - - + 添加 - - + + - - From b88004390013d826e5e0aff452ec1f9fb483d222 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 1 Nov 2025 21:19:05 +0800 Subject: [PATCH 55/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20?= =?UTF-8?q?editor=20=E7=9A=84=20search-bar=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/mobile/search-bar/config.ts | 4 +- .../components/mobile/search-bar/index.vue | 48 +++---------------- .../components/mobile/search-bar/property.vue | 18 +++---- 3 files changed, 18 insertions(+), 52 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/search-bar/config.ts b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/search-bar/config.ts index 01d5894d1..c471780e1 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/search-bar/config.ts +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/search-bar/config.ts @@ -13,10 +13,10 @@ export interface SearchProperty { style: ComponentStyle; } -// 文字位置 +/** 文字位置 */ export type PlaceholderPosition = 'center' | 'left'; -// 定义组件 +/** 定义组件 */ export const component = { id: 'SearchBar', name: '搜索框', diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/search-bar/index.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/search-bar/index.vue index e7c770304..7463d7db6 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/search-bar/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/search-bar/index.vue @@ -5,19 +5,19 @@ import { IconifyIcon } from '@vben/icons'; /** 搜索框 */ defineOptions({ name: 'SearchBar' }); + defineProps<{ property: SearchProperty }>(); - - diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/search-bar/property.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/search-bar/property.vue index 5e1822078..4dca02da7 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/search-bar/property.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/search-bar/property.vue @@ -11,6 +11,7 @@ import { ElCard, ElForm, ElFormItem, + ElInput, ElRadioButton, ElRadioGroup, ElSlider, @@ -18,7 +19,7 @@ import { ElTooltip, } from 'element-plus'; -import { Draggable } from '#/views/mall/promotion/components'; +import { ColorInput, Draggable } from '#/views/mall/promotion/components'; import ComponentContainerProperty from '../../component-container-property.vue'; @@ -26,10 +27,12 @@ import ComponentContainerProperty from '../../component-container-property.vue'; defineOptions({ name: 'SearchProperty' }); const props = defineProps<{ modelValue: SearchProperty }>(); + const emit = defineEmits(['update:modelValue']); + const formData = useVModel(props, 'modelValue', emit); -// 监听热词数组变化 +/** 监听热词数组变化 */ watch( () => formData.value.hotKeywords, (newVal) => { @@ -45,8 +48,7 @@ watch( \ No newline at end of file diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-card/property.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-card/property.vue index 79a7eb080..46a0e16c5 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-card/property.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-card/property.vue @@ -5,16 +5,16 @@ import { useVModel } from '@vueuse/core'; import ComponentContainerProperty from '../../component-container-property.vue'; -// 用户卡片属性面板 +/** 用户卡片属性面板 */ defineOptions({ name: 'UserCardProperty' }); const props = defineProps<{ modelValue: UserCardProperty }>(); + const emit = defineEmits(['update:modelValue']); + const formData = useVModel(props, 'modelValue', emit); - - diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-order/config.ts b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-order/config.ts index 25ca85065..e149b22f1 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-order/config.ts +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-order/config.ts @@ -2,11 +2,10 @@ import type { ComponentStyle, DiyComponent } from '../../../util'; /** 用户订单属性 */ export interface UserOrderProperty { - // 组件样式 - style: ComponentStyle; + style: ComponentStyle; // 组件样式 } -// 定义组件 +/** 定义组件 */ export const component = { id: 'UserOrder', name: '用户订单', diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-order/index.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-order/index.vue index ab527acee..1c171b3eb 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-order/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-order/index.vue @@ -5,13 +5,12 @@ import { ElImage } from 'element-plus'; /** 用户订单 */ defineOptions({ name: 'UserOrder' }); -// 定义属性 + +/** 定义属性 */ defineProps<{ property: UserOrderProperty }>(); - - + \ No newline at end of file diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-order/property.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-order/property.vue index 48f0c0a41..2f9abe556 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-order/property.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-order/property.vue @@ -5,16 +5,16 @@ import { useVModel } from '@vueuse/core'; import ComponentContainerProperty from '../../component-container-property.vue'; -// 用户订单属性面板 +/** 用户订单属性面板 */ defineOptions({ name: 'UserOrderProperty' }); const props = defineProps<{ modelValue: UserOrderProperty }>(); + const emit = defineEmits(['update:modelValue']); + const formData = useVModel(props, 'modelValue', emit); - - + \ No newline at end of file diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-wallet/config.ts b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-wallet/config.ts index 2b10d32fb..71d8d0245 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-wallet/config.ts +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-wallet/config.ts @@ -2,11 +2,10 @@ import type { ComponentStyle, DiyComponent } from '../../../util'; /** 用户资产属性 */ export interface UserWalletProperty { - // 组件样式 - style: ComponentStyle; + style: ComponentStyle; // 组件样式 } -// 定义组件 +/** 定义组件 */ export const component = { id: 'UserWallet', name: '用户资产', diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-wallet/index.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-wallet/index.vue index 7581e54c9..4eabad045 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-wallet/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-wallet/index.vue @@ -5,13 +5,12 @@ import { ElImage } from 'element-plus'; /** 用户资产 */ defineOptions({ name: 'UserWallet' }); -// 定义属性 + +/** 定义属性 */ defineProps<{ property: UserWalletProperty }>(); - - + \ No newline at end of file diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-wallet/property.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-wallet/property.vue index 5c01b828e..74b374535 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-wallet/property.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/user-wallet/property.vue @@ -5,11 +5,13 @@ import { useVModel } from '@vueuse/core'; import ComponentContainerProperty from '../../component-container-property.vue'; -// 用户资产属性面板 +/** 用户资产属性面板 */ defineOptions({ name: 'UserWalletProperty' }); const props = defineProps<{ modelValue: UserWalletProperty }>(); + const emit = defineEmits(['update:modelValue']); + const formData = useVModel(props, 'modelValue', emit); From d7cea8be392b0f3c5fef0171df0422b8f70a58ed Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 1 Nov 2025 21:42:23 +0800 Subject: [PATCH 60/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91video-?= =?UTF-8?q?player=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/mobile/video-player/config.ts | 19 +++++++------------ .../components/mobile/video-player/index.vue | 13 ++----------- .../mobile/video-player/property.vue | 8 ++++---- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/video-player/config.ts b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/video-player/config.ts index bc9195575..ab7ccd311 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/video-player/config.ts +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/video-player/config.ts @@ -2,23 +2,18 @@ import type { ComponentStyle, DiyComponent } from '../../../util'; /** 视频播放属性 */ export interface VideoPlayerProperty { - // 视频链接 - videoUrl: string; - // 封面链接 - posterUrl: string; - // 是否自动播放 - autoplay: boolean; - // 组件样式 - style: VideoPlayerStyle; + videoUrl: string; // 视频链接 + posterUrl: string; // 封面链接 + autoplay: boolean; // 是否自动播放 + style: VideoPlayerStyle; // 组件样式 } -// 视频播放样式 +/** 视频播放样式 */ export interface VideoPlayerStyle extends ComponentStyle { - // 视频高度 - height: number; + height: number; // 视频高度 } -// 定义组件 +/** 定义组件 */ export const component = { id: 'VideoPlayer', name: '视频播放', diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/video-player/index.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/video-player/index.vue index ddd448d96..b58577d5b 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/video-player/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/video-player/index.vue @@ -11,13 +11,13 @@ defineProps<{ property: VideoPlayerProperty }>(); - - diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/video-player/property.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/video-player/property.vue index 67c355905..c576d8f76 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/video-player/property.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/video-player/property.vue @@ -9,11 +9,13 @@ import UploadImg from '#/components/upload/image-upload.vue'; import ComponentContainerProperty from '../../component-container-property.vue'; -// 视频播放属性面板 +/** 视频播放属性面板 */ defineOptions({ name: 'VideoPlayerProperty' }); const props = defineProps<{ modelValue: VideoPlayerProperty }>(); + const emit = defineEmits(['update:modelValue']); + const formData = useVModel(props, 'modelValue', emit); @@ -58,6 +60,4 @@ const formData = useVModel(props, 'modelValue', emit); - - - + \ No newline at end of file From 4412d455a30f0b97a34a940b1fedee7b5e3633d6 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 1 Nov 2025 22:50:24 +0800 Subject: [PATCH 61/61] =?UTF-8?q?feat=EF=BC=9A=E3=80=90antd=E3=80=91?= =?UTF-8?q?=E3=80=90ele=E3=80=91=E4=BB=A3=E7=A0=81=E9=A3=8E=E6=A0=BC?= =?UTF-8?q?=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/infra/apiAccessLog/modules/detail.vue | 1 - .../views/infra/apiErrorLog/modules/detail.vue | 1 - .../views/infra/job/logger/modules/detail.vue | 1 - .../src/views/infra/job/modules/detail.vue | 1 - .../views/mall/trade/afterSale/detail/index.vue | 1 + .../src/views/mall/trade/order/detail/index.vue | 3 ++- .../src/views/pay/notify/modules/detail.vue | 1 - .../src/views/pay/order/modules/detail.vue | 1 - .../src/views/pay/refund/modules/detail.vue | 1 - .../src/views/pay/transfer/modules/detail.vue | 1 - .../src/views/system/loginlog/modules/detail.vue | 1 - .../src/views/system/mail/log/modules/detail.vue | 1 - .../system/notify/message/modules/detail.vue | 1 - .../views/system/notify/my/modules/detail.vue | 1 - .../views/system/operatelog/modules/detail.vue | 1 - .../src/views/system/sms/log/modules/detail.vue | 1 - .../views/system/social/user/modules/detail.vue | 3 --- .../web-ele/src/views/infra/apiAccessLog/data.ts | 4 ++-- .../views/infra/apiAccessLog/modules/detail.vue | 1 - .../views/infra/apiErrorLog/modules/detail.vue | 1 - .../views/infra/job/logger/modules/detail.vue | 2 +- .../src/views/infra/job/modules/detail.vue | 1 - .../mall/home/modules/operation-data-card.vue | 6 +++--- .../mall/statistics/trade/modules/trend-card.vue | 3 ++- .../trade/afterSale/modules/disagree-form.vue | 4 ++-- .../views/mall/trade/brokerage/user/index.vue | 14 +++++--------- .../src/views/mall/trade/order/detail/index.vue | 16 ++++++---------- apps/web-ele/src/views/pay/notify/data.ts | 1 - .../src/views/pay/notify/modules/detail.vue | 2 -- .../src/views/pay/order/modules/detail.vue | 1 - .../src/views/pay/refund/modules/detail.vue | 2 +- .../src/views/pay/transfer/modules/detail.vue | 2 +- .../src/views/system/loginlog/modules/detail.vue | 2 +- .../src/views/system/mail/log/modules/detail.vue | 2 +- .../system/notify/message/modules/detail.vue | 1 - .../views/system/notify/my/modules/detail.vue | 1 - .../views/system/operatelog/modules/detail.vue | 1 - .../src/views/system/sms/log/modules/detail.vue | 3 +-- .../views/system/social/user/modules/detail.vue | 2 -- 39 files changed, 29 insertions(+), 64 deletions(-) diff --git a/apps/web-antd/src/views/infra/apiAccessLog/modules/detail.vue b/apps/web-antd/src/views/infra/apiAccessLog/modules/detail.vue index b3de99cc7..badc9376c 100644 --- a/apps/web-antd/src/views/infra/apiAccessLog/modules/detail.vue +++ b/apps/web-antd/src/views/infra/apiAccessLog/modules/detail.vue @@ -14,7 +14,6 @@ const formData = ref(); const [Descriptions] = useDescription({ bordered: true, column: 1, - class: 'mx-4', schema: useDetailSchema(), }); diff --git a/apps/web-antd/src/views/infra/apiErrorLog/modules/detail.vue b/apps/web-antd/src/views/infra/apiErrorLog/modules/detail.vue index 9c4e44c9f..da52c17fa 100644 --- a/apps/web-antd/src/views/infra/apiErrorLog/modules/detail.vue +++ b/apps/web-antd/src/views/infra/apiErrorLog/modules/detail.vue @@ -14,7 +14,6 @@ const formData = ref(); const [Descriptions] = useDescription({ bordered: true, column: 1, - class: 'mx-4', schema: useDetailSchema(), }); diff --git a/apps/web-antd/src/views/infra/job/logger/modules/detail.vue b/apps/web-antd/src/views/infra/job/logger/modules/detail.vue index 18c868de4..ceb1b5bf1 100644 --- a/apps/web-antd/src/views/infra/job/logger/modules/detail.vue +++ b/apps/web-antd/src/views/infra/job/logger/modules/detail.vue @@ -15,7 +15,6 @@ const formData = ref(); const [Descriptions] = useDescription({ bordered: true, column: 1, - class: 'mx-4', schema: useDetailSchema(), }); diff --git a/apps/web-antd/src/views/infra/job/modules/detail.vue b/apps/web-antd/src/views/infra/job/modules/detail.vue index 145a19dab..f23149e2d 100644 --- a/apps/web-antd/src/views/infra/job/modules/detail.vue +++ b/apps/web-antd/src/views/infra/job/modules/detail.vue @@ -16,7 +16,6 @@ const nextTimes = ref([]); // 下一次执行时间 const [Descriptions] = useDescription({ bordered: true, column: 1, - class: 'mx-4', schema: useDetailSchema(), }); diff --git a/apps/web-antd/src/views/mall/trade/afterSale/detail/index.vue b/apps/web-antd/src/views/mall/trade/afterSale/detail/index.vue index c2a1fd9ac..85c513261 100644 --- a/apps/web-antd/src/views/mall/trade/afterSale/detail/index.vue +++ b/apps/web-antd/src/views/mall/trade/afterSale/detail/index.vue @@ -48,6 +48,7 @@ const afterSale = ref({ logs: [], }); +// TODO @xingyu:貌似 antd 相比 antd 来说,多了一个框?有啥办法只有 1 个么? const [OrderDescriptions] = useDescription({ title: '订单信息', bordered: false, diff --git a/apps/web-antd/src/views/mall/trade/order/detail/index.vue b/apps/web-antd/src/views/mall/trade/order/detail/index.vue index 89a2a1bfa..14c0db8c5 100644 --- a/apps/web-antd/src/views/mall/trade/order/detail/index.vue +++ b/apps/web-antd/src/views/mall/trade/order/detail/index.vue @@ -60,6 +60,7 @@ const deliveryExpressList = ref( const expressTrackList = ref([]); const pickUpStore = ref(); +// TODO @xingyu:貌似 antd 相比 antd 来说,多了一个框?有啥办法只有 1 个么? const [OrderInfoDescriptions] = useDescription({ title: '订单信息', bordered: false, @@ -337,7 +338,7 @@ onMounted(async () => {
diff --git a/apps/web-antd/src/views/pay/notify/modules/detail.vue b/apps/web-antd/src/views/pay/notify/modules/detail.vue index fb79db80a..90a6a67b0 100644 --- a/apps/web-antd/src/views/pay/notify/modules/detail.vue +++ b/apps/web-antd/src/views/pay/notify/modules/detail.vue @@ -19,7 +19,6 @@ const formData = ref(); const [Description] = useDescription({ bordered: true, column: 2, - class: 'mx-4', schema: useDetailSchema(), }); diff --git a/apps/web-antd/src/views/pay/order/modules/detail.vue b/apps/web-antd/src/views/pay/order/modules/detail.vue index 68b5426c2..2d4d84b10 100644 --- a/apps/web-antd/src/views/pay/order/modules/detail.vue +++ b/apps/web-antd/src/views/pay/order/modules/detail.vue @@ -15,7 +15,6 @@ const formData = ref(); const [Descriptions] = useDescription({ bordered: true, column: 2, - class: 'mx-4', schema: useDetailSchema(), }); diff --git a/apps/web-antd/src/views/pay/refund/modules/detail.vue b/apps/web-antd/src/views/pay/refund/modules/detail.vue index 79adf6d65..d78ea529d 100644 --- a/apps/web-antd/src/views/pay/refund/modules/detail.vue +++ b/apps/web-antd/src/views/pay/refund/modules/detail.vue @@ -15,7 +15,6 @@ const formData = ref(); const [Descriptions] = useDescription({ bordered: true, column: 2, - class: 'mx-4', schema: useDetailSchema(), }); diff --git a/apps/web-antd/src/views/pay/transfer/modules/detail.vue b/apps/web-antd/src/views/pay/transfer/modules/detail.vue index ea9fb84b6..83150697c 100644 --- a/apps/web-antd/src/views/pay/transfer/modules/detail.vue +++ b/apps/web-antd/src/views/pay/transfer/modules/detail.vue @@ -15,7 +15,6 @@ const formData = ref(); const [Descriptions] = useDescription({ bordered: true, column: 2, - class: 'mx-4', schema: useDetailSchema(), }); diff --git a/apps/web-antd/src/views/system/loginlog/modules/detail.vue b/apps/web-antd/src/views/system/loginlog/modules/detail.vue index a0970c5c2..4982a32b3 100644 --- a/apps/web-antd/src/views/system/loginlog/modules/detail.vue +++ b/apps/web-antd/src/views/system/loginlog/modules/detail.vue @@ -14,7 +14,6 @@ const formData = ref(); const [Descriptions] = useDescription({ bordered: true, column: 1, - class: 'mx-4', schema: useDetailSchema(), }); diff --git a/apps/web-antd/src/views/system/mail/log/modules/detail.vue b/apps/web-antd/src/views/system/mail/log/modules/detail.vue index e9fe28d76..3b04a9d04 100644 --- a/apps/web-antd/src/views/system/mail/log/modules/detail.vue +++ b/apps/web-antd/src/views/system/mail/log/modules/detail.vue @@ -14,7 +14,6 @@ const formData = ref(); const [Descriptions] = useDescription({ bordered: true, column: 2, - class: 'mx-4', schema: useDetailSchema(), }); diff --git a/apps/web-antd/src/views/system/notify/message/modules/detail.vue b/apps/web-antd/src/views/system/notify/message/modules/detail.vue index 7b4afe83e..a0e100dd4 100644 --- a/apps/web-antd/src/views/system/notify/message/modules/detail.vue +++ b/apps/web-antd/src/views/system/notify/message/modules/detail.vue @@ -14,7 +14,6 @@ const formData = ref(); const [Descriptions] = useDescription({ bordered: true, column: 1, - class: 'mx-4', schema: useDetailSchema(), }); diff --git a/apps/web-antd/src/views/system/notify/my/modules/detail.vue b/apps/web-antd/src/views/system/notify/my/modules/detail.vue index 7b4afe83e..a0e100dd4 100644 --- a/apps/web-antd/src/views/system/notify/my/modules/detail.vue +++ b/apps/web-antd/src/views/system/notify/my/modules/detail.vue @@ -14,7 +14,6 @@ const formData = ref(); const [Descriptions] = useDescription({ bordered: true, column: 1, - class: 'mx-4', schema: useDetailSchema(), }); diff --git a/apps/web-antd/src/views/system/operatelog/modules/detail.vue b/apps/web-antd/src/views/system/operatelog/modules/detail.vue index e69d8b20d..5ada4818a 100644 --- a/apps/web-antd/src/views/system/operatelog/modules/detail.vue +++ b/apps/web-antd/src/views/system/operatelog/modules/detail.vue @@ -14,7 +14,6 @@ const formData = ref(); const [Descriptions] = useDescription({ bordered: true, column: 1, - class: 'mx-4', schema: useDetailSchema(), }); diff --git a/apps/web-antd/src/views/system/sms/log/modules/detail.vue b/apps/web-antd/src/views/system/sms/log/modules/detail.vue index 71cfb2c3a..2831f6ff5 100644 --- a/apps/web-antd/src/views/system/sms/log/modules/detail.vue +++ b/apps/web-antd/src/views/system/sms/log/modules/detail.vue @@ -14,7 +14,6 @@ const formData = ref(); const [Descriptions] = useDescription({ bordered: true, column: 2, - class: 'mx-4', schema: useDetailSchema(), }); diff --git a/apps/web-antd/src/views/system/social/user/modules/detail.vue b/apps/web-antd/src/views/system/social/user/modules/detail.vue index df24c9bab..de2b35cbf 100644 --- a/apps/web-antd/src/views/system/social/user/modules/detail.vue +++ b/apps/web-antd/src/views/system/social/user/modules/detail.vue @@ -16,9 +16,6 @@ const formData = ref(); const [Descriptions] = useDescription({ bordered: true, column: 1, - size: 'middle', - class: 'mx-4', - labelStyle: { width: '185px' }, schema: useDetailSchema(), }); diff --git a/apps/web-ele/src/views/infra/apiAccessLog/data.ts b/apps/web-ele/src/views/infra/apiAccessLog/data.ts index 0abdede2d..fb59f59b6 100644 --- a/apps/web-ele/src/views/infra/apiAccessLog/data.ts +++ b/apps/web-ele/src/views/infra/apiAccessLog/data.ts @@ -226,7 +226,7 @@ export function useDetailSchema(): DescriptionItemSchema[] { label: '请求时间', field: 'beginTime', render: (val, data) => { - if (data?.beginTime && data?.endTime) { + if (val && data?.endTime) { return `${formatDateTime(val)} ~ ${formatDateTime(data.endTime)}`; } return ''; @@ -245,7 +245,7 @@ export function useDetailSchema(): DescriptionItemSchema[] { render: (val, data) => { if (val === 0) { return '正常'; - } else if (data && data.resultMsg) { + } else if (val > 0 && data?.resultMsg) { return `失败 | ${val} | ${data.resultMsg}`; } return ''; diff --git a/apps/web-ele/src/views/infra/apiAccessLog/modules/detail.vue b/apps/web-ele/src/views/infra/apiAccessLog/modules/detail.vue index f5b3c65a3..0b3c4c7fa 100644 --- a/apps/web-ele/src/views/infra/apiAccessLog/modules/detail.vue +++ b/apps/web-ele/src/views/infra/apiAccessLog/modules/detail.vue @@ -14,7 +14,6 @@ const formData = ref(); const [Descriptions] = useDescription({ border: true, column: 1, - labelWidth: 110, schema: useDetailSchema(), }); diff --git a/apps/web-ele/src/views/infra/apiErrorLog/modules/detail.vue b/apps/web-ele/src/views/infra/apiErrorLog/modules/detail.vue index bfe5fbd23..705cfdcd0 100644 --- a/apps/web-ele/src/views/infra/apiErrorLog/modules/detail.vue +++ b/apps/web-ele/src/views/infra/apiErrorLog/modules/detail.vue @@ -14,7 +14,6 @@ const formData = ref(); const [Descriptions] = useDescription({ border: true, column: 1, - labelWidth: 110, schema: useDetailSchema(), }); diff --git a/apps/web-ele/src/views/infra/job/logger/modules/detail.vue b/apps/web-ele/src/views/infra/job/logger/modules/detail.vue index 5a5e7a7ad..3fd440e47 100644 --- a/apps/web-ele/src/views/infra/job/logger/modules/detail.vue +++ b/apps/web-ele/src/views/infra/job/logger/modules/detail.vue @@ -13,8 +13,8 @@ import { useDetailSchema } from '../data'; const formData = ref(); const [Descriptions] = useDescription({ + border: true, column: 1, - labelWidth: 140, schema: useDetailSchema(), }); diff --git a/apps/web-ele/src/views/infra/job/modules/detail.vue b/apps/web-ele/src/views/infra/job/modules/detail.vue index 01528a091..4774573d1 100644 --- a/apps/web-ele/src/views/infra/job/modules/detail.vue +++ b/apps/web-ele/src/views/infra/job/modules/detail.vue @@ -16,7 +16,6 @@ const nextTimes = ref([]); // 下一次执行时间 const [Descriptions] = useDescription({ border: true, column: 1, - labelWidth: 140, schema: useDetailSchema(), }); diff --git a/apps/web-ele/src/views/mall/home/modules/operation-data-card.vue b/apps/web-ele/src/views/mall/home/modules/operation-data-card.vue index 4f6354bfe..4e98089db 100644 --- a/apps/web-ele/src/views/mall/home/modules/operation-data-card.vue +++ b/apps/web-ele/src/views/mall/home/modules/operation-data-card.vue @@ -95,9 +95,9 @@ onActivated(() => { /** 初始化 */ onMounted(() => { - getOrderData(); - getProductData(); - getWalletRechargeData(); + loadOrderData(); + loadProductData(); + loadWalletRechargeData(); }); diff --git a/apps/web-ele/src/views/mall/statistics/trade/modules/trend-card.vue b/apps/web-ele/src/views/mall/statistics/trade/modules/trend-card.vue index 3173e0bdd..9aa2d279a 100644 --- a/apps/web-ele/src/views/mall/statistics/trade/modules/trend-card.vue +++ b/apps/web-ele/src/views/mall/statistics/trade/modules/trend-card.vue @@ -27,6 +27,7 @@ import { getTradeStatisticsList, } from '#/api/mall/statistics/trade'; import ShortcutDateRangePicker from '#/components/shortcut-date-range-picker/shortcut-date-range-picker.vue'; +import { $t } from '#/locales'; import { getTradeTrendChartOptions } from './trend-chart-options'; @@ -138,7 +139,7 @@ async function handleExport() { - 导出 + {{ $t('page.action.export') }}
diff --git a/apps/web-ele/src/views/mall/trade/afterSale/modules/disagree-form.vue b/apps/web-ele/src/views/mall/trade/afterSale/modules/disagree-form.vue index 47f8a365a..8675c0553 100644 --- a/apps/web-ele/src/views/mall/trade/afterSale/modules/disagree-form.vue +++ b/apps/web-ele/src/views/mall/trade/afterSale/modules/disagree-form.vue @@ -9,7 +9,7 @@ import { $t } from '@vben/locales'; import { ElMessage } from 'element-plus'; import { useVbenForm } from '#/adapter/form'; -import * as AfterSaleApi from '#/api/mall/trade/afterSale/index'; +import { disagreeAfterSale } from '#/api/mall/trade/afterSale'; import { useDisagreeFormSchema } from '../data'; @@ -40,7 +40,7 @@ const [Modal, modalApi] = useVbenModal({ try { const data = (await formApi.getValues()) as MallAfterSaleApi.DisagreeRequest; - await AfterSaleApi.disagreeAfterSale(data); + await disagreeAfterSale(data); // 关闭并提示 await modalApi.close(); emit('success'); diff --git a/apps/web-ele/src/views/mall/trade/brokerage/user/index.vue b/apps/web-ele/src/views/mall/trade/brokerage/user/index.vue index d66be3c56..5b7d958dc 100644 --- a/apps/web-ele/src/views/mall/trade/brokerage/user/index.vue +++ b/apps/web-ele/src/views/mall/trade/brokerage/user/index.vue @@ -93,18 +93,14 @@ async function handleBrokerageEnabledChange( }) .then(async () => { // 更新推广资格 - const res = await updateBrokerageEnabled({ + await updateBrokerageEnabled({ id: row.id!, enabled: newEnabled, }); - if (res) { - // 提示并返回成功 - ElMessage.success($t('ui.actionMessage.operationSuccess')); - handleRefresh(); - resolve(true); - } else { - reject(new Error('更新失败')); - } + // 提示并返回成功 + ElMessage.success($t('ui.actionMessage.operationSuccess')); + handleRefresh(); + resolve(true); }) .catch(() => { reject(new Error('取消操作')); diff --git a/apps/web-ele/src/views/mall/trade/order/detail/index.vue b/apps/web-ele/src/views/mall/trade/order/detail/index.vue index d0700e91c..bb4629305 100644 --- a/apps/web-ele/src/views/mall/trade/order/detail/index.vue +++ b/apps/web-ele/src/views/mall/trade/order/detail/index.vue @@ -18,9 +18,10 @@ import { useTabs } from '@vben/hooks'; import { ElCard, ElLoading, ElMessage, ElTag } from 'element-plus'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; -import * as DeliveryExpressApi from '#/api/mall/trade/delivery/express'; -import * as DeliveryPickUpStoreApi from '#/api/mall/trade/delivery/pickUpStore'; +import { getSimpleDeliveryExpressList } from '#/api/mall/trade/delivery/express'; +import { getDeliveryPickUpStore } from '#/api/mall/trade/delivery/pickUpStore'; import * as TradeOrderApi from '#/api/mall/trade/order'; +import { getExpressTrackList } from '#/api/mall/trade/order'; import { useDescription } from '#/components/description'; import { DictTag } from '#/components/dict-tag'; import { TableAction } from '#/components/table-action'; @@ -169,12 +170,9 @@ async function getDetail() { // 如果配送方式为快递,则查询物流公司 if (res.deliveryType === DeliveryTypeEnum.EXPRESS.type) { - deliveryExpressList.value = - await DeliveryExpressApi.getSimpleDeliveryExpressList(); + deliveryExpressList.value = await getSimpleDeliveryExpressList(); if (res.logisticsId) { - expressTrackList.value = await TradeOrderApi.getExpressTrackList( - res.id!, - ); + expressTrackList.value = await getExpressTrackList(res.id!); expressTrackGridApi.setGridOptions({ data: expressTrackList.value || [], }); @@ -183,9 +181,7 @@ async function getDetail() { res.deliveryType === DeliveryTypeEnum.PICK_UP.type && res.pickUpStoreId ) { - pickUpStore.value = await DeliveryPickUpStoreApi.getDeliveryPickUpStore( - res.pickUpStoreId, - ); + pickUpStore.value = await getDeliveryPickUpStore(res.pickUpStoreId); } } finally { loading.value = false; diff --git a/apps/web-ele/src/views/pay/notify/data.ts b/apps/web-ele/src/views/pay/notify/data.ts index d94c31865..5917b416c 100644 --- a/apps/web-ele/src/views/pay/notify/data.ts +++ b/apps/web-ele/src/views/pay/notify/data.ts @@ -90,7 +90,6 @@ export function useGridFormSchema(): VbenFormSchema[] { componentProps: { ...getRangePickerDefaultProps(), clearable: true, - placeholder: ['开始日期', '结束日期'], }, }, ]; diff --git a/apps/web-ele/src/views/pay/notify/modules/detail.vue b/apps/web-ele/src/views/pay/notify/modules/detail.vue index 0375c6fa3..d5b7bb71c 100644 --- a/apps/web-ele/src/views/pay/notify/modules/detail.vue +++ b/apps/web-ele/src/views/pay/notify/modules/detail.vue @@ -19,8 +19,6 @@ const formData = ref(); const [Description] = useDescription({ border: true, column: 2, - direction: 'horizontal', - labelWidth: 140, schema: useDetailSchema(), }); diff --git a/apps/web-ele/src/views/pay/order/modules/detail.vue b/apps/web-ele/src/views/pay/order/modules/detail.vue index 452e63e18..99c261d77 100644 --- a/apps/web-ele/src/views/pay/order/modules/detail.vue +++ b/apps/web-ele/src/views/pay/order/modules/detail.vue @@ -15,7 +15,6 @@ const formData = ref(); const [Descriptions] = useDescription({ border: true, column: 2, - labelWidth: 140, schema: useDetailSchema(), }); diff --git a/apps/web-ele/src/views/pay/refund/modules/detail.vue b/apps/web-ele/src/views/pay/refund/modules/detail.vue index 7b02d9889..1b93a77e6 100644 --- a/apps/web-ele/src/views/pay/refund/modules/detail.vue +++ b/apps/web-ele/src/views/pay/refund/modules/detail.vue @@ -13,8 +13,8 @@ import { useDetailSchema } from '../data'; const formData = ref(); const [Descriptions] = useDescription({ + border: true, column: 2, - labelWidth: 140, schema: useDetailSchema(), }); diff --git a/apps/web-ele/src/views/pay/transfer/modules/detail.vue b/apps/web-ele/src/views/pay/transfer/modules/detail.vue index deb23fabf..86dd91569 100644 --- a/apps/web-ele/src/views/pay/transfer/modules/detail.vue +++ b/apps/web-ele/src/views/pay/transfer/modules/detail.vue @@ -13,8 +13,8 @@ import { useDetailSchema } from '../data'; const formData = ref(); const [Descriptions] = useDescription({ + border: true, column: 2, - labelWidth: 140, schema: useDetailSchema(), }); diff --git a/apps/web-ele/src/views/system/loginlog/modules/detail.vue b/apps/web-ele/src/views/system/loginlog/modules/detail.vue index 773069b9f..d1c9bea00 100644 --- a/apps/web-ele/src/views/system/loginlog/modules/detail.vue +++ b/apps/web-ele/src/views/system/loginlog/modules/detail.vue @@ -12,8 +12,8 @@ import { useDetailSchema } from '../data'; const formData = ref(); const [Descriptions] = useDescription({ + border: true, column: 1, - labelWidth: 110, schema: useDetailSchema(), }); diff --git a/apps/web-ele/src/views/system/mail/log/modules/detail.vue b/apps/web-ele/src/views/system/mail/log/modules/detail.vue index e70243d8b..ab0daa76e 100644 --- a/apps/web-ele/src/views/system/mail/log/modules/detail.vue +++ b/apps/web-ele/src/views/system/mail/log/modules/detail.vue @@ -12,8 +12,8 @@ import { useDetailSchema } from '../data'; const formData = ref(); const [Descriptions] = useDescription({ + border: true, column: 2, - labelWidth: 140, schema: useDetailSchema(), }); diff --git a/apps/web-ele/src/views/system/notify/message/modules/detail.vue b/apps/web-ele/src/views/system/notify/message/modules/detail.vue index 0db8555f5..f7dbc8f58 100644 --- a/apps/web-ele/src/views/system/notify/message/modules/detail.vue +++ b/apps/web-ele/src/views/system/notify/message/modules/detail.vue @@ -14,7 +14,6 @@ const formData = ref(); const [Descriptions] = useDescription({ border: true, column: 1, - labelWidth: 140, schema: useDetailSchema(), }); diff --git a/apps/web-ele/src/views/system/notify/my/modules/detail.vue b/apps/web-ele/src/views/system/notify/my/modules/detail.vue index 0db8555f5..f7dbc8f58 100644 --- a/apps/web-ele/src/views/system/notify/my/modules/detail.vue +++ b/apps/web-ele/src/views/system/notify/my/modules/detail.vue @@ -14,7 +14,6 @@ const formData = ref(); const [Descriptions] = useDescription({ border: true, column: 1, - labelWidth: 140, schema: useDetailSchema(), }); diff --git a/apps/web-ele/src/views/system/operatelog/modules/detail.vue b/apps/web-ele/src/views/system/operatelog/modules/detail.vue index d9d224f55..f4d8ae922 100644 --- a/apps/web-ele/src/views/system/operatelog/modules/detail.vue +++ b/apps/web-ele/src/views/system/operatelog/modules/detail.vue @@ -14,7 +14,6 @@ const formData = ref(); const [Descriptions] = useDescription({ border: true, column: 1, - labelWidth: 110, schema: useDetailSchema(), }); diff --git a/apps/web-ele/src/views/system/sms/log/modules/detail.vue b/apps/web-ele/src/views/system/sms/log/modules/detail.vue index 4fcd48df9..37af10f7e 100644 --- a/apps/web-ele/src/views/system/sms/log/modules/detail.vue +++ b/apps/web-ele/src/views/system/sms/log/modules/detail.vue @@ -12,9 +12,8 @@ import { useDetailSchema } from '../data'; const formData = ref(); const [Descriptions] = useDescription({ + border: true, column: 2, - direction: 'horizontal', - labelWidth: 140, schema: useDetailSchema(), }); diff --git a/apps/web-ele/src/views/system/social/user/modules/detail.vue b/apps/web-ele/src/views/system/social/user/modules/detail.vue index a70a29247..a4edf0018 100644 --- a/apps/web-ele/src/views/system/social/user/modules/detail.vue +++ b/apps/web-ele/src/views/system/social/user/modules/detail.vue @@ -16,8 +16,6 @@ const formData = ref(); const [Descriptions] = useDescription({ border: true, column: 1, - size: 'large', - labelWidth: 185, schema: useDetailSchema(), });