From a4332b59b16c81ae685c38023fbf8d392bb45fd8 Mon Sep 17 00:00:00 2001
From: pengjun <158915633@qq.com>
Date: Wed, 8 Nov 2023 18:24:14 +0800
Subject: [PATCH] dj
---
.../patientRegister/PatientRegisterItem.vue | 65 ++++++++++++-------
src/views/customerOrg/customerOrgGroup.vue | 2 +-
2 files changed, 41 insertions(+), 26 deletions(-)
diff --git a/src/components/patientRegister/PatientRegisterItem.vue b/src/components/patientRegister/PatientRegisterItem.vue
index 1bac875..36f0d2a 100644
--- a/src/components/patientRegister/PatientRegisterItem.vue
+++ b/src/components/patientRegister/PatientRegisterItem.vue
@@ -103,22 +103,21 @@
-
+
-
+
+ @input="changePrice(scope.$index)" />
-
+
@@ -852,9 +851,8 @@ export default {
this.patientRegister.patientRegisterAbs.forEach(e => {
e.discount = this.discount
- e.chargePrice = (e.standardPrice * this.discount / 100).toFixed(2)
- e.total = (e.standardPrice * this.discount * e.amount / 100).toFixed(2)
- return e
+ e.chargePrice = Math.round(e.standardPrice * this.discount) / 100
+ e.total = Math.round(e.standardPrice * this.discount * e.amount) / 100
});
this.onSubmit('')
@@ -866,36 +864,47 @@ export default {
if (!this.total) return
if (!this.patientRegister.patientRegisterAbs || this.patientRegister.patientRegisterAbs.length == 0) return
- let sumChargeDetails = 0 //单个标准价折后价 合计总计
+ let sumChargeDetails = Number(0) //单个标准价折后价 合计总计
let qtyIsOneLast = 0 //数量为1的最后行项目,用于返写金额
-
- this.discount = (100 * this.total / this.totalStand).toFixed(2)
+ console.log('this.total / this.totalStand',this.total , this.totalStand)
+ this.discount = Math.round((100 * this.total / this.totalStand) * 100)/100
this.patientRegister.patientRegisterAbs.forEach((e, index) => {
if (e.amount == 1) qtyIsOneLast = index
e.discount = this.discount
- e.chargePrice = (e.standardPrice * this.discount / 100).toFixed(2)
- e.total = (e.standardPrice * this.discount * e.amount / 100).toFixed(2)
- sumChargeDetails += Number((e.standardPrice * this.discount * e.amount / 100).toFixed(2))
- return e
+ e.chargePrice = Math.round((e.standardPrice * this.discount / 100) * 100)/100
+ e.total = Math.round((e.standardPrice * this.discount * e.amount / 100) * 100)/100
+ sumChargeDetails += Math.round((e.standardPrice * this.discount * e.amount / 100) * 100)/100
});
+
console.log('this.total - sumChargeDetails', sumChargeDetails, this.total - sumChargeDetails)
+ //平衡金额(按总价折扣后,再根据折扣合计 会出现金额差)
if (this.total != sumChargeDetails) {
- this.patientRegister.patientRegisterAbs[qtyIsOneLast].chargePrice
- = (Number(this.patientRegister.patientRegisterAbs[qtyIsOneLast].chargePrice)
- + Number((this.total - sumChargeDetails) / this.patientRegister.patientRegisterAbs[qtyIsOneLast].amount)).toFixed(2)
+ console.log('qtyIsOneLast',qtyIsOneLast)
+ this.patientRegister.patientRegisterAbs[qtyIsOneLast].total =
+ Math.round((Number(this.patientRegister.patientRegisterAbs[qtyIsOneLast].total) + Number(this.total) - Number(sumChargeDetails))*100)/100
+ this.patientRegister.patientRegisterAbs[qtyIsOneLast].chargePrice =
+ Math.round(this.patientRegister.patientRegisterAbs[qtyIsOneLast].total * 100 / this.patientRegister.patientRegisterAbs[qtyIsOneLast].amount)/100
+ if(this.patientRegister.patientRegisterAbs[qtyIsOneLast].standardPrice != 0){
+ this.patientRegister.patientRegisterAbs[qtyIsOneLast].discount =
+ Math.round(this.patientRegister.patientRegisterAbs[qtyIsOneLast].chargePrice * 10000/this.patientRegister.patientRegisterAbs[qtyIsOneLast].standardPrice)/100
+ }
}
//this.onSubmit('')
},
+
+
+
//修改数量
changeDiscount(index) {
//console.log('index',index)
if (!this.patientRegister.patientRegisterAbs || this.patientRegister.patientRegisterAbs.length == 0) return
if (!this.patientRegister.patientRegisterAbs[index].discount) return
//console.log(this.patientRegister.patientRegisterAbs[index].chargePrice,this.patientRegister.patientRegisterAbs[index].standardPrice)
- this.patientRegister.patientRegisterAbs[index].chargePrice = Number(this.patientRegister.patientRegisterAbs[index].standardPrice * this.patientRegister.patientRegisterAbs[index].discount / 100).toFixed(2)
+ this.patientRegister.patientRegisterAbs[index].chargePrice = Math.round(this.patientRegister.patientRegisterAbs[index].standardPrice * this.patientRegister.patientRegisterAbs[index].discount)/100
+ this.patientRegister.patientRegisterAbs[index].total = this.patientRegister.patientRegisterAbs[index].chargePrice * this.patientRegister.patientRegisterAbs[index].amount
this.onSubmit('')
},
@@ -905,14 +914,14 @@ export default {
if (!this.patientRegister.patientRegisterAbs || this.patientRegister.patientRegisterAbs.length == 0) return
if (!this.patientRegister.patientRegisterAbs[index].chargePrice) return
//console.log(this.patientRegister.patientRegisterAbs[index].chargePrice,this.patientRegister.patientRegisterAbs[index].standardPrice)
- this.patientRegister.patientRegisterAbs[index].discount = Number(this.patientRegister.patientRegisterAbs[index].chargePrice * 100 / this.patientRegister.patientRegisterAbs[index].standardPrice).toFixed(2)
+ this.patientRegister.patientRegisterAbs[index].discount = Math.round(this.patientRegister.patientRegisterAbs[index].chargePrice * 10000 / this.patientRegister.patientRegisterAbs[index].standardPrice)/100
this.onSubmit('')
},
//自定义计算列
getSummaries(param) {
const { columns, data } = param;
- const sumCol = [1, 4] //需合计的列
+ const sumCol = [1, 5] //需合计的列
const sums = [];
columns.forEach((column, index) => {
//console.log('column, index,data',column, index,data)
@@ -930,9 +939,15 @@ export default {
sums[index] = 0
data.forEach(e => {
- if (!isNaN(e[column.property])) sums[index] += e[column.property] * e['amount']
+ if (!isNaN(e[column.property])){
+ if(index == 1){
+ sums[index] += e[column.property] * e['amount']
+ }else{
+ sums[index] += e[column.property]
+ }
+ }
})
- sums[index] = sums[index].toFixed(2) //+ ' 元';
+ sums[index] = Math.round(sums[index] * 100)/100 //+ ' 元';
// const values = data.map(item => Number(item[column.property]));
// if (!values.every(value => isNaN(value))) {
@@ -951,10 +966,10 @@ export default {
// }
});
- this.totalStand = sums[2];
+ this.totalStand = sums[1];
//console.log('this.totalFoucs/this.discountFoucs',this.totalFoucs,this.discountFoucs)
if (!this.totalFoucs) this.total = sums[5];
- if (!this.discountFoucs) this.discount = Number(this.total * 100 / this.totalStand).toFixed(2);
+ if (!this.discountFoucs) this.discount = Math.round(this.total * 10000 / this.totalStand)/100;
return sums;
},
},
diff --git a/src/views/customerOrg/customerOrgGroup.vue b/src/views/customerOrg/customerOrgGroup.vue
index bcde1b3..fe63335 100644
--- a/src/views/customerOrg/customerOrgGroup.vue
+++ b/src/views/customerOrg/customerOrgGroup.vue
@@ -307,7 +307,7 @@ export default {
//刷新分组价格(供子组件调用)
refreshMoney(formData){
- console.log('this is parent')
+ //console.log('this is parent')
let lfind = arrayExistObj(this.customerOrgGroups,'id',formData.id)
if(lfind > -1) this.customerOrgGroups[lfind].price = formData.price
},