review:【antd/ele】【mall】营销模块的迁移
This commit is contained in:
@@ -30,7 +30,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
try {
|
try {
|
||||||
const data = modalApi.getData<any[]>();
|
const data = modalApi.getData<any[]>();
|
||||||
// 填充列表数据
|
// 填充列表数据
|
||||||
await gridApi.setGridOptions({ data });
|
gridApi.setGridOptions({ data });
|
||||||
} finally {
|
} finally {
|
||||||
modalApi.unlock();
|
modalApi.unlock();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
try {
|
try {
|
||||||
const data = modalApi.getData<any[]>();
|
const data = modalApi.getData<any[]>();
|
||||||
// 填充列表数据
|
// 填充列表数据
|
||||||
await gridApi.setGridOptions({ data });
|
gridApi.setGridOptions({ data });
|
||||||
} finally {
|
} finally {
|
||||||
modalApi.unlock();
|
modalApi.unlock();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
}
|
}
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<any>();
|
const data = modalApi.getData<any>();
|
||||||
|
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
type: IotDataSinkTypeEnum.HTTP,
|
type: IotDataSinkTypeEnum.HTTP,
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import { useFormSchema } from '../data';
|
|||||||
|
|
||||||
const emit = defineEmits(['success']);
|
const emit = defineEmits(['success']);
|
||||||
|
|
||||||
// 初始化 formData,确保始终有值
|
|
||||||
const formData = ref<Partial<MallCommentApi.Comment>>({
|
const formData = ref<Partial<MallCommentApi.Comment>>({
|
||||||
descriptionScores: 5,
|
descriptionScores: 5,
|
||||||
benefitScores: 5,
|
benefitScores: 5,
|
||||||
@@ -100,7 +99,6 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
},
|
},
|
||||||
async onOpenChange(isOpen: boolean) {
|
async onOpenChange(isOpen: boolean) {
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
// 重置表单数据
|
|
||||||
selectedSku.value = undefined;
|
selectedSku.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -108,6 +106,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
const data = modalApi.getData<MallCommentApi.Comment>();
|
const data = modalApi.getData<MallCommentApi.Comment>();
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
// 新建模式:重置表单
|
// 新建模式:重置表单
|
||||||
|
// TODO @puhui999:这里的重置,可以统一到 103 行那么?
|
||||||
selectedSku.value = undefined;
|
selectedSku.value = undefined;
|
||||||
await formApi.setValues({ spuId: undefined, skuId: undefined });
|
await formApi.setValues({ spuId: undefined, skuId: undefined });
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ watch(
|
|||||||
</SkuList>
|
</SkuList>
|
||||||
</template>
|
</template>
|
||||||
</VxeColumn>
|
</VxeColumn>
|
||||||
<VxeColumn field="id" align="center" title="商品编号" />
|
<VxeColumn field="id" align="center" title="商品编号" min-width="30" />
|
||||||
<VxeColumn title="商品图" min-width="80">
|
<VxeColumn title="商品图" min-width="80">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<Image
|
<Image
|
||||||
|
|||||||
@@ -41,23 +41,14 @@ function handleEdit(row: MallBargainActivityApi.BargainActivity) {
|
|||||||
|
|
||||||
/** 关闭砍价活动 */
|
/** 关闭砍价活动 */
|
||||||
async function handleClose(row: MallBargainActivityApi.BargainActivity) {
|
async function handleClose(row: MallBargainActivityApi.BargainActivity) {
|
||||||
try {
|
await confirm('确认关闭该砍价活动吗?');
|
||||||
await confirm({
|
|
||||||
content: '确认关闭该砍价活动吗?',
|
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: '确认关闭该砍价活动吗?',
|
content: '关闭中...',
|
||||||
duration: 0,
|
duration: 0,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await closeBargainActivity(row.id as number);
|
await closeBargainActivity(row.id!);
|
||||||
message.success({
|
message.success('关闭成功');
|
||||||
content: '关闭成功',
|
|
||||||
});
|
|
||||||
handleRefresh();
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
@@ -71,10 +62,8 @@ async function handleDelete(row: MallBargainActivityApi.BargainActivity) {
|
|||||||
duration: 0,
|
duration: 0,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteBargainActivity(row.id as number);
|
await deleteBargainActivity(row.id!);
|
||||||
message.success({
|
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
|
||||||
});
|
|
||||||
handleRefresh();
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
|
|||||||
@@ -96,17 +96,15 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
message.error('请选择砍价商品');
|
message.error('请选择砍价商品');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skuId.value) {
|
if (!skuId.value) {
|
||||||
message.error('请选择商品 SKU');
|
message.error('请选择商品 SKU');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 提交表单
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
try {
|
try {
|
||||||
const values = await formApi.getValues();
|
const values = await formApi.getValues();
|
||||||
|
|
||||||
// 构建提交数据,价格字段转换为分
|
|
||||||
const data = {
|
const data = {
|
||||||
...values,
|
...values,
|
||||||
spuId: spuId.value,
|
spuId: spuId.value,
|
||||||
@@ -120,11 +118,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
? Math.round(values.randomMaxPrice * 100)
|
? Math.round(values.randomMaxPrice * 100)
|
||||||
: undefined,
|
: undefined,
|
||||||
} as MallBargainActivityApi.BargainActivity;
|
} as MallBargainActivityApi.BargainActivity;
|
||||||
|
|
||||||
await (formData.value?.id
|
await (formData.value?.id
|
||||||
? updateBargainActivity(data)
|
? updateBargainActivity(data)
|
||||||
: createBargainActivity(data));
|
: createBargainActivity(data));
|
||||||
|
// 关闭并提示
|
||||||
await modalApi.close();
|
await modalApi.close();
|
||||||
emit('success');
|
emit('success');
|
||||||
message.success($t('ui.actionMessage.operationSuccess'));
|
message.success($t('ui.actionMessage.operationSuccess'));
|
||||||
@@ -141,17 +138,15 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
skuInfo.value = undefined;
|
skuInfo.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 加载表单数据
|
||||||
const data = modalApi.getData<MallBargainActivityApi.BargainActivity>();
|
const data = modalApi.getData<MallBargainActivityApi.BargainActivity>();
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
try {
|
try {
|
||||||
formData.value = await getBargainActivity(data.id);
|
formData.value = await getBargainActivity(data.id);
|
||||||
await nextTick();
|
await nextTick();
|
||||||
|
|
||||||
// 设置表单值时,价格字段从分转换为元
|
// 设置表单值时,价格字段从分转换为元
|
||||||
await formApi.setValues({
|
await formApi.setValues({
|
||||||
...formData.value,
|
...formData.value,
|
||||||
@@ -164,14 +159,12 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
? formData.value.randomMaxPrice / 100
|
? formData.value.randomMaxPrice / 100
|
||||||
: undefined,
|
: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
// 加载商品和 SKU 信息
|
// 加载商品和 SKU 信息
|
||||||
if (formData.value.spuId) {
|
if (formData.value.spuId) {
|
||||||
const spu = await getSpu(formData.value.spuId);
|
const spu = await getSpu(formData.value.spuId);
|
||||||
if (spu) {
|
if (spu) {
|
||||||
spuId.value = spu.id;
|
spuId.value = spu.id;
|
||||||
spuName.value = spu.name || '';
|
spuName.value = spu.name || '';
|
||||||
|
|
||||||
if (formData.value.skuId) {
|
if (formData.value.skuId) {
|
||||||
const selectedSku = spu.skus?.find(
|
const selectedSku = spu.skus?.find(
|
||||||
(sku) => sku.id === formData.value?.skuId,
|
(sku) => sku.id === formData.value?.skuId,
|
||||||
@@ -214,6 +207,19 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
<!-- SKU 信息展示 -->
|
<!-- SKU 信息展示 -->
|
||||||
<div v-if="skuInfo" class="mt-4">
|
<div v-if="skuInfo" class="mt-4">
|
||||||
<table class="w-full border-collapse border border-gray-300">
|
<table class="w-full border-collapse border border-gray-300">
|
||||||
|
<!-- TODO @puhui999:和 element-plus 有点差别哈;ps:是不是用 grid 组件呀?或者 vxe 组件
|
||||||
|
图片
|
||||||
|
颜色
|
||||||
|
版本
|
||||||
|
商品条码
|
||||||
|
销售价(元)
|
||||||
|
市场价(元)
|
||||||
|
成本价(元)
|
||||||
|
库存
|
||||||
|
砍价起始价格(元)
|
||||||
|
砍价底价(元)
|
||||||
|
活动库存
|
||||||
|
-->
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="bg-gray-100">
|
<tr class="bg-gray-100">
|
||||||
<th class="border border-gray-300 px-4 py-2">商品图片</th>
|
<th class="border border-gray-300 px-4 py-2">商品图片</th>
|
||||||
|
|||||||
@@ -43,23 +43,14 @@ function handleEdit(row: MallCombinationActivityApi.CombinationActivity) {
|
|||||||
async function handleClose(
|
async function handleClose(
|
||||||
row: MallCombinationActivityApi.CombinationActivity,
|
row: MallCombinationActivityApi.CombinationActivity,
|
||||||
) {
|
) {
|
||||||
try {
|
await confirm('确认关闭该拼团活动吗?');
|
||||||
await confirm({
|
|
||||||
content: '确认关闭该拼团活动吗?',
|
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: '关闭中...',
|
content: '关闭中...',
|
||||||
duration: 0,
|
duration: 0,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await closeCombinationActivity(row.id as number);
|
await closeCombinationActivity(row.id!);
|
||||||
message.success({
|
message.success('关闭成功');
|
||||||
content: '关闭成功',
|
|
||||||
});
|
|
||||||
handleRefresh();
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
@@ -75,10 +66,8 @@ async function handleDelete(
|
|||||||
duration: 0,
|
duration: 0,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteCombinationActivity(row.id as number);
|
await deleteCombinationActivity(row.id!);
|
||||||
message.success({
|
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
|
||||||
});
|
|
||||||
handleRefresh();
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
|
|||||||
@@ -92,12 +92,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
message.error('请选择拼团商品');
|
message.error('请选择拼团商品');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skuTableData.value.length === 0) {
|
if (skuTableData.value.length === 0) {
|
||||||
message.error('请至少配置一个 SKU');
|
message.error('请至少配置一个 SKU');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证 SKU 配置
|
// 验证 SKU 配置
|
||||||
const hasInvalidSku = skuTableData.value.some(
|
const hasInvalidSku = skuTableData.value.some(
|
||||||
(sku) => sku.combinationPrice < 0.01,
|
(sku) => sku.combinationPrice < 0.01,
|
||||||
@@ -107,11 +105,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 提交表单
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
try {
|
try {
|
||||||
const values = await formApi.getValues();
|
const values = await formApi.getValues();
|
||||||
|
|
||||||
// 构建提交数据
|
|
||||||
const data: any = {
|
const data: any = {
|
||||||
...values,
|
...values,
|
||||||
spuId: spuId.value,
|
spuId: spuId.value,
|
||||||
@@ -120,11 +117,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
combinationPrice: Math.round(sku.combinationPrice * 100), // 转换为分
|
combinationPrice: Math.round(sku.combinationPrice * 100), // 转换为分
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
|
|
||||||
await (formData.value?.id
|
await (formData.value?.id
|
||||||
? updateCombinationActivity(data)
|
? updateCombinationActivity(data)
|
||||||
: createCombinationActivity(data));
|
: createCombinationActivity(data));
|
||||||
|
// 关闭并提示
|
||||||
await modalApi.close();
|
await modalApi.close();
|
||||||
emit('success');
|
emit('success');
|
||||||
message.success($t('ui.actionMessage.operationSuccess'));
|
message.success($t('ui.actionMessage.operationSuccess'));
|
||||||
@@ -140,20 +136,19 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
skuTableData.value = [];
|
skuTableData.value = [];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 加载数据
|
||||||
const data =
|
const data =
|
||||||
modalApi.getData<MallCombinationActivityApi.CombinationActivity>();
|
modalApi.getData<MallCombinationActivityApi.CombinationActivity>();
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
try {
|
try {
|
||||||
formData.value = await getCombinationActivity(data.id);
|
formData.value = await getCombinationActivity(data.id);
|
||||||
await nextTick();
|
await nextTick();
|
||||||
await formApi.setValues(formData.value);
|
await formApi.setValues(formData.value);
|
||||||
|
|
||||||
// 加载商品和 SKU 信息
|
// 加载商品和 SKU 信息
|
||||||
|
// TODO @puhui999:if return,简化括号层级
|
||||||
if (formData.value.spuId) {
|
if (formData.value.spuId) {
|
||||||
const spu = await getSpu(formData.value.spuId);
|
const spu = await getSpu(formData.value.spuId);
|
||||||
if (spu) {
|
if (spu) {
|
||||||
@@ -221,6 +216,15 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
class="h-16 w-16 object-cover"
|
class="h-16 w-16 object-cover"
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
|
<!-- TODO @puhui999:这里貌似和 element-plus 没对齐;;ps:是不是用 grid 组件呀?或者 vxe 组件
|
||||||
|
图片
|
||||||
|
商品条码
|
||||||
|
销售价(元)
|
||||||
|
市场价(元)
|
||||||
|
成本价(元)
|
||||||
|
库存
|
||||||
|
拼团价格(元)
|
||||||
|
-->
|
||||||
<td class="border border-gray-300 px-4 py-2">
|
<td class="border border-gray-300 px-4 py-2">
|
||||||
{{ sku.skuName }}
|
{{ sku.skuName }}
|
||||||
</td>
|
</td>
|
||||||
@@ -228,6 +232,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
¥{{ (sku.price / 100).toFixed(2) }}
|
¥{{ (sku.price / 100).toFixed(2) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="border border-gray-300 px-4 py-2">
|
<td class="border border-gray-300 px-4 py-2">
|
||||||
|
<!-- TODO @puhui999:是不是要使用 antd 的哈? -->
|
||||||
<input
|
<input
|
||||||
v-model.number="sku.combinationPrice"
|
v-model.number="sku.combinationPrice"
|
||||||
type="number"
|
type="number"
|
||||||
|
|||||||
@@ -57,24 +57,22 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
async function open() {
|
async function open() {
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
// 重置查询条件并重新加载数据,与老组件行为一致
|
|
||||||
await gridApi.query();
|
await gridApi.query();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 确认选择 */
|
||||||
|
function handleConfirm() {
|
||||||
|
const selectedRecords = (gridApi.grid?.getCheckboxRecords() ||
|
||||||
|
[]) as MallCouponTemplateApi.CouponTemplate[];
|
||||||
|
emit('change', selectedRecords);
|
||||||
|
closeModal();
|
||||||
|
}
|
||||||
|
|
||||||
/** 关闭弹窗 */
|
/** 关闭弹窗 */
|
||||||
function closeModal() {
|
function closeModal() {
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 确认选择 */
|
|
||||||
function handleConfirm() {
|
|
||||||
// 从 gridApi 获取选中的记录
|
|
||||||
const selectedRecords = (gridApi.grid?.getCheckboxRecords() ||
|
|
||||||
[]) as MallCouponTemplateApi.CouponTemplate[];
|
|
||||||
emit('change', selectedRecords);
|
|
||||||
closeModal();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 对外暴露的方法 */
|
/** 对外暴露的方法 */
|
||||||
defineExpose({
|
defineExpose({
|
||||||
open,
|
open,
|
||||||
|
|||||||
@@ -41,23 +41,14 @@ function handleEdit(row: MallDiscountActivityApi.DiscountActivity) {
|
|||||||
|
|
||||||
/** 关闭满减活动 */
|
/** 关闭满减活动 */
|
||||||
async function handleClose(row: MallDiscountActivityApi.DiscountActivity) {
|
async function handleClose(row: MallDiscountActivityApi.DiscountActivity) {
|
||||||
try {
|
await confirm('确认关闭该限时折扣活动吗?');
|
||||||
await confirm({
|
|
||||||
content: '确认关闭该限时折扣活动吗?',
|
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: '正在关闭中',
|
content: '正在关闭中...',
|
||||||
duration: 0,
|
duration: 0,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await closeDiscountActivity(row.id as number);
|
await closeDiscountActivity(row.id!);
|
||||||
message.success({
|
message.success('关闭成功');
|
||||||
content: '关闭成功',
|
|
||||||
});
|
|
||||||
handleRefresh();
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
@@ -71,7 +62,7 @@ async function handleDelete(row: MallDiscountActivityApi.DiscountActivity) {
|
|||||||
duration: 0,
|
duration: 0,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteDiscountActivity(row.id as number);
|
await deleteDiscountActivity(row.id!);
|
||||||
message.success({
|
message.success({
|
||||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -126,7 +126,6 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
},
|
},
|
||||||
formItemClass: 'col-span-2',
|
formItemClass: 'col-span-2',
|
||||||
},
|
},
|
||||||
// TODO @puhui999:商品图太大了。
|
|
||||||
{
|
{
|
||||||
fieldName: 'spuId',
|
fieldName: 'spuId',
|
||||||
label: '活动商品',
|
label: '活动商品',
|
||||||
|
|||||||
@@ -180,7 +180,6 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
},
|
},
|
||||||
async onOpenChange(isOpen: boolean) {
|
async onOpenChange(isOpen: boolean) {
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
// 重置表单数据(新增和编辑模式都需要)
|
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
spuList.value = [];
|
spuList.value = [];
|
||||||
spuPropertyList.value = [];
|
spuPropertyList.value = [];
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<!-- 积分商城活动橱窗组件:用于展示和选择积分商城活动 -->
|
<!-- 积分商城活动橱窗组件:用于展示和选择积分商城活动 -->
|
||||||
|
<!-- TODO @puhui999:不需要 point- 前缀 --->
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { MallPointActivityApi } from '#/api/mall/promotion/point';
|
import type { MallPointActivityApi } from '#/api/mall/promotion/point';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<!-- 积分商城活动选择弹窗组件 -->
|
<!-- 积分商城活动选择弹窗组件 -->
|
||||||
|
<!-- TODO @puhui999:不需要 point- 前缀 --->
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { VbenFormSchema } from '#/adapter/form';
|
import type { VbenFormSchema } from '#/adapter/form';
|
||||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ const formData = ref<Partial<MallRewardActivityApi.RewardActivity>>({
|
|||||||
productScope: PromotionProductScopeEnum.ALL.scope,
|
productScope: PromotionProductScopeEnum.ALL.scope,
|
||||||
rules: [],
|
rules: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const getTitle = computed(() => {
|
const getTitle = computed(() => {
|
||||||
return formData.value?.id
|
return formData.value?.id
|
||||||
? $t('ui.actionTitle.edit', ['满减送'])
|
? $t('ui.actionTitle.edit', ['满减送'])
|
||||||
@@ -76,6 +75,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
});
|
});
|
||||||
// 设置 productScopeValues
|
// 设置 productScopeValues
|
||||||
switch (data.productScope) {
|
switch (data.productScope) {
|
||||||
|
// TODO @puhui999:这里要不要搞成类似优惠劵的
|
||||||
case PromotionProductScopeEnum.CATEGORY.scope: {
|
case PromotionProductScopeEnum.CATEGORY.scope: {
|
||||||
const categoryIds = data.productCategoryIds;
|
const categoryIds = data.productCategoryIds;
|
||||||
data.productScopeValues = Array.isArray(categoryIds)
|
data.productScopeValues = Array.isArray(categoryIds)
|
||||||
@@ -90,7 +90,6 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
break;
|
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));
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import { useFormSchema } from '../data';
|
|||||||
|
|
||||||
const emit = defineEmits(['success']);
|
const emit = defineEmits(['success']);
|
||||||
const formData = ref<MallSeckillActivityApi.SeckillActivity>();
|
const formData = ref<MallSeckillActivityApi.SeckillActivity>();
|
||||||
|
|
||||||
const getTitle = computed(() => {
|
const getTitle = computed(() => {
|
||||||
return formData.value?.id
|
return formData.value?.id
|
||||||
? $t('ui.actionTitle.edit', ['秒杀活动'])
|
? $t('ui.actionTitle.edit', ['秒杀活动'])
|
||||||
@@ -90,12 +89,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
message.error('请选择秒杀商品');
|
message.error('请选择秒杀商品');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skuTableData.value.length === 0) {
|
if (skuTableData.value.length === 0) {
|
||||||
message.error('请至少配置一个 SKU');
|
message.error('请至少配置一个 SKU');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证 SKU 配置
|
// 验证 SKU 配置
|
||||||
const hasInvalidSku = skuTableData.value.some(
|
const hasInvalidSku = skuTableData.value.some(
|
||||||
(sku) => sku.stock < 1 || sku.seckillPrice < 0.01,
|
(sku) => sku.stock < 1 || sku.seckillPrice < 0.01,
|
||||||
@@ -105,11 +102,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 提交表单
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
try {
|
try {
|
||||||
const values = await formApi.getValues();
|
const values = await formApi.getValues();
|
||||||
|
|
||||||
// 构建提交数据
|
|
||||||
const data: any = {
|
const data: any = {
|
||||||
...values,
|
...values,
|
||||||
spuId: spuId.value,
|
spuId: spuId.value,
|
||||||
@@ -119,11 +115,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
seckillPrice: Math.round(sku.seckillPrice * 100), // 转换为分
|
seckillPrice: Math.round(sku.seckillPrice * 100), // 转换为分
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
|
|
||||||
await (formData.value?.id
|
await (formData.value?.id
|
||||||
? updateSeckillActivity(data)
|
? updateSeckillActivity(data)
|
||||||
: createSeckillActivity(data));
|
: createSeckillActivity(data));
|
||||||
|
// 关闭并提示
|
||||||
await modalApi.close();
|
await modalApi.close();
|
||||||
emit('success');
|
emit('success');
|
||||||
message.success($t('ui.actionMessage.operationSuccess'));
|
message.success($t('ui.actionMessage.operationSuccess'));
|
||||||
@@ -140,18 +135,18 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 加载数据
|
||||||
const data = modalApi.getData<MallSeckillActivityApi.SeckillActivity>();
|
const data = modalApi.getData<MallSeckillActivityApi.SeckillActivity>();
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
try {
|
try {
|
||||||
formData.value = await getSeckillActivity(data.id);
|
formData.value = await getSeckillActivity(data.id);
|
||||||
await nextTick();
|
await nextTick();
|
||||||
await formApi.setValues(formData.value);
|
await formApi.setValues(formData.value);
|
||||||
|
|
||||||
// 加载商品和 SKU 信息
|
// 加载商品和 SKU 信息
|
||||||
|
// TODO @puhui999:if return 简化括号层级
|
||||||
if (formData.value.spuId) {
|
if (formData.value.spuId) {
|
||||||
const spu = await getSpu(formData.value.spuId);
|
const spu = await getSpu(formData.value.spuId);
|
||||||
if (spu) {
|
if (spu) {
|
||||||
@@ -201,6 +196,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
|
|
||||||
<!-- SKU 配置表格 -->
|
<!-- SKU 配置表格 -->
|
||||||
<div v-if="skuTableData.length > 0" class="mt-4">
|
<div v-if="skuTableData.length > 0" class="mt-4">
|
||||||
|
<!-- TODO @puhui999:Grid?或者 VXETable 哇? -->
|
||||||
<table class="w-full border-collapse border border-gray-300">
|
<table class="w-full border-collapse border border-gray-300">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="bg-gray-100">
|
<tr class="bg-gray-100">
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import {
|
|||||||
import { UploadType } from './modules/upload';
|
import { UploadType } from './modules/upload';
|
||||||
import UploadFile from './modules/UploadFile.vue';
|
import UploadFile from './modules/UploadFile.vue';
|
||||||
import UploadVideo from './modules/UploadVideo.vue';
|
import UploadVideo from './modules/UploadVideo.vue';
|
||||||
|
import {$t} from '@vben/locales';
|
||||||
|
|
||||||
defineOptions({ name: 'MpMaterial' });
|
defineOptions({ name: 'MpMaterial' });
|
||||||
|
|
||||||
@@ -95,7 +96,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
// 当 tab 切换时,更新 Grid 的 columns 和 rowConfig
|
// 当 tab 切换时,更新 Grid 的 columns 和 rowConfig
|
||||||
async function onTabChange() {
|
async function onTabChange() {
|
||||||
const columns = getColumnsByType();
|
const columns = getColumnsByType();
|
||||||
await gridApi.setGridOptions({
|
gridApi.setGridOptions({
|
||||||
columns,
|
columns,
|
||||||
rowConfig: {
|
rowConfig: {
|
||||||
keyField: 'id',
|
keyField: 'id',
|
||||||
@@ -109,7 +110,7 @@ async function onTabChange() {
|
|||||||
async function handleAccountChange(id: number) {
|
async function handleAccountChange(id: number) {
|
||||||
accountId.value = id;
|
accountId.value = id;
|
||||||
// 同步设置表单值
|
// 同步设置表单值
|
||||||
gridApi.formApi.setValues({ accountId: id });
|
await gridApi.formApi.setValues({ accountId: id });
|
||||||
await gridApi.formApi.submitForm();
|
await gridApi.formApi.submitForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +128,7 @@ async function handleDelete(id: number) {
|
|||||||
try {
|
try {
|
||||||
await deletePermanentMaterial(id);
|
await deletePermanentMaterial(id);
|
||||||
message.success('删除成功');
|
message.success('删除成功');
|
||||||
handleRefresh();
|
await handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
}
|
}
|
||||||
@@ -205,7 +206,7 @@ async function handleDelete(id: number) {
|
|||||||
</Button>
|
</Button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 图片列的slot -->
|
<!-- 图片列的 slot -->
|
||||||
<template #image="{ row }">
|
<template #image="{ row }">
|
||||||
<div class="flex items-center justify-center" style="height: 192px">
|
<div class="flex items-center justify-center" style="height: 192px">
|
||||||
<img
|
<img
|
||||||
@@ -216,12 +217,12 @@ async function handleDelete(id: number) {
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 语音列的slot -->
|
<!-- 语音列的 slot -->
|
||||||
<template #voice="{ row }">
|
<template #voice="{ row }">
|
||||||
<audio :src="row.url" controls style="width: 160px"></audio>
|
<audio :src="row.url" controls style="width: 160px"></audio>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 视频列的slot -->
|
<!-- 视频列的 slot -->
|
||||||
<template #video="{ row }">
|
<template #video="{ row }">
|
||||||
<video
|
<video
|
||||||
:src="row.url"
|
:src="row.url"
|
||||||
@@ -230,16 +231,17 @@ async function handleDelete(id: number) {
|
|||||||
></video>
|
></video>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 操作列的slot -->
|
<!-- 操作列的 slot -->
|
||||||
<template #actions="{ row }">
|
<template #actions="{ row }">
|
||||||
<TableAction
|
<TableAction
|
||||||
:actions="[
|
:actions="[
|
||||||
{
|
{
|
||||||
label: '删除',
|
label: $t('common.delete'),
|
||||||
icon: ACTION_ICON.delete,
|
type: 'link',
|
||||||
color: 'danger',
|
danger: true,
|
||||||
|
icon: ACTION_ICON.DELETE,
|
||||||
auth: ['mp:material:delete'],
|
auth: ['mp:material:delete'],
|
||||||
onClick: () => handleDelete(row.id),
|
onClick: () => handleDelete(row.id!),
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import type { PageParam, PageResult } from '@vben/request';
|
import type { PageParam, PageResult } from '@vben/request';
|
||||||
|
|
||||||
import type { MallSpuApi } from '#/api/mall/product/spu';
|
|
||||||
|
|
||||||
import { requestClient } from '#/api/request';
|
import { requestClient } from '#/api/request';
|
||||||
|
|
||||||
export namespace MallBargainActivityApi {
|
export namespace MallBargainActivityApi {
|
||||||
@@ -32,17 +30,6 @@ export namespace MallBargainActivityApi {
|
|||||||
bargainMinPrice: number; // 砍价底价
|
bargainMinPrice: number; // 砍价底价
|
||||||
stock: number; // 活动库存
|
stock: number; // 活动库存
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @puhui999:要不要删除?
|
|
||||||
/** 扩展 SKU 配置 */
|
|
||||||
export type SkuExtension = {
|
|
||||||
productConfig: BargainProduct; // 砍价活动配置
|
|
||||||
} & MallSpuApi.Sku;
|
|
||||||
|
|
||||||
/** 扩展 SPU 配置 */
|
|
||||||
export interface SpuExtension extends MallSpuApi.Spu {
|
|
||||||
skus: SkuExtension[]; // SKU 列表
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 查询砍价活动列表 */
|
/** 查询砍价活动列表 */
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import type { PageParam, PageResult } from '@vben/request';
|
import type { PageParam, PageResult } from '@vben/request';
|
||||||
|
|
||||||
import type { MallSpuApi } from '#/api/mall/product/spu';
|
|
||||||
|
|
||||||
import { requestClient } from '#/api/request';
|
import { requestClient } from '#/api/request';
|
||||||
|
|
||||||
export namespace MallCombinationActivityApi {
|
export namespace MallCombinationActivityApi {
|
||||||
@@ -23,25 +21,15 @@ export namespace MallCombinationActivityApi {
|
|||||||
limitDuration?: number; // 限制时长
|
limitDuration?: number; // 限制时长
|
||||||
combinationPrice?: number; // 拼团价格
|
combinationPrice?: number; // 拼团价格
|
||||||
products: CombinationProduct[]; // 商品列表
|
products: CombinationProduct[]; // 商品列表
|
||||||
|
picUrl?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @puhui999:要不要删除?
|
|
||||||
/** 拼团活动所需属性 */
|
/** 拼团活动所需属性 */
|
||||||
export interface CombinationProduct {
|
export interface CombinationProduct {
|
||||||
spuId: number; // 商品 SPU 编号
|
spuId: number; // 商品 SPU 编号
|
||||||
skuId: number; // 商品 SKU 编号
|
skuId: number; // 商品 SKU 编号
|
||||||
combinationPrice: number; // 拼团价格
|
combinationPrice: number; // 拼团价格
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 扩展 SKU 配置 */
|
|
||||||
export type SkuExtension = {
|
|
||||||
productConfig: CombinationProduct; // 拼团活动配置
|
|
||||||
} & MallSpuApi.Sku;
|
|
||||||
|
|
||||||
/** 扩展 SPU 配置 */
|
|
||||||
export interface SpuExtension extends MallSpuApi.Spu {
|
|
||||||
skus: SkuExtension[]; // SKU 列表
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 查询拼团活动列表 */
|
/** 查询拼团活动列表 */
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import type { PageParam, PageResult } from '@vben/request';
|
import type { PageParam, PageResult } from '@vben/request';
|
||||||
|
|
||||||
import type { MallSpuApi } from '#/api/mall/product/spu';
|
|
||||||
|
|
||||||
import { requestClient } from '#/api/request';
|
import { requestClient } from '#/api/request';
|
||||||
|
|
||||||
export namespace MallDiscountActivityApi {
|
export namespace MallDiscountActivityApi {
|
||||||
@@ -25,17 +23,6 @@ export namespace MallDiscountActivityApi {
|
|||||||
endTime?: Date; // 结束时间
|
endTime?: Date; // 结束时间
|
||||||
products?: DiscountProduct[]; // 商品列表
|
products?: DiscountProduct[]; // 商品列表
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @puhui999:要不要删除?
|
|
||||||
/** 扩展 SKU 配置 */
|
|
||||||
export type SkuExtension = {
|
|
||||||
productConfig: DiscountProduct; // 限时折扣配置
|
|
||||||
} & MallSpuApi.Sku;
|
|
||||||
|
|
||||||
/** 扩展 SPU 配置 */
|
|
||||||
export interface SpuExtension extends MallSpuApi.Spu {
|
|
||||||
skus: SkuExtension[]; // SKU 列表
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 查询限时折扣活动列表 */
|
/** 查询限时折扣活动列表 */
|
||||||
|
|||||||
@@ -36,17 +36,6 @@ export namespace MallPointActivityApi {
|
|||||||
price: number; // 兑换金额,单位:分
|
price: number; // 兑换金额,单位:分
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @puhui999:这些还需要么?
|
|
||||||
/** 扩展 SKU 配置 */
|
|
||||||
export type SkuExtension = {
|
|
||||||
productConfig: PointProduct; // 积分商城商品配置
|
|
||||||
} & MallSpuApi.Sku;
|
|
||||||
|
|
||||||
/** 扩展 SPU 配置 */
|
|
||||||
export interface SpuExtension extends MallSpuApi.Spu {
|
|
||||||
skus: SkuExtension[]; // SKU 列表
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 扩展 SPU 配置(带积分信息) */
|
/** 扩展 SPU 配置(带积分信息) */
|
||||||
export interface SpuExtensionWithPoint extends MallSpuApi.Spu {
|
export interface SpuExtensionWithPoint extends MallSpuApi.Spu {
|
||||||
pointStock: number; // 积分商城活动库存
|
pointStock: number; // 积分商城活动库存
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import type { PageParam, PageResult } from '@vben/request';
|
import type { PageParam, PageResult } from '@vben/request';
|
||||||
|
|
||||||
import type { MallSpuApi } from '#/api/mall/product/spu';
|
|
||||||
|
|
||||||
import { requestClient } from '#/api/request';
|
import { requestClient } from '#/api/request';
|
||||||
|
|
||||||
export namespace MallSeckillActivityApi {
|
export namespace MallSeckillActivityApi {
|
||||||
@@ -33,17 +31,7 @@ export namespace MallSeckillActivityApi {
|
|||||||
totalStock?: number; // 秒杀总库存
|
totalStock?: number; // 秒杀总库存
|
||||||
seckillPrice?: number; // 秒杀价格
|
seckillPrice?: number; // 秒杀价格
|
||||||
products?: SeckillProduct[]; // 秒杀商品列表
|
products?: SeckillProduct[]; // 秒杀商品列表
|
||||||
}
|
picUrl?: any;
|
||||||
|
|
||||||
// TODO @puhui999:这些还需要么?
|
|
||||||
/** 扩展 SKU 配置 */
|
|
||||||
export type SkuExtension = {
|
|
||||||
productConfig: SeckillProduct; // 秒杀商品配置
|
|
||||||
} & MallSpuApi.Sku;
|
|
||||||
|
|
||||||
/** 扩展 SPU 配置 */
|
|
||||||
export interface SpuExtension extends MallSpuApi.Spu {
|
|
||||||
skus: SkuExtension[]; // SKU 列表
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import { useFormSchema } from '../data';
|
|||||||
|
|
||||||
const emit = defineEmits(['success']);
|
const emit = defineEmits(['success']);
|
||||||
|
|
||||||
|
// TODO @puhui999:这里和 yudao-ui-admin-vben-v5/apps/web-antd/src/views/mall/product/comment/modules/form.vue 存在差异,是不是还没迁移到呀。
|
||||||
const formData = ref<MallCommentApi.Comment>();
|
const formData = ref<MallCommentApi.Comment>();
|
||||||
const getTitle = computed(() => {
|
const getTitle = computed(() => {
|
||||||
return formData.value?.id
|
return formData.value?.id
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
placeholder: '请输入活动名称',
|
placeholder: '请输入活动名称',
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
|
// TODO @puhui999:这里和 antd 里的不太一样,可以看看。
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'startTime',
|
fieldName: 'startTime',
|
||||||
@@ -222,12 +223,14 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
|||||||
field: 'bargainFirstPrice',
|
field: 'bargainFirstPrice',
|
||||||
title: '起始价格',
|
title: '起始价格',
|
||||||
minWidth: 100,
|
minWidth: 100,
|
||||||
|
// TODO @puhui999:这里和 antd 不太一样,得看看
|
||||||
formatter: 'formatFenToYuanAmount',
|
formatter: 'formatFenToYuanAmount',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'bargainMinPrice',
|
field: 'bargainMinPrice',
|
||||||
title: '砍价底价',
|
title: '砍价底价',
|
||||||
minWidth: 100,
|
minWidth: 100,
|
||||||
|
// TODO @puhui999:这里和 antd 不太一样,得看看
|
||||||
formatter: 'formatFenToYuanAmount',
|
formatter: 'formatFenToYuanAmount',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,9 +42,16 @@ function handleEdit(row: MallBargainActivityApi.BargainActivity) {
|
|||||||
/** 关闭砍价活动 */
|
/** 关闭砍价活动 */
|
||||||
async function handleClose(row: MallBargainActivityApi.BargainActivity) {
|
async function handleClose(row: MallBargainActivityApi.BargainActivity) {
|
||||||
await confirm('确定关闭该砍价活动吗?');
|
await confirm('确定关闭该砍价活动吗?');
|
||||||
await closeBargainActivity(row.id as number);
|
const loadingInstance = ElLoading.service({
|
||||||
ElMessage.success('关闭成功');
|
text: '关闭中...',
|
||||||
handleRefresh();
|
});
|
||||||
|
try {
|
||||||
|
await closeBargainActivity(row.id!);
|
||||||
|
ElMessage.success('关闭成功');
|
||||||
|
handleRefresh();
|
||||||
|
} finally {
|
||||||
|
loadingInstance.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除砍价活动 */
|
/** 删除砍价活动 */
|
||||||
@@ -53,7 +60,7 @@ async function handleDelete(row: MallBargainActivityApi.BargainActivity) {
|
|||||||
text: $t('ui.actionMessage.deleting', [row.name]),
|
text: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteBargainActivity(row.id as number);
|
await deleteBargainActivity(row.id!);
|
||||||
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||||
handleRefresh();
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ const getTitle = computed(() => {
|
|||||||
: $t('ui.actionTitle.create', ['砍价活动']);
|
: $t('ui.actionTitle.create', ['砍价活动']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ================= 商品选择相关 =================
|
||||||
const spuId = ref<number>();
|
const spuId = ref<number>();
|
||||||
const skuId = ref<number>();
|
const skuId = ref<number>();
|
||||||
const spuName = ref<string>('');
|
const spuName = ref<string>('');
|
||||||
@@ -39,12 +40,14 @@ const skuInfo = ref<{
|
|||||||
skuName: string;
|
skuName: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const spuSkuSelectRef = ref();
|
const spuSkuSelectRef = ref(); // 商品选择弹窗 Ref
|
||||||
|
|
||||||
|
/** 打开商品选择弹窗 */
|
||||||
const handleSelectProduct = () => {
|
const handleSelectProduct = () => {
|
||||||
spuSkuSelectRef.value?.open();
|
spuSkuSelectRef.value?.open();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 选择商品后的回调 */
|
||||||
async function handleSpuSelected(selectedSpuId: number, skuIds?: number[]) {
|
async function handleSpuSelected(selectedSpuId: number, skuIds?: number[]) {
|
||||||
const spu = await getSpu(selectedSpuId);
|
const spu = await getSpu(selectedSpuId);
|
||||||
if (!spu) return;
|
if (!spu) return;
|
||||||
@@ -52,6 +55,7 @@ async function handleSpuSelected(selectedSpuId: number, skuIds?: number[]) {
|
|||||||
spuId.value = spu.id;
|
spuId.value = spu.id;
|
||||||
spuName.value = spu.name || '';
|
spuName.value = spu.name || '';
|
||||||
|
|
||||||
|
// 砍价活动只选择一个 SKU
|
||||||
if (skuIds && skuIds.length > 0) {
|
if (skuIds && skuIds.length > 0) {
|
||||||
const selectedSku = spu.skus?.find((sku) => sku.id === skuIds[0]);
|
const selectedSku = spu.skus?.find((sku) => sku.id === skuIds[0]);
|
||||||
if (selectedSku) {
|
if (selectedSku) {
|
||||||
@@ -65,6 +69,8 @@ async function handleSpuSelected(selectedSpuId: number, skuIds?: number[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ================= end =================
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
const [Form, formApi] = useVbenForm({
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
componentProps: {
|
componentProps: {
|
||||||
@@ -85,6 +91,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 验证商品和 SKU 选择
|
||||||
if (!spuId.value) {
|
if (!spuId.value) {
|
||||||
ElMessage.error('请选择砍价商品');
|
ElMessage.error('请选择砍价商品');
|
||||||
return;
|
return;
|
||||||
@@ -94,6 +101,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 提交表单
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
try {
|
try {
|
||||||
const values = await formApi.getValues();
|
const values = await formApi.getValues();
|
||||||
@@ -110,10 +118,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
? Math.round(values.randomMaxPrice * 100)
|
? Math.round(values.randomMaxPrice * 100)
|
||||||
: undefined,
|
: undefined,
|
||||||
} as MallBargainActivityApi.BargainActivity;
|
} as MallBargainActivityApi.BargainActivity;
|
||||||
|
|
||||||
await (formData.value?.id
|
await (formData.value?.id
|
||||||
? updateBargainActivity(data)
|
? updateBargainActivity(data)
|
||||||
: createBargainActivity(data));
|
: createBargainActivity(data));
|
||||||
|
// 关闭并提示
|
||||||
await modalApi.close();
|
await modalApi.close();
|
||||||
emit('success');
|
emit('success');
|
||||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||||
@@ -130,16 +138,16 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
skuInfo.value = undefined;
|
skuInfo.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 加载表单数据
|
||||||
const data = modalApi.getData<MallBargainActivityApi.BargainActivity>();
|
const data = modalApi.getData<MallBargainActivityApi.BargainActivity>();
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
try {
|
try {
|
||||||
formData.value = await getBargainActivity(data.id);
|
formData.value = await getBargainActivity(data.id);
|
||||||
await nextTick();
|
await nextTick();
|
||||||
|
// 设置表单值时,价格字段从分转换为元
|
||||||
await formApi.setValues({
|
await formApi.setValues({
|
||||||
...formData.value,
|
...formData.value,
|
||||||
bargainFirstPrice: (formData.value.bargainFirstPrice || 0) / 100,
|
bargainFirstPrice: (formData.value.bargainFirstPrice || 0) / 100,
|
||||||
@@ -151,7 +159,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
? formData.value.randomMaxPrice / 100
|
? formData.value.randomMaxPrice / 100
|
||||||
: undefined,
|
: undefined,
|
||||||
});
|
});
|
||||||
|
// 加载商品和 SKU 信息
|
||||||
if (formData.value.spuId) {
|
if (formData.value.spuId) {
|
||||||
const spu = await getSpu(formData.value.spuId);
|
const spu = await getSpu(formData.value.spuId);
|
||||||
if (spu) {
|
if (spu) {
|
||||||
@@ -183,6 +191,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
<Modal class="w-3/5" :title="getTitle">
|
<Modal class="w-3/5" :title="getTitle">
|
||||||
<div class="mx-4">
|
<div class="mx-4">
|
||||||
<Form />
|
<Form />
|
||||||
|
|
||||||
|
<!-- 商品选择区域 -->
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<div class="mb-2 flex items-center">
|
<div class="mb-2 flex items-center">
|
||||||
<span class="text-sm font-medium">砍价活动商品:</span>
|
<span class="text-sm font-medium">砍价活动商品:</span>
|
||||||
@@ -193,8 +203,23 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
已选择: {{ spuName }}
|
已选择: {{ spuName }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- SKU 信息展示 -->
|
||||||
<div v-if="skuInfo" class="mt-4">
|
<div v-if="skuInfo" class="mt-4">
|
||||||
<table class="w-full border-collapse border border-gray-300">
|
<table class="w-full border-collapse border border-gray-300">
|
||||||
|
<!-- TODO @puhui999:和 element-plus 有点差别哈;ps:是不是用 grid 组件呀?或者 vxe 组件
|
||||||
|
图片
|
||||||
|
颜色
|
||||||
|
版本
|
||||||
|
商品条码
|
||||||
|
销售价(元)
|
||||||
|
市场价(元)
|
||||||
|
成本价(元)
|
||||||
|
库存
|
||||||
|
砍价起始价格(元)
|
||||||
|
砍价底价(元)
|
||||||
|
活动库存
|
||||||
|
-->
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="bg-gray-100">
|
<tr class="bg-gray-100">
|
||||||
<th class="border border-gray-300 px-4 py-2">商品图片</th>
|
<th class="border border-gray-300 px-4 py-2">商品图片</th>
|
||||||
@@ -225,6 +250,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
|
<!-- 商品选择器弹窗(单选模式) -->
|
||||||
<SpuSkuSelect
|
<SpuSkuSelect
|
||||||
ref="spuSkuSelectRef"
|
ref="spuSkuSelectRef"
|
||||||
:is-select-sku="true"
|
:is-select-sku="true"
|
||||||
|
|||||||
@@ -75,12 +75,14 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
|||||||
field: 'activity.bargainMinPrice',
|
field: 'activity.bargainMinPrice',
|
||||||
title: '最低价',
|
title: '最低价',
|
||||||
minWidth: 100,
|
minWidth: 100,
|
||||||
|
// TODO @puhui999:这里和 antd 不同
|
||||||
formatter: 'formatFenToYuanAmount',
|
formatter: 'formatFenToYuanAmount',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'bargainPrice',
|
field: 'bargainPrice',
|
||||||
title: '当前价',
|
title: '当前价',
|
||||||
minWidth: 100,
|
minWidth: 100,
|
||||||
|
// TODO @puhui999:这里和 antd 不同
|
||||||
formatter: 'formatFenToYuanAmount',
|
formatter: 'formatFenToYuanAmount',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -152,6 +154,7 @@ export function useHelpGridColumns(): VxeTableGridOptions['columns'] {
|
|||||||
field: 'reducePrice',
|
field: 'reducePrice',
|
||||||
title: '砍价金额',
|
title: '砍价金额',
|
||||||
minWidth: 100,
|
minWidth: 100,
|
||||||
|
// TODO @puhui999:这里和 antd 不同
|
||||||
formatter: 'formatFenToYuanAmount',
|
formatter: 'formatFenToYuanAmount',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,10 +43,17 @@ function handleEdit(row: MallCombinationActivityApi.CombinationActivity) {
|
|||||||
async function handleClose(
|
async function handleClose(
|
||||||
row: MallCombinationActivityApi.CombinationActivity,
|
row: MallCombinationActivityApi.CombinationActivity,
|
||||||
) {
|
) {
|
||||||
await confirm('确定关闭该拼团活动吗?');
|
await confirm('确认关闭该拼团活动吗?');
|
||||||
await closeCombinationActivity(row.id as number);
|
const loadingInstance = ElLoading.service({
|
||||||
ElMessage.success('关闭成功');
|
text: '关闭中...',
|
||||||
handleRefresh();
|
});
|
||||||
|
try {
|
||||||
|
await closeCombinationActivity(row.id!);
|
||||||
|
ElMessage.success('关闭成功');
|
||||||
|
handleRefresh();
|
||||||
|
} finally {
|
||||||
|
loadingInstance.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除拼团活动 */
|
/** 删除拼团活动 */
|
||||||
@@ -57,7 +64,7 @@ async function handleDelete(
|
|||||||
text: $t('ui.actionMessage.deleting', [row.name]),
|
text: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteCombinationActivity(row.id as number);
|
await deleteCombinationActivity(row.id!);
|
||||||
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||||
handleRefresh();
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -91,12 +91,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
ElMessage.error('请选择拼团商品');
|
ElMessage.error('请选择拼团商品');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skuTableData.value.length === 0) {
|
if (skuTableData.value.length === 0) {
|
||||||
ElMessage.error('请至少配置一个 SKU');
|
ElMessage.error('请至少配置一个 SKU');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证 SKU 配置
|
// 验证 SKU 配置
|
||||||
const hasInvalidSku = skuTableData.value.some(
|
const hasInvalidSku = skuTableData.value.some(
|
||||||
(sku) => sku.combinationPrice < 0.01,
|
(sku) => sku.combinationPrice < 0.01,
|
||||||
@@ -106,11 +104,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 提交表单
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
try {
|
try {
|
||||||
const values = await formApi.getValues();
|
const values = await formApi.getValues();
|
||||||
|
|
||||||
// 构建提交数据
|
|
||||||
const data: any = {
|
const data: any = {
|
||||||
...values,
|
...values,
|
||||||
spuId: spuId.value,
|
spuId: spuId.value,
|
||||||
@@ -119,11 +116,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
combinationPrice: Math.round(sku.combinationPrice * 100), // 转换为分
|
combinationPrice: Math.round(sku.combinationPrice * 100), // 转换为分
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
|
|
||||||
await (formData.value?.id
|
await (formData.value?.id
|
||||||
? updateCombinationActivity(data)
|
? updateCombinationActivity(data)
|
||||||
: createCombinationActivity(data));
|
: createCombinationActivity(data));
|
||||||
|
// 关闭并提示
|
||||||
await modalApi.close();
|
await modalApi.close();
|
||||||
emit('success');
|
emit('success');
|
||||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||||
@@ -139,20 +135,19 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
skuTableData.value = [];
|
skuTableData.value = [];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 加载数据
|
||||||
const data =
|
const data =
|
||||||
modalApi.getData<MallCombinationActivityApi.CombinationActivity>();
|
modalApi.getData<MallCombinationActivityApi.CombinationActivity>();
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
try {
|
try {
|
||||||
formData.value = await getCombinationActivity(data.id);
|
formData.value = await getCombinationActivity(data.id);
|
||||||
await nextTick();
|
await nextTick();
|
||||||
await formApi.setValues(formData.value);
|
await formApi.setValues(formData.value);
|
||||||
|
|
||||||
// 加载商品和 SKU 信息
|
// 加载商品和 SKU 信息
|
||||||
|
// TODO @puhui999:if return,简化括号层级
|
||||||
if (formData.value.spuId) {
|
if (formData.value.spuId) {
|
||||||
const spu = await getSpu(formData.value.spuId);
|
const spu = await getSpu(formData.value.spuId);
|
||||||
if (spu) {
|
if (spu) {
|
||||||
@@ -220,6 +215,15 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
class="h-16 w-16 object-cover"
|
class="h-16 w-16 object-cover"
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
|
<!-- TODO @puhui999:这里貌似和 element-plus 没对齐;;ps:是不是用 grid 组件呀?或者 vxe 组件
|
||||||
|
图片
|
||||||
|
商品条码
|
||||||
|
销售价(元)
|
||||||
|
市场价(元)
|
||||||
|
成本价(元)
|
||||||
|
库存
|
||||||
|
拼团价格(元)
|
||||||
|
-->
|
||||||
<td class="border border-gray-300 px-4 py-2">
|
<td class="border border-gray-300 px-4 py-2">
|
||||||
{{ sku.skuName }}
|
{{ sku.skuName }}
|
||||||
</td>
|
</td>
|
||||||
@@ -227,6 +231,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
¥{{ (sku.price / 100).toFixed(2) }}
|
¥{{ (sku.price / 100).toFixed(2) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="border border-gray-300 px-4 py-2">
|
<td class="border border-gray-300 px-4 py-2">
|
||||||
|
<!-- TODO @puhui999:是不是要使用 antd 的哈? -->
|
||||||
<input
|
<input
|
||||||
v-model.number="sku.combinationPrice"
|
v-model.number="sku.combinationPrice"
|
||||||
type="number"
|
type="number"
|
||||||
|
|||||||
@@ -111,7 +111,6 @@ function emitActivityChange() {
|
|||||||
>
|
>
|
||||||
<ElTooltip :content="activity.name">
|
<ElTooltip :content="activity.name">
|
||||||
<div class="relative h-full w-full">
|
<div class="relative h-full w-full">
|
||||||
<!-- TODO @芋艿 -->
|
|
||||||
<ElImage
|
<ElImage
|
||||||
:src="activity.picUrl"
|
:src="activity.picUrl"
|
||||||
class="h-full w-full rounded-lg object-cover"
|
class="h-full w-full rounded-lg object-cover"
|
||||||
|
|||||||
@@ -57,12 +57,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
async function open() {
|
async function open() {
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
// 重置查询条件并重新加载数据,与 antd 行为一致
|
|
||||||
await gridApi.query();
|
await gridApi.query();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 确认选择 */
|
/** 确认选择 */
|
||||||
async function handleConfirm() {
|
function handleConfirm() {
|
||||||
const selectedRecords = (gridApi.grid?.getCheckboxRecords() ||
|
const selectedRecords = (gridApi.grid?.getCheckboxRecords() ||
|
||||||
[]) as MallCouponTemplateApi.CouponTemplate[];
|
[]) as MallCouponTemplateApi.CouponTemplate[];
|
||||||
emit('change', selectedRecords);
|
emit('change', selectedRecords);
|
||||||
@@ -74,6 +73,7 @@ function closeModal() {
|
|||||||
visible.value = false;
|
visible.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 对外暴露的方法 */
|
||||||
defineExpose({
|
defineExpose({
|
||||||
open,
|
open,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
rows: 4,
|
rows: 4,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// TODO
|
// TODO @puhui999:这里和 antd 对应的不太一样;
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,11 +41,17 @@ function handleEdit(row: MallDiscountActivityApi.DiscountActivity) {
|
|||||||
|
|
||||||
/** 关闭满减活动 */
|
/** 关闭满减活动 */
|
||||||
async function handleClose(row: MallDiscountActivityApi.DiscountActivity) {
|
async function handleClose(row: MallDiscountActivityApi.DiscountActivity) {
|
||||||
await confirm('确定关闭该限时折扣活动吗?');
|
await confirm('确认关闭该限时折扣活动吗?');
|
||||||
await closeDiscountActivity(row.id as number);
|
const loadingInstance = ElLoading.service({
|
||||||
ElMessage.success('关闭成功');
|
text: '正在关闭中...',
|
||||||
handleRefresh();
|
});
|
||||||
}
|
try {
|
||||||
|
await closeDiscountActivity(row.id as number);
|
||||||
|
ElMessage.success('关闭成功');
|
||||||
|
handleRefresh();
|
||||||
|
} finally {
|
||||||
|
loadingInstance.close();
|
||||||
|
}
|
||||||
|
|
||||||
/** 删除满减活动 */
|
/** 删除满减活动 */
|
||||||
async function handleDelete(row: MallDiscountActivityApi.DiscountActivity) {
|
async function handleDelete(row: MallDiscountActivityApi.DiscountActivity) {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import { useFormSchema } from '../data';
|
|||||||
|
|
||||||
defineOptions({ name: 'DiscountActivityForm' });
|
defineOptions({ name: 'DiscountActivityForm' });
|
||||||
|
|
||||||
|
// TODO @puhui999:这里和 yudao-ui-admin-vben-v5/apps/web-antd/src/views/mall/promotion/discountActivity/modules/form.vue 不太一样
|
||||||
const emit = defineEmits(['success']);
|
const emit = defineEmits(['success']);
|
||||||
const formData = ref<MallDiscountActivityApi.DiscountActivity>();
|
const formData = ref<MallDiscountActivityApi.DiscountActivity>();
|
||||||
const getTitle = computed(() => {
|
const getTitle = computed(() => {
|
||||||
@@ -69,6 +70,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
},
|
},
|
||||||
async onOpenChange(isOpen: boolean) {
|
async onOpenChange(isOpen: boolean) {
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
|
// TODO @puhui999:这里和 yudao-ui-admin-vben-v5/apps/web-antd/src/views/mall/promotion/discountActivity/modules/form.vue 不太一样
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -91,6 +93,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Modal class="w-3/5" :title="getTitle">
|
<Modal class="w-3/5" :title="getTitle">
|
||||||
|
<!-- TODO @puhui999:这里和 yudao-ui-admin-vben-v5/apps/web-antd/src/views/mall/promotion/discountActivity/modules/form.vue 不太一样 -->
|
||||||
<Form />
|
<Form />
|
||||||
</Modal>
|
</Modal>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -127,7 +127,6 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
},
|
},
|
||||||
formItemClass: 'col-span-2',
|
formItemClass: 'col-span-2',
|
||||||
},
|
},
|
||||||
// TODO @puhui999:商品图太大了。
|
|
||||||
{
|
{
|
||||||
fieldName: 'spuId',
|
fieldName: 'spuId',
|
||||||
label: '活动商品',
|
label: '活动商品',
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import {
|
|||||||
SpuAndSkuList,
|
SpuAndSkuList,
|
||||||
SpuSkuSelect,
|
SpuSkuSelect,
|
||||||
} from '#/views/mall/product/spu/components';
|
} from '#/views/mall/product/spu/components';
|
||||||
|
// TODO @puhui999:getPropertyList 在 antd 和 el 导入的路径不同;是不是要统一下哈;
|
||||||
import { getPropertyList } from '#/views/mall/product/spu/components/property-util';
|
import { getPropertyList } from '#/views/mall/product/spu/components/property-util';
|
||||||
|
|
||||||
import { useFormSchema } from '../data';
|
import { useFormSchema } from '../data';
|
||||||
@@ -99,6 +100,7 @@ async function getSpuDetails(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO @puhui999:这里的 spuList,是不是直接放到 145 行就 ok 啦;(尾部);
|
||||||
spuList.value = [];
|
spuList.value = [];
|
||||||
|
|
||||||
// 筛选指定的 SKU
|
// 筛选指定的 SKU
|
||||||
@@ -132,6 +134,7 @@ async function getSpuDetails(
|
|||||||
});
|
});
|
||||||
res.skus = selectSkus;
|
res.skus = selectSkus;
|
||||||
|
|
||||||
|
// TODO @puhui999:这里的逻辑,是不是放到 147 行(尾部);
|
||||||
const spuProperties: SpuProperty<MallSpuApi.Spu>[] = [
|
const spuProperties: SpuProperty<MallSpuApi.Spu>[] = [
|
||||||
{
|
{
|
||||||
spuId: res.id!,
|
spuId: res.id!,
|
||||||
@@ -180,7 +183,6 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
},
|
},
|
||||||
async onOpenChange(isOpen: boolean) {
|
async onOpenChange(isOpen: boolean) {
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
// 重置表单数据(新增和编辑模式都需要)
|
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
spuList.value = [];
|
spuList.value = [];
|
||||||
spuPropertyList.value = [];
|
spuPropertyList.value = [];
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<!-- 积分商城活动橱窗组件:用于展示和选择积分商城活动 -->
|
<!-- 积分商城活动橱窗组件:用于展示和选择积分商城活动 -->
|
||||||
|
<!-- TODO @puhui999:antd 多了一个,看着 ele 要迁移下? --->
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { MallPointActivityApi } from '#/api/mall/promotion/point';
|
import type { MallPointActivityApi } from '#/api/mall/promotion/point';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<!-- 积分商城活动选择弹窗组件 -->
|
<!-- 积分商城活动选择弹窗组件 -->
|
||||||
|
<!-- TODO @puhui999:antd 多了一个,看着 ele 要迁移下? --->
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { VbenFormSchema } from '#/adapter/form';
|
import type { VbenFormSchema } from '#/adapter/form';
|
||||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { $t } from '@vben/locales';
|
|||||||
import { z } from '#/adapter/form';
|
import { z } from '#/adapter/form';
|
||||||
import { getRangePickerDefaultProps } from '#/utils';
|
import { getRangePickerDefaultProps } from '#/utils';
|
||||||
|
|
||||||
|
/** 列表的搜索表单 */
|
||||||
export function useGridFormSchema(): VbenFormSchema[] {
|
export function useGridFormSchema(): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@@ -45,6 +46,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 列表的表格列 */
|
||||||
export function useGridColumns(): VxeTableGridOptions['columns'] {
|
export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@@ -97,6 +99,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 新增/修改的表单 */
|
||||||
export function useFormSchema(): VbenFormSchema[] {
|
export function useFormSchema(): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@@ -173,6 +176,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
return values.productScope === PromotionProductScopeEnum.SPU.scope;
|
return values.productScope === PromotionProductScopeEnum.SPU.scope;
|
||||||
},
|
},
|
||||||
trigger(values, form) {
|
trigger(values, form) {
|
||||||
|
// 当加载已有数据时,根据 productScopeValues 设置 productSpuIds
|
||||||
if (
|
if (
|
||||||
values.productScope === PromotionProductScopeEnum.SPU.scope &&
|
values.productScope === PromotionProductScopeEnum.SPU.scope &&
|
||||||
values.productScopeValues
|
values.productScopeValues
|
||||||
@@ -195,11 +199,13 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
trigger(values, form) {
|
trigger(values, form) {
|
||||||
|
// 当加载已有数据时,根据 productScopeValues 设置 productCategoryIds
|
||||||
if (
|
if (
|
||||||
values.productScope === PromotionProductScopeEnum.CATEGORY.scope &&
|
values.productScope === PromotionProductScopeEnum.CATEGORY.scope &&
|
||||||
values.productScopeValues
|
values.productScopeValues
|
||||||
) {
|
) {
|
||||||
const categoryIds = values.productScopeValues;
|
const categoryIds = values.productScopeValues;
|
||||||
|
// 单选时使用数组不能反显,取第一个元素
|
||||||
form.setFieldValue(
|
form.setFieldValue(
|
||||||
'productCategoryIds',
|
'productCategoryIds',
|
||||||
Array.isArray(categoryIds) && categoryIds.length > 0
|
Array.isArray(categoryIds) && categoryIds.length > 0
|
||||||
@@ -219,7 +225,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'productScopeValues',
|
fieldName: 'productScopeValues', // 隐藏字段:用于自动同步 productScopeValues
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
dependencies: {
|
dependencies: {
|
||||||
triggerFields: ['productScope', 'productSpuIds', 'productCategoryIds'],
|
triggerFields: ['productScope', 'productSpuIds', 'productCategoryIds'],
|
||||||
|
|||||||
@@ -25,28 +25,32 @@ const [FormModal, formModalApi] = useVbenModal({
|
|||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** 刷新表格 */
|
||||||
function handleRefresh() {
|
function handleRefresh() {
|
||||||
gridApi.query();
|
gridApi.query();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 创建满减送活动 */
|
||||||
function handleCreate() {
|
function handleCreate() {
|
||||||
formModalApi.setData(null).open();
|
formModalApi.setData(null).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 编辑满减送活动 */
|
||||||
function handleEdit(row: MallRewardActivityApi.RewardActivity) {
|
function handleEdit(row: MallRewardActivityApi.RewardActivity) {
|
||||||
formModalApi.setData({ id: row.id }).open();
|
formModalApi.setData({ id: row.id }).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 关闭满减送活动 */
|
||||||
async function handleClose(row: MallRewardActivityApi.RewardActivity) {
|
async function handleClose(row: MallRewardActivityApi.RewardActivity) {
|
||||||
const loading = ElLoading.service({
|
const loadingInstance = ElLoading.service({
|
||||||
text: $t('ui.actionMessage.closing', [row.name]),
|
text: $t('ui.actionMessage.closing', [row.name]),
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await closeRewardActivity(row.id as number);
|
await closeRewardActivity(row.id!);
|
||||||
ElMessage.success($t('ui.actionMessage.closeSuccess', [row.name]));
|
ElMessage.success($t('ui.actionMessage.closeSuccess', [row.name]));
|
||||||
handleRefresh();
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
loading.close();
|
loadingInstance.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +59,7 @@ async function handleDelete(row: MallRewardActivityApi.RewardActivity) {
|
|||||||
text: $t('ui.actionMessage.deleting', [row.name]),
|
text: $t('ui.actionMessage.deleting', [row.name]),
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await deleteRewardActivity(row.id as number);
|
await deleteRewardActivity(row.id!);
|
||||||
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||||
handleRefresh();
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
@@ -97,7 +101,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
<template>
|
<template>
|
||||||
<Page auto-content-height>
|
<Page auto-content-height>
|
||||||
<FormModal @success="handleRefresh" />
|
<FormModal @success="handleRefresh" />
|
||||||
|
|
||||||
<Grid table-title="满减送活动">
|
<Grid table-title="满减送活动">
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<TableAction
|
<TableAction
|
||||||
@@ -122,6 +125,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
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: 'link',
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import { useFormSchema } from '../data';
|
|||||||
import RewardRule from './reward-rule.vue';
|
import RewardRule from './reward-rule.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['success']);
|
const emit = defineEmits(['success']);
|
||||||
|
|
||||||
const formData = ref<Partial<MallRewardActivityApi.RewardActivity>>({
|
const formData = ref<Partial<MallRewardActivityApi.RewardActivity>>({
|
||||||
conditionType: PromotionConditionTypeEnum.PRICE.type,
|
conditionType: PromotionConditionTypeEnum.PRICE.type,
|
||||||
productScope: PromotionProductScopeEnum.ALL.scope,
|
productScope: PromotionProductScopeEnum.ALL.scope,
|
||||||
@@ -56,6 +57,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
|
// 提交表单
|
||||||
try {
|
try {
|
||||||
const values = await formApi.getValues();
|
const values = await formApi.getValues();
|
||||||
const data = { ...formData.value, ...values };
|
const data = { ...formData.value, ...values };
|
||||||
@@ -71,6 +73,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
switch (data.productScope) {
|
switch (data.productScope) {
|
||||||
|
// TODO @puhui999:是不是也可以类似优惠劵的处理策略哈;
|
||||||
case PromotionProductScopeEnum.CATEGORY.scope: {
|
case PromotionProductScopeEnum.CATEGORY.scope: {
|
||||||
const categoryIds = data.productCategoryIds;
|
const categoryIds = data.productCategoryIds;
|
||||||
data.productScopeValues = Array.isArray(categoryIds)
|
data.productScopeValues = Array.isArray(categoryIds)
|
||||||
@@ -88,6 +91,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
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));
|
||||||
|
// 关闭并提示
|
||||||
await modalApi.close();
|
await modalApi.close();
|
||||||
emit('success');
|
emit('success');
|
||||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||||
@@ -100,6 +104,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
formData.value = {};
|
formData.value = {};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 加载数据
|
||||||
const data = modalApi.getData<MallRewardActivityApi.RewardActivity>();
|
const data = modalApi.getData<MallRewardActivityApi.RewardActivity>();
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
return;
|
return;
|
||||||
@@ -115,6 +120,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
formData.value = result;
|
formData.value = result;
|
||||||
|
// 设置到 values
|
||||||
await formApi.setValues(result);
|
await formApi.setValues(result);
|
||||||
} finally {
|
} finally {
|
||||||
modalApi.unlock();
|
modalApi.unlock();
|
||||||
@@ -126,12 +132,15 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
<template>
|
<template>
|
||||||
<Modal :title="getTitle" class="w-2/3">
|
<Modal :title="getTitle" class="w-2/3">
|
||||||
<Form class="mx-6">
|
<Form class="mx-6">
|
||||||
|
<!-- 自定义插槽:优惠规则 -->
|
||||||
<template #rules>
|
<template #rules>
|
||||||
<RewardRule v-model="formData" />
|
<RewardRule v-model="formData" />
|
||||||
</template>
|
</template>
|
||||||
|
<!-- 自定义插槽:商品选择 -->
|
||||||
<template #productSpuIds>
|
<template #productSpuIds>
|
||||||
<SpuShowcase v-model="formData.productSpuIds" />
|
<SpuShowcase v-model="formData.productSpuIds" />
|
||||||
</template>
|
</template>
|
||||||
|
<!-- 自定义插槽:分类选择 -->
|
||||||
<template #productCategoryIds>
|
<template #productCategoryIds>
|
||||||
<ProductCategorySelect v-model="formData.productCategoryIds" multiple />
|
<ProductCategorySelect v-model="formData.productCategoryIds" multiple />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -19,22 +19,26 @@ defineOptions({ name: 'RewardRuleCouponSelect' });
|
|||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
modelValue: MallRewardActivityApi.RewardRule;
|
modelValue: MallRewardActivityApi.RewardRule;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emits = defineEmits<{
|
const emits = defineEmits<{
|
||||||
(e: 'update:modelValue', v: any): void;
|
(e: 'update:modelValue', v: any): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
/** 选择赠送的优惠类型拓展 */
|
||||||
interface GiveCoupon extends MallCouponTemplateApi.CouponTemplate {
|
interface GiveCoupon extends MallCouponTemplateApi.CouponTemplate {
|
||||||
giveCount?: number;
|
giveCount?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const rewardRule = useVModel(props, 'modelValue', emits);
|
const rewardRule = useVModel(props, 'modelValue', emits);
|
||||||
const list = ref<GiveCoupon[]>([]);
|
const list = ref<GiveCoupon[]>([]); // 选择的优惠劵列表
|
||||||
|
|
||||||
|
/** 选择优惠券 */
|
||||||
const selectRef = ref<InstanceType<typeof CouponSelect>>();
|
const selectRef = ref<InstanceType<typeof CouponSelect>>();
|
||||||
function handleSelect() {
|
function handleSelect() {
|
||||||
selectRef.value?.open();
|
selectRef.value?.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 选择优惠券后的回调 */
|
||||||
function handleChange(val: any[]) {
|
function handleChange(val: any[]) {
|
||||||
for (const item of val) {
|
for (const item of val) {
|
||||||
if (list.value.some((v) => v.id === item.id)) {
|
if (list.value.some((v) => v.id === item.id)) {
|
||||||
@@ -44,11 +48,14 @@ function handleChange(val: any[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 删除优惠券 */
|
||||||
function handleDelete(index: number) {
|
function handleDelete(index: number) {
|
||||||
list.value.splice(index, 1);
|
list.value.splice(index, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 初始化赠送的优惠券列表 */
|
||||||
async function initGiveCouponList() {
|
async function initGiveCouponList() {
|
||||||
|
// 校验优惠券存在
|
||||||
if (
|
if (
|
||||||
!rewardRule.value ||
|
!rewardRule.value ||
|
||||||
!rewardRule.value.giveCouponTemplateCounts ||
|
!rewardRule.value.giveCouponTemplateCounts ||
|
||||||
@@ -71,13 +78,16 @@ async function initGiveCouponList() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 监听 list 变化,自动同步到 rewardRule */
|
||||||
watch(
|
watch(
|
||||||
list,
|
list,
|
||||||
(val) => {
|
(val) => {
|
||||||
if (!rewardRule.value) {
|
if (!rewardRule.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 核心:清空 giveCouponTemplateCounts,解决删除不生效的问题
|
||||||
rewardRule.value.giveCouponTemplateCounts = {};
|
rewardRule.value.giveCouponTemplateCounts = {};
|
||||||
|
// 设置优惠券和其数量的对应
|
||||||
val.forEach((item) => {
|
val.forEach((item) => {
|
||||||
rewardRule.value.giveCouponTemplateCounts![item.id] = item.giveCount!;
|
rewardRule.value.giveCouponTemplateCounts![item.id] = item.giveCount!;
|
||||||
});
|
});
|
||||||
@@ -93,6 +103,7 @@ onMounted(async () => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<!-- 已选优惠券列表 -->
|
||||||
<div v-if="list.length > 0" class="mb-2 flex flex-col gap-2">
|
<div v-if="list.length > 0" class="mb-2 flex flex-col gap-2">
|
||||||
<div
|
<div
|
||||||
v-for="(item, index) in list"
|
v-for="(item, index) in list"
|
||||||
@@ -136,8 +147,10 @@ onMounted(async () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 添加按钮 -->
|
||||||
<ElButton link class="!pl-0" @click="handleSelect">+ 添加优惠券</ElButton>
|
<ElButton link class="!pl-0" @click="handleSelect">+ 添加优惠券</ElButton>
|
||||||
|
|
||||||
|
<!-- 优惠券选择弹窗 -->
|
||||||
<CouponSelect
|
<CouponSelect
|
||||||
ref="selectRef"
|
ref="selectRef"
|
||||||
:take-type="CouponTemplateTakeTypeEnum.ADMIN.type"
|
:take-type="CouponTemplateTakeTypeEnum.ADMIN.type"
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ defineOptions({ name: 'RewardRule' });
|
|||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
modelValue: Partial<MallRewardActivityApi.RewardActivity>;
|
modelValue: Partial<MallRewardActivityApi.RewardActivity>;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emits = defineEmits<{
|
const emits = defineEmits<{
|
||||||
(e: 'update:modelValue', v: any): void;
|
(e: 'update:modelValue', v: any): void;
|
||||||
}>();
|
}>();
|
||||||
@@ -37,6 +38,7 @@ const isPriceCondition = computed(() => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** 处理新增 */
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
if (!formData.value.rules) {
|
if (!formData.value.rules) {
|
||||||
formData.value.rules = [];
|
formData.value.rules = [];
|
||||||
@@ -49,19 +51,24 @@ function handleAdd() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 处理删除 */
|
||||||
function handleDelete(ruleIndex: number) {
|
function handleDelete(ruleIndex: number) {
|
||||||
formData.value.rules?.splice(ruleIndex, 1);
|
formData.value.rules?.splice(ruleIndex, 1);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<!-- TODO @puhui999:这里报错了;idea -->
|
||||||
<ElRow :gutter="[16, 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">
|
||||||
|
<!-- 规则标题 -->
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<span class="text-base font-medium">活动层级 {{ index + 1 }}</span>
|
<span class="text-base font-medium">
|
||||||
|
活动层级 {{ index + 1 }}
|
||||||
|
</span>
|
||||||
<ElButton
|
<ElButton
|
||||||
v-if="index !== 0"
|
v-if="index !== 0"
|
||||||
type="danger"
|
type="danger"
|
||||||
@@ -75,6 +82,7 @@ function handleDelete(ruleIndex: number) {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<ElForm :model="rule" label-position="left">
|
<ElForm :model="rule" label-position="left">
|
||||||
|
<!-- 优惠门槛 -->
|
||||||
<ElFormItem label="优惠门槛:" class="mb-3">
|
<ElFormItem label="优惠门槛:" class="mb-3">
|
||||||
<div
|
<div
|
||||||
class="flex items-center gap-2 rounded-md bg-gray-50 px-3 py-2"
|
class="flex items-center gap-2 rounded-md bg-gray-50 px-3 py-2"
|
||||||
@@ -106,7 +114,9 @@ function handleDelete(ruleIndex: number) {
|
|||||||
<div
|
<div
|
||||||
class="flex items-center gap-2 rounded-md bg-gray-50 px-3 py-2"
|
class="flex items-center gap-2 rounded-md bg-gray-50 px-3 py-2"
|
||||||
>
|
>
|
||||||
<span class="!w-21 shrink-0 text-sm text-gray-500">订单金额优惠</span>
|
<span class="!w-21 shrink-0 text-sm text-gray-500">
|
||||||
|
订单金额优惠
|
||||||
|
</span>
|
||||||
<span>减</span>
|
<span>减</span>
|
||||||
<ElInputNumber
|
<ElInputNumber
|
||||||
v-model="rule.discountPrice"
|
v-model="rule.discountPrice"
|
||||||
@@ -118,7 +128,7 @@ function handleDelete(ruleIndex: number) {
|
|||||||
/>
|
/>
|
||||||
<span>元</span>
|
<span>元</span>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 包邮 -->
|
||||||
<div
|
<div
|
||||||
class="flex items-center gap-2 rounded-md bg-gray-50 px-3 py-2"
|
class="flex items-center gap-2 rounded-md bg-gray-50 px-3 py-2"
|
||||||
>
|
>
|
||||||
@@ -129,7 +139,9 @@ function handleDelete(ruleIndex: number) {
|
|||||||
<div
|
<div
|
||||||
class="flex items-center gap-2 rounded-md bg-gray-50 px-3 py-2"
|
class="flex items-center gap-2 rounded-md bg-gray-50 px-3 py-2"
|
||||||
>
|
>
|
||||||
<span class="w-20 shrink-0 text-sm text-gray-500">送积分</span>
|
<span class="w-20 shrink-0 text-sm text-gray-500">
|
||||||
|
送积分
|
||||||
|
</span>
|
||||||
<span>送</span>
|
<span>送</span>
|
||||||
<ElInputNumber
|
<ElInputNumber
|
||||||
v-model="rule.point"
|
v-model="rule.point"
|
||||||
@@ -140,11 +152,13 @@ function handleDelete(ruleIndex: number) {
|
|||||||
/>
|
/>
|
||||||
<span>积分</span>
|
<span>积分</span>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 送优惠券 -->
|
||||||
<div
|
<div
|
||||||
class="flex flex-col items-start gap-2 rounded-md bg-gray-50 px-3 py-2"
|
class="flex flex-col items-start gap-2 rounded-md bg-gray-50 px-3 py-2"
|
||||||
>
|
>
|
||||||
<span class="w-20 shrink-0 text-sm text-gray-500">送优惠券</span>
|
<span class="w-20 shrink-0 text-sm text-gray-500">
|
||||||
|
送优惠券
|
||||||
|
</span>
|
||||||
<RewardRuleCouponSelect
|
<RewardRuleCouponSelect
|
||||||
:model-value="rule"
|
:model-value="rule"
|
||||||
@update:model-value="
|
@update:model-value="
|
||||||
@@ -159,10 +173,12 @@ function handleDelete(ruleIndex: number) {
|
|||||||
</ElCol>
|
</ElCol>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<ElCol :span="24" class="mt-2">
|
<!-- 添加规则按钮 -->
|
||||||
<ElButton type="primary" @click="handleAdd">+ 添加优惠规则</ElButton>
|
<Col :span="24" class="mt-2">
|
||||||
</ElCol>
|
<Button type="primary" @click="handleAdd">+ 添加优惠规则</Button>
|
||||||
|
</Col>
|
||||||
|
|
||||||
|
<!-- 提示信息 -->
|
||||||
<ElCol :span="24" class="mt-2">
|
<ElCol :span="24" class="mt-2">
|
||||||
<ElTag type="warning">
|
<ElTag type="warning">
|
||||||
提示:赠送积分为 0 时不赠送;未选择优惠券时不赠送。
|
提示:赠送积分为 0 时不赠送;未选择优惠券时不赠送。
|
||||||
|
|||||||
@@ -7,6 +7,31 @@ import { getDictOptions } from '@vben/hooks';
|
|||||||
import { z } from '#/adapter/form';
|
import { z } from '#/adapter/form';
|
||||||
import { getSimpleSeckillConfigList } from '#/api/mall/promotion/seckill/seckillConfig';
|
import { getSimpleSeckillConfigList } from '#/api/mall/promotion/seckill/seckillConfig';
|
||||||
|
|
||||||
|
/** 列表的搜索表单 */
|
||||||
|
export function useGridFormSchema(): VbenFormSchema[] {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
fieldName: 'name',
|
||||||
|
label: '活动名称',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入活动名称',
|
||||||
|
clearable: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'status',
|
||||||
|
label: '活动状态',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请选择活动状态',
|
||||||
|
clearable: true,
|
||||||
|
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/** 新增/编辑的表单 */
|
/** 新增/编辑的表单 */
|
||||||
export function useFormSchema(): VbenFormSchema[] {
|
export function useFormSchema(): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
@@ -115,31 +140,6 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 列表的搜索表单 */
|
|
||||||
export function useGridFormSchema(): VbenFormSchema[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
fieldName: 'name',
|
|
||||||
label: '活动名称',
|
|
||||||
component: 'Input',
|
|
||||||
componentProps: {
|
|
||||||
placeholder: '请输入活动名称',
|
|
||||||
clearable: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'status',
|
|
||||||
label: '活动状态',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
placeholder: '请选择活动状态',
|
|
||||||
clearable: true,
|
|
||||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 列表的字段 */
|
/** 列表的字段 */
|
||||||
export function useGridColumns(): VxeTableGridOptions['columns'] {
|
export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export function setConfigList(list: any[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 格式化配置名称 */
|
/** 格式化配置名称 */
|
||||||
export function formatConfigNames(configId: number): string {
|
export function formatConfigNames(configId: number | string): string {
|
||||||
const config = configList.find((item) => item.id === configId);
|
const config = configList.find((item) => item.id === configId);
|
||||||
return config === null || config === undefined
|
return config === null || config === undefined
|
||||||
? ''
|
? ''
|
||||||
@@ -27,8 +27,11 @@ export function formatSeckillPrice(products: any[]): string {
|
|||||||
|
|
||||||
/** 格式化活动时间范围 */
|
/** 格式化活动时间范围 */
|
||||||
export function formatTimeRange(
|
export function formatTimeRange(
|
||||||
startTime: Date | string,
|
startTime: Date | string | undefined,
|
||||||
endTime: Date | string,
|
endTime: Date | string | undefined,
|
||||||
): string {
|
): string {
|
||||||
return `${formatDate(startTime, 'YYYY-MM-DD')} ~ ${formatDate(endTime, 'YYYY-MM-DD')}`;
|
if (startTime && endTime) {
|
||||||
|
return `${formatDate(startTime, 'YYYY-MM-DD')} ~ ${formatDate(endTime, 'YYYY-MM-DD')}`;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// TODO @puhui999:antd 没有,是不是要统一哈。
|
||||||
cellConfig: {
|
cellConfig: {
|
||||||
height: 250,
|
height: 250,
|
||||||
},
|
},
|
||||||
@@ -164,6 +165,7 @@ onMounted(async () => {
|
|||||||
link: true,
|
link: true,
|
||||||
auth: ['promotion:seckill-activity:close'],
|
auth: ['promotion:seckill-activity:close'],
|
||||||
ifShow: row.status === 0,
|
ifShow: row.status === 0,
|
||||||
|
// TODO @puhui999:antd 这里是 popConfirm,看看要不要统一
|
||||||
onClick: handleClose.bind(null, row),
|
onClick: handleClose.bind(null, row),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,15 +27,19 @@ const getTitle = computed(() => {
|
|||||||
: $t('ui.actionTitle.create', ['秒杀活动']);
|
: $t('ui.actionTitle.create', ['秒杀活动']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ================= 商品选择相关 =================
|
||||||
const spuId = ref<number>();
|
const spuId = ref<number>();
|
||||||
const spuName = ref<string>('');
|
const spuName = ref<string>('');
|
||||||
const skuTableData = ref<any[]>([]);
|
const skuTableData = ref<any[]>([]);
|
||||||
const spuSkuSelectRef = ref();
|
|
||||||
|
|
||||||
|
const spuSkuSelectRef = ref(); // 商品选择弹窗 Ref
|
||||||
|
|
||||||
|
/** 打开商品选择弹窗 */
|
||||||
const handleSelectProduct = () => {
|
const handleSelectProduct = () => {
|
||||||
spuSkuSelectRef.value?.open();
|
spuSkuSelectRef.value?.open();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 选择商品后的回调 */
|
||||||
async function handleSpuSelected(selectedSpuId: number, skuIds?: number[]) {
|
async function handleSpuSelected(selectedSpuId: number, skuIds?: number[]) {
|
||||||
const spu = await getSpu(selectedSpuId);
|
const spu = await getSpu(selectedSpuId);
|
||||||
if (!spu) return;
|
if (!spu) return;
|
||||||
@@ -43,6 +47,7 @@ async function handleSpuSelected(selectedSpuId: number, skuIds?: number[]) {
|
|||||||
spuId.value = spu.id;
|
spuId.value = spu.id;
|
||||||
spuName.value = spu.name || '';
|
spuName.value = spu.name || '';
|
||||||
|
|
||||||
|
// 筛选指定的 SKU
|
||||||
const selectedSkus = skuIds
|
const selectedSkus = skuIds
|
||||||
? spu.skus?.filter((sku) => skuIds.includes(sku.id!))
|
? spu.skus?.filter((sku) => skuIds.includes(sku.id!))
|
||||||
: spu.skus;
|
: spu.skus;
|
||||||
@@ -58,6 +63,8 @@ async function handleSpuSelected(selectedSpuId: number, skuIds?: number[]) {
|
|||||||
})) || [];
|
})) || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ================= end =================
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
const [Form, formApi] = useVbenForm({
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
componentProps: {
|
componentProps: {
|
||||||
@@ -77,6 +84,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 验证商品和 SKU 配置
|
||||||
if (!spuId.value) {
|
if (!spuId.value) {
|
||||||
ElMessage.error('请选择秒杀商品');
|
ElMessage.error('请选择秒杀商品');
|
||||||
return;
|
return;
|
||||||
@@ -85,6 +93,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
ElMessage.error('请至少配置一个 SKU');
|
ElMessage.error('请至少配置一个 SKU');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 验证 SKU 配置
|
||||||
const hasInvalidSku = skuTableData.value.some(
|
const hasInvalidSku = skuTableData.value.some(
|
||||||
(sku) => sku.stock < 1 || sku.seckillPrice < 0.01,
|
(sku) => sku.stock < 1 || sku.seckillPrice < 0.01,
|
||||||
);
|
);
|
||||||
@@ -93,6 +102,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 提交表单
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
try {
|
try {
|
||||||
const values = await formApi.getValues();
|
const values = await formApi.getValues();
|
||||||
@@ -102,12 +112,13 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
products: skuTableData.value.map((sku) => ({
|
products: skuTableData.value.map((sku) => ({
|
||||||
skuId: sku.skuId,
|
skuId: sku.skuId,
|
||||||
stock: sku.stock,
|
stock: sku.stock,
|
||||||
seckillPrice: Math.round(sku.seckillPrice * 100),
|
seckillPrice: Math.round(sku.seckillPrice * 100), // 转换为分
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
await (formData.value?.id
|
await (formData.value?.id
|
||||||
? updateSeckillActivity(data)
|
? updateSeckillActivity(data)
|
||||||
: createSeckillActivity(data));
|
: createSeckillActivity(data));
|
||||||
|
// 关闭并提示
|
||||||
await modalApi.close();
|
await modalApi.close();
|
||||||
emit('success');
|
emit('success');
|
||||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||||
@@ -123,6 +134,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
skuTableData.value = [];
|
skuTableData.value = [];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 加载数据
|
||||||
const data = modalApi.getData<MallSeckillActivityApi.SeckillActivity>();
|
const data = modalApi.getData<MallSeckillActivityApi.SeckillActivity>();
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
return;
|
return;
|
||||||
@@ -130,12 +143,16 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
try {
|
try {
|
||||||
formData.value = await getSeckillActivity(data.id);
|
formData.value = await getSeckillActivity(data.id);
|
||||||
|
// TODO @puhui999:这里需要 nextTick 么?因为 antd 有
|
||||||
await formApi.setValues(formData.value);
|
await formApi.setValues(formData.value);
|
||||||
|
// 加载商品和 SKU 信息
|
||||||
|
// TODO @puhui999:if return 简化括号层级
|
||||||
if (formData.value.spuId) {
|
if (formData.value.spuId) {
|
||||||
const spu = await getSpu(formData.value.spuId);
|
const spu = await getSpu(formData.value.spuId);
|
||||||
if (spu) {
|
if (spu) {
|
||||||
spuId.value = spu.id;
|
spuId.value = spu.id;
|
||||||
spuName.value = spu.name || '';
|
spuName.value = spu.name || '';
|
||||||
|
// 回填 SKU 配置
|
||||||
const products = formData.value.products || [];
|
const products = formData.value.products || [];
|
||||||
skuTableData.value =
|
skuTableData.value =
|
||||||
spu.skus
|
spu.skus
|
||||||
@@ -148,7 +165,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
picUrl: sku.picUrl || spu.picUrl || '',
|
picUrl: sku.picUrl || spu.picUrl || '',
|
||||||
price: sku.price || 0,
|
price: sku.price || 0,
|
||||||
stock: product?.stock || 0,
|
stock: product?.stock || 0,
|
||||||
seckillPrice: (product?.seckillPrice || 0) / 100,
|
seckillPrice: (product?.seckillPrice || 0) / 100, // 分转元
|
||||||
};
|
};
|
||||||
}) || [];
|
}) || [];
|
||||||
}
|
}
|
||||||
@@ -164,9 +181,12 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
<Modal class="w-4/5" :title="getTitle">
|
<Modal class="w-4/5" :title="getTitle">
|
||||||
<div class="mx-4">
|
<div class="mx-4">
|
||||||
<Form />
|
<Form />
|
||||||
|
|
||||||
|
<!-- 商品选择区域 -->
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<div class="mb-2 flex items-center">
|
<div class="mb-2 flex items-center">
|
||||||
<span class="text-sm font-medium">秒杀活动商品:</span>
|
<span class="text-sm font-medium">秒杀活动商品:</span>
|
||||||
|
<!-- TODO @puhui999:使用 ElButton 这种哈 -->
|
||||||
<el-button class="ml-2" type="primary" @click="handleSelectProduct">
|
<el-button class="ml-2" type="primary" @click="handleSelectProduct">
|
||||||
选择商品
|
选择商品
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -174,7 +194,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
已选择: {{ spuName }}
|
已选择: {{ spuName }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- SKU 配置表格 -->
|
||||||
<div v-if="skuTableData.length > 0" class="mt-4">
|
<div v-if="skuTableData.length > 0" class="mt-4">
|
||||||
|
<!-- TODO @puhui999:Grid?或者 VXETable 哇? -->
|
||||||
<table class="w-full border-collapse border border-gray-300">
|
<table class="w-full border-collapse border border-gray-300">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="bg-gray-100">
|
<tr class="bg-gray-100">
|
||||||
@@ -225,6 +248,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
|
<!-- 商品选择器弹窗 -->
|
||||||
<SpuSkuSelect
|
<SpuSkuSelect
|
||||||
ref="spuSkuSelectRef"
|
ref="spuSkuSelectRef"
|
||||||
:is-select-sku="true"
|
:is-select-sku="true"
|
||||||
|
|||||||
@@ -110,7 +110,6 @@ function emitActivityChange() {
|
|||||||
>
|
>
|
||||||
<ElTooltip :content="activity.name">
|
<ElTooltip :content="activity.name">
|
||||||
<div class="relative h-full w-full">
|
<div class="relative h-full w-full">
|
||||||
<!-- TODO @芋艿 -->
|
|
||||||
<ElImage
|
<ElImage
|
||||||
:src="activity.picUrl"
|
:src="activity.picUrl"
|
||||||
class="h-full w-full rounded-lg object-cover"
|
class="h-full w-full rounded-lg object-cover"
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
// 当 tab 切换时,更新 Grid 的 columns 和 rowConfig
|
// 当 tab 切换时,更新 Grid 的 columns 和 rowConfig
|
||||||
async function onTabChange() {
|
async function onTabChange() {
|
||||||
const columns = getColumnsByType();
|
const columns = getColumnsByType();
|
||||||
await gridApi.setGridOptions({
|
gridApi.setGridOptions({
|
||||||
columns,
|
columns,
|
||||||
rowConfig: {
|
rowConfig: {
|
||||||
keyField: 'id',
|
keyField: 'id',
|
||||||
@@ -115,7 +115,7 @@ async function onTabChange() {
|
|||||||
async function handleAccountChange(id: number) {
|
async function handleAccountChange(id: number) {
|
||||||
accountId.value = id;
|
accountId.value = id;
|
||||||
// 同步设置表单值
|
// 同步设置表单值
|
||||||
gridApi.formApi.setValues({ accountId: id });
|
await gridApi.formApi.setValues({ accountId: id });
|
||||||
await gridApi.formApi.submitForm();
|
await gridApi.formApi.submitForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ async function handleDelete(id: number) {
|
|||||||
try {
|
try {
|
||||||
await deletePermanentMaterial(id);
|
await deletePermanentMaterial(id);
|
||||||
ElMessage.success('删除成功');
|
ElMessage.success('删除成功');
|
||||||
handleRefresh();
|
await handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
loadingInstance.close();
|
loadingInstance.close();
|
||||||
}
|
}
|
||||||
@@ -211,7 +211,7 @@ async function handleDelete(id: number) {
|
|||||||
</ElButton>
|
</ElButton>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 图片列的slot -->
|
<!-- 图片列的 slot -->
|
||||||
<template #image="{ row }">
|
<template #image="{ row }">
|
||||||
<div class="flex items-center justify-center" style="height: 192px">
|
<div class="flex items-center justify-center" style="height: 192px">
|
||||||
<img
|
<img
|
||||||
@@ -222,12 +222,12 @@ async function handleDelete(id: number) {
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 语音列的slot -->
|
<!-- 语音列的 slot -->
|
||||||
<template #voice="{ row }">
|
<template #voice="{ row }">
|
||||||
<audio :src="row.url" controls style="width: 160px"></audio>
|
<audio :src="row.url" controls style="width: 160px"></audio>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 视频列的slot -->
|
<!-- 视频列的 slot -->
|
||||||
<template #video="{ row }">
|
<template #video="{ row }">
|
||||||
<video
|
<video
|
||||||
:src="row.url"
|
:src="row.url"
|
||||||
@@ -236,16 +236,17 @@ async function handleDelete(id: number) {
|
|||||||
></video>
|
></video>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 操作列的slot -->
|
<!-- 操作列的 slot -->
|
||||||
<template #actions="{ row }">
|
<template #actions="{ row }">
|
||||||
<TableAction
|
<TableAction
|
||||||
:actions="[
|
:actions="[
|
||||||
{
|
{
|
||||||
label: '删除',
|
label: $t('common.delete'),
|
||||||
icon: ACTION_ICON.delete,
|
type: 'danger',
|
||||||
color: 'danger',
|
link: true,
|
||||||
|
icon: ACTION_ICON.DELETE,
|
||||||
auth: ['mp:material:delete'],
|
auth: ['mp:material:delete'],
|
||||||
onClick: () => handleDelete(row.id),
|
onClick: () => handleDelete(row.id!),
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user