소스 검색

新分支

28169 1 년 전
부모
커밋
084b1aef25
1개의 변경된 파일249개의 추가작업 그리고 0개의 파일을 삭제
  1. 249 0
      src/xt_pages/outpatientCharges/invoiceTemplate/printEleven.vue

+ 249 - 0
src/xt_pages/outpatientCharges/invoiceTemplate/printEleven.vue 파일 보기

@@ -0,0 +1,249 @@
1
+<template>
2
+  <div id='invoice-print' style="position: relative;">
3
+    <div>
4
+      <div style="display: inline-block; position: absolute;top: 30px;left: 30px;">{{list.order.mdtrt_id}}</div>
5
+      <div style="display: inline-block; position: absolute;top: 30px;left: 230px;">{{  paramsObj.setl_time ? paramsObj.setl_time.split(' ')[0].slice(0,4) : getTime(list.date, '{y}-{m}-{d}').slice(0,4) }}</div>
6
+      <div style="display: inline-block; position: absolute;top: 30px;left: 280px;">{{ paramsObj.setl_time ? parseInt(paramsObj.setl_time.split(' ')[0].slice(5,7)) : getTime(list.date, '{y}-{m}-{d}').slice(5,7) }}</div>
7
+      <div style="display: inline-block; position: absolute;top: 30px;left: 330px;">{{ paramsObj.setl_time ? parseInt(paramsObj.setl_time.split(' ')[0].slice(8,11)) : getTime(list.date, '{y}-{m}-{d}').slice(8,11) }}</div>
8
+    </div>
9
+    <div>
10
+      <div style="position: absolute;top: 50px;left: 60px;">{{ paramsObj.name }}</div>
11
+      <div style="display:flex;justify-content: space-between;">
12
+          <div  style="position: absolute;top:50px;left:260px;">√</div>
13
+          <div  style="position: absolute;top:50px;left:220px;"></div>
14
+          <div  style="position: absolute;top:50px;left:250px;"></div>
15
+      </div>
16
+      <div style="display:flex;justify-content: space-between;">
17
+          <div  style="position: absolute;top:50px;left:480px;" v-if="list.gender == 1">√</div>
18
+          <div  style="position: absolute;top:50px;left:540px;" v-else-if="list.gender == 2">√</div>
19
+      </div>
20
+    </div>
21
+    <div style="display:flex;justify-content: space-between;">
22
+      <div  style="position: absolute;top:68px;left:120px;">医保</div>
23
+      <div  style="position: absolute;top:68px;left:300px;">{{ list.number.length <= 13 ? list.psn_cash_money.toFixed(2) : (list.psn_cash_money).toFixed(2) }}</div>
24
+      <div  style="position: absolute;top:68px;left:480px;">现金</div>
25
+    </div>
26
+    <div style="display:flex;justify-content: space-between;">
27
+      <div  style="position: absolute;top:124px;left:0px;">西药</div>
28
+      <div  style="position: absolute;top:124px;left:60px;">{{ list.westernMedicineCostTotal ? list.westernMedicineCostTotal.toFixed(2) : '' }}</div>
29
+      <div  style="position: absolute;top:124px;left:120px;">检查费</div>
30
+      <div  style="position: absolute;top:124px;left:180px;">{{ list.checkCostTotal ? list.checkCostTotal.toFixed(2) : '' }}</div>
31
+      <div  style="position: absolute;top:124px;left:240px;">治疗费</div>
32
+      <div  style="position: absolute;top:124px;left:320px;">{{ list.treatCostTotal ? list.treatCostTotal.toFixed(2) : '' }}</div>
33
+      <div  style="position: absolute;top:124px;left:410px;">床位费</div>
34
+      <div  style="position: absolute;top:124px;left:480px;">{{ list.bedCostTotal ? list.bedCostTotal.toFixed(2) : '' }}</div>
35
+    </div>
36
+    <div style="display:flex;justify-content: space-between;">
37
+      <div  style="position: absolute;top:150px;left:0px;">中成药</div>
38
+      <div  style="position: absolute;top:150px;left:60px;">{{ list.chineseTraditionalMedicineCostTotal ? list.chineseTraditionalMedicineCostTotal.toFixed(2) : '' }}</div>
39
+      <div  style="position: absolute;top:150px;left:120px;">化验费</div>
40
+      <div  style="position: absolute;top:150px;left:180px;">{{ list.laboratoryCostTotal ? list.laboratoryCostTotal.toFixed(2) : '' }}</div>
41
+      <div  style="position: absolute;top:150px;left:240px;">手术费</div>
42
+      <div  style="position: absolute;top:150px;left:320px;">{{ list.operationCostTotal ? list.operationCostTotal.toFixed(2) : '' }}</div>
43
+      <div  style="position: absolute;top:150px;left:410px;">其他费</div>
44
+      <div  style="position: absolute;top:150px;left:480px;">{{ list.otherCostTotal ? list.otherCostTotal.toFixed(2) : '' }}</div>
45
+    </div>
46
+    <div style="display:flex;justify-content: space-between;">
47
+      <div  style="position: absolute;top:176px;left:0px;">诊察费</div>
48
+      <div  style="position: absolute;top:176px;left:60px;">{{ list.zhenChaCostTotal ? list.zhenChaCostTotal.toFixed(2) : '' }}</div>
49
+      <div  style="position: absolute;top:176px;left:120px;">材料费</div>
50
+      <div  style="position: absolute;top:176px;left:180px;">{{ list.materialCostTotal ? list.materialCostTotal.toFixed(2) : '' }}</div>
51
+      <div  style="position: absolute;top:176px;left:240px;"></div>
52
+      <div  style="position: absolute;top:176px;left:320px;"></div>
53
+      <div  style="position: absolute;top:176px;left:410px;"></div>
54
+      <div  style="position: absolute;top:176px;left:480px;"></div>
55
+    </div>
56
+    <div style="display:flex;justify-content: space-between;">
57
+      <div  style="position: absolute;top:202px;left:60px;"></div>
58
+      <div  style="position: absolute;top:202px;left:180px;"></div>
59
+      <div  style="position: absolute;top:202px;left:320px;"></div>
60
+      <div  style="position: absolute;top:202px;left:480px;"></div>
61
+    </div>
62
+    <div>
63
+      <span>
64
+        <span  style="position: absolute;top:230px;left:120px">
65
+          <span v-if="zhongwen.indexOf('万') > -1 && zhongwen.indexOf('拾') > -1 && zhongwen.indexOf('拾') == 1">
66
+                    {{ zhongwen.substring(0,1) }}
67
+                </span>
68
+                <span v-else>零</span>
69
+        </span>
70
+        <span  style="position: absolute;top:230px;left:160px">
71
+            <span v-if="zhongwen.indexOf('万') > -1">
72
+                    {{ zhongwen.substring(zhongwen.indexOf('万') - 1,zhongwen.indexOf('万')) }}
73
+                </span>
74
+                <span v-else>零</span>
75
+        </span>
76
+        <span  style="position: absolute;top:230px;left:210px">
77
+            <span v-if="zhongwen.indexOf('仟') > -1">
78
+                    {{ zhongwen.substring(zhongwen.indexOf('仟') - 1,zhongwen.indexOf('仟')) }}
79
+                </span>
80
+                <span v-else>零</span>
81
+        </span>
82
+        <span  style="position: absolute;top:230px;left:260px">
83
+            <span v-if="zhongwen.indexOf('佰') > -1">
84
+                    {{ zhongwen.substring(zhongwen.indexOf('佰') - 1,zhongwen.indexOf('佰')) }}
85
+                </span>
86
+                <span v-else>零</span>
87
+        </span>
88
+        <span style="position: absolute;top:230px;left:310px">
89
+            <span v-if="zhongwen.indexOf('拾') > -1">
90
+                    {{zhongwen.substring(zhongwen.indexOf('拾') - 1,zhongwen.indexOf('拾')) == '佰' ||  !zhongwen.substring(zhongwen.indexOf('拾') - 1,zhongwen.indexOf('拾'))? '壹' : zhongwen.substring(zhongwen.indexOf('拾') - 1,zhongwen.indexOf('拾')) }}
91
+                </span>
92
+                <span v-else>零</span>
93
+        </span>
94
+        <span  style="position: absolute;top:230px;left:360px">
95
+           <span v-if="zhongwen.indexOf('元') > -1 && zhongwen.substring(this.zhongwen.indexOf('元') - 1).substring(0,1)!= '拾'">
96
+                    {{ zhongwen.substring(zhongwen.indexOf('元') - 1,zhongwen.indexOf('元')) }}
97
+                </span>
98
+                <span v-else>零</span>
99
+        </span>
100
+        <span  style="position: absolute;top:230px;left:420px">
101
+             <span v-if="zhongwen.indexOf('角') > -1">
102
+                    {{ zhongwen.substring(zhongwen.indexOf('角') - 1,zhongwen.indexOf('角')) }}
103
+                </span>
104
+                <span v-else>零</span>
105
+        </span>
106
+
107
+        <span  style="position: absolute;top:230px;left:480px">
108
+             <span v-if="zhongwen.indexOf('分') > -1">
109
+                    {{ zhongwen.substring(zhongwen.indexOf('分') - 1,zhongwen.indexOf('分')) }}
110
+                </span>
111
+                <span v-else>零</span>
112
+        </span>
113
+      </span>
114
+      <span style="position: absolute;top:230px;left:530px">{{ totalPrice.toFixed(2) }}</span>
115
+    </div>
116
+
117
+
118
+    <div style="display:flex;justify-content: space-between;">
119
+      <div style="position: absolute;top:283px;left:100px;">阳春{{ org_name}}</div>
120
+      <div style="position: absolute;top:283px;left:240px;"></div>
121
+      <div style="position: absolute;top:283px;left:410px;">{{list.admin_user_name}}</div>
122
+    </div>
123
+  </div>
124
+</template>
125
+<script>
126
+import { getInvoice } from '@/api/project/project'
127
+import { uParseTime } from '@/utils/tools'
128
+export default {
129
+  props:{
130
+    paramsObj:Object
131
+  },
132
+  data(){
133
+    return{
134
+      gender:'',
135
+      list:{},
136
+      printDate:'',
137
+      zhongwen:'',
138
+      totalPrice:0.0,
139
+      org_id:'',
140
+      org_name:''
141
+    }
142
+  },
143
+  created(){
144
+    console.log('paramsObj',this.paramsObj)
145
+    let params = {
146
+      order_id: this.paramsObj.order_id,
147
+      patient_id: this.paramsObj.patient_id,
148
+      number: this.paramsObj.number,
149
+    }
150
+    this.getInvoice(params)
151
+    // var data = new Date();
152
+    // var month =data.getMonth() < 9 ? "0" + (data.getMonth() + 1) : data.getMonth() + 1;
153
+    // var date = data.getDate() <= 9 ? "0" + data.getDate() : data.getDate();
154
+    // this.printDate = data.getFullYear() + "-" + month + "-" + date;
155
+    // this.smalltoBIG(982732.21)
156
+    this.org_id = this.$store.getters.xt_user.org_id
157
+    this.org_name = this.$store.getters.xt_user.org.org_name
158
+  },
159
+  methods:{
160
+    getInvoice(params){
161
+      getInvoice(params).then((res) => {
162
+        console.log('res',res)
163
+        this.list = res.data.data
164
+        this.totalPrice = this.list.westernMedicineCostTotal + this.list.checkCostTotal + this.list.treatCostTotal + this.list.bedCostTotal + this.list.chineseTraditionalMedicineCostTotal +
165
+          this.list.laboratoryCostTotal + this.list.operationCostTotal + this.list.otherCostTotal + this.list.materialCostTotal + this.list.zhenChaCostTotal
166
+        if(this.totalPrice == 0){
167
+
168
+          this.totalPrice = this.list.medfee_sumamt
169
+        }
170
+        console.log( "this.totalPrice")
171
+
172
+        this.smalltoBIG(this.totalPrice.toFixed(2))
173
+        var data = new Date(res.data.data.date * 1000);
174
+        var month =data.getMonth() < 9 ? "0" + (data.getMonth() + 1) : data.getMonth() + 1;
175
+        var date = data.getDate() <= 9 ? "0" + data.getDate() : data.getDate();
176
+        this.printDate = data.getFullYear() + "-" + month + "-" + date;
177
+        this.gender = this.list.gender
178
+      })
179
+    },
180
+    smalltoBIG(n) {
181
+      // let fraction = ['角', '分'];
182
+      // let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
183
+      // let unit = [['元.', '万,', '亿,'], ["元",'拾', '佰', '仟']];
184
+      // let head = price < 0 ? '欠' : '';
185
+      // price = Math.abs(price);
186
+      // let upper = '';
187
+      // for (let i = 0; i < fraction.length; i++) {
188
+      // upper += (digit[Math.floor(price * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
189
+      // }
190
+      // upper = upper || '整';
191
+      // price = Math.floor(price);
192
+      // for (let i = 0; i < unit[0].length && price > 0; i++) {
193
+      // let p = '';
194
+      // for (let j = 0; j < unit[1].length && price > 0; j++) {
195
+      //     p = digit[price % 10] + unit[1][j] + p;
196
+      //     price = Math.floor(price / 10);
197
+      // }
198
+      // upper = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + upper;
199
+      // }
200
+      // this.zhongwen = head + upper.replace(/(零.)*零圆/, '圆').replace(/(零.)+/g, '零').replace(/^整$/, '零圆整')
201
+      // console.log('6666',head + upper.replace(/(零.)*零圆/, '圆').replace(/(零.)+/g, '零').replace(/^整$/, '零圆整'))
202
+      if (!/^(0|[1-9]\d*)(\.\d+)?$/.test(n)){
203
+        return "数据非法";  //判断数据是否大于0
204
+      }
205
+
206
+      var unit = "仟佰拾亿仟佰拾万仟佰拾元角分", str = "";
207
+      n += "00";
208
+
209
+      var indexpoint = n.indexOf('.');  // 如果是小数,截取小数点前面的位数
210
+
211
+      if (indexpoint >= 0){
212
+
213
+        n = n.substring(0, indexpoint) + n.substr(indexpoint+1, 2);   // 若为小数,截取需要使用的unit单位
214
+      }
215
+
216
+      unit = unit.substr(unit.length - n.length);  // 若为整数,截取需要使用的unit单位
217
+      for (var i=0; i < n.length; i++){
218
+        str += "零壹贰叁肆伍陆柒捌玖".charAt(n.charAt(i)) + unit.charAt(i);  //遍历转化为大写的数字
219
+      }
220
+
221
+      this.zhongwen =  str.replace(/零(仟|佰|拾|角)/g, "零").replace(/(零)+/g, "零").replace(/零(万|亿|元)/g, "$1").replace(/(亿)万|壹(拾)/g, "$1$2").replace(/^元零?|零分/g, "").replace(/元$/g, "元整");
222
+      console.log(this.zhongwen)
223
+    },
224
+    getTime(value, temp) {
225
+      if (value == 0) {
226
+        return ''
227
+      }
228
+      if (value != undefined) {
229
+        return uParseTime(value, temp)
230
+      }
231
+      return ''
232
+    },
233
+  },
234
+  watch:{
235
+    paramsObj:{//深度监听,可监听到对象、数组的变化
236
+      handler(val, oldVal){
237
+        let params = {
238
+          order_id: val.order_id,
239
+          patient_id: val.patient_id,
240
+          number: val.number,
241
+        }
242
+        this.getInvoice(params)
243
+
244
+      },
245
+      deep:true
246
+    }
247
+  }
248
+}
249
+</script>