修复食材入库的原进价显示

This commit is contained in:
weiwei committed 2025-05-23 09:56:34 +08:00
1 parent 0484050c69
commit 0c46b250c0
2 files changed
+11 -7

No files matched your search

@@ -60,16 +60,16 @@
<vxe-column field="name" title="库存食材">
<template #default="{ row }">{{ row.name || row.erpMaterialId }}</template>
</vxe-column>
<vxe-column field="quantity" title="数量" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
<template #edit="{ row }"><el-input v-model="row.quantity" /></template>
</vxe-column>
<vxe-column field="unitPrice" title="原进价">
<template #default="{ row }">{{ row.unitPrice || 0 }}</template>
<vxe-column field="purchasePrice" title="原进价">
<template #default="{ row }">{{ displayPrice(row.purchasePrice) || 0 }}</template>
</vxe-column>
<vxe-column field="realPrice" title="实际进价" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
<template #default="{ row }">{{ row.realPrice }}</template>
<template #edit="{ row }"><el-input v-model="row.realPrice" /></template>
</vxe-column>
<vxe-column field="quantity" title="数量" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
<template #edit="{ row }"><el-input v-model="row.quantity" /></template>
</vxe-column>
<vxe-column field="totalAmount" title="累计总金额">
<template #default="{ row }">{{ (Number(row.quantity || 0) * Number(row.realPrice || 0)).toFixed(2) }}</template>
</vxe-column>
@@ -157,7 +157,7 @@ const openDialog = async (id: string) => {
Object.assign(baseForm, res.data, { items: "" })
state.itemTableForm = res.data.items.map((item: any) => ({
...item,
unitPrice: displayPrice(item.unitPrice, ""),
purchasePrice: item.unitPrice,
realPrice: displayPrice(item.realPrice, ""),
totalAmount: displayPrice(item.totalAmount, ""),
}))
@@ -244,7 +244,7 @@ const tableFormItems = () =>
id: item.isNew ? undefined : item.id,
erpMaterialId: item.erpMaterialId,
quantity: item.quantity,
unitPrice: storePrice(item.unitPrice),
unitPrice: item.purchasePrice,
realPrice: item.realPrice ? storePrice(item.realPrice) : 0,
totalAmount: storePrice((Number(item.quantity || 0) * Number(item.realPrice || 0)).toFixed(2)),
stock: item.stock,
@@ -26,6 +26,9 @@
<el-table-column prop="name" label="食材名称" min-width="150px" align="center" show-overflow-tooltip />
<el-table-column prop="unit" label="单位" min-width="100px" align="center" show-overflow-tooltip />
<el-table-column prop="stock" label="库存" min-width="80px" align="center" show-overflow-tooltip />
<el-table-column prop="purchasePrice" label="原进价" min-width="80px" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ displayPrice(row.purchasePrice) }}</template>
</el-table-column>
</el-table>
<pagination
@size-change="sizeChangeHandle"
@@ -45,6 +48,7 @@
<script setup lang="ts">
import { ref } from "vue"
import { fetchErpMaterialPageList } from "/@/api/canteen/canteenErpMaterial"
import { displayPrice } from "/@/utils/formatMoney"
const emit = defineEmits(["getSelectedRows"])
const props = withDefaults(