printSix.vue 12KB

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