商城:

1. 修复秒杀活动,修改商品的秒杀价格,会存在 *100 的问题
This commit is contained in:
YunaiV
2023-08-12 16:25:05 +08:00
parent 9984de0dc7
commit ff8bde207d
4 changed files with 35 additions and 31 deletions

View File

@@ -10,8 +10,7 @@
type="primary"
@click="openForm('create')"
>
<Icon class="mr-5px" icon="ep:plus" />
新增
<Icon class="mr-5px" icon="ep:plus" /> 新增
</el-button>
</template>
</Search>
@@ -74,8 +73,8 @@ import { allSchemas } from './seckillActivity.data'
import { getSimpleSeckillConfigList } from '@/api/mall/promotion/seckill/seckillConfig'
import * as SeckillActivityApi from '@/api/mall/promotion/seckill/seckillActivity'
import SeckillActivityForm from './SeckillActivityForm.vue'
import { cloneDeep } from 'lodash-es'
import { createImageViewer } from '@/components/ImageViewer'
import { sortTableColumns } from '@/hooks/web/useCrudSchemas'
defineOptions({ name: 'PromotionSeckillActivity' })
@@ -99,12 +98,14 @@ const openForm = (type: string, id?: number) => {
const handleDelete = (id: number) => {
tableMethods.delList(id, false)
}
/** 商品图预览 */
const imagePreview = (imgUrl: string) => {
createImageViewer({
urlList: [imgUrl]
})
}
const configList = ref([]) // 时段配置精简列表
const convertSeckillConfigNames = computed(
() => (row) =>
@@ -120,18 +121,10 @@ const expandChange = (row, expandedRows) => {
/** 初始化 **/
onMounted(async () => {
/*
TODO
后面准备封装成一个函数来操作 tableColumns 重新排列:比如说需求是表单上商品选择是在后面的而列表展示的时候需要调到位置。
封装效果支持批量操作,给出 field 和需要插入的位置,例:[{field:'spuId',index: 1}] 效果为把 field 为 spuId 的 column 移动到第一个位置
*/
// 处理一下表格列让商品往前
const index = allSchemas.tableColumns.findIndex((item) => item.field === 'spuId')
const column = cloneDeep(allSchemas.tableColumns[index])
allSchemas.tableColumns.splice(index, 1)
// 添加到开头
allSchemas.tableColumns.unshift(column)
// 获得活动列表
sortTableColumns(allSchemas.tableColumns, 'spuId')
await getList()
// 获得秒杀时间段
configList.value = await getSimpleSeckillConfigList()
})
</script>