This commit is contained in:
zjf committed 2025-02-27 15:17:12 +08:00
commit 1793e3a92d
15 files changed
+349 -388

No files matched your search

@@ -55,8 +55,8 @@
<script setup lang="ts" name="linkCgCodeDialog">
import { ref } from "vue"
import { getCgddPage } from "/@/api/supermarketerp/smErpInventoryRecords"
import { VxeTableEvents } from "vxe-table"
import { getCgInventoryPage } from "/@/api/supermarketerp/smErpCgBack"
const linkCgCodeDialogVisible = defineModel()
const emit = defineEmits(["getSelectedCgPlan"])
@@ -74,7 +74,7 @@ const openLinkCodeDialog = async () => {
step.value = 0
linkCodeLoading.value = true
try {
const res = await getCgddPage().finally(() => (linkCodeLoading.value = false))
const res = await getCgInventoryPage({ inventoryType: "3" }).finally(() => (linkCodeLoading.value = false))
if (res.code === 0) {
cgddPage.value = res.data.records
}
@@ -181,14 +181,14 @@
import { ref, reactive, computed, onMounted } from "vue"
import { useRouter, useRoute } from "vue-router"
import { useMessage } from "/@/hooks/message"
import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpInventoryRecords"
import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpCgBack"
import { getPlanCode, getErpSpuSimpleAll } from "/@/api/supermarketerp/common"
import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
import { getSupplierTypeOptions } from "/@/api/supermarketerp/smErpSupplier"
import { formatDate } from "/@/utils/formatTime"
import { Search } from "@element-plus/icons-vue"
import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectDialog.vue"
import linkCgCodeDialog from "/@/views/supermarketerp/smErpCgDd/components/linkCgCodeDialog.vue"
import linkCgCodeDialog from "/@/views/supermarketerp/smErpCgBack/components/linkCgCodeDialog.vue"
import { displayPrice } from "/@/utils/formatMoney"
const router = useRouter()
@@ -55,8 +55,8 @@
<script setup lang="ts" name="linkCgCodeDialog">
import { ref } from "vue"
import { getCgddPage } from "/@/api/supermarketerp/smErpInventoryRecords"
import { VxeTableEvents } from "vxe-table"
import { getCgInventoryPage } from "/@/api/supermarketerp/smErpRetailBack"
const linkCgCodeDialogVisible = defineModel()
const emit = defineEmits(["getSelectedCgPlan"])
@@ -74,7 +74,7 @@ const openLinkCodeDialog = async () => {
step.value = 0
linkCodeLoading.value = true
try {
const res = await getCgddPage().finally(() => (linkCodeLoading.value = false))
const res = await getCgInventoryPage({ inventoryType: "5" }).finally(() => (linkCodeLoading.value = false))
if (res.code === 0) {
cgddPage.value = res.data.records
}
@@ -219,7 +219,7 @@ import { getSupplierTypeOptions } from "/@/api/supermarketerp/smErpSupplier"
import { formatDate } from "/@/utils/formatTime"
import { Search } from "@element-plus/icons-vue"
import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectDialog.vue"
import linkCgCodeDialog from "/@/views/supermarketerp/smErpCgDd/components/linkCgCodeDialog.vue"
import linkCgCodeDialog from "/@/views/supermarketerp/smErpRetailBack/components/linkCgCodeDialog.vue"
import { displayPrice, storePrice } from "/@/utils/formatMoney"
import { useDict } from "/@/hooks/dict"
@@ -244,7 +244,10 @@ const openDialog = async (id: string) => {
// 获取supermarketSpu信息
if (id) {
form.id = id
getsupermarketSpuData(id)
await getsupermarketSpuData(id)
// 设置基础包装单位单选行
supermarketUnitEntityListRef.value.setRadioRow(form.smErpUnitEntityList.findIndex((item: any) => item.isBase))
}
// 获取分类下拉选项 & 获取品牌下拉选项 & 获取货商下拉选项
@@ -268,17 +271,19 @@ const getsupermarketSpuData = async (id: string) => {
if (res.code === 0) {
res.data.smErpUnitEntityList = res.data.smErpUnitEntityList.map((item: any) => {
// 格式化数据
item.retailPrice = displayPrice(item.retailPrice, "")
item.promotionPrice = displayPrice(item.promotionPrice, "")
item.purchasePrice = displayPrice(item.purchasePrice, "")
item.costPrice = displayPrice(item.costPrice, "")
item.retailPrice = parseFloat(displayPrice(item.retailPrice, ""))
item.promotionPrice = parseFloat(displayPrice(item.promotionPrice, ""))
item.purchasePrice = parseFloat(displayPrice(item.purchasePrice, ""))
item.costPrice = parseFloat(displayPrice(item.costPrice, ""))
return item
})
Object.assign(form, res.data)
// 设置基础包装单位单选行
supermarketUnitEntityListRef.value.setRadioRow(form.smErpUnitEntityList.findIndex((item: any) => item.isBase))
Object.assign(form, {
...res.data,
costPrice: parseFloat(displayPrice(res.data.costPrice, "")),
purchasePrice: parseFloat(displayPrice(res.data.purchasePrice, "")),
retailPrice: parseFloat(displayPrice(res.data.retailPrice, "")),
})
console.log("获取的商品详情:", res.data)
}
@@ -338,7 +343,7 @@ const onSubmit = async () => {
console.log("提交的数据", form)
const valid = await dataFormRef.value.validate().catch(() => {})
// if (!valid) return useMessage().warning("基础信息必填项未填写完整")
if (!valid) return useMessage().warning("基础信息必填项未填写完整")
if (!form.smErpUnitEntityList || form.smErpUnitEntityList.length <= 0) return useMessage().warning("请添加包装单位")
if (!(await supermarketUnitEntityListRef.value.editableTableValidate())) return useMessage().warning("包装单位必填项未填写完整")
if (!supermarketUnitEntityListRef.value.getRadioEvent()) return useMessage().warning("请选择基础包装单位")