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,