|
@@ -0,0 +1,169 @@
|
|
1
|
+<template>
|
|
2
|
+ <div id='invoice-print'>
|
|
3
|
+ <div style="display:flex;">
|
|
4
|
+ <!-- <div style="position: absolute;top:30px;left:70px;">{{ list.order_number }}</div> -->
|
|
5
|
+ <!-- <div>{{ list.id_card_no }}</div> -->
|
|
6
|
+ </div>
|
|
7
|
+ <div style="display:flex;justify-content: space-between;">
|
|
8
|
+ <div style="position: absolute;top:100px;left:250px;">{{ list.department_name }}</div>
|
|
9
|
+ <div></div>
|
|
10
|
+ <div>
|
|
11
|
+ <span style="position: absolute;top:80px;left:80px;">{{ paramsObj.setl_time.split(' ')[0].slice(0,10) }}</span>
|
|
12
|
+ </div>
|
|
13
|
+ </div>
|
|
14
|
+ <div style="display:flex;justify-content: space-between;">
|
|
15
|
+ <div style="position: absolute;top:100px;left:80px;"> {{ paramsObj.name }}</div>
|
|
16
|
+
|
|
17
|
+ </div>
|
|
18
|
+
|
|
19
|
+ <!-- <div style="display:flex;justify-content: space-between;"> -->
|
|
20
|
+ <div style="position: absolute;top:120px;left:80px">西药 {{ list.westernMedicineCostTotal }}</div>
|
|
21
|
+ <!-- <div style="position: absolute;top:140px;left:80px"></div> -->
|
|
22
|
+ <div style="position: absolute;top:120px;left:220px">检查费 {{ list.checkCostTotal }}</div>
|
|
23
|
+ <!-- <div style="position: absolute;top:180px;left:80px"></div> -->
|
|
24
|
+ <div style="position: absolute;top:140px;left:80px">治疗费 {{ list.treatCostTotal }}</div>
|
|
25
|
+ <!-- <div style="position: absolute;top:140px;left:80px"></div> -->
|
|
26
|
+ <div style="position: absolute;top:140px;left:220px">化验费 {{ list.laboratoryCostTotal }}</div>
|
|
27
|
+ <!-- <div style="position: absolute;top:140px;left:80px"></div> -->
|
|
28
|
+ <!-- </div> -->
|
|
29
|
+ <!-- <div style="display:flex;justify-content: space-between;"> -->
|
|
30
|
+ <div style="position: absolute;top:160px;left:80px">中成药 {{ list.chineseTraditionalMedicineCostTotal }}</div>
|
|
31
|
+ <!-- <div style="position: absolute;top:170px;left:80px"></div> -->
|
|
32
|
+ <div style="position: absolute;top:160px;left:220px">材料费 {{ list.materialCostTotal }}</div>
|
|
33
|
+
|
|
34
|
+ <div style="position: absolute;top:200px;left:80px">医疗费总金额: </div>
|
|
35
|
+ <div style="position: absolute;top:200px;left:250px">个人现金支付: </div>
|
|
36
|
+ <div style="position: absolute;top:220px;left:80px">全自费金额: </div>
|
|
37
|
+ <div style="position: absolute;top:220px;left:250px">基金支付总额: </div>
|
|
38
|
+ <div style="position: absolute;top:240px;left:80px">个人账户支付: </div>
|
|
39
|
+ <!-- <div style="position: absolute;top:300px;left:80px">医疗费总金额 {{ list.order.medfee_sumamt }}</div>
|
|
40
|
+ <div style="position: absolute;top:300px;left:300px">个人自费 {{ list.psn_cash_money }}</div> -->
|
|
41
|
+ <div>
|
|
42
|
+ <!-- <div style="position: absolute;top:320px;left:120px">{{ org_name }}</div> -->
|
|
43
|
+ <div style="position: absolute;top:340px;left:120px">{{ paramsObj.chargeName }}</div>
|
|
44
|
+ </div>
|
|
45
|
+ </div>
|
|
46
|
+</template>
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+<script>
|
|
50
|
+import { getInvoice } from '@/api/project/project'
|
|
51
|
+import { uParseTime } from '@/utils/tools'
|
|
52
|
+export default {
|
|
53
|
+ props:{
|
|
54
|
+ paramsObj:Object
|
|
55
|
+ },
|
|
56
|
+ data(){
|
|
57
|
+ return{
|
|
58
|
+ list:{},
|
|
59
|
+ printDate:'',
|
|
60
|
+ zhongwen:'',
|
|
61
|
+ totalPrice:0.0,
|
|
62
|
+ org_id:'',
|
|
63
|
+ org_name:''
|
|
64
|
+ }
|
|
65
|
+ },
|
|
66
|
+ created(){
|
|
67
|
+ console.log('paramsObj',this.paramsObj)
|
|
68
|
+ let params = {
|
|
69
|
+ order_id: this.paramsObj.order_id,
|
|
70
|
+ patient_id: this.paramsObj.patient_id,
|
|
71
|
+ }
|
|
72
|
+ this.getInvoice(params)
|
|
73
|
+ // var data = new Date();
|
|
74
|
+ // var month =data.getMonth() < 9 ? "0" + (data.getMonth() + 1) : data.getMonth() + 1;
|
|
75
|
+ // var date = data.getDate() <= 9 ? "0" + data.getDate() : data.getDate();
|
|
76
|
+ // this.printDate = data.getFullYear() + "-" + month + "-" + date;
|
|
77
|
+ // this.smalltoBIG(982732.21)
|
|
78
|
+ this.org_id = this.$store.getters.xt_user.org_id
|
|
79
|
+ this.org_name = this.$store.getters.xt_user.org.org_name
|
|
80
|
+ },
|
|
81
|
+ methods:{
|
|
82
|
+ getInvoice(params){
|
|
83
|
+ getInvoice(params).then((res) => {
|
|
84
|
+ console.log('res',res)
|
|
85
|
+ this.list = res.data.data
|
|
86
|
+ this.totalPrice = this.list.westernMedicineCostTotal + this.list.checkCostTotal + this.list.treatCostTotal + this.list.bedCostTotal + this.list.chineseTraditionalMedicineCostTotal +
|
|
87
|
+ this.list.laboratoryCostTotal + this.list.operationCostTotal + this.list.otherCostTotal + this.list.materialCostTotal
|
|
88
|
+ this.smalltoBIG(this.list.psn_cash_money)
|
|
89
|
+ var data = new Date(res.data.data.date * 1000);
|
|
90
|
+ var month =data.getMonth() < 9 ? "0" + (data.getMonth() + 1) : data.getMonth() + 1;
|
|
91
|
+ var date = data.getDate() <= 9 ? "0" + data.getDate() : data.getDate();
|
|
92
|
+ this.printDate = data.getFullYear() + "-" + month + "-" + date;
|
|
93
|
+ })
|
|
94
|
+ },
|
|
95
|
+ smalltoBIG(n) {
|
|
96
|
+ // let fraction = ['角', '分'];
|
|
97
|
+ // let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
|
|
98
|
+ // let unit = [['元.', '万,', '亿,'], ["元",'拾', '佰', '仟']];
|
|
99
|
+ // let head = price < 0 ? '欠' : '';
|
|
100
|
+ // price = Math.abs(price);
|
|
101
|
+ // let upper = '';
|
|
102
|
+ // for (let i = 0; i < fraction.length; i++) {
|
|
103
|
+ // upper += (digit[Math.floor(price * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
|
|
104
|
+ // }
|
|
105
|
+ // upper = upper || '整';
|
|
106
|
+ // price = Math.floor(price);
|
|
107
|
+ // for (let i = 0; i < unit[0].length && price > 0; i++) {
|
|
108
|
+ // let p = '';
|
|
109
|
+ // for (let j = 0; j < unit[1].length && price > 0; j++) {
|
|
110
|
+ // p = digit[price % 10] + unit[1][j] + p;
|
|
111
|
+ // price = Math.floor(price / 10);
|
|
112
|
+ // }
|
|
113
|
+ // upper = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + upper;
|
|
114
|
+ // }
|
|
115
|
+ // this.zhongwen = head + upper.replace(/(零.)*零圆/, '圆').replace(/(零.)+/g, '零').replace(/^整$/, '零圆整')
|
|
116
|
+ // console.log('6666',head + upper.replace(/(零.)*零圆/, '圆').replace(/(零.)+/g, '零').replace(/^整$/, '零圆整'))
|
|
117
|
+ if (!/^(0|[1-9]\d*)(\.\d+)?$/.test(n)){
|
|
118
|
+ return "数据非法"; //判断数据是否大于0
|
|
119
|
+ }
|
|
120
|
+
|
|
121
|
+ var unit = "仟佰拾亿仟佰拾万仟佰拾元角分", str = "";
|
|
122
|
+ n += "00";
|
|
123
|
+
|
|
124
|
+ var indexpoint = n.indexOf('.'); // 如果是小数,截取小数点前面的位数
|
|
125
|
+
|
|
126
|
+ if (indexpoint >= 0){
|
|
127
|
+
|
|
128
|
+ n = n.substring(0, indexpoint) + n.substr(indexpoint+1, 2); // 若为小数,截取需要使用的unit单位
|
|
129
|
+ }
|
|
130
|
+
|
|
131
|
+ unit = unit.substr(unit.length - n.length); // 若为整数,截取需要使用的unit单位
|
|
132
|
+ for (var i=0; i < n.length; i++){
|
|
133
|
+ str += "零壹贰叁肆伍陆柒捌玖".charAt(n.charAt(i)) + unit.charAt(i); //遍历转化为大写的数字
|
|
134
|
+ }
|
|
135
|
+ console.log("str",str)
|
|
136
|
+ if(str == '零元零角零分'){
|
|
137
|
+ this.zhongwen = '零'
|
|
138
|
+ }else{
|
|
139
|
+ this.zhongwen = str.replace(/零(仟|佰|拾|角)/g, "零").replace(/(零)+/g, "零").replace(/零(万|亿|元)/g, "$1").replace(/(亿)万|壹(拾)/g, "$1$2").replace(/^元零?|零分/g, "").replace(/元$/g, "元整");
|
|
140
|
+ }
|
|
141
|
+
|
|
142
|
+ console.log(this.zhongwen)
|
|
143
|
+ },
|
|
144
|
+ getTime(value, temp) {
|
|
145
|
+ if (value == 0) {
|
|
146
|
+ return ''
|
|
147
|
+ }
|
|
148
|
+ if (value != undefined) {
|
|
149
|
+ return uParseTime(value, temp)
|
|
150
|
+ }
|
|
151
|
+ return ''
|
|
152
|
+ },
|
|
153
|
+
|
|
154
|
+ },
|
|
155
|
+ watch:{
|
|
156
|
+ paramsObj:{//深度监听,可监听到对象、数组的变化
|
|
157
|
+ handler(val, oldVal){
|
|
158
|
+ let params = {
|
|
159
|
+ order_id: val.order_id,
|
|
160
|
+ patient_id: val.patient_id,
|
|
161
|
+ }
|
|
162
|
+ this.getInvoice(params)
|
|
163
|
+
|
|
164
|
+ },
|
|
165
|
+ deep:true
|
|
166
|
+ }
|
|
167
|
+ }
|
|
168
|
+}
|
|
169
|
+</script>
|