pengjun 2 years ago
parent
commit
a4332b59b1
  1. 65
      src/components/patientRegister/PatientRegisterItem.vue
  2. 2
      src/views/customerOrg/customerOrgGroup.vue

65
src/components/patientRegister/PatientRegisterItem.vue

@ -103,22 +103,21 @@
<el-table-column label="标准价格" prop="standardPrice" min-width="70" align="center" /> <el-table-column label="标准价格" prop="standardPrice" min-width="70" align="center" />
<el-table-column label="折扣" prop="discount" min-width="60"> <el-table-column label="折扣" prop="discount" min-width="60">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input type="number" v-model="scope.row.discount" size="small" @input="changeDiscount(scope.$index)"
@blur="onSubmit('')" />
<el-input type="number" v-model="scope.row.discount" size="small" @input="changeDiscount(scope.$index)" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="数量" prop="amount" min-width="50"> <el-table-column label="数量" prop="amount" min-width="50">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input type="number" v-model="scope.row.amount" size="small" @blur="onSubmit('')" />
<el-input type="number" v-model="scope.row.amount" size="small" @input="changeDiscount(scope.$index)" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="实收价格" prop="chargePrice" min-width="70"> <el-table-column label="实收价格" prop="chargePrice" min-width="70">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input type="number" v-model="scope.row.chargePrice" size="small" <el-input type="number" v-model="scope.row.chargePrice" size="small"
@input="changePrice(scope.$index)" @blur="onSubmit('')" />
@input="changePrice(scope.$index)" /> <!--立即触发保存 @blur="onSubmit('')" -->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="total" label="金额" min-width="70" v-if="false" />
<el-table-column prop="total" label="金额" min-width="70" align="center"/>
<el-table-column prop="standardPrice" label="标准金额" min-width="70" v-if="false" /> <el-table-column prop="standardPrice" label="标准金额" min-width="70" v-if="false" />
<el-table-column label="支付方式" prop="payTypeFlag" min-width="100"> <el-table-column label="支付方式" prop="payTypeFlag" min-width="100">
<template slot-scope="scope"> <template slot-scope="scope">
@ -852,9 +851,8 @@ export default {
this.patientRegister.patientRegisterAbs.forEach(e => { this.patientRegister.patientRegisterAbs.forEach(e => {
e.discount = this.discount 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('') this.onSubmit('')
@ -866,36 +864,47 @@ export default {
if (!this.total) return if (!this.total) return
if (!this.patientRegister.patientRegisterAbs || this.patientRegister.patientRegisterAbs.length == 0) return if (!this.patientRegister.patientRegisterAbs || this.patientRegister.patientRegisterAbs.length == 0) return
let sumChargeDetails = 0 //
let sumChargeDetails = Number(0) //
let qtyIsOneLast = 0 //1 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) => { this.patientRegister.patientRegisterAbs.forEach((e, index) => {
if (e.amount == 1) qtyIsOneLast = index if (e.amount == 1) qtyIsOneLast = index
e.discount = this.discount 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) console.log('this.total - sumChargeDetails', sumChargeDetails, this.total - sumChargeDetails)
//
if (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('') //this.onSubmit('')
}, },
// //
changeDiscount(index) { changeDiscount(index) {
//console.log('index',index) //console.log('index',index)
if (!this.patientRegister.patientRegisterAbs || this.patientRegister.patientRegisterAbs.length == 0) return if (!this.patientRegister.patientRegisterAbs || this.patientRegister.patientRegisterAbs.length == 0) return
if (!this.patientRegister.patientRegisterAbs[index].discount) return if (!this.patientRegister.patientRegisterAbs[index].discount) return
//console.log(this.patientRegister.patientRegisterAbs[index].chargePrice,this.patientRegister.patientRegisterAbs[index].standardPrice) //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('') this.onSubmit('')
}, },
@ -905,14 +914,14 @@ export default {
if (!this.patientRegister.patientRegisterAbs || this.patientRegister.patientRegisterAbs.length == 0) return if (!this.patientRegister.patientRegisterAbs || this.patientRegister.patientRegisterAbs.length == 0) return
if (!this.patientRegister.patientRegisterAbs[index].chargePrice) return if (!this.patientRegister.patientRegisterAbs[index].chargePrice) return
//console.log(this.patientRegister.patientRegisterAbs[index].chargePrice,this.patientRegister.patientRegisterAbs[index].standardPrice) //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('') this.onSubmit('')
}, },
// //
getSummaries(param) { getSummaries(param) {
const { columns, data } = param; const { columns, data } = param;
const sumCol = [1, 4] //
const sumCol = [1, 5] //
const sums = []; const sums = [];
columns.forEach((column, index) => { columns.forEach((column, index) => {
//console.log('column, index,data',column, index,data) //console.log('column, index,data',column, index,data)
@ -930,9 +939,15 @@ export default {
sums[index] = 0 sums[index] = 0
data.forEach(e => { 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])); // const values = data.map(item => Number(item[column.property]));
// if (!values.every(value => isNaN(value))) { // 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) //console.log('this.totalFoucs/this.discountFoucs',this.totalFoucs,this.discountFoucs)
if (!this.totalFoucs) this.total = sums[5]; 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; return sums;
}, },
}, },

2
src/views/customerOrg/customerOrgGroup.vue

@ -307,7 +307,7 @@ export default {
// //
refreshMoney(formData){ refreshMoney(formData){
console.log('this is parent')
//console.log('this is parent')
let lfind = arrayExistObj(this.customerOrgGroups,'id',formData.id) let lfind = arrayExistObj(this.customerOrgGroups,'id',formData.id)
if(lfind > -1) this.customerOrgGroups[lfind].price = formData.price if(lfind > -1) this.customerOrgGroups[lfind].price = formData.price
}, },

Loading…
Cancel
Save