From a2ed4445f27aee99e814937b2541e939c4f70dbe Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 7 Oct 2025 20:30:18 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90ele=E3=80=91=E3=80=90memb?= =?UTF-8?q?er=20=E4=BC=9A=E5=91=98=E3=80=91=E4=BC=98=E5=8C=96=E4=BC=9A?= =?UTF-8?q?=E5=91=98=20list=E3=80=81form=20=E7=9B=B8=E5=85=B3=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/promotion/coupon/components/index.ts | 2 +- .../src/api/mall/promotion/coupon/coupon.ts | 6 +- .../mall/promotion/coupon/components/data.ts | 64 ++++++++++++++ .../mall/promotion/coupon/components/index.ts | 2 + .../promotion/coupon/components/send-form.vue | 86 +++++++++++++++++++ apps/web-ele/src/views/member/user/index.vue | 10 +-- 6 files changed, 159 insertions(+), 11 deletions(-) create mode 100644 apps/web-ele/src/views/mall/promotion/coupon/components/data.ts create mode 100644 apps/web-ele/src/views/mall/promotion/coupon/components/index.ts create mode 100644 apps/web-ele/src/views/mall/promotion/coupon/components/send-form.vue 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 3e18ad3c7..00a6c3f32 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,2 @@ +export * from './data'; export { default as CouponSendForm } from './send-form.vue'; -export * from './data'; \ No newline at end of file diff --git a/apps/web-ele/src/api/mall/promotion/coupon/coupon.ts b/apps/web-ele/src/api/mall/promotion/coupon/coupon.ts index 6cba23c16..52bc96290 100644 --- a/apps/web-ele/src/api/mall/promotion/coupon/coupon.ts +++ b/apps/web-ele/src/api/mall/promotion/coupon/coupon.ts @@ -40,9 +40,9 @@ export namespace MallCouponApi { } /** 发送优惠券 */ - export interface SendCoupon { + export interface CouponSendReqVO { /** 优惠券编号 */ - couponId: number; + templateId: number; /** 用户编号数组 */ userIds: number[]; } @@ -62,6 +62,6 @@ export function getCouponPage(params: PageParam) { } /** 发送优惠券 */ -export function sendCoupon(data: MallCouponApi.SendCoupon) { +export function sendCoupon(data: MallCouponApi.CouponSendReqVO) { return requestClient.post('/promotion/coupon/send', data); } diff --git a/apps/web-ele/src/views/mall/promotion/coupon/components/data.ts b/apps/web-ele/src/views/mall/promotion/coupon/components/data.ts new file mode 100644 index 000000000..6961bfa74 --- /dev/null +++ b/apps/web-ele/src/views/mall/promotion/coupon/components/data.ts @@ -0,0 +1,64 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeGridProps } from '#/adapter/vxe-table'; + +import { + discountFormat, + remainedCountFormat, + usePriceFormat, + validityTypeFormat, +} from '../formatter'; + +/** 搜索表单的 schema */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'name', + label: '优惠券名称', + componentProps: { + placeholder: '请输入优惠券名称', + clearable: true, + }, + }, + ]; +} + +/** 表格列配置 */ +export function useGridColumns(): VxeGridProps['columns'] { + return [ + { + title: '优惠券名称', + field: 'name', + minWidth: 120, + }, + { + title: '优惠金额 / 折扣', + field: 'discount', + minWidth: 120, + formatter: ({ row }) => discountFormat(row), + }, + { + title: '最低消费', + field: 'usePrice', + minWidth: 100, + formatter: ({ row }) => usePriceFormat(row), + }, + { + title: '有效期限', + field: 'validityType', + minWidth: 140, + formatter: ({ row }) => validityTypeFormat(row), + }, + { + title: '剩余数量', + minWidth: 100, + formatter: ({ row }) => remainedCountFormat(row), + }, + { + title: '操作', + width: 100, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-ele/src/views/mall/promotion/coupon/components/index.ts b/apps/web-ele/src/views/mall/promotion/coupon/components/index.ts new file mode 100644 index 000000000..00a6c3f32 --- /dev/null +++ b/apps/web-ele/src/views/mall/promotion/coupon/components/index.ts @@ -0,0 +1,2 @@ +export * from './data'; +export { default as CouponSendForm } from './send-form.vue'; diff --git a/apps/web-ele/src/views/mall/promotion/coupon/components/send-form.vue b/apps/web-ele/src/views/mall/promotion/coupon/components/send-form.vue new file mode 100644 index 000000000..83e989227 --- /dev/null +++ b/apps/web-ele/src/views/mall/promotion/coupon/components/send-form.vue @@ -0,0 +1,86 @@ + + + diff --git a/apps/web-ele/src/views/member/user/index.vue b/apps/web-ele/src/views/member/user/index.vue index c1ff4436c..6e166cd46 100644 --- a/apps/web-ele/src/views/member/user/index.vue +++ b/apps/web-ele/src/views/member/user/index.vue @@ -12,7 +12,7 @@ import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { getUserPage } from '#/api/member/user'; import { $t } from '#/locales'; -// import { CouponSendForm } from '../../mall/promotion/coupon/components/CouponSendForm.vue'; +import { CouponSendForm } from '../../mall/promotion/coupon/components'; import { useGridColumns, useGridFormSchema } from './data'; import BalanceForm from './modules/balance-form.vue'; import Form from './modules/form.vue'; @@ -42,7 +42,7 @@ const [LevelFormModal, levelFormModalApi] = useVbenModal({ }); const [CouponSendFormModal, couponSendFormModalApi] = useVbenModal({ - // connectedComponent: CouponSendForm, + connectedComponent: CouponSendForm, destroyOnClose: true, }); @@ -99,17 +99,12 @@ function handleViewDetail(row: MemberUserApi.User) { }); } -// 表格实例 const [Grid, gridApi] = useVbenVxeGrid({ formOptions: { schema: useGridFormSchema(), }, gridOptions: { columns: useGridColumns(), - checkboxConfig: { - highlight: true, - labelField: 'checkbox', - }, height: 'auto', keepSource: true, proxyConfig: { @@ -125,6 +120,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ }, rowConfig: { keyField: 'id', + isHover: true, }, toolbarConfig: { refresh: true,