From 276d91190c1a5e6e1214a6d0f18bdc5154c502c2 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 8 Oct 2025 17:01:18 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=20=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E3=80=91=E5=95=86=E5=93=81=E5=B1=9E=E6=80=A7=E7=9A=84=E8=BF=81?= =?UTF-8?q?=E7=A7=BB=EF=BC=88antd=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/mall/promotion/coupon/coupon.ts | 54 +++++-------- .../src/views/mall/product/property/data.ts | 75 +++++++++++++------ .../src/views/mall/product/property/index.vue | 2 +- .../property/modules/property-grid.vue | 34 ++++----- .../product/property/modules/value-form.vue | 32 ++++---- .../product/property/modules/value-grid.vue | 30 ++++---- 6 files changed, 114 insertions(+), 113 deletions(-) diff --git a/apps/web-antd/src/api/mall/promotion/coupon/coupon.ts b/apps/web-antd/src/api/mall/promotion/coupon/coupon.ts index 52bc96290..99792e4ed 100644 --- a/apps/web-antd/src/api/mall/promotion/coupon/coupon.ts +++ b/apps/web-antd/src/api/mall/promotion/coupon/coupon.ts @@ -5,46 +5,28 @@ import { requestClient } from '#/api/request'; export namespace MallCouponApi { /** 优惠券 */ export interface Coupon { - /** 优惠券编号 */ - id: number; - /** 优惠券名称 */ - name: string; - /** 优惠券状态 */ - status: number; - /** 优惠券类型 */ - type: number; - /** 优惠券金额 */ - price: number; - /** 使用门槛 */ - usePrice: number; - /** 商品范围 */ - productScope: number; - /** 商品编号数组 */ - productSpuIds: number[]; - /** 有效期类型 */ - validityType: number; - /** 固定日期-生效开始时间 */ - validStartTime: Date; - /** 固定日期-生效结束时间 */ - validEndTime: Date; - /** 领取日期-开始天数 */ - fixedStartTerm: number; - /** 领取日期-结束天数 */ - fixedEndTerm: number; - /** 每人限领个数 */ - takeLimitCount: number; - /** 是否设置满多少金额可用 */ - usePriceEnabled: boolean; - /** 商品分类编号数组 */ - productCategoryIds: number[]; + id: number; // 优惠券编号 + name: string; // 优惠券名称 + status: number; // 优惠券状态 + type: number; // 优惠券类型 + price: number; // 优惠券金额 + usePrice: number; // 使用门槛 + productScope: number; // 商品范围 + productSpuIds: number[]; // 商品编号数组 + validityType: number; // 有效期类型 + validStartTime: Date; // 固定日期-生效开始时间 + validEndTime: Date; // 固定日期-生效结束时间 + fixedStartTerm: number; // 领取日期-开始天数 + fixedEndTerm: number; // 领取日期-结束天数 + takeLimitCount: number; // 每人限领个数 + usePriceEnabled: boolean; // 是否设置满多少金额可用 + productCategoryIds: number[]; // 商品分类编号数组 } /** 发送优惠券 */ export interface CouponSendReqVO { - /** 优惠券编号 */ - templateId: number; - /** 用户编号数组 */ - userIds: number[]; + templateId: number; // 优惠券编号 + userIds: number[]; // 用户编号数组 } } diff --git a/apps/web-antd/src/views/mall/product/property/data.ts b/apps/web-antd/src/views/mall/product/property/data.ts index d24e62e45..e8c3b2080 100644 --- a/apps/web-antd/src/views/mall/product/property/data.ts +++ b/apps/web-antd/src/views/mall/product/property/data.ts @@ -2,10 +2,11 @@ import type { VbenFormSchema } from '#/adapter/form'; import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import { getPropertySimpleList } from '#/api/mall/product/property'; +import { getRangePickerDefaultProps } from '#/utils'; // ============================== 属性 ============================== -/** 类型新增/修改的表单 */ +/** 属性新增/修改的表单 */ export function usePropertyFormSchema(): VbenFormSchema[] { return [ { @@ -18,10 +19,10 @@ export function usePropertyFormSchema(): VbenFormSchema[] { }, { fieldName: 'name', - label: '名称', + label: '属性名称', component: 'Input', componentProps: { - placeholder: '请输入名称', + placeholder: '请输入属性名称', }, rules: 'required', }, @@ -36,53 +37,66 @@ export function usePropertyFormSchema(): VbenFormSchema[] { ]; } -/** 类型列表的搜索表单 */ +/** 属性列表的搜索表单 */ export function usePropertyGridFormSchema(): VbenFormSchema[] { return [ { fieldName: 'name', - label: '名称', + label: '属性名称', component: 'Input', componentProps: { - placeholder: '请输入名称', + placeholder: '请输入属性名称', + allowClear: true, + }, + }, + { + fieldName: 'createTime', + label: '创建时间', + component: 'RangePicker', + componentProps: { + ...getRangePickerDefaultProps(), allowClear: true, }, }, ]; } -/** 类型列表的字段 */ +/** 属性列表的字段 */ export function usePropertyGridColumns(): VxeTableGridOptions['columns'] { return [ { field: 'id', - title: '编号', + title: '属性编号', + minWidth: 100, }, { field: 'name', - title: '名称', + title: '属性名称', + minWidth: 200, }, { field: 'remark', title: '备注', + minWidth: 180, }, { field: 'createTime', title: '创建时间', + minWidth: 180, formatter: 'formatDateTime', }, { title: '操作', - width: 160, + minWidth: 120, fixed: 'right', slots: { default: 'actions' }, }, ]; } -// ============================== 值数据 ============================== +// ============================== 属性值 ============================== -/** 数据新增/修改的表单 */ +/** 属性值新增/修改的表单 */ export function useValueFormSchema(): VbenFormSchema[] { return [ { @@ -95,11 +109,12 @@ export function useValueFormSchema(): VbenFormSchema[] { }, { fieldName: 'propertyId', - label: '属性编号', + label: '属性', component: 'ApiSelect', componentProps: (values) => { return { api: getPropertySimpleList, + placeholder: '请选择属性', labelField: 'name', valueField: 'id', disabled: !!values.id, @@ -112,10 +127,10 @@ export function useValueFormSchema(): VbenFormSchema[] { }, { fieldName: 'name', - label: '名称', + label: '属性值名称', component: 'Input', componentProps: { - placeholder: '请输入名称', + placeholder: '请输入属性值名称', }, rules: 'required', }, @@ -130,45 +145,61 @@ export function useValueFormSchema(): VbenFormSchema[] { ]; } -/** 字典数据列表搜索表单 */ +/** 属性值列表搜索表单 */ export function useValueGridFormSchema(): VbenFormSchema[] { return [ + { + fieldName: 'propertyId', + label: '属性项', + component: 'ApiSelect', + componentProps: { + api: getPropertySimpleList, + placeholder: '请选择属性项', + labelField: 'name', + valueField: 'id', + disabled: true, + allowClear: false, + }, + }, { fieldName: 'name', - label: '名称', + label: '属性值名称', component: 'Input', componentProps: { + placeholder: '请输入属性值名称', allowClear: true, }, }, ]; } -/** - * 字典数据表格列 - */ +/** 属性值表格列 */ export function useValueGridColumns(): VxeTableGridOptions['columns'] { return [ { field: 'id', - title: '编号', + title: '属性值编号', + minWidth: 100, }, { field: 'name', title: '属性值名称', + minWidth: 180, }, { field: 'remark', title: '备注', + minWidth: 180, }, { title: '创建时间', field: 'createTime', + minWidth: 180, formatter: 'formatDateTime', }, { title: '操作', - width: 160, + minWidth: 120, fixed: 'right', slots: { default: 'actions' }, }, diff --git a/apps/web-antd/src/views/mall/product/property/index.vue b/apps/web-antd/src/views/mall/product/property/index.vue index 97036c490..302b0a320 100644 --- a/apps/web-antd/src/views/mall/product/property/index.vue +++ b/apps/web-antd/src/views/mall/product/property/index.vue @@ -6,7 +6,7 @@ import { DocAlert, Page } from '@vben/common-ui'; import PropertyGrid from './modules/property-grid.vue'; import ValueGrid from './modules/value-grid.vue'; -const searchPropertyId = ref(); // 搜索的属性ID +const searchPropertyId = ref(); // 搜索的属性 ID function handlePropertyIdSelect(propertyId: number) { searchPropertyId.value = propertyId; diff --git a/apps/web-antd/src/views/mall/product/property/modules/property-grid.vue b/apps/web-antd/src/views/mall/product/property/modules/property-grid.vue index 8c2347e2f..73aa359b6 100644 --- a/apps/web-antd/src/views/mall/product/property/modules/property-grid.vue +++ b/apps/web-antd/src/views/mall/product/property/modules/property-grid.vue @@ -1,8 +1,5 @@