|
|
|
@ -11,53 +11,80 @@ |
|
|
|
<div class="mainareaBox"> |
|
|
|
<el-table :header-cell-style="{ background: '#eef1f6' }" :data="dict.asbItem" height="200" |
|
|
|
@selection-change="handleSelectionChange" size="small"> |
|
|
|
<el-table-column type="selection"></el-table-column> |
|
|
|
<el-table-column label="未选组合项目" prop="displayName"></el-table-column> |
|
|
|
<el-table-column type="selection" /> |
|
|
|
<el-table-column prop="displayName" label="未选组合项目" width="120"/> |
|
|
|
<el-table-column prop="price" label="标准价格" width="70"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<div style="text-align: center;">{{ scope.row.price }}</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="forSexId" label="适用性别" width="70"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<div style="text-align: center;">{{ ldddw(dict.forSex, "id", scope.row.forSexId, "displayName") }}</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="mainbutton"> |
|
|
|
<div style="margin-left: 10px"> |
|
|
|
<el-button type="primary" @click="addAbs">添加 <i class="el-icon-bottom"></i> |
|
|
|
<div class="btnList"> |
|
|
|
<el-button type="primary" @click="addAbs(asbItemChoosed)">添加 <i class="el-icon-bottom"></i> |
|
|
|
</el-button> |
|
|
|
</div> |
|
|
|
<div style="margin-left: 10px"> |
|
|
|
<div class="btnList"> |
|
|
|
<el-button type="primary" @click="delAbs">移除 <i class="el-icon-top"></i> |
|
|
|
</el-button> |
|
|
|
</div> |
|
|
|
<div style="margin-left: 10px"> |
|
|
|
<div class="btnList"> |
|
|
|
<el-button type="success" @click="onSubmit('保存')">保存 <i class="el-icon-check"></i> |
|
|
|
</el-button> |
|
|
|
</div> |
|
|
|
<div class="btnList"> |
|
|
|
<span>折扣 </span> |
|
|
|
<el-input style="width:55px;" v-model="discount" size="small" @input="changeAllDiscount" type="number"/> |
|
|
|
</div> |
|
|
|
<div class="btnList"> |
|
|
|
<span>总金额 </span> |
|
|
|
<el-input style="width:70px;" v-model="total" size="small" @input="changeTotal" type="number"/> |
|
|
|
</div> |
|
|
|
<div class="btnList"> |
|
|
|
<el-select v-model="asbItemId" placeholder="快速选择组合项目" size="small" |
|
|
|
filterable clearable @change="quickChoosedAsb" style="width:150px;text-align: left;padding-right: 15px;"> |
|
|
|
<el-option v-for="item in dict.asbItemQuick" :key="item.id" :value="item.id" |
|
|
|
:label="item.displayName + ' , ' + item.price + ' , ' + ldddw(dict.forSex, 'id', item.forSexId, 'displayName') " /> |
|
|
|
</el-select> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="mainareaBox"> |
|
|
|
<el-table :data="patientRegister.patientRegisterAbs" height="200" :summary-method="getSummaries" show-summary |
|
|
|
@selection-change="selecteditems" size="small"> |
|
|
|
<!-- temporaryselection personnelUnit.nogroupselected--> |
|
|
|
<el-table-column type="selection"></el-table-column> |
|
|
|
<el-table-column label="已选组合项目" width="110" prop="asbitemName" /> |
|
|
|
<el-table-column label="标准价格" prop="standardPrice" /> |
|
|
|
<el-table-column label="折扣" prop="discount"> |
|
|
|
<el-table-column type="selection"/> |
|
|
|
<el-table-column label="已选组合项目" width="120" prop="asbitemName" /> |
|
|
|
<el-table-column label="标准价格" prop="standardPrice" width="70"/> |
|
|
|
<el-table-column label="折扣" prop="discount" width="60"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input v-model="scope.row.discount" size="small" /> |
|
|
|
<el-input type="number" v-model="scope.row.discount" size="small" @input="changeDiscount(scope.$index)"/> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="实收价格" prop="chargePrice"> |
|
|
|
<el-table-column label="数量" prop="amount" width="50"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input v-model="patientRegister.patientRegisterAbs[scope.$index].chargePrice" size="small" /> |
|
|
|
<el-input type="number" v-model="scope.row.amount" size="small" /> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="数量" prop="amount"> |
|
|
|
<el-table-column label="实收价格" prop="chargePrice" width="70"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input v-model="patientRegister.patientRegisterAbs[scope.$index].amount" size="small" /> |
|
|
|
<el-input type="number" v-model="patientRegister.patientRegisterAbs[scope.$index].chargePrice" size="small" @input="changePrice(scope.$index)"/> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="total" label="金额" width="70" v-if="false" /> |
|
|
|
<el-table-column prop="standardPrice" label="标准金额" width="70" v-if="false" /> |
|
|
|
<el-table-column label="支付方式" prop="payTypeFlag" width="100"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-select v-model="patientRegister.patientRegisterAbs[scope.$index].payTypeFlag" size="small"> |
|
|
|
<el-option v-for="item in dict.payType" :key="item.id" :label="item.displayName" :value="item.id" |
|
|
|
width="100" /> |
|
|
|
<el-select v-model="scope.row.payTypeFlag" size="small"> |
|
|
|
<el-option v-for="item in dict.payType" :key="item.id" |
|
|
|
:label="item.displayName" :value="item.id" /> |
|
|
|
</el-select> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
@ -68,7 +95,7 @@ |
|
|
|
<script> |
|
|
|
import { mapState, mapActions } from "vuex"; |
|
|
|
import { getapi, postapi, putapi, deletapi } from "@/api/api"; |
|
|
|
import { arrayFilter, arrayReduce, arrayExistObj } from "../../utlis/proFunc"; |
|
|
|
import { arrayFilter, arrayReduce, arrayExistObj,dddw } from "../../utlis/proFunc"; |
|
|
|
export default { |
|
|
|
props: ["patientRegisterForm"], |
|
|
|
data() { |
|
|
|
@ -94,6 +121,11 @@ export default { |
|
|
|
amount: 1, // integer($int32) 数量 |
|
|
|
groupPackageId: null, // string($uuid) 分组或者套餐ID |
|
|
|
}, //单个添加的组合项目 |
|
|
|
|
|
|
|
asbItemId:'', |
|
|
|
discount:100, |
|
|
|
total:0, |
|
|
|
totalStand:0, |
|
|
|
}; |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
@ -105,6 +137,9 @@ export default { |
|
|
|
methods: { |
|
|
|
...mapActions(['getCustomerOrgGroup', 'getMedicalPackageAsb', 'getPatientRegisterAbs']), |
|
|
|
|
|
|
|
ldddw(arrayData, key, value, display) { |
|
|
|
return dddw(arrayData, key, value, display); |
|
|
|
}, |
|
|
|
//保存按钮 |
|
|
|
// [ |
|
|
|
// { |
|
|
|
@ -203,6 +238,7 @@ export default { |
|
|
|
if (res.code == 1) { |
|
|
|
//未选项目中移除,已选项中添加 |
|
|
|
this.getPatientRegisterAbs(this.patientRegisterForm.id) |
|
|
|
|
|
|
|
if (msg) this.$message.success(`${msg}操作成功`); |
|
|
|
} |
|
|
|
}) |
|
|
|
@ -213,12 +249,12 @@ export default { |
|
|
|
|
|
|
|
// 添加组合项目 |
|
|
|
///api/app/register-asbitem/many/3fa85f64-5717-4562-b3fc-2c963f66afa6' |
|
|
|
addAbs() { |
|
|
|
addAbs(asbItemChoosed) { |
|
|
|
let body = [] |
|
|
|
let checked = true |
|
|
|
let payTypeFlag = '0' //默认个人支付 |
|
|
|
let lfind = -1 |
|
|
|
if (this.asbItemChoosed.length < 1) { |
|
|
|
if (asbItemChoosed.length < 1) { |
|
|
|
alert("请选择要添加的组合项目") |
|
|
|
return |
|
|
|
} |
|
|
|
@ -229,12 +265,12 @@ export default { |
|
|
|
// "forSexId": "F", |
|
|
|
// "itemTypeId": "3a0b16de-75b9-c910-c61b-844709a88940", |
|
|
|
// "price": 0, |
|
|
|
//console.log('this.asbItemChoosed.length',this.asbItemChoosed.length) |
|
|
|
for (let i = 0; i < this.asbItemChoosed.length; i++) { |
|
|
|
console.log('asbItemChoosed.length',asbItemChoosed.length) |
|
|
|
for (let i = 0; i < asbItemChoosed.length; i++) { |
|
|
|
if (this.patientRegisterForm.sexId == 'U') break //未选性别时,无需判断组合项目性别限制 |
|
|
|
if (this.asbItemChoosed[i].forSexId == 'A') continue |
|
|
|
if (this.asbItemChoosed[i].forSexId != this.patientRegisterForm.sexId) { |
|
|
|
alert(`所选项目:${this.asbItemChoosed[i].displayName},不适合当前人员性别`) |
|
|
|
if (asbItemChoosed[i].forSexId == 'A') continue |
|
|
|
if (asbItemChoosed[i].forSexId != this.patientRegisterForm.sexId) { |
|
|
|
alert(`所选项目:${asbItemChoosed[i].displayName},不适合当前人员性别`) |
|
|
|
checked = false |
|
|
|
break |
|
|
|
} |
|
|
|
@ -243,19 +279,20 @@ export default { |
|
|
|
if (!checked) return |
|
|
|
|
|
|
|
if (this.patientRegisterForm.customerOrgId != this.dict.personOrgId) payTypeFlag = '1' |
|
|
|
for (let i = 0; i < this.asbItemChoosed.length; i++) { |
|
|
|
for (let i = 0; i < asbItemChoosed.length; i++) { |
|
|
|
let pojo = { |
|
|
|
asbitemId: this.asbItemChoosed[i].id, |
|
|
|
asbitemId: asbItemChoosed[i].id, |
|
|
|
patientRegisterId: this.patientRegisterForm.id, |
|
|
|
standardPrice: this.asbItemChoosed[i].price, |
|
|
|
chargePrice: this.asbItemChoosed[i].price, |
|
|
|
standardPrice: asbItemChoosed[i].price, |
|
|
|
chargePrice: asbItemChoosed[i].price, |
|
|
|
payTypeFlag, |
|
|
|
isCharge: "N", |
|
|
|
amount: 1 |
|
|
|
amount: 1, |
|
|
|
total:asbItemChoosed[i].price, |
|
|
|
} |
|
|
|
body.push(pojo) |
|
|
|
this.patientRegister.patientRegisterAbs.push({ ...pojo, asbitemName: this.asbItemChoosed[i].displayName }) |
|
|
|
lfind = arrayExistObj(this.dict.asbItem, 'id', this.asbItemChoosed[i].id) |
|
|
|
this.patientRegister.patientRegisterAbs.push({ ...pojo, asbitemName: asbItemChoosed[i].displayName }) |
|
|
|
lfind = arrayExistObj(this.dict.asbItem, 'id', asbItemChoosed[i].id) |
|
|
|
if (lfind > -1) this.dict.asbItem.splice(lfind, 1) |
|
|
|
} |
|
|
|
|
|
|
|
@ -352,9 +389,9 @@ export default { |
|
|
|
this.dict.asbItem = arrayFilter(this.dict.asbItemAll, "itemTypeId", lv); |
|
|
|
} else { |
|
|
|
this.dict.asbItem = [...this.dict.asbItemAll]; |
|
|
|
} |
|
|
|
} |
|
|
|
console.log('lv,this.dict.asbItem', lv, this.dict.asbItem) |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//按项目类别显示组合项目,并过滤已选择的组合项目 |
|
|
|
@ -558,12 +595,93 @@ export default { |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//快速选择组合项目 |
|
|
|
quickChoosedAsb(v){ |
|
|
|
let lfind = -1 |
|
|
|
let asbItemChoosed = [] |
|
|
|
|
|
|
|
console.log('quickChoosedAsb',v,this.dict.asbItemQuick) |
|
|
|
if(v){ |
|
|
|
lfind = arrayExistObj(this.dict.asbItemQuick,'id',v) |
|
|
|
if(lfind > -1){ |
|
|
|
asbItemChoosed.push(this.dict.asbItemQuick[lfind]) |
|
|
|
this.addAbs(asbItemChoosed) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
//修改总折扣 |
|
|
|
changeAllDiscount(){ |
|
|
|
|
|
|
|
if(!this.discount || this.discount == 0) return |
|
|
|
if(!this.patientRegister.patientRegisterAbs || this.patientRegister.patientRegisterAbs.length == 0) return |
|
|
|
|
|
|
|
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 |
|
|
|
}); |
|
|
|
this.onSubmit('') |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//修改总金额 |
|
|
|
changeTotal(){ |
|
|
|
|
|
|
|
if(!this.total) return |
|
|
|
if(!this.patientRegister.patientRegisterAbs || this.patientRegister.patientRegisterAbs.length == 0) return |
|
|
|
|
|
|
|
let sumChargeDetails = 0 //单个标准价折后价 合计总计 |
|
|
|
let qtyIsOneLast = 0 //数量为1的最后行项目,用于返写金额 |
|
|
|
|
|
|
|
|
|
|
|
this.discount = (100 * this.total/this.totalStand ).toFixed(2) |
|
|
|
|
|
|
|
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 |
|
|
|
}); |
|
|
|
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) |
|
|
|
} |
|
|
|
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.onSubmit('') |
|
|
|
}, |
|
|
|
|
|
|
|
//修改单价 |
|
|
|
changePrice(index){ |
|
|
|
//console.log('index',index) |
|
|
|
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.onSubmit('') |
|
|
|
}, |
|
|
|
|
|
|
|
//自定义计算列 |
|
|
|
getSummaries(param) { |
|
|
|
const { columns, data } = param; |
|
|
|
const sumCol = [2,4] //需合计的列 |
|
|
|
const sumCol = [2,5] //需合计的列 |
|
|
|
const sums = []; |
|
|
|
columns.forEach((column, index) => { |
|
|
|
//console.log('column, index,data',column, index,data) |
|
|
|
//显示合计列 |
|
|
|
if (index === 1) { |
|
|
|
sums[index] = '合计'; |
|
|
|
@ -576,22 +694,32 @@ export default { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
const values = data.map(item => Number(item[column.property])); |
|
|
|
if (!values.every(value => isNaN(value))) { |
|
|
|
sums[index] = values.reduce((prev, curr) => { |
|
|
|
const value = Number(curr); |
|
|
|
if (!isNaN(value)) { |
|
|
|
return prev + curr; |
|
|
|
} else { |
|
|
|
return prev; |
|
|
|
} |
|
|
|
}, 0); |
|
|
|
sums[index] += ' 元'; |
|
|
|
} else { |
|
|
|
sums[index] = 'N/A'; |
|
|
|
} |
|
|
|
}); |
|
|
|
sums[index] = 0 |
|
|
|
data.forEach(e =>{ |
|
|
|
if(!isNaN(e[column.property])) sums[index] += e[column.property] * e['amount'] |
|
|
|
}) |
|
|
|
sums[index] = sums[index].toFixed(2) //+ ' 元'; |
|
|
|
|
|
|
|
// const values = data.map(item => Number(item[column.property])); |
|
|
|
// if (!values.every(value => isNaN(value))) { |
|
|
|
// sums[index] = values.reduce((prev, curr) => { |
|
|
|
// const value = Number(curr); |
|
|
|
// if (!isNaN(value)) { |
|
|
|
// //return prev + curr; //原始 |
|
|
|
// return prev + curr; //改造 |
|
|
|
// } else { |
|
|
|
// return prev; |
|
|
|
// } |
|
|
|
// }, 0); |
|
|
|
// sums[index] = sums[index].toFixed(2) + ' 元'; |
|
|
|
// } else { |
|
|
|
// sums[index] = 'N/A'; |
|
|
|
// } |
|
|
|
|
|
|
|
}); |
|
|
|
this.totalStand = sums[2] |
|
|
|
this.total = sums[5] |
|
|
|
this.discount = Number(this.total * 100 / this.totalStand).toFixed(2) |
|
|
|
return sums; |
|
|
|
}, |
|
|
|
|
|
|
|
@ -622,7 +750,7 @@ export default { |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|
<style scoped> |
|
|
|
<style lang="scss" scoped> |
|
|
|
.mainareaBox { |
|
|
|
border: 1px solid #000; |
|
|
|
height: 200px; |
|
|
|
@ -631,8 +759,40 @@ export default { |
|
|
|
|
|
|
|
.mainbutton { |
|
|
|
display: flex; |
|
|
|
margin-left: 20px; |
|
|
|
margin-left: 5px; |
|
|
|
padding: 5px 10px; |
|
|
|
margin-top: 10px; |
|
|
|
} |
|
|
|
.btnList{ |
|
|
|
margin-left: 5px; |
|
|
|
} |
|
|
|
|
|
|
|
::v-deep .el-input__inner { |
|
|
|
text-align: center; |
|
|
|
padding-left: 1px; |
|
|
|
padding-right: 1px; |
|
|
|
} |
|
|
|
::v-deep .el-table th.el-table__cell{ |
|
|
|
text-align: center; |
|
|
|
padding-left: 1px; |
|
|
|
padding-right: 1px; |
|
|
|
} |
|
|
|
|
|
|
|
::v-deep .el-table td.el-table__cell{ |
|
|
|
padding-left: 1px; |
|
|
|
padding-right: 1px; |
|
|
|
} |
|
|
|
::v-deep .el-table .cell{ |
|
|
|
padding-left: 1px; |
|
|
|
padding-right: 1px; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
::v-deep input[type="number"]::-webkit-inner-spin-button, |
|
|
|
input[type="number"]::-webkit-outer-spin-button { |
|
|
|
-webkit-appearance: none !important; |
|
|
|
margin: 0 !important; |
|
|
|
} |
|
|
|
|
|
|
|
</style> |
|
|
|
|