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/hard/hard-dept-total/index.vue b/src/views/hard/hard-dept-total/index.vue index ea39e24..b661ed2 100644 --- a/src/views/hard/hard-dept-total/index.vue +++ b/src/views/hard/hard-dept-total/index.vue @@ -48,6 +48,22 @@ displayPrice(row.walletReducePrice) }} + + + + + + + + - + @@ -118,7 +118,7 @@ export interface rowVU { packageNum: number purchasePrice: number retailPrice: number - promotionPrice: number | null + promotionPrice: number costPrice: number isNew?: boolean isBase?: boolean | null @@ -133,11 +133,11 @@ const packageUnitList = defineModel("modelValue", { barCode: "", spec: "", unit: "", - status: "", + status: "0", packageNum: 1, purchasePrice: 0, retailPrice: 0.01, - promotionPrice: null, + promotionPrice: 0, costPrice: 0, }, ], @@ -166,11 +166,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, } @@ -197,7 +197,7 @@ const removeSelectRowEvent = () => { } // 获取单选的行 -const getRadioEvent = () => { +const getRadioRow = () => { const $table = editableTableRef.value if ($table) { const currRadioRow = $table.getRadioRecord() @@ -231,7 +231,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, } 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 @@