printTen.vue 12KB

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