Browse Source

打印发票

huangyw 3 years ago
parent
commit
523cdeca54

+ 5 - 2
src/xt_pages/outpatientCharges/invoicePrint.vue View File

@@ -19,7 +19,8 @@
19 19
           </div>
20 20
           <printTwo v-if="org_id == 10106" :paramsObj="invoiceParams"></printTwo>
21 21
           <printFour v-if="org_id == 10215 || org_id == 4" :paramsObj="invoiceParams"></printFour>
22
-          <printFive v-if="org_id == 10188 || org_id == 0 ||org_id == 10217" :paramsObj="invoiceParams"></printFive>
22
+          <printFive v-if="org_id == 10188 " :paramsObj="invoiceParams"></printFive>
23
+          <printSix v-if="org_id == 10217|| org_id == 0" :paramsObj="invoiceParams"></printSix>
23 24
         </div>
24 25
     </div>
25 26
   </div>
@@ -31,6 +32,7 @@ import printTwo from './invoiceTemplate/printTwo'
31 32
 import printThree from './invoiceTemplate/printThree'
32 33
 import printFour from './invoiceTemplate/printFour'
33 34
 import printFive from './invoiceTemplate/printFive'
35
+import printSix from './invoiceTemplate/printSix'
34 36
 export default {
35 37
    name: "invoicePrint",
36 38
   components: {
@@ -38,7 +40,8 @@ export default {
38 40
     printTwo,
39 41
     printThree,
40 42
     printFour,
41
-    printFive
43
+    printFive,
44
+    printSix
42 45
   },
43 46
   props:{
44 47
     invoiceParams:Object

+ 231 - 0
src/xt_pages/outpatientCharges/invoiceTemplate/printSix.vue View File

@@ -0,0 +1,231 @@
1
+<template>
2
+    <div id='invoice-print'>
3
+        <div v-for='(i,index) in pageArr.length' :key="index">
4
+            <div :style="{position: 'absolute',top:(10 + (index * 400))  + 'px',left:130+ 'px',}">盐城大丰悦达金骆驼血液透析中心</div>
5
+            <div :style="{position: 'absolute',top:(40 + (index * 400))  + 'px',left:90+ 'px',}">{{ list.order_number }}</div>
6
+            <div style="display:flex;justify-content: space-between;">
7
+                <div :style="{position: 'absolute',top:(70 + (index * 400))  + 'px',left:80+ 'px',}">{{ paramsObj.name }}</div>
8
+            </div>
9
+            <div :style="{position: 'absolute',top:(130 + (index * 400))  + 'px',left:80+ 'px',}">
10
+                <div v-if="list.westernMedicineCostTotal">西药 {{ list.westernMedicineCostTotal }}</div>
11
+                <div v-if="list.treatCostTotal">治疗费 {{ list.treatCostTotal }}</div>
12
+                <div v-if="list.bedCostTotal">床位费 {{ list.bedCostTotal }}</div>
13
+                <div v-if="list.chineseTraditionalMedicineCostTotal">中成药 {{ list.chineseTraditionalMedicineCostTotal }}</div>
14
+                <div v-if="list.laboratoryCostTotal">化验费 {{ list.laboratoryCostTotal }}</div>
15
+                <div v-if="list.operationCostTotal">手术费 {{ list.operationCostTotal }}</div>
16
+                <div v-if="list.otherCostTotal">其他费 {{ list.otherCostTotal }}</div>
17
+                <div v-if="list.materialCostTotal">材料费 {{ list.materialCostTotal }}</div>
18
+            </div>
19
+            <div :style="{position: 'absolute',top:(130 + (index * 400))  + 'px',left:260+ 'px'}">
20
+                <div v-for="item in list.order_info.slice(index * 10,(index * 10) + pageArr[index])">
21
+                    <span style="display:inline-block;width:200px;">
22
+                        <span v-if="item.advice.id == 0">
23
+                            <span v-if="item.project.type == 2"> {{ item.project.project.project_name }}</span>
24
+                            <span v-if="item.project.type == 3">{{ item.project.good_info.good_name }}</span>
25
+                        </span>
26
+                        <span v-else>{{ item.advice.advice_name }}</span>
27
+                    </span>
28
+                    <span style="display:inline-block;width:50px;">
29
+                        <span v-if="item.advice.id == 0">
30
+                            <span v-if="item.project.type == 2">{{ item.project.count }}{{ item.project.unit }}</span>
31
+                            <span v-if="item.project.type == 3">{{ item.project.count }}{{ item.project.unit }}</span>
32
+                        </span>
33
+                        <span v-else>{{ item.advice.prescribing_number }}{{ item.advice.prescribing_number_unit }}</span>
34
+                    </span>
35
+                    <span>
36
+                        <span v-if="item.advice.id == 0">
37
+                            <span v-if="item.project.type == 2">{{ (item.project.count * item.pric).toFixed(2) }}</span>
38
+                            <span v-if="item.project.type == 3">{{ (item.project.count * item.pric).toFixed(2) }}</span>
39
+                        </span>
40
+                        <span v-else>{{ (item.advice.prescribing_number * item.pric).toFixed(2) }}</span>
41
+                    </span>
42
+                </div>
43
+            </div>
44
+            <div :style="{position: 'absolute',top:(345 + (index * 400))  + 'px',left:110+ 'px'}">{{ zhongwen }}</div>
45
+            <div :style="{position: 'absolute',top:(345 + (index * 400))  + 'px',left:460+ 'px'}">{{ list.medfee_sumamt }}</div>
46
+            <div v-if="index == pageArr.length - 1" :style="{position: 'absolute',top:(360 + (index * 400))  + 'px',left:110+ 'px',width:100 + '%',fontSize:12+'px'}">
47
+                <div style="display:flex;">
48
+                  <div style="width:140px">医疗总费用:{{ list.order.medfee_sumamt }}</div>
49
+                  <div style="width:140px">基金支付总额:{{ list.order.fund_pay_sumamt }}</div>
50
+                  <div style="width:140px">统筹支出:{{ list.order.hifp_pay }}</div>
51
+                  <div style="width:140px">大病支出:{{list.order.hifmi_pay}}</div>
52
+
53
+                </div>
54
+                <div style="display:flex;">
55
+                  <div style="width:140px">个人账户支付:{{ list.order.acct_pay }}</div>
56
+                  <div style="width:140px">现金支出:{{ list.order.psn_cash_pay }}</div>
57
+                  <div style="width:140px">本次账户:0</div>
58
+                  <div style="width:140px">上次账户:0</div>
59
+                </div>
60
+              <div style="display:flex;">
61
+                <div style="width:140px">账户余额:{{ list.order.balc }}</div>
62
+                <div style="width:140px">其他支出:{{ list.order.oth_pay }}</div>
63
+                <div style="width:140px">大病补充保险支出:0</div>
64
+                <div style="width:140px">民政支出:0</div>
65
+              </div>
66
+              <div style="display:flex;">
67
+                <div style="width:220px">医疗救助基金支出:{{ list.order.maf_pay }}</div>
68
+                <div style="width:280px">企业补充医疗保险基金支出:{{ list.order.hifes_pay }}</div>
69
+              </div>
70
+
71
+            </div>
72
+            <div>
73
+                <div :style="{position: 'absolute',top:(420 + (index * 400))  + 'px',left:100+ 'px'}">盐城大丰悦达金骆驼血液透析中心</div>
74
+                <div :style="{position: 'absolute',top:(420 + (index * 400))  + 'px',left:360+ 'px'}">{{ paramsObj.chargeName }}</div>
75
+                <div :style="{position: 'absolute',top:(420 + (index * 400))  + 'px',left:520+ 'px'}">
76
+                    <span>{{  paramsObj.setl_time ? paramsObj.setl_time.split(' ')[0].slice(0,4) : getTime(list.date, '{y}-{m}-{d}').slice(0,4) }}</span>
77
+                </div>
78
+                <div :style="{position: 'absolute',top:(420 + (index * 400))  + 'px',left:560+ 'px'}">
79
+                    <span>{{ paramsObj.setl_time ? parseInt(paramsObj.setl_time.split(' ')[0].slice(5,7)) : getTime(list.date, '{y}-{m}-{d}').slice(5,7) }}</span>
80
+                </div>
81
+                <div :style="{position: 'absolute',top:(420 + (index * 400))  + 'px',left:600+ 'px'}">
82
+                    <span>{{ paramsObj.setl_time ? parseInt(paramsObj.setl_time.split(' ')[0].slice(8,11)) : getTime(list.date, '{y}-{m}-{d}').slice(8,11) }}</span>
83
+                </div>
84
+            </div>
85
+        </div>
86
+    </div>
87
+</template>
88
+
89
+
90
+<script>
91
+import { getInvoice } from '@/api/project/project'
92
+import { uParseTime } from '@/utils/tools'
93
+export default {
94
+    props:{
95
+        paramsObj:Object
96
+    },
97
+    data(){
98
+        return{
99
+            list:{},
100
+            printDate:'',
101
+            zhongwen:'',
102
+            totalPrice:0.0,
103
+            org_id:'',
104
+            org_name:'',
105
+            page:1,
106
+            pageArr:[],
107
+        }
108
+    },
109
+    created(){
110
+        console.log('paramsObj',this.paramsObj)
111
+        let params = {
112
+            order_id: this.paramsObj.order_id,
113
+            patient_id: this.paramsObj.patient_id,
114
+        }
115
+        this.getInvoice(params)
116
+        // var data = new Date();
117
+        // var month =data.getMonth() < 9 ? "0" + (data.getMonth() + 1) : data.getMonth() + 1;
118
+        // var date = data.getDate() <= 9 ? "0" + data.getDate() : data.getDate();
119
+        // this.printDate = data.getFullYear() + "-" + month + "-" + date;
120
+        // this.smalltoBIG(982732.21)
121
+        this.org_id = this.$store.getters.xt_user.org_id
122
+        this.org_name = this.$store.getters.xt_user.org.org_name
123
+    },
124
+    methods:{
125
+        getInvoice(params){
126
+            getInvoice(params).then((res) => {
127
+                console.log('res',res)
128
+                this.list = res.data.data
129
+                console.log(this.list,'表单内容打印记得注释')
130
+                this.totalPrice = this.list.westernMedicineCostTotal + this.list.checkCostTotal + this.list.treatCostTotal + this.list.bedCostTotal + this.list.chineseTraditionalMedicineCostTotal +
131
+                                    this.list.laboratoryCostTotal + this.list.operationCostTotal + this.list.otherCostTotal + this.list.materialCostTotal
132
+                this.smalltoBIG(this.list.medfee_sumamt)
133
+                var data = new Date(res.data.data.date * 1000);
134
+                var month =data.getMonth() < 9 ? "0" + (data.getMonth() + 1) : data.getMonth() + 1;
135
+                var date = data.getDate() <= 9 ? "0" + data.getDate() : data.getDate();
136
+                this.printDate = data.getFullYear() + "-" + month + "-" + date;
137
+                this.pageArr = []
138
+                this.getPage()
139
+                console.log('pageArr',this.pageArr)
140
+            })
141
+        },
142
+        smalltoBIG(n) {
143
+            // let fraction = ['角', '分'];
144
+            // let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
145
+            // let unit = [['元.', '万,', '亿,'], ["元",'拾', '佰', '仟']];
146
+            // let head = price < 0 ? '欠' : '';
147
+            // price = Math.abs(price);
148
+            // let upper = '';
149
+            // for (let i = 0; i < fraction.length; i++) {
150
+            // upper += (digit[Math.floor(price * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
151
+            // }
152
+            // upper = upper || '整';
153
+            // price = Math.floor(price);
154
+            // for (let i = 0; i < unit[0].length && price > 0; i++) {
155
+            // let p = '';
156
+            // for (let j = 0; j < unit[1].length && price > 0; j++) {
157
+            //     p = digit[price % 10] + unit[1][j] + p;
158
+            //     price = Math.floor(price / 10);
159
+            // }
160
+            // upper = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + upper;
161
+            // }
162
+            // this.zhongwen = head + upper.replace(/(零.)*零圆/, '圆').replace(/(零.)+/g, '零').replace(/^整$/, '零圆整')
163
+            // console.log('6666',head + upper.replace(/(零.)*零圆/, '圆').replace(/(零.)+/g, '零').replace(/^整$/, '零圆整'))
164
+            if (!/^(0|[1-9]\d*)(\.\d+)?$/.test(n)){
165
+                return "数据非法";  //判断数据是否大于0
166
+            }
167
+
168
+            var unit = "仟佰拾亿仟佰拾万仟佰拾元角分", str = "";
169
+            n += "00";
170
+
171
+            var indexpoint = n.indexOf('.');  // 如果是小数,截取小数点前面的位数
172
+
173
+            if (indexpoint >= 0){
174
+
175
+                n = n.substring(0, indexpoint) + n.substr(indexpoint+1, 2);   // 若为小数,截取需要使用的unit单位
176
+            }
177
+
178
+            unit = unit.substr(unit.length - n.length);  // 若为整数,截取需要使用的unit单位
179
+            for (var i=0; i < n.length; i++){
180
+                str += "零壹贰叁肆伍陆柒捌玖".charAt(n.charAt(i)) + unit.charAt(i);  //遍历转化为大写的数字
181
+            }
182
+            console.log("str",str)
183
+            if(str == '零元零角零分'){
184
+                this.zhongwen = '零'
185
+            }else{
186
+                this.zhongwen =  str.replace(/零(仟|佰|拾|角)/g, "零").replace(/(零)+/g, "零").replace(/零(万|亿|元)/g, "$1").replace(/(亿)万|壹(拾)/g, "$1$2").replace(/^元零?|零分/g, "").replace(/元$/g, "元整");
187
+            }
188
+
189
+            console.log(this.zhongwen)
190
+        },
191
+        getTime(value, temp) {
192
+            if (value == 0) {
193
+                return ''
194
+            }
195
+            if (value != undefined) {
196
+                return uParseTime(value, temp)
197
+            }
198
+            return ''
199
+        },
200
+        getPage(){
201
+        if(this.list.order_info.length <= 10){
202
+            this.page = 1
203
+            this.pageArr.push(this.list.order_info.length)
204
+        }else if(this.list.order_info.length > 10){
205
+            this.page = parseInt(this.list.order_info.length / 10)
206
+            let num = this.list.order_info.length % 10
207
+            for (var i=0;i<this.page;i++){
208
+                this.pageArr.push(10)
209
+            }
210
+            if(num != 0){
211
+                this.pageArr.push(num)
212
+            }
213
+        }
214
+      }
215
+
216
+    },
217
+    watch:{
218
+        paramsObj:{//深度监听,可监听到对象、数组的变化
219
+            handler(val, oldVal){
220
+                let params = {
221
+                    order_id: val.order_id,
222
+                    patient_id: val.patient_id,
223
+                }
224
+                this.getInvoice(params)
225
+
226
+            },
227
+            deep:true
228
+        }
229
+    }
230
+}
231
+</script>