fix: 完善 mall seckillActivity add

pull/176/head
puhui999 2023-06-25 17:16:26 +08:00
parent 51e79f29cc
commit 341303b014
3 changed files with 15 additions and 6 deletions

View File

@ -10,7 +10,6 @@
<!-- 先选择 -->
<template #spuIds>
<el-button @click="spuSelectRef.open()"></el-button>
<!-- TODO @puhui999默认展开 SKU 毕竟 SKU 是主角SPU 是配角 -->
<SpuAndSkuList
ref="spuAndSkuListRef"
:rule-config="ruleConfig"
@ -24,7 +23,7 @@
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
<SpuSelect ref="spuSelectRef" :is-select-sku="true" @confirm="selectSpu" />
<SpuSelect ref="spuSelectRef" @confirm="selectSpu" />
</template>
<script lang="ts" setup>
import { SpuAndSkuList, SpuProperty, SpuSelect } from '../../components'
@ -132,7 +131,7 @@ const submitForm = async () => {
try {
const data = formRef.value.formModel as SeckillActivityApi.SeckillActivityVO
data.spuIds = spuList.value.map((spu) => spu.id!)
data.products = spuAndSkuListRef.value.getSkuConfigs()
data.products = spuAndSkuListRef.value.getSkuConfigs('productConfig')
if (formType.value === 'create') {
await SeckillActivityApi.createSeckillActivity(data)
message.success(t('common.createSuccess'))

View File

@ -24,11 +24,14 @@
v-model:pageSize="tableObject.pageSize"
:columns="allSchemas.tableColumns"
:data="tableObject.tableList"
:expand="true"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
@expand-change="expandChange"
>
<template #expand> 展示活动商品和商品相关属性活动配置</template>
<template #configIds="{ row }">
<el-tag v-for="(name, index) in convertSeckillConfigNames(row)" :key="index" class="mr-5px">
{{ name }}
@ -93,6 +96,11 @@ const convertSeckillConfigNames = computed(
?.filter((item) => row.configIds.includes(item.id))
?.map((config) => config.name)
)
const expandChange = (row, expandedRows) => {
// TODO puhui CRUD
console.log(row, expandedRows)
}
/** 初始化 **/
onMounted(async () => {
await getList()

View File

@ -16,7 +16,6 @@ export const rules = reactive({
})
// CrudSchema https://doc.iocoder.cn/vue3/crud-schema/
// TODO @puhui999table 宽度调整下,有点太长啦;部分字段可以隐藏哈,根据需求;
const crudSchemas = reactive<CrudSchema[]>([
{
label: '秒杀活动名称',
@ -177,8 +176,10 @@ const crudSchemas = reactive<CrudSchema[]>([
}
},
{
label: '秒杀活动商品', // TODO @puhui999格式化的商品不对
label: '秒杀活动商品',
field: 'spuIds',
isTable: false,
isSearch: false,
form: {
colProps: {
span: 24
@ -218,7 +219,7 @@ const crudSchemas = reactive<CrudSchema[]>([
},
{
label: '状态',
field: 'status', // TODO @puhui999状态在 table 格式化不对;
field: 'status', // TODO @puhui999状态在 table 格式化不对;建表插入的数据状态值不对,改为 0 或 1 就好了
dictType: DICT_TYPE.COMMON_STATUS,
dictClass: 'number',
isForm: false,
@ -233,6 +234,7 @@ const crudSchemas = reactive<CrudSchema[]>([
{
label: '备注',
field: 'remark',
isSearch: false,
form: {
component: 'Input',
componentProps: {