金额计算修改
This commit is contained in:
1 parent
978176eea5
commit
fa749334d7
6 files changed
+48
-34
No files matched your search
@@ -115,18 +115,18 @@
|
||||
<template #default="{ row }">
|
||||
{{
|
||||
row.purchasePrice
|
||||
? displayPrice(row.purchasePrice)
|
||||
: displayPrice(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice)
|
||||
? displayPrice(row.purchasePrice, "元", 2)
|
||||
: displayPrice(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice, "元", 2)
|
||||
}}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="totalAmount" title="累计总金额">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.unitId && row.quantity && row.unit && !row.erpUnitVos">
|
||||
{{ displayPrice(row.quantity * parseFloat(row.purchasePrice)) }}
|
||||
{{ displayPrice(row.quantity * parseFloat(row.purchasePrice), "元", 2) }}
|
||||
</span>
|
||||
<span v-if="row.unitId && row.quantity && row.erpUnitVos">
|
||||
{{ displayPrice(Number(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice) * row.quantity) }}
|
||||
{{ displayPrice(Number(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice) * row.quantity, "元", 2) }}
|
||||
</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
@@ -236,7 +236,7 @@ const dataRules = ref({
|
||||
// 可编辑表格校验规则
|
||||
const validRules = ref<VxeTablePropTypes.EditRules<any>>({
|
||||
unitId: [{ required: true, message: "必须选择" }],
|
||||
quantity: [{ required: true, type: "number", min: 1, max: 99, message: "数值范围1~99" }],
|
||||
quantity: [{ required: true, type: "number", min: 1, message: "必需大于等于0" }],
|
||||
})
|
||||
|
||||
// 初始化数据
|
||||
|
||||
@@ -120,18 +120,18 @@
|
||||
<template #default="{ row }">
|
||||
{{
|
||||
row.purchasePrice
|
||||
? displayPrice(row.purchasePrice)
|
||||
: displayPrice(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice)
|
||||
? displayPrice(row.purchasePrice, "元", 2)
|
||||
: displayPrice(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice, "元", 2)
|
||||
}}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="totalAmount" title="累计总金额">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.unitId && row.quantity && row.unit && !row.erpUnitVos">
|
||||
{{ displayPrice(row.quantity * parseFloat(row.purchasePrice)) }}
|
||||
{{ displayPrice(row.quantity * parseFloat(row.purchasePrice), "元", 2) }}
|
||||
</span>
|
||||
<span v-if="row.unitId && row.quantity && row.erpUnitVos">
|
||||
{{ displayPrice(Number(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice) * row.quantity) }}
|
||||
{{ displayPrice(Number(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice) * row.quantity, "元", 2) }}
|
||||
</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
@@ -243,7 +243,7 @@ const dataRules = ref({
|
||||
// 可编辑表格校验规则
|
||||
const validRules = ref<VxeTablePropTypes.EditRules<any>>({
|
||||
unitId: [{ required: true, message: "必须选择" }],
|
||||
quantity: [{ required: true, type: "number", min: 1, max: 99, message: "数值范围1~99" }],
|
||||
quantity: [{ required: true, type: "number", min: 1, message: "必需大于等于0" }],
|
||||
})
|
||||
|
||||
// 初始化数据
|
||||
|
||||
@@ -120,18 +120,18 @@
|
||||
<template #default="{ row }">
|
||||
{{
|
||||
row.purchasePrice
|
||||
? displayPrice(row.purchasePrice)
|
||||
: displayPrice(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice)
|
||||
? displayPrice(row.purchasePrice, "元", 2)
|
||||
: displayPrice(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice, "元", 2)
|
||||
}}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="totalAmount" title="累计总金额">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.unitId && row.quantity && row.unit && !row.erpUnitVos">
|
||||
{{ displayPrice(row.quantity * parseFloat(row.purchasePrice)) }}
|
||||
{{ displayPrice(row.quantity * parseFloat(row.purchasePrice), "元", 2) }}
|
||||
</span>
|
||||
<span v-if="row.unitId && row.quantity && row.erpUnitVos">
|
||||
{{ displayPrice(Number(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice) * row.quantity) }}
|
||||
{{ displayPrice(Number(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice) * row.quantity, "元", 2) }}
|
||||
</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
@@ -243,7 +243,7 @@ const dataRules = ref({
|
||||
// 可编辑表格校验规则
|
||||
const validRules = ref<VxeTablePropTypes.EditRules<any>>({
|
||||
unitId: [{ required: true, message: "必须选择" }],
|
||||
quantity: [{ required: true, type: "number", min: 1, max: 99, message: "数值范围1~99" }],
|
||||
quantity: [{ required: true, type: "number", min: 1, message: "必需大于等于0" }],
|
||||
})
|
||||
|
||||
// 初始化数据
|
||||
|
||||
@@ -206,7 +206,7 @@ const dataRules = ref({
|
||||
// 可编辑表格校验规则
|
||||
const validRules = ref<VxeTablePropTypes.EditRules<any>>({
|
||||
unitId: [{ required: true, message: "必须选择" }],
|
||||
quantity: [{ required: true, type: "number", min: 1, max: 99, message: "数值范围1~99" }],
|
||||
quantity: [{ required: true, type: "number", min: 0, message: "必需大于等于0" }],
|
||||
})
|
||||
|
||||
// 初始化数据
|
||||
|
||||
@@ -125,18 +125,20 @@
|
||||
<template #default="{ row }">
|
||||
{{
|
||||
row.purchasePrice
|
||||
? displayPrice(row.purchasePrice)
|
||||
: displayPrice(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice)
|
||||
? displayPrice(row.purchasePrice, "元", 2)
|
||||
: displayPrice(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice, "元", 2)
|
||||
}}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="totalAmount" title="累计总金额">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.unitId && row.quantity && row.unit && !row.erpUnitVos">
|
||||
{{ displayPrice(row.quantity * parseFloat(row.purchasePrice)) }}
|
||||
{{ displayPrice(row.quantity * parseFloat(row.purchasePrice), "元", 2) }}
|
||||
</span>
|
||||
<span v-if="row.unitId && row.quantity && row.erpUnitVos">
|
||||
{{ displayPrice(Number(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice) * row.quantity) }}
|
||||
{{
|
||||
displayPrice(Number(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice) * row.quantity, "元", 2)
|
||||
}}
|
||||
</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
@@ -147,18 +149,23 @@
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
</div>
|
||||
<div class="w-52">
|
||||
<el-card class="h-full flex items-center">
|
||||
<div class="w-64">
|
||||
<el-card class="h-full flex items-center overflow-auto">
|
||||
<el-form :model="receiveAmountForm" :rules="receiveAmountFormRules" label-width="100px">
|
||||
<el-form-item label="单据金额:" prop="totalAmount">
|
||||
<span class="w-full text-purple-600 border-b border-b-black text-xl h-8 text-center">{{ displayPrice(totalAmount) }}</span>
|
||||
<span class="w-full text-purple-600 border-b border-b-black text-xl h-8 text-center">{{
|
||||
displayPrice(totalAmount, "元", 2)
|
||||
}}</span>
|
||||
</el-form-item>
|
||||
<el-form-item class="receive-amount-input" label="收款金额:" prop="receiveAmount">
|
||||
<el-input v-model.trim="receiveAmountForm.receiveAmount" />
|
||||
</el-form-item>
|
||||
<el-form-item label="找零:" prop="backAmount">
|
||||
<span class="w-full text-green-600 border-b border-b-black text-xl h-8 text-center">
|
||||
{{ receiveAmountForm.receiveAmount && displayPrice(Number(totalAmount) - storePrice(receiveAmountForm.receiveAmount)) }}
|
||||
{{
|
||||
receiveAmountForm.receiveAmount &&
|
||||
displayPrice(Number(totalAmount) - storePrice(receiveAmountForm.receiveAmount), "元", 2)
|
||||
}}
|
||||
</span>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -272,7 +279,7 @@ const dataRules = ref({
|
||||
// 可编辑表格校验规则
|
||||
const validRules = ref<VxeTablePropTypes.EditRules<any>>({
|
||||
unitId: [{ required: true, message: "必须选择" }],
|
||||
quantity: [{ required: true, type: "number", min: 1, max: 99, message: "数值范围1~99" }],
|
||||
quantity: [{ required: true, type: "number", min: 1, message: "必需大于等于0" }],
|
||||
})
|
||||
|
||||
// 收款金额表单校验规则
|
||||
|
||||
@@ -125,18 +125,20 @@
|
||||
<template #default="{ row }">
|
||||
{{
|
||||
row.purchasePrice
|
||||
? displayPrice(row.purchasePrice)
|
||||
: displayPrice(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice)
|
||||
? displayPrice(row.purchasePrice, "元", 2)
|
||||
: displayPrice(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice, "元", 2)
|
||||
}}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="totalAmount" title="累计总金额">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.unitId && row.quantity && row.unit && !row.erpUnitVos">
|
||||
{{ displayPrice(row.quantity * parseFloat(row.purchasePrice)) }}
|
||||
{{ displayPrice(row.quantity * parseFloat(row.purchasePrice), "元", 2) }}
|
||||
</span>
|
||||
<span v-if="row.unitId && row.quantity && row.erpUnitVos">
|
||||
{{ displayPrice(Number(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice) * row.quantity) }}
|
||||
{{
|
||||
displayPrice(Number(row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice) * row.quantity, "元", 2)
|
||||
}}
|
||||
</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
@@ -147,18 +149,23 @@
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
</div>
|
||||
<div class="w-52">
|
||||
<el-card class="h-full flex items-center">
|
||||
<div class="w-64">
|
||||
<el-card class="h-full flex items-center overflow-auto">
|
||||
<el-form :model="receiveAmountForm" :rules="receiveAmountFormRules" label-width="100px">
|
||||
<el-form-item label="单据金额:" prop="totalAmount">
|
||||
<span class="w-full text-purple-600 border-b border-b-black text-xl h-8 text-center">{{ displayPrice(totalAmount) }}</span>
|
||||
<span class="w-full text-purple-600 border-b border-b-black text-xl h-8 text-center">{{
|
||||
displayPrice(totalAmount, "元", 2)
|
||||
}}</span>
|
||||
</el-form-item>
|
||||
<el-form-item class="receive-amount-input" label="收款金额:" prop="receiveAmount">
|
||||
<el-input v-model.trim="receiveAmountForm.receiveAmount" />
|
||||
</el-form-item>
|
||||
<el-form-item label="找零:" prop="backAmount">
|
||||
<span class="w-full text-green-600 border-b border-b-black text-xl h-8 text-center">
|
||||
{{ receiveAmountForm.receiveAmount && displayPrice(Number(totalAmount) - storePrice(receiveAmountForm.receiveAmount)) }}
|
||||
{{
|
||||
receiveAmountForm.receiveAmount &&
|
||||
displayPrice(Number(totalAmount) - storePrice(receiveAmountForm.receiveAmount), "元", 2)
|
||||
}}
|
||||
</span>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -272,7 +279,7 @@ const dataRules = ref({
|
||||
// 可编辑表格校验规则
|
||||
const validRules = ref<VxeTablePropTypes.EditRules<any>>({
|
||||
unitId: [{ required: true, message: "必须选择" }],
|
||||
quantity: [{ required: true, type: "number", min: 1, max: 99, message: "数值范围1~99" }],
|
||||
quantity: [{ required: true, type: "number", min: 1, message: "必需大于等于0" }],
|
||||
})
|
||||
|
||||
// 收款金额表单校验规则
|
||||
|
||||
Reference in new issue
Block a user