feat:【ele】【mall】rewardActivity 代码对齐 antd

This commit is contained in:
puhui999
2025-12-20 11:11:00 +08:00
parent 41f0a9465d
commit c1b1343794
4 changed files with 13 additions and 28 deletions

View File

@@ -54,6 +54,7 @@ async function handleClose(row: MallRewardActivityApi.RewardActivity) {
} }
} }
/** 删除满减送活动 */
async function handleDelete(row: MallRewardActivityApi.RewardActivity) { async function handleDelete(row: MallRewardActivityApi.RewardActivity) {
const loadingInstance = ElLoading.service({ const loadingInstance = ElLoading.service({
text: $t('ui.actionMessage.deleting', [row.name]), text: $t('ui.actionMessage.deleting', [row.name]),
@@ -120,16 +121,16 @@ const [Grid, gridApi] = useVbenVxeGrid({
:actions="[ :actions="[
{ {
label: $t('common.edit'), label: $t('common.edit'),
type: 'link', type: 'primary',
link: true,
icon: ACTION_ICON.EDIT, icon: ACTION_ICON.EDIT,
auth: ['promotion:reward-activity:update'], auth: ['promotion:reward-activity:update'],
onClick: handleEdit.bind(null, row), onClick: handleEdit.bind(null, row),
}, },
// TODO @puhui999下面两个按钮type、danger 属性无效,应该是 el 不是这个哈。
{ {
label: '关闭', label: '关闭',
type: 'link', type: 'danger',
danger: true, link: true,
icon: ACTION_ICON.CLOSE, icon: ACTION_ICON.CLOSE,
auth: ['promotion:reward-activity:close'], auth: ['promotion:reward-activity:close'],
ifShow: row.status === CommonStatusEnum.ENABLE, ifShow: row.status === CommonStatusEnum.ENABLE,
@@ -140,8 +141,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
}, },
{ {
label: $t('common.delete'), label: $t('common.delete'),
type: 'link', type: 'danger',
danger: true, link: true,
icon: ACTION_ICON.DELETE, icon: ACTION_ICON.DELETE,
auth: ['promotion:reward-activity:delete'], auth: ['promotion:reward-activity:delete'],
popConfirm: { popConfirm: {

View File

@@ -72,22 +72,7 @@ const [Modal, modalApi] = useVbenModal({
item.limit = convertToInteger(item.limit || 0); item.limit = convertToInteger(item.limit || 0);
} }
}); });
switch (data.productScope) { // productScopeValues 已通过 data.ts 中的 dependencies.trigger 自动同步到表单值中
// TODO @puhui999是不是也可以类似优惠劵的处理策略哈
case PromotionProductScopeEnum.CATEGORY.scope: {
const categoryIds = data.productCategoryIds;
data.productScopeValues = Array.isArray(categoryIds)
? categoryIds
: categoryIds
? [categoryIds]
: [];
break;
}
case PromotionProductScopeEnum.SPU.scope: {
data.productScopeValues = data.productSpuIds;
break;
}
}
await (data.id await (data.id
? updateRewardActivity(data as MallRewardActivityApi.RewardActivity) ? updateRewardActivity(data as MallRewardActivityApi.RewardActivity)
: createRewardActivity(data as MallRewardActivityApi.RewardActivity)); : createRewardActivity(data as MallRewardActivityApi.RewardActivity));

View File

@@ -130,7 +130,7 @@ onMounted(async () => {
<span class="text-gray-500"></span> <span class="text-gray-500"></span>
<ElInputNumber <ElInputNumber
v-model="item.giveCount" v-model="item.giveCount"
class="!w-20" class="!w-32"
:min="0" :min="0"
:step="1" :step="1"
/> />

View File

@@ -58,8 +58,7 @@ function handleDelete(ruleIndex: number) {
</script> </script>
<template> <template>
<!-- TODO @puhui999这里报错了idea --> <ElRow :gutter="16">
<ElRow :gutter="[16, 16]">
<template v-if="formData.rules"> <template v-if="formData.rules">
<ElCol v-for="(rule, index) in formData.rules" :key="index" :span="24"> <ElCol v-for="(rule, index) in formData.rules" :key="index" :span="24">
<ElCard size="small" class="rounded-lg"> <ElCard size="small" class="rounded-lg">
@@ -174,9 +173,9 @@ function handleDelete(ruleIndex: number) {
</template> </template>
<!-- 添加规则按钮 --> <!-- 添加规则按钮 -->
<Col :span="24" class="mt-2"> <ElCol :span="24" class="mt-2">
<Button type="primary" @click="handleAdd">+ 添加优惠规则</Button> <ElButton type="primary" @click="handleAdd">+ 添加优惠规则</ElButton>
</Col> </ElCol>
<!-- 提示信息 --> <!-- 提示信息 -->
<ElCol :span="24" class="mt-2"> <ElCol :span="24" class="mt-2">