123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451 |
- <template>
- <div id="invoice-print" style="font-size: 12px">
- <div v-if="list.order_number">
- <div style="display: flex">
- <div style="position: absolute; top: 50px; left: 60px">
- {{ list.order_number }}
- </div>
- <!-- <div>{{ list.id_card_no }}</div> -->
- </div>
- <div style="display: flex; justify-content: space-between">
- <!-- <div>{{ list.department_name }}</div> -->
- <div style="position: absolute; top: 50px; left: 260px">
- {{ id_card_no ? id_card_no : list.order.certno }}
- </div>
- <div></div>
- </div>
- <div style="display: flex; justify-content: space-between">
- <!-- <div>{{ list.department_name }}</div> -->
- <div style="position: absolute; top: 70px; left: 90px">门诊</div>
- <div></div>
- <div style="position: absolute; top: 70px; left: 240px">
- {{ number ? number : list.order.mdtrt_id }}
- </div>
- <div style="position: absolute; left: 470px; top: 70px">
- <span>{{
- paramsObj.setl_time
- ? paramsObj.setl_time.split(" ")[0].slice(0, 4)
- : getTime(list.date, "{y}-{m}-{d}").slice(0, 4)
- }}</span>
- </div>
- <div style="position: absolute; left: 530px; top: 70px">
- <span>{{
- paramsObj.setl_time
- ? parseInt(paramsObj.setl_time.split(" ")[0].slice(5, 7))
- : getTime(list.date, "{y}-{m}-{d}").slice(5, 7)
- }}</span>
- </div>
- <div style="position: absolute; left: 560px; top: 70px">
- <span>{{
- paramsObj.setl_time
- ? parseInt(paramsObj.setl_time.split(" ")[0].slice(8, 11))
- : getTime(list.date, "{y}-{m}-{d}").slice(8, 11)
- }}</span>
- </div>
- </div>
- <div style="display: flex; justify-content: space-between">
- <div style="position: absolute; top: 85px; left: 100px">
- {{ paramsObj.name }}
- </div>
- <div style="position: absolute; top: 85px; left: 180px">√</div>
- <!-- <div>{{ list.pay_way }}</div> -->
- <div style="position: absolute; top: 85px; left: 380px">
- {{ in_hosptial_time }}
- </div>
- <div style="position: absolute; top: 85px; left: 530px">
- {{ out_hosptial_time }}
- </div>
- </div>
- <div style="display: flex; justify-content: space-between">
- <!-- <div>{{ paramsObj.gend == 1 ? '男' : '女' }}</div> -->
- <div v-if="gend == 1" style="position: absolute; top: 110px; left: 100px">√</div>
- <div v-if="gend == 2" style="position: absolute; top: 110px; left: 140px">√</div>
-
-
- <div style="position: absolute; top: 110px; left: 260px">
- {{ balance_accounts_type != 2 ? list.order.fund_pay_sumamt : "0.00" }}
- </div>
- <div style="position: absolute; top: 110px; left: 420px">
- {{
- balance_accounts_type != 2
- ? list.order.psn_cash_pay
- : list.order.medfee_sumamt
- }}
- </div>
- <div style="position: absolute; top: 110px; left: 540px">现金</div>
- </div>
- <div style="display: flex; justify-content: space-between">
- <div style="position: absolute; top: 145px; left: 50px">西药</div>
- <div style="position: absolute; top: 145px; left: 130px">
- {{
- list.westernMedicineCostTotal
- ? list.westernMedicineCostTotal.toFixed(2)
- : ""
- }}
- </div>
- <div style="position: absolute; top: 145px; left: 180px">检查费</div>
- <div style="position: absolute; top: 145px; left: 260px">
- {{ list.checkCostTotal ? list.checkCostTotal.toFixed(2) : "" }}
- </div>
- <div style="position: absolute; top: 145px; left: 340px">治疗费</div>
- <div style="position: absolute; top: 145px; left: 420px">
- {{ list.treatCostTotal ? list.treatCostTotal.toFixed(2) : "" }}
- </div>
- <div style="position: absolute; top: 145px; left: 480px">床位费</div>
- <div style="position: absolute; top: 145px; left: 540px">
- {{ list.bedCostTotal ? list.bedCostTotal.toFixed(2) : "" }}
- </div>
- </div>
- <div style="display: flex; justify-content: space-between">
- <div style="position: absolute; top: 170px; left: 50px">中成药</div>
- <div style="position: absolute; top: 170px; left: 130px">
- {{
- list.chineseTraditionalMedicineCostTotal
- ? list.chineseTraditionalMedicineCostTotal.toFixed(2)
- : ""
- }}
- </div>
- <div style="position: absolute; top: 170px; left: 180px">化验费</div>
- <div style="position: absolute; top: 170px; left: 260px">
- {{
- list.laboratoryCostTotal ? list.laboratoryCostTotal.toFixed(2) : ""
- }}
- </div>
- <div style="position: absolute; top: 170px; left: 340px">手术费</div>
- <div style="position: absolute; top: 170px; left: 420px">
- {{
- list.operationCostTotal ? list.operationCostTotal.toFixed(2) : ""
- }}
- </div>
- <div style="position: absolute; top: 170px; left: 480px">其他费</div>
- <div style="position: absolute; top: 170px; left: 540px">
- {{ list.otherCostTotal ? list.otherCostTotal.toFixed(2) : "" }}
- </div>
- </div>
- <div style="display: flex; justify-content: space-between">
- <div style="position: absolute; top: 190px; left: 50px"></div>
- <div style="position: absolute; top: 190px; left: 130px"></div>
- <div style="position: absolute; top: 190px; left: 180px"></div>
- <div style="position: absolute; top: 190px; left: 260px"></div>
- <div style="position: absolute; top: 190px; left: 340px">材料费</div>
- <div style="position: absolute; top: 190px; left: 420px">
- {{ list.materialCostTotal ? list.materialCostTotal.toFixed(2) : "" }}
- </div>
- <div style="position: absolute; top: 190px; left: 480px">诊察费</div>
- <div style="position: absolute; top: 190px; left: 540px">
- {{ list.zhenChaCostTotal ? list.zhenChaCostTotal.toFixed(2) : "" }}
- </div>
- </div>
- <div style="display: flex; justify-content: space-between">
- <div style="position: absolute; top: 210px; left: 50px"></div>
- <div style="position: absolute; top: 210px; left: 130px"></div>
- <div style="position: absolute; top: 210px; left: 180px"></div>
- <div
- style="position: absolute; top: 210px; left: 260px"
- v-if="balance_accounts_type != 2"
- >
- {{ list.psn_cash_money ? list.psn_cash_money.toFixed(2) : "" }}
- </div>
- <div style="position: absolute; top: 210px; left: 260px" v-else>
- {{ list.order.medfee_sumamt ? list.order.medfee_sumamt : "" }}
- </div>
-
- <div style="position: absolute; top: 210px; left: 340px"></div>
- <div style="position: absolute; top: 210px; left: 420px"></div>
- <div style="position: absolute; top: 210px; left: 480px"></div>
- <div style="position: absolute; top: 210px; left: 540px"></div>
- </div>
- <div>
- <span>
- <span style="position: absolute; top: 235px; left: 190px">
- <span
- v-if="
- zhongwen.indexOf('万') > -1 &&
- zhongwen.indexOf('拾') > -1 &&
- zhongwen.indexOf('拾') == 1
- "
- >
- {{ zhongwen.substring(0, 1) }}
- </span>
- <span v-else>零</span>
- </span>
- <span style="position: absolute; top: 235px; left: 220px">
- <span v-if="zhongwen.indexOf('万') > -1">
- {{
- zhongwen.substring(
- zhongwen.indexOf("万") - 1,
- zhongwen.indexOf("万")
- )
- }}
- </span>
- <span v-else>零</span>
- </span>
- <span style="position: absolute; top: 235px; left: 250px">
- <span v-if="zhongwen.indexOf('仟') > -1">
- {{zhongwen.substring(zhongwen.indexOf("仟") - 1,zhongwen.indexOf("仟"))}}
- </span>
- <span v-else>零</span>
- </span>
- <span style="position: absolute; top: 235px; left: 290px">
- <span v-if="zhongwen.indexOf('佰') > -1">
- {{
- zhongwen.substring(
- zhongwen.indexOf("佰") - 1,
- zhongwen.indexOf("佰")
- )
- }}
- </span>
- <span v-else>零</span>
- </span>
- <span style="position: absolute; top: 235px; left: 320px">
- <span v-if="zhongwen.indexOf('拾') > -1">
- {{
- zhongwen.substring(
- zhongwen.indexOf("拾") - 1,
- zhongwen.indexOf("拾")
- ) == "佰" ||
- !zhongwen.substring(
- zhongwen.indexOf("拾") - 1,
- zhongwen.indexOf("拾")
- ) ||
- zhongwen.substring(
- zhongwen.indexOf("拾") - 1,
- zhongwen.indexOf("拾")
- ) == "零"
- ? "壹"
- : zhongwen.substring(
- zhongwen.indexOf("拾") - 1,
- zhongwen.indexOf("拾")
- )
- }}
- </span>
- <span v-else>零</span>
- </span>
- <span style="position: absolute; top: 235px; left: 350px">
- <span
- v-if="
- zhongwen.indexOf('元') > -1 &&
- zhongwen
- .substring(this.zhongwen.indexOf('元') - 1)
- .substring(0, 1) != '拾' &&
- zhongwen
- .substring(this.zhongwen.indexOf('元') - 1)
- .substring(0, 1) != '佰' &&
- zhongwen
- .substring(this.zhongwen.indexOf('元') - 1)
- .substring(0, 1) != '仟'
- "
- >
- {{
- zhongwen.substring(
- zhongwen.indexOf("元") - 1,
- zhongwen.indexOf("元")
- )
- }}
- </span>
- <span v-else>零</span>
- </span>
- <span style="position: absolute; top: 235px; left: 380px">
- <span v-if="zhongwen.indexOf('角') > -1">
- {{
- zhongwen.substring(
- zhongwen.indexOf("角") - 1,
- zhongwen.indexOf("角")
- )
- }}
- </span>
- <span v-else>零</span>
- </span>
- <span style="position: absolute; top: 235px; left: 415px">
- <span v-if="zhongwen.indexOf('分') > -1">
- {{
- zhongwen.substring(
- zhongwen.indexOf("分") - 1,
- zhongwen.indexOf("分")
- )
- }}
- </span>
- <span v-else>零</span>
- </span>
- </span>
- <span style="position: absolute; top: 235px; left: 500px">{{
- totalPrice.toFixed(2)
- }}</span>
- </div>
- <!-- <div style="position: absolute;top:300px;left:460px">现金:{{ list.psn_cash_money }}</div> -->
- <div>
- <div style="position: absolute; top: 300px; left: 120px">
- {{ org_name }}
- </div>
- <div style="position: absolute; top: 300px; left: 460px">高慧裕</div>
- </div>
- </div>
- </div>
- </template>
-
-
- <script>
- import { getInvoice } from "@/api/project/project";
- import { uParseTime } from "@/utils/tools";
- export default {
- props: {
- paramsObj: Object,
- },
- data() {
- return {
- list: {},
- printDate: "",
- zhongwen: "",
- totalPrice: 0.0,
- org_id: "",
- org_name: "",
- in_hosptial_time: "",
- out_hosptial_time: "",
- id_card_no: "",
- number: "",
- balance_accounts_type: "",
- gend: "",
- loading: true,
- };
- },
- created() {
- console.log("paramsObj", this.paramsObj);
- let params = {
- order_id: this.paramsObj.order_id,
- patient_id: this.paramsObj.patient_id,
- };
- this.$nextTick(() => {
- this.getInvoice(params);
- })
-
- this.org_id = this.$store.getters.xt_user.org_id;
- this.org_name = this.$store.getters.xt_user.org.org_name;
- },
- methods: {
- getInvoice(params) {
- getInvoice(params).then((res) => {
- this.$nextTick(() => {
- this.list = res.data.data;
- this.totalPrice =
- this.list.westernMedicineCostTotal +
- this.list.checkCostTotal +
- this.list.treatCostTotal +
- this.list.bedCostTotal +
- this.list.chineseTraditionalMedicineCostTotal +
- this.list.laboratoryCostTotal +
- this.list.operationCostTotal +
- this.list.otherCostTotal +
- this.list.materialCostTotal +
- this.list.zhenChaCostTotal;
- this.smalltoBIG(this.list.order.medfee_sumamt);
- var data = new Date(res.data.data.date * 1000);
- var month =
- data.getMonth() < 9
- ? "0" + (data.getMonth() + 1)
- : data.getMonth() + 1;
- var date =
- data.getDate() <= 9 ? "0" + data.getDate() : data.getDate();
- this.printDate = data.getFullYear() + "-" + month + "-" + date;
- if (this.list.his.id > 0) {
- this.in_hosptial_time = this.getTime();
- this.out_hosptial_time = this.list.order.setl_time.split(" ")[0];
- } else {
- this.in_hosptial_time =
- this.list.his_hospital_record.in_hosptial_time.split(" ")[0];
- this.out_hosptial_time =
- this.list.his_hospital_record.out_hosptial_time.split(" ")[0];
- }
-
- this.id_card_no = this.list.his_hospital_record.id_card_no;
- this.number = this.list.his_hospital_record.number;
- this.balance_accounts_type =
- this.list.his_hospital_record.balance_accounts_type;
- this.gend = this.list.gender;
- this.loading = false;
- })
- });
-
- },
- smalltoBIG(n) {
- // let fraction = ['角', '分'];
- // let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
- // let unit = [['元.', '万,', '亿,'], ["元",'拾', '佰', '仟']];
- // let head = price < 0 ? '欠' : '';
- // price = Math.abs(price);
- // let upper = '';
- // for (let i = 0; i < fraction.length; i++) {
- // upper += (digit[Math.floor(price * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
- // }
- // upper = upper || '整';
- // price = Math.floor(price);
- // for (let i = 0; i < unit[0].length && price > 0; i++) {
- // let p = '';
- // for (let j = 0; j < unit[1].length && price > 0; j++) {
- // p = digit[price % 10] + unit[1][j] + p;
- // price = Math.floor(price / 10);
- // }
- // upper = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + upper;
- // }
- // this.zhongwen = head + upper.replace(/(零.)*零圆/, '圆').replace(/(零.)+/g, '零').replace(/^整$/, '零圆整')
- // console.log('6666',head + upper.replace(/(零.)*零圆/, '圆').replace(/(零.)+/g, '零').replace(/^整$/, '零圆整'))
- if (!/^(0|[1-9]\d*)(\.\d+)?$/.test(n)) {
- return "数据非法"; //判断数据是否大于0
- }
-
- var unit = "仟佰拾亿仟佰拾万仟佰拾元角分",
- str = "";
- n += "00";
-
- var indexpoint = n.indexOf("."); // 如果是小数,截取小数点前面的位数
-
- if (indexpoint >= 0) {
- n = n.substring(0, indexpoint) + n.substr(indexpoint + 1, 2); // 若为小数,截取需要使用的unit单位
- }
-
- unit = unit.substr(unit.length - n.length); // 若为整数,截取需要使用的unit单位
- for (var i = 0; i < n.length; i++) {
- str += "零壹贰叁肆伍陆柒捌玖".charAt(n.charAt(i)) + unit.charAt(i); //遍历转化为大写的数字
- }
-
- this.zhongwen = str
- .replace(/零(仟|佰|拾|角)/g, "零")
- .replace(/(零)+/g, "零")
- .replace(/零(万|亿|元)/g, "$1")
- .replace(/(亿)万|壹(拾)/g, "$1$2")
- .replace(/^元零?|零分/g, "")
- .replace(/元$/g, "元整");
- console.log(this.zhongwen, "中文");
- console.log(
- this.zhongwen.substring(
- this.zhongwen.indexOf("拾") - 1,
- this.zhongwen.indexOf("拾")
- ),
- "op"
- );
- },
- getTime(value, temp) {
- if (value == 0) {
- return "";
- }
- if (value != undefined) {
- return uParseTime(value, temp);
- }
- return "";
- },
- },
- watch: {
- paramsObj: {
- //深度监听,可监听到对象、数组的变化
- handler(val, oldVal) {
- let params = {
- order_id: val.order_id,
- patient_id: val.patient_id,
- };
- this.getInvoice(params);
- },
- deep: true,
- },
- },
- };
- </script>
|