商城:

1. 微调砍价活动的代码

(cherry picked from commit 7bf3e41c61)
This commit is contained in:
YunaiV 2023-08-13 00:49:17 +08:00 committed by shizhong
parent 81d8e36ccc
commit cfef155ee2
3 changed files with 3 additions and 14 deletions

View File

@ -129,7 +129,6 @@ const getSpuDetails = async (
if (typeof products !== 'undefined') {
const product = products.find((item) => item.skuId === sku.id)
if (product) {
//
product.bargainFirstPrice = formatToFraction(product.bargainFirstPrice)
product.bargainPrice = formatToFraction(product.bargainPrice)
}

View File

@ -65,8 +65,8 @@
import { allSchemas } from './bargainActivity.data'
import * as BargainActivityApi from '@/api/mall/promotion/bargain/bargainActivity'
import BargainActivityForm from './BargainActivityForm.vue'
import { cloneDeep } from 'lodash-es'
import { createImageViewer } from '@/components/ImageViewer'
import { sortTableColumns } from '@/hooks/web/useCrudSchemas'
defineOptions({ name: 'PromotionBargainActivity' })
@ -98,20 +98,10 @@ const handleDelete = (id: number) => {
tableMethods.delList(id, false)
}
// TODO @puhui999使 element plus crud schema
/** 初始化 **/
onMounted(() => {
/**
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')
getList()
})
</script>