review:【antd】【mall】商品发布相关

This commit is contained in:
YunaiV
2025-11-01 11:05:04 +08:00
parent f2c90ea7a4
commit 7f192823d7
11 changed files with 35 additions and 47 deletions

View File

@@ -37,6 +37,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
keepSource: true,
proxyConfig: {
ajax: {
// TODO @芋艿:要不要 ele 和 antd 统一下;
query: async ({ page }, formValues) => {
const params: any = {
pageNo: page.currentPage,

View File

@@ -102,7 +102,6 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
return [
// 隐藏 ID 字段
{
fieldName: 'id',
component: 'Input',
@@ -111,7 +110,6 @@ export function useFormSchema(): VbenFormSchema[] {
show: () => false,
},
},
// 活动名称
{
fieldName: 'name',
label: '活动名称',
@@ -122,7 +120,6 @@ export function useFormSchema(): VbenFormSchema[] {
allowClear: true,
},
},
// 活动时间
{
fieldName: 'startAndEndTime',
label: '活动时间',
@@ -135,7 +132,6 @@ export function useFormSchema(): VbenFormSchema[] {
allowClear: true,
},
},
// 条件类型
{
fieldName: 'conditionType',
label: '条件类型',
@@ -147,7 +143,6 @@ export function useFormSchema(): VbenFormSchema[] {
},
rules: z.number().default(PromotionConditionTypeEnum.PRICE.type),
},
// 活动范围
{
fieldName: 'productScope',
label: '活动范围',
@@ -159,7 +154,6 @@ export function useFormSchema(): VbenFormSchema[] {
},
rules: z.number().default(PromotionProductScopeEnum.ALL.scope),
},
// 备注
{
fieldName: 'remark',
label: '备注',
@@ -170,14 +164,12 @@ export function useFormSchema(): VbenFormSchema[] {
allowClear: true,
},
},
// 优惠规则(自定义组件插槽)
{
fieldName: 'rules',
label: '优惠设置',
component: 'Input',
formItemClass: 'items-start',
},
// 商品范围选择(自定义组件插槽)
{
fieldName: 'productSpuIds',
label: '选择商品',

View File

@@ -3,6 +3,7 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MallRewardActivityApi } from '#/api/mall/promotion/reward/rewardActivity';
import { Page, useVbenModal } from '@vben/common-ui';
import { CommonStatusEnum } from '@vben/constants';
import { message } from 'ant-design-vue';
@@ -41,6 +42,7 @@ function handleEdit(row: MallRewardActivityApi.RewardActivity) {
/** 关闭满减送活动 */
async function handleClose(row: MallRewardActivityApi.RewardActivity) {
// TODO @puhui999这个国际化需要加下哈closing、closeSuccess
const hideLoading = message.loading({
content: $t('ui.actionMessage.closing', [row.name]),
duration: 0,
@@ -104,7 +106,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
<Page auto-content-height>
<FormModal @success="handleRefresh" />
<Grid table-title="满减送活动">
<!-- 工具栏按钮 -->
<template #toolbar-tools>
<TableAction
:actions="[
@@ -118,8 +119,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
]"
/>
</template>
<!-- 行操作按钮 -->
<template #actions="{ row }">
<TableAction
:actions="[
@@ -136,7 +135,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
danger: true,
icon: ACTION_ICON.CLOSE,
auth: ['promotion:reward-activity:close'],
ifShow: row.status === 0,
ifShow: row.status === CommonStatusEnum.ENABLE,
popConfirm: {
title: '确认关闭该满减送活动吗?',
confirm: handleClose.bind(null, row),

View File

@@ -1,5 +1,4 @@
<script lang="ts" setup>
import type { VbenFormProps } from '#/adapter/form';
import type { MallRewardActivityApi } from '#/api/mall/promotion/reward/rewardActivity';
import { computed, nextTick, ref } from 'vue';
@@ -45,7 +44,7 @@ const [Form, formApi] = useVbenForm({
class: 'w-full',
},
labelWidth: 100,
} as VbenFormProps['commonConfig'],
},
layout: 'horizontal',
schema: useFormSchema(),
showDefaultActions: false,
@@ -53,6 +52,7 @@ const [Form, formApi] = useVbenForm({
const rewardRuleRef = ref<InstanceType<typeof RewardRule>>();
// TODO @芋艿:这里需要在简化下;
const [Modal, modalApi] = useVbenModal({
async onConfirm() {
const { valid } = await formApi.validate();

View File

@@ -35,7 +35,6 @@ export function useGridFormSchema(): VbenFormSchema[] {
/** 新增/编辑的表单 */
export function useFormSchema(): VbenFormSchema[] {
return [
// 隐藏的 ID 字段
{
component: 'Input',
fieldName: 'id',