From 7bf3e41c6189776b129670d44c9b40ecce2f86d5 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 13 Aug 2023 00:49:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=9F=8E=EF=BC=9A=201.=20=E5=BE=AE?= =?UTF-8?q?=E8=B0=83=E7=A0=8D=E4=BB=B7=E6=B4=BB=E5=8A=A8=E7=9A=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{ => activity}/BargainActivityForm.vue | 1 - .../{ => activity}/bargainActivity.data.ts | 0 .../promotion/bargain/{ => activity}/index.vue | 16 +++------------- 3 files changed, 3 insertions(+), 14 deletions(-) rename src/views/mall/promotion/bargain/{ => activity}/BargainActivityForm.vue (99%) rename src/views/mall/promotion/bargain/{ => activity}/bargainActivity.data.ts (100%) rename src/views/mall/promotion/bargain/{ => activity}/index.vue (78%) diff --git a/src/views/mall/promotion/bargain/BargainActivityForm.vue b/src/views/mall/promotion/bargain/activity/BargainActivityForm.vue similarity index 99% rename from src/views/mall/promotion/bargain/BargainActivityForm.vue rename to src/views/mall/promotion/bargain/activity/BargainActivityForm.vue index 91bb52d0..5384d6a1 100644 --- a/src/views/mall/promotion/bargain/BargainActivityForm.vue +++ b/src/views/mall/promotion/bargain/activity/BargainActivityForm.vue @@ -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) } diff --git a/src/views/mall/promotion/bargain/bargainActivity.data.ts b/src/views/mall/promotion/bargain/activity/bargainActivity.data.ts similarity index 100% rename from src/views/mall/promotion/bargain/bargainActivity.data.ts rename to src/views/mall/promotion/bargain/activity/bargainActivity.data.ts diff --git a/src/views/mall/promotion/bargain/index.vue b/src/views/mall/promotion/bargain/activity/index.vue similarity index 78% rename from src/views/mall/promotion/bargain/index.vue rename to src/views/mall/promotion/bargain/activity/index.vue index 42222f45..abcbcc6b 100644 --- a/src/views/mall/promotion/bargain/index.vue +++ b/src/views/mall/promotion/bargain/activity/index.vue @@ -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() })