Browse Source

charge

master
pengjun 2 years ago
parent
commit
4c9ebf96c4
  1. 21
      src/utlis/proFunc.js
  2. 238
      src/views/charge/charge.vue

21
src/utlis/proFunc.js

@ -21,6 +21,27 @@ exports.objCopy = (from, to) => {
}
};
//对象深拷贝
function deepCopy(obj) {
if (typeof obj != 'object' || obj == null) {
return obj;
}
let copy;
if (Array.isArray(obj)) {
copy = [];
for (let i = 0; i < obj.length; i++) {
copy[i] = deepCopy(obj[i]);
}
} else {
copy = {};
for (let key in obj) {
copy[key] = deepCopy(obj[key]);
}
}
return copy;
};
exports.deepCopy = deepCopy;
//类似PB中的dddw的功能 add by pengjun
exports.dddw = (arrayData, key, value, display) => {
//console.log(arrayData,key,value,display)

238
src/views/charge/charge.vue

@ -15,15 +15,20 @@
</el-date-picker>
</div>
<div style="margin-left:10px;">
<el-button type="primary" class="btnClass" @click="Query">查询</el-button>
<el-button type="primary" class="btnClass" @click="Query" size="small" style="width:95px;">查询</el-button>
</div>
</div>
<div style="display:flex;margin-top:10px;">
<el-radio-group v-model="query.chargeFlag" @input="Query" size="mini">
<el-radio-group v-model="query.chargeFlag" @input="Query" size="mini" style="margin-top:8px;">
<el-radio label="N">未收费</el-radio>
<el-radio label="Y">已收费</el-radio>
<el-radio label="B">已退费</el-radio>
</el-radio-group>
<div style="margin-left:20px;">
<span>发票号</span>
<el-input placeholder="发票/收据号" v-model="query.invoiceNo" size="small" style="width: 100px;" clearable
@change="Query('invoiceNo')" />
</div>
</div>
</div>
<!-- 列表 -->
@ -73,25 +78,27 @@
<div style="display: flex; flex-wrap: wrap;margin-top:40px; height:40px; width: 100%;">
<div class="query">
<span>条码号</span>
<el-input placeholder="条码号" v-model="query.patientRegisterNo" size="small" style="width: 140px" clearable
@change="Query" />
<el-input placeholder="条码号" v-model="query.patientRegisterNo" size="small" style="width: 140px;" clearable
@change="Query('patientRegisterNo')" />
</div>
<div class="query">
<span>档案号</span>
<el-input placeholder="档案号" v-model="query.patientNo" size="small" style="width: 100px" clearable
@change="Query" />
<el-input placeholder="档案号" v-model="query.patientNo" size="small" style="width: 100px;" clearable
@change="Query('patientNo')" />
</div>
<div class="query">
<span>姓名</span>
<el-input placeholder="姓名" v-model="query.patientName" size="small" style="width: 100px" disabled />
<el-input placeholder="姓名" v-model="query.patientName" size="small" style="width: 100px;" disabled
@change="Query" />
</div>
</div>
</div>
<!-- 收费信息 -->
<div class="prListDivClass">
<!-- charge -->
<div>
<el-form ref="form" :model="form" label-width="80px" :rules="rules" size="small">
<div style="height:103px;">
<el-form ref="form" :model="form" label-width="80px" :rules="rules" size="small"
:disabled="query.chargeFlag != 'N'">
<el-row>
<el-col :span="12">
<el-form-item label="发票号" prop="invoiceNo">
@ -116,7 +123,7 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-row v-if="query.chargeFlag == 'N'">
<el-col :span="12">
<el-form-item label="预收金额" prop="preTotal">
<el-input v-model="form.preTotal" @input="findBalance" />
@ -132,24 +139,25 @@
</div>
<!-- charge_pay -->
<div>
<div style="margin-top:5px;font-size:10px;">收费方式</div>
<div style="margin-top:5px;font-size:10px;">{{ query.chargeFlag == 'B' ? '退' : '' }}费方式</div>
<el-table :data="chargePays" border highlight-current-row size="small"
:height="window.pageHeight > 600 ? (window.pageHeight - 230 - 146) / 2 : 112">
<el-table-column prop="payModeId" label="收费方式" width="180">
<el-table-column prop="payModeId" :label="(query.chargeFlag == 'B' ? '退' : '') + '费方式'" width="180">
<template slot-scope="scope">
<div>{{ dddw(dict.payMode, "id", scope.row.payModeId, "displayName") }}</div>
</template>
</el-table-column>
<el-table-column prop="chargeMoney" label="金额">
<template slot-scope="scope">
<el-input type="number" v-model="scope.row.chargeMoney" size="small" @input="inputMoney" />
<el-input type="number" v-model="scope.row.chargeMoney" size="small" @input="inputMoney"
:disabled="query.chargeFlag == 'B'" />
</template>
</el-table-column>
<el-table-column prop="cardRegisterId" label="会员卡">
<template slot-scope="scope">
<el-select v-model="scope.row.cardRegisterId" placeholder="请选择" size="small" filterable clearable
:disabled="scope.row.payModeId == '05' ? false : true">
<el-option v-for="item in cardRegister" :key="item.id" :label="item.idNo" :value="item.id" />
:disabled="scope.row.payModeId == '05' && query.chargeFlag != 'B' ? false : true">
<el-option v-for="item in cardRegister" :key="item.id" :label="item.cardNo" :value="item.id" />
</el-select>
</template>
</el-table-column>
@ -157,32 +165,35 @@
</div>
<!-- asbitem -->
<div>
<div style="margin-top:5px; font-size:10px;">待收费项目</div>
<div style="margin-top:5px; font-size:10px;">{{ query.chargeFlag == 'N' ? '待收' : (query.chargeFlag == 'Y' ?
'已收' : '已退') }}费项目</div>
<el-table :data="asbItemsForFee" border highlight-current-row
:height="window.pageHeight > 600 ? (window.pageHeight - 230 - 146) / 2 : 112" size="small"
@selection-change="handleSelectionChange" ref="asbItemsForFeeTable">
<el-table-column type="selection" align="center" />
<el-table-column label="已选组合项目" width="120" prop="asbitemName" />
<el-table-column type="selection" align="center" v-if="query.chargeFlag == 'N'" />
<el-table-column label="组合项目" width="120" prop="asbitemName" />
<el-table-column label="标准价格" prop="standardPrice" width="80" align="center" />
<el-table-column label="折扣" prop="discount" width="60">
<el-table-column label="折扣" prop="discount" width="60" align="center">
<template slot-scope="scope">
<el-input type="number" v-model="scope.row.discount"
<el-input type="number" v-model="scope.row.discount" v-if="query.chargeFlag == 'N'"
:disabled="scope.row.isCharge == 'Y' ? true : false" size="small"
@input="changeDiscount(scope.row)" />
<div v-if="query.chargeFlag != 'N'">{{ scope.row.discount }}</div>
</template>
</el-table-column>
<el-table-column label="数量" prop="amount" width="50" align="center" />
<el-table-column label="实收价格" prop="chargePrice" width="80">
<el-table-column label="实收价格" prop="chargePrice" width="80" align="center">
<template slot-scope="scope">
<el-input type="number" v-model="scope.row.chargePrice"
<el-input type="number" v-model="scope.row.chargePrice" v-if="query.chargeFlag == 'N'"
:disabled="scope.row.isCharge == 'Y' ? true : false" size="small" @input="changePrice(scope.row)" />
<div v-if="query.chargeFlag != 'N'">{{ scope.row.chargePrice }}</div>
</template>
</el-table-column>
<el-table-column prop="total" label="金额" width="70" v-if="false" />
<el-table-column prop="standardPrice" label="标准金额" width="80" v-if="false" />
<el-table-column label="支付方式" prop="payTypeFlag" width="100" align="center" >
<el-table-column label="支付方式" prop="payTypeFlag" width="100" align="center">
<template slot-scope="scope">
<div>{{ dddw(dict.payType, "id", scope.row.payTypeFlag, "displayName") }}</div>
<div>{{ dddw(dict.payType, "id", scope.row.payTypeFlag, "displayName") }}</div>
</template>
</el-table-column>
<el-table-column prop="checkCompleteFlag" label="状态" align="center">
@ -222,7 +233,7 @@
import moment from 'moment';
import { mapState, mapActions } from "vuex";
import { getapi, postapi, putapi, deletapi } from "@/api/api";
import { tcdate, dddw, arrayExistObj } from "../../utlis/proFunc";
import { tcdate, dddw, arrayExistObj, deepCopy } from "../../utlis/proFunc";
import PatientRegisterQuery from "../../components/patientRegister/patientRegisterQuery.vue";
import PatientRegisterRefuseList from "../../components/patientRegister/PatientRegisterRefuseList.vue";
@ -234,7 +245,14 @@ export default {
},
data() {
return {
query: { chargeFlag: 'N' },//
query: {
chargeFlag: 'N',
dateRange: null,
patientRegisterNo: '',
patientNo: '',
invoiceNo: '',
patientName: '',
},//
patientList: [],//
form: {
id: null,
@ -288,9 +306,10 @@ export default {
],
},
chargePays: [], //
chargePaysInit: [], //()
asbItemsForFee: [], //
selectedData: [], //
cardRegister: [{ id: '00000000-0000-0000-0000-000000000000', idNo: '0001' }], //
cardRegister: [{ id: '00000000-0000-0000-0000-000000000000', cardNo: '0001' }], //
cardRegisterAll: [], //
};
},
@ -314,19 +333,48 @@ export default {
dddw, moment,
//
Query() {
Query(type) {
let url = '', body = {};
console.log('query', this.query);
console.log('query', type, this.query);
// {
// "skipCount": 2147483647,
// "sorting": "string",
// "patientName": "string",
// "patientNo": "string",
// "patientRegisterNo": "string",
// "invoiceNo": "string",
// "startDate": "string",
// "endDate": "string",
// "maxResultCount": 0
// }
if (type == 'patientRegisterNo') {
if (!this.query.patientRegisterNo) return;
body = { patientRegisterNo: this.query.patientRegisterNo };
} else if (type == 'patientNo') {
if (!this.query.patientNo) return;
body = { patientNo: this.query.patientNo };
} else if (type == 'invoiceNo' && this.query.chargeFlag != 'N') {
if (!this.query.invoiceNo) return;
body = { invoiceNo: this.query.invoiceNo };
} else {
if (this.query.dateRange) {
body.startDate = moment(this.query.dateRange[0]).format('yyyy-MM-DD');
body.endDate = moment(this.query.dateRange[1]).format('yyyy-MM-DD');
}
// if(this.query.patientName){
// body.patientName = this.query.patientName;
// }
}
switch (this.query.chargeFlag) {
case 'Y':
//
url = '/api/app/patientregister/getpatientregisterchargelist';
break;
case 'B':
//退
url = '/api/app/patientregister/getpatientregisterchargebacklist';
break;
default:
//
@ -337,6 +385,11 @@ export default {
postapi(url, body).then(res => {
if (res.code != - 1) {
this.patientList = res.data.items;
if (this.patientList.length > 0) {
this.query.patientRegisterNo = this.patientList[0].patientRegisterNo;
this.query.patientName = this.patientList[0].patientName;
this.query.patientNo = this.patientList[0].patientNo;
}
}
});
@ -344,6 +397,13 @@ export default {
//
rowClick(row) {
this.query.patientRegisterNo = row.patientRegisterNo;
this.query.patientName = row.patientName;
this.query.patientNo = row.patientNo;
this.chargePays = deepCopy(this.chargePaysInit);
//console.log(this.chargePays, this.chargePaysInit);
if (this.query.chargeFlag == 'B') {
this.form.chargeFlag = '1';
} else {
@ -359,55 +419,53 @@ export default {
this.form.invoiceNo = '';
this.form.invoiceOrgName = row.patientName;
}
this.getCardRegister(row.idNo);
this.getAsbItemsForFee(row.patientRegisterId, row.chargeId);
//
this.getCardRegister(row.idNo);
if (this.query.chargeFlag == 'Y') {
this.getChargePayByChargeId(row.chargeId);
this.getChargeAsbByChargeid(row.chargeId);
} else if (this.query.chargeFlag == 'B') {
this.getChargeBackPayByChargeBackId(row.chargeBackId);
this.getChargeAsbByChargeid(row.chargeId);
}
switch (this.query.chargeFlag) {
case 'N':
this.getAsbItemsForFee(row.patientRegisterId);
break;
case 'Y':
this.getChargePayByChargeId(row.chargeId);
this.getChargeAsbByChargeid(row.chargeId);
break;
default:
this.getChargeBackPayByChargeBackId(row.chargeBackId);
this.getChargeAsbByChargeid(row.chargeId);
break;
}
},
//
async getAsbItemsForFee(patientRegisterId, chargeId) {
async getAsbItemsForFee(patientRegisterId) {
//
this.asbItemsForFee = [];
if (this.query.chargeFlag == 'N') {
getapi(`/api/app/registerasbitem/getlistinpatientregisterid?PatientRegisterId=${patientRegisterId}`)
.then(res => {
if (res.code == 1) {
this.asbItemsForFee = res.data;
for (let i = this.asbItemsForFee.length - 1; i >= 0; i--) {
if (this.asbItemsForFee[i].isCharge == 'Y') {
this.asbItemsForFee.splice(i, 1);
continue;
}
this.asbItemsForFee[i].chargePriceOri = this.asbItemsForFee[i].chargePrice;
this.asbItemsForFee[i].discount = Math.round(10000 * this.asbItemsForFee[i].chargePrice / this.asbItemsForFee[i].standardPrice) / 100;
this.asbItemsForFee[i].standTotal = this.asbItemsForFee[i].amount * this.asbItemsForFee[i].standardPrice;
this.asbItemsForFee[i].total = this.asbItemsForFee[i].amount * this.asbItemsForFee[i].chargePrice;
}
//
this.toCharge(patientRegisterId);
}
});
} else {
//
getapi(`/api/app/registerasbitem/getlistinpatientregisterid?PatientRegisterId=${chargeId}`)
.then(res => {
if (res.code == 1) {
this.asbItemsForFee = res.data;
getapi(`/api/app/registerasbitem/getlistinpatientregisterid?PatientRegisterId=${patientRegisterId}`)
.then(res => {
if (res.code == 1) {
this.asbItemsForFee = res.data;
for (let i = this.asbItemsForFee.length - 1; i >= 0; i--) {
if (this.asbItemsForFee[i].isCharge == 'Y' || this.asbItemsForFee[i].payTypeFlag == '1') {
this.asbItemsForFee.splice(i, 1);
continue;
}
this.asbItemsForFee[i].chargePriceOri = this.asbItemsForFee[i].chargePrice;
this.asbItemsForFee[i].discount = Math.round(10000 * this.asbItemsForFee[i].chargePrice / this.asbItemsForFee[i].standardPrice) / 100;
this.asbItemsForFee[i].standTotal = this.asbItemsForFee[i].amount * this.asbItemsForFee[i].standardPrice;
this.asbItemsForFee[i].total = this.asbItemsForFee[i].amount * this.asbItemsForFee[i].chargePrice;
}
});
}
//
this.toCharge(patientRegisterId);
}
});
},
@ -430,7 +488,7 @@ export default {
getCardRegister(idNo) {
let body = { cardModeId: '0', idNo };
this.cardRegister = [];
getapi(`/api/app/cardregister/getcardregisterlist`, body).then(res => {
postapi(`/api/app/cardregister/getcardregisterlist`, body).then(res => {
if (res.code != - 1) {
this.cardRegister = res.data;
}
@ -457,6 +515,7 @@ export default {
creationTime: e.creationTime,
});
});
this.sumTotal(this.asbItemsForFee, this.form);
}
});
},
@ -470,7 +529,7 @@ export default {
lfind = arrayExistObj(this.chargePays, 'payModeId', e.payModeId);
if (lfind > - 1) {
this.chargePays[lfind].chargeMoney = e.chargeMoney;
this.chargePays[lfind].cardRegisterId = e.cardBillId;
this.chargePays[lfind].cardRegisterId = e.cardRegisterId;
}
});
}
@ -485,7 +544,7 @@ export default {
lfind = arrayExistObj(this.chargePays, 'payModeId', e.payModeId);
if (lfind > - 1) {
this.chargePays[lfind].chargeMoney = e.backMoeny;
this.chargePays[lfind].cardRegisterId = e.cardBillId;
this.chargePays[lfind].cardRegisterId = e.cardRegisterId;
}
});
}
@ -505,20 +564,25 @@ export default {
},
//
sumTotal() {
sumTotal(details, head) {
let total = 0, totalOri = 0;
this.selectedData.forEach(e => {
details.forEach(e => {
totalOri += Math.round(e.amount * e.chargePriceOri * 100) / 100; //
total += Math.round(e.amount * e.chargePrice * 100) / 100; //
//console.log(total, e.chargePrice, e.amount)
});
this.form.total = total;
this.form.preTotal = total;
total = Math.round(total * 100) / 100;
totalOri = Math.round(totalOri * 100) / 100;
head.total = total;
head.preTotal = total;
if (totalOri == 0) {
this.form.discount = 100;
head.discount = 100;
} else {
this.form.discount = Math.round(10000 * total / totalOri) / 100;
head.discount = Math.round(10000 * total / totalOri) / 100;
}
},
//
@ -602,7 +666,7 @@ export default {
//
handleSelectionChange(v) {
this.selectedData = v;
this.sumTotal();
this.sumTotal(this.selectedData, this.form);
},
//
@ -617,7 +681,7 @@ export default {
totalDetailsCur = Math.round(100 * row.amount * row.chargePrice) / 100;
this.form.total = total + totalDetailsCur - totalDetailsOri;
}
this.sumTotal();
this.sumTotal(this.selectedData, this.form);
},
@ -626,7 +690,7 @@ export default {
if (row.chargePriceOri != 0) {
row.discount = Math.round(10000 * row.chargePrice / row.standardPrice) / 100;
}
this.sumTotal();
this.sumTotal(this.selectedData, this.form);
},
//
@ -823,9 +887,8 @@ export default {
],
};
if (isPreview) {
getapi(`/api/app/printreport/getpatientregisterguidereport?PatientRegisterId=${chargeId}`)
postapi(`/api/app/printreport/getchargereport?ChargeId=${chargeId}`)
.then((res) => {
if (res.code != -1) {
toOutShell.ReportTable = res.data;
@ -837,7 +900,7 @@ export default {
this.$message.warning(err);
});
} else {
getapi(`/api/app/printreport/getpatientregisterguidereport?PatientRegisterId=${chargeId}`)
postapi(`/api/app/printreport/getchargereport?ChargeId=${chargeId}`)
.then((res) => {
if (res.code != -1) {
toOutShell.ReportTable = res.data;
@ -952,10 +1015,11 @@ export default {
if (res.code == 1) {
this.dict.payMode = res.data;
//
this.chargePays = [];
this.chargePaysInit = [];
this.dict.payMode.forEach(e => {
this.chargePays.push({ chargeId: null, payModeId: e.id, chargeMoney: 0, cardBillId: null })
})
this.chargePaysInit.push({ chargeId: null, payModeId: e.id, chargeMoney: 0, cardBillId: null })
});
this.chargePays = deepCopy(this.chargePaysInit);
}
});

Loading…
Cancel
Save