feat:【antd】【member 会员】迁移 CouponSendForm 组件
This commit is contained in:
@@ -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: '请输入优惠券名称',
|
||||||
|
allowClear: 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' },
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
export { default as CouponSendForm } from './send-form.vue';
|
||||||
|
export * from './data';
|
||||||
@@ -11,12 +11,7 @@ import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
|||||||
import { sendCoupon } from '#/api/mall/promotion/coupon/coupon';
|
import { sendCoupon } from '#/api/mall/promotion/coupon/coupon';
|
||||||
import { getCouponTemplatePage } from '#/api/mall/promotion/coupon/couponTemplate';
|
import { getCouponTemplatePage } from '#/api/mall/promotion/coupon/couponTemplate';
|
||||||
|
|
||||||
import {
|
import { useFormSchema, useGridColumns } from './data';
|
||||||
discountFormat,
|
|
||||||
remainedCountFormat,
|
|
||||||
usePriceFormat,
|
|
||||||
validityTypeFormat,
|
|
||||||
} from '../formatter';
|
|
||||||
|
|
||||||
/** 发送优惠券 */
|
/** 发送优惠券 */
|
||||||
async function handleSendCoupon(row: MallCouponTemplateApi.CouponTemplate) {
|
async function handleSendCoupon(row: MallCouponTemplateApi.CouponTemplate) {
|
||||||
@@ -35,57 +30,10 @@ async function handleSendCoupon(row: MallCouponTemplateApi.CouponTemplate) {
|
|||||||
|
|
||||||
const [Grid] = useVbenVxeGrid({
|
const [Grid] = useVbenVxeGrid({
|
||||||
formOptions: {
|
formOptions: {
|
||||||
// TODO @AI:挪到 data.ts
|
schema: useFormSchema(),
|
||||||
schema: [
|
|
||||||
{
|
|
||||||
component: 'Input',
|
|
||||||
fieldName: 'name',
|
|
||||||
label: '优惠券名称',
|
|
||||||
componentProps: {
|
|
||||||
placeholder: '请输入优惠券名称',
|
|
||||||
allowClear: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
gridOptions: {
|
gridOptions: {
|
||||||
// TODO @AI:挪到 data.ts
|
columns: useGridColumns(),
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
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' },
|
|
||||||
},
|
|
||||||
],
|
|
||||||
height: 500,
|
height: 500,
|
||||||
keepSource: true,
|
keepSource: true,
|
||||||
proxyConfig: {
|
proxyConfig: {
|
||||||
@@ -111,7 +59,10 @@ const [Grid] = useVbenVxeGrid({
|
|||||||
} as VxeGridProps<MallCouponTemplateApi.CouponTemplate>,
|
} as VxeGridProps<MallCouponTemplateApi.CouponTemplate>,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [Modal, modalApi] = useVbenModal({});
|
const [Modal, modalApi] = useVbenModal({
|
||||||
|
showCancelButton: false,
|
||||||
|
showConfirmButton: false,
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -12,7 +12,7 @@ import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
|||||||
import { getUserPage } from '#/api/member/user';
|
import { getUserPage } from '#/api/member/user';
|
||||||
import { $t } from '#/locales';
|
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 { useGridColumns, useGridFormSchema } from './data';
|
||||||
import BalanceForm from './modules/balance-form.vue';
|
import BalanceForm from './modules/balance-form.vue';
|
||||||
import Form from './modules/form.vue';
|
import Form from './modules/form.vue';
|
||||||
|
|||||||
Reference in New Issue
Block a user