From ba9539833bc5b487b1d8d9cdaecff12f4c268528 Mon Sep 17 00:00:00 2001 From: weiwei Date: Tue, 17 Jun 2025 12:48:10 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=BA=93=E5=AD=98=E5=95=86=E5=93=81?= =?UTF-8?q?=E7=BC=96=E8=BE=91tab=E5=8F=AF=E7=82=B9=E5=87=BB=E5=88=87?= =?UTF-8?q?=E6=8D=A2=EF=BC=8C=E9=83=A8=E5=88=86=E5=80=BC=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/auxiliary-code.vue | 12 +- .../supermarketSpu/components/base-info.vue | 4 +- .../components/package-unit.vue | 16 +-- .../supermarketerp/supermarketSpu/form.vue | 117 ++++++++++-------- 4 files changed, 77 insertions(+), 72 deletions(-) diff --git a/src/views/supermarketerp/supermarketSpu/components/auxiliary-code.vue b/src/views/supermarketerp/supermarketSpu/components/auxiliary-code.vue index 16db13a..eeaf67c 100644 --- a/src/views/supermarketerp/supermarketSpu/components/auxiliary-code.vue +++ b/src/views/supermarketerp/supermarketSpu/components/auxiliary-code.vue @@ -10,6 +10,7 @@ border show-overflow max-height="380" + :edit-rules="validRules" :column-config="{ resizable: true }" :row-config="{ isHover: true }" :resizable-config="{ dragMode: 'fixed' }" @@ -47,9 +48,6 @@ - @@ -90,10 +88,10 @@ const props = withDefaults( const editableTableRef = ref() -// const validRules = { -// unit: [{ required: true, message: "包装单位不能为空", trigger: "blur" }], -// barCode: [{ required: true, message: "条码不能为空", trigger: "blur" }], -// } +const validRules = { + // unit: [{ required: true, message: "包装单位不能为空", trigger: "blur" }], + // barCode: [{ required: true, message: "条码不能为空", trigger: "blur" }], +} // 底部表格行新增 const pushEvent = () => { diff --git a/src/views/supermarketerp/supermarketSpu/components/base-info.vue b/src/views/supermarketerp/supermarketSpu/components/base-info.vue index 1a05ade..b55608e 100644 --- a/src/views/supermarketerp/supermarketSpu/components/base-info.vue +++ b/src/views/supermarketerp/supermarketSpu/components/base-info.vue @@ -32,13 +32,13 @@ - + - + diff --git a/src/views/supermarketerp/supermarketSpu/components/package-unit.vue b/src/views/supermarketerp/supermarketSpu/components/package-unit.vue index 919bbec..305ccc6 100644 --- a/src/views/supermarketerp/supermarketSpu/components/package-unit.vue +++ b/src/views/supermarketerp/supermarketSpu/components/package-unit.vue @@ -54,7 +54,7 @@ - + @@ -113,7 +113,7 @@ export interface rowVU { packageNum: number purchasePrice: number retailPrice: number - promotionPrice: number | null + promotionPrice: number costPrice: number isNew?: boolean isBase?: boolean | null @@ -127,11 +127,11 @@ const packageUnitList = defineModel("modelValue", { barCode: "", spec: "", unit: "", - status: "", + status: "0", packageNum: 1, purchasePrice: 0, retailPrice: 0.01, - promotionPrice: null, + promotionPrice: 0, costPrice: 0, }, ], @@ -160,11 +160,11 @@ const pushEvent = (row?: rowVU | undefined) => { barCode: "", spec: "", unit: "", - status: "", + status: "0", packageNum: 1, purchasePrice: 0, retailPrice: 0.01, - promotionPrice: null, + promotionPrice: 0, costPrice: 0, isNew: true, } @@ -191,7 +191,7 @@ const removeSelectRowEvent = () => { } // 获取单选的行 -const getRadioEvent = () => { +const getRadioRow = () => { const $table = editableTableRef.value if ($table) { const currRadioRow = $table.getRadioRecord() @@ -225,7 +225,7 @@ const editableTableValidate = async () => { defineExpose({ editableTableValidate, - getRadioEvent, + getRadioRow, setRadioRow, pushEvent, }) diff --git a/src/views/supermarketerp/supermarketSpu/form.vue b/src/views/supermarketerp/supermarketSpu/form.vue index 11e001c..1a95377 100644 --- a/src/views/supermarketerp/supermarketSpu/form.vue +++ b/src/views/supermarketerp/supermarketSpu/form.vue @@ -1,34 +1,31 @@ @@ -46,7 +43,7 @@ import { nanoid } from "nanoid" const emit = defineEmits(["refresh"]) -const dataFormRef = ref() +const formRef = ref() const packageUnitRef = ref() const visible = ref(false) const loading = ref(false) @@ -87,8 +84,8 @@ const form = reactive({ costPrice: 0, }) -// 表单金额转为单位分 -const formatedMoney = computed(() => { +// 基本信息的金额转为单位分 +const formatedBaseFormMoney = computed(() => { return { grossMargin: storePrice(form.grossMargin), purchasePrice: storePrice(form.purchasePrice), @@ -176,51 +173,63 @@ const getsupermarketSpuData = async (id: string) => { // 重置表单数据 const resetForm = () => { - dataFormRef.value?.resetFields() + formRef.value?.resetFields() form.smErpUnitEntityList = [] form.smErpAuxiliaryCodeEntityList = [] } -// 第一步的下一步 -const addPackageUnitNextStep = () => { - currentTabPaneIndex.value++ +// tab栏切换 +const handleTabChange = (name: TabPaneName) => { + currentTabPaneIndex.value = tabPaneEnum.findIndex((item) => item === name) if (form.id) return - - const row = { - id: nanoid(5), - barCode: form.barCode, - spec: form.spec, - unit: form.unit, - status: form.unitStatus, - packageNum: form.packageNum, - purchasePrice: form.purchasePrice, - retailPrice: form.retailPrice, - promotionPrice: form.promotionPrice, - costPrice: form.costPrice, - isNew: true, - flag: "addPackageUnitNextStep", - } - const isFlagRowExist = form.smErpUnitEntityList.some((item: rowVU) => item.flag === "addPackageUnitNextStep") - if (isFlagRowExist) return - packageUnitRef.value.pushEvent(row) - packageUnitRef.value.setRadioRow(0) // 设置基础包装单位的单选行 + setDefaultPackageUnit() } -// tab栏切换 -const handleTabChange = (name: TabPaneName) => (currentTabPaneIndex.value = tabPaneEnum.findIndex((item) => item === name)) +// 下一步 +const nextStep = () => { + currentTabPaneIndex.value++ + if (form.id) return + setDefaultPackageUnit() +} -// 计算包装单位列表 -const usePackageUnitList = () => { - const curRadioRowUnit = packageUnitRef.value.getRadioEvent() +// 默认设置一行基础包装单位 +const setDefaultPackageUnit = () => { + if (currentTabPaneIndex.value == 1) { + const isFlagRowExist = form.smErpUnitEntityList.some((item: rowVU) => item.flag === "defaultAddedPackageUnit") + if (isFlagRowExist) return + const row = { + id: nanoid(5), + barCode: form.barCode, + spec: form.spec, + unit: form.unit, + status: form.unitStatus, + packageNum: form.packageNum, + purchasePrice: form.purchasePrice, + retailPrice: form.retailPrice, + promotionPrice: form.promotionPrice, + costPrice: form.costPrice, + isNew: true, + flag: "defaultAddedPackageUnit", + } + packageUnitRef.value.pushEvent(row) + packageUnitRef.value.setRadioRow(0) // 自动设置基础包装单位的radio单选行 + } +} + +// 整理包装单位列表 +const settlePackageUnitList = () => { + const curRadioRowUnit = packageUnitRef.value.getRadioRow() const smErpUnitEntityList = JSON.parse(JSON.stringify(form.smErpUnitEntityList)) return smErpUnitEntityList.map((item: rowVU) => { + // 设置基础包装单位标识(isBase) if (item.id === curRadioRowUnit.id) { item.isBase = true } else { item.isBase = false } + // 转换金额单位 item.costPrice = storePrice(item.costPrice) - item.promotionPrice = item.promotionPrice ? storePrice(item.promotionPrice) : null + item.promotionPrice = storePrice(item.promotionPrice) item.purchasePrice = storePrice(item.purchasePrice) item.retailPrice = storePrice(item.retailPrice) if (item.isNew) { @@ -231,14 +240,13 @@ const usePackageUnitList = () => { }) } -// 计算辅助条码列表 -const useAuxiliaryCode = () => { +// 整理辅助条码列表 +const settleAuxiliaryCode = () => { const smErpAuxiliaryCodeEntityList = [...form.smErpAuxiliaryCodeEntityList] return smErpAuxiliaryCodeEntityList .filter((item: rowVC) => item.unitId) .map((item: rowVC) => { const curPackageUnitItem = form.smErpUnitEntityList.find((unitItem: any) => unitItem.id == item.unitId) - console.log(form.smErpUnitEntityList) if (item.isNew) { item.id = "" @@ -251,26 +259,25 @@ const useAuxiliaryCode = () => { // 提交 const onSubmit = async () => { - const valid = await dataFormRef.value.validate().catch(() => {}) - if (!valid) return useMessage().warning("基础信息和库存必填项未填写完整") + const valid = await formRef.value.validate().catch(() => {}) + if (!valid) return useMessage().warning("基础信息或库存必填项未填写完整") if (!form.smErpUnitEntityList || form.smErpUnitEntityList.length <= 0) return useMessage().warning("请添加包装单位") if (!(await packageUnitRef.value.editableTableValidate())) return useMessage().warning("包装单位必填项未填写完整") - if (!packageUnitRef.value.getRadioEvent()) return useMessage().warning("请选择基础包装单位") + if (!packageUnitRef.value.getRadioRow()) return useMessage().warning("请选择基础包装单位") - // if (!form.stock || !form.inventoryUpperLimit || !form.inventoryLowerLimit) return useMessage().warning("库存必填项未填写完整") // if (!form.smErpAuxiliaryCodeEntityList || form.smErpAuxiliaryCodeEntityList.length <= 0) return useMessage().warning("请添加辅助条码") // if (!(await auxiliaryCodeRef.value.editableTableValidate())) return useMessage().warning("辅助条码必填项未填写完整") - console.log(form.smErpUnitEntityList) + console.log("未整理-包装单位", form.smErpUnitEntityList) + console.log("未整理-辅助条码", form.smErpAuxiliaryCodeEntityList) - const smErpAuxiliaryCodeEntityList = useAuxiliaryCode() - const smErpUnitEntityList = usePackageUnitList() + const smErpAuxiliaryCodeEntityList = settleAuxiliaryCode() + const smErpUnitEntityList = settlePackageUnitList() try { loading.value = true const _pa = { ...form, - ...formatedMoney.value, - grossMargin: storePrice(form.grossMargin), + ...formatedBaseFormMoney.value, smErpAuxiliaryCodeEntityList, smErpUnitEntityList, } From 32d07535f580d6eb450732f3c1087065b7f2585b Mon Sep 17 00:00:00 2001 From: dzc <2388224167@qq.com> Date: Wed, 18 Jun 2025 11:15:01 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=E9=80=80=E8=BF=98=E5=90=84=E8=87=AA?= =?UTF-8?q?=E9=A3=9F=E5=A0=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 8 +- src/components/DictSelect/index.vue | 29 ++-- .../wallet/wallet-recharge-apply/form.vue | 53 +++++-- .../wallet/wallet-recharge-apply/index.vue | 140 ++++++------------ 4 files changed, 114 insertions(+), 116 deletions(-) diff --git a/.env.development b/.env.development index 4a5dc26..d895fee 100644 --- a/.env.development +++ b/.env.development @@ -8,19 +8,19 @@ VITE_OPEN = true ENV = 'development' # ADMIN 服务地址 -VITE_ADMIN_PROXY_PATH = http://123.157.250.162:8089/api/ # 测试线上 +# VITE_ADMIN_PROXY_PATH = http://123.157.250.162:8089/api/ # 测试线上 # VITE_ADMIN_PROXY_PATH = http://123.156.230.15:8089/api/ # 测试线上-过期 # VITE_ADMIN_PROXY_PATH = http://pjcloud.center.takin.cc/ # VITE_ADMIN_PROXY_PATH = http://localhost:9999/ -# VITE_ADMIN_PROXY_PATH = http://192.168.101.139:9999/ # 邓-本地 +VITE_ADMIN_PROXY_PATH = http://192.168.101.139:9999/ # 邓-本地 # VITE_ADMIN_PROXY_PATH = http://59.202.170.152:81/api # 正式环境线上 # 图片访问基础地址 -VITE_IMAGE_BASE_PATH = http://123.157.250.162:8089/api/ # 测试线上 +# VITE_IMAGE_BASE_PATH = http://123.157.250.162:8089/api/ # 测试线上 # VITE_IMAGE_BASE_PATH = http://123.156.230.15:8089/api/ # 测试线上-过期 # VITE_IMAGE_BASE_PATH = http://pjcloud.center.takin.cc # VITE_IMAGE_BASE_PATH = http://localhost:9999 -# VITE_IMAGE_BASE_PATH = http://192.168.101.139:9999 # 邓-本地 +VITE_IMAGE_BASE_PATH = http://192.168.101.139:9999 # 邓-本地 # VITE_IMAGE_BASE_PATH = http://59.202.170.152:81/api/ # 正式环境线上 # 代码生成服务地址 diff --git a/src/components/DictSelect/index.vue b/src/components/DictSelect/index.vue index 260e222..6433532 100644 --- a/src/components/DictSelect/index.vue +++ b/src/components/DictSelect/index.vue @@ -1,12 +1,7 @@ @@ -20,6 +15,7 @@ const selectId = defineModel() export type Props = { dictCode: string placeholder?: string + hideIds?: string | Array } const props = withDefaults(defineProps(), { placeholder: "请选择", @@ -40,6 +36,21 @@ watch( { immediate: true }, ) +const filterDictList = computed(() => { + const hideKeys = props.hideIds + // 排序 + const list = state.dictList?.sort((pren: any, next: any) => { + return pren.sortOrder - next.sortOrder + }) + if (!hideKeys) return list + if (typeof hideKeys == "string") { + return list.filter((p: any) => p.value != hideKeys) + } + if (Array.isArray(hideKeys)) { + return list.filter((p: any) => !hideKeys.includes(p.value)) + } +}) + async function getDictOptions() { if (!props.dictCode) return [] const dicts = dict().getDict(props.dictCode) @@ -60,7 +71,7 @@ async function getDictOptions() { diff --git a/src/views/wallet/wallet-recharge-apply/form.vue b/src/views/wallet/wallet-recharge-apply/form.vue index 8addf21..1af26cc 100644 --- a/src/views/wallet/wallet-recharge-apply/form.vue +++ b/src/views/wallet/wallet-recharge-apply/form.vue @@ -1,16 +1,19 @@