商城:

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

@ -9,6 +9,7 @@ import { TableColumn } from '@/types/table'
import { DescriptionsSchema } from '@/types/descriptions'
import { ComponentOptions, ComponentProps } from '@/types/components'
import { DictTag } from '@/components/DictTag'
import { cloneDeep } from 'lodash-es'
export type CrudSchema = Omit<TableColumn, 'children'> & {
isSearch?: boolean // 是否在查询显示
@ -306,3 +307,12 @@ const filterOptions = (options: Recordable, labelField?: string) => {
return v
})
}
// 将 tableColumns 指定 fields 放到最前面
export const sortTableColumns = (tableColumns: TableColumn[], field: string) => {
const fieldIndex = tableColumns.findIndex((item) => item.field === field)
const fieldColumn = cloneDeep(tableColumns[fieldIndex])
tableColumns.splice(fieldIndex, 1)
// 添加到开头
tableColumns.unshift(fieldColumn)
}