Skip to content

Commit 7bf3e41

Browse files
committed
商城:
1. 微调砍价活动的代码
1 parent 127e6b2 commit 7bf3e41

File tree

3 files changed

+3
-14
lines changed

3 files changed

+3
-14
lines changed

src/views/mall/promotion/bargain/BargainActivityForm.vue renamed to src/views/mall/promotion/bargain/activity/BargainActivityForm.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ const getSpuDetails = async (
129129
if (typeof products !== 'undefined') {
130130
const product = products.find((item) => item.skuId === sku.id)
131131
if (product) {
132-
// 分转元
133132
product.bargainFirstPrice = formatToFraction(product.bargainFirstPrice)
134133
product.bargainPrice = formatToFraction(product.bargainPrice)
135134
}

src/views/mall/promotion/bargain/index.vue renamed to src/views/mall/promotion/bargain/activity/index.vue

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
import { allSchemas } from './bargainActivity.data'
6666
import * as BargainActivityApi from '@/api/mall/promotion/bargain/bargainActivity'
6767
import BargainActivityForm from './BargainActivityForm.vue'
68-
import { cloneDeep } from 'lodash-es'
6968
import { createImageViewer } from '@/components/ImageViewer'
69+
import { sortTableColumns } from '@/hooks/web/useCrudSchemas'
7070
7171
defineOptions({ name: 'PromotionBargainActivity' })
7272
@@ -98,20 +98,10 @@ const handleDelete = (id: number) => {
9898
tableMethods.delList(id, false)
9999
}
100100
101-
// TODO @puhui999:要不还是使用原生的 element plus 做。感觉 crud schema 复杂界面,做起来麻烦
102101
/** 初始化 **/
103102
onMounted(() => {
104-
/**
105-
TODO
106-
后面准备封装成一个函数来操作 tableColumns 重新排列:比如说需求是表单上商品选择是在后面的而列表展示的时候需要调到位置。
107-
封装效果支持批量操作,给出 field 和需要插入的位置,例:[{field:'spuId',index: 1}] 效果为把 field 为 spuId 的 column 移动到第一个位置
108-
*/
109-
// 处理一下表格列让商品往前
110-
const index = allSchemas.tableColumns.findIndex((item) => item.field === 'spuId')
111-
const column = cloneDeep(allSchemas.tableColumns[index])
112-
allSchemas.tableColumns.splice(index, 1)
113-
// 添加到开头
114-
allSchemas.tableColumns.unshift(column)
103+
// 获得活动列表
104+
sortTableColumns(allSchemas.tableColumns, 'spuId')
115105
getList()
116106
})
117107
</script>

0 commit comments

Comments
 (0)