MzGuideBill.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <el-container>
  3. <el-header style="height: 35px; margin-top: 10px">
  4. <el-input v-model="patientId" style="width: 220px" clearable @keyup.enter="fetchList">
  5. <template #prepend>门诊id号</template>
  6. </el-input>
  7. <el-button icon="Search" type="primary" @click="fetchList">检索</el-button>
  8. <el-button type="primary" icon="RefreshLeft" @click="reset">重置</el-button>
  9. <el-button type="primary" icon="Printer" @click="printObj">打印</el-button>
  10. </el-header>
  11. <el-container>
  12. <el-aside width="330px">
  13. <el-table ref="listTable" :data="roughList" @row-click="fetchDetail" :height="tableHeight" highlight-current-row>
  14. <el-table-column prop="deptName" label="执行科室"></el-table-column>
  15. <el-table-column prop="doctorName" label="执行医生"></el-table-column>
  16. <el-table-column prop="priceTime" label="执行时间"></el-table-column>
  17. <el-table-column prop="fixedAmt" label="费用总计(¥)"></el-table-column>
  18. </el-table>
  19. </el-aside>
  20. <el-main>
  21. <div
  22. id="printArea"
  23. style="
  24. width: 520px;
  25. font-size: 12px;
  26. display: inline-block;
  27. width: 520px;
  28. padding-bottom: 10px;
  29. vertical-align: middle;
  30. background-color: rgb(255, 255, 255);
  31. border-radius: 4px;
  32. border: 1px solid rgb(235, 238, 245);
  33. font-size: 18px;
  34. box-shadow: rgba(0, 0, 0, 0.1) 0px 2px 12px 0px;
  35. text-align: left;
  36. overflow: hidden;
  37. backface-visibility: hidden;
  38. "
  39. >
  40. <div style="display: flex; width: 100%; height: 50px; line-height: 50px; padding: 15px 0 10px 20px">
  41. <div>
  42. <img style="width: 50px" :src="logo" />
  43. </div>
  44. <div style="font-size: 18px; font-weight: bold; width: 320px">泰和医院门诊指引单</div>
  45. <div>
  46. <svg id="barcode"></svg>
  47. </div>
  48. </div>
  49. <div style="padding: 5px 20px">
  50. <div style="margin-top: 10px; height: 32px; line-height: 32px; font-size: 13px; border-bottom: 1px solid #333">
  51. <span style="margin-left: 30px">门诊号:{{ patientId }}</span>
  52. <span style="margin-left: 30px">姓名:{{ currentRow.patName }}</span>
  53. <span style="margin-left: 30px">日期:{{ fixTime(currentRow.priceTime) }}</span>
  54. </div>
  55. <div>
  56. <div style="display: flex; height: 30px; line-height: 30px; font-size: 13px; border-bottom: 1px solid lightgray">
  57. <div style="width: 120px; text-align: center">项目类别</div>
  58. <div style="width: 100px; text-align: center">项目费用(¥)</div>
  59. <div style="width: 140px; text-align: center">执行科室名称</div>
  60. <div style="width: 120px; text-align: center">执行科室地址</div>
  61. </div>
  62. <div v-for="(item, index) in detail.list" :key="index" style="display: flex; height: 30px; line-height: 30px; font-size: 12px; border-bottom: 1px solid lightgray">
  63. <div style="width: 120px; text-align: center">{{ item.itemType }}</div>
  64. <div style="width: 100px; text-align: center">{{ item.fixedAmt }}</div>
  65. <div style="width: 140px; text-align: center">{{ item.execDeptName }}</div>
  66. <div style="width: 120px; text-align: center">{{ item.execDeptAddress }}</div>
  67. </div>
  68. <div style="display: flex; height: 30px; line-height: 30px; border-bottom: 1px solid lightgray">
  69. <div style="width: 120px; text-align: center">合计</div>
  70. <div style="width: 100px; text-align: center">{{ detail.sum }}</div>
  71. </div>
  72. <div style="margin-top: 10px; width: 100%; font-size: 12px; color: gray; text-align: right">请缴费后至以上科室取药或检查治疗,检查完成后可关注服务号查询结果。</div>
  73. </div>
  74. </div>
  75. <div style="margin: 30px 0 7px 20px; font-size: 13px; display: flex">
  76. <div style="width: 130px">
  77. <div id="wxqrcode"></div>
  78. <div style="width: 100px; text-align: center">微信支付</div>
  79. </div>
  80. </div>
  81. <div style="margin-left: 20px; margin-bottom: 20px; font-size: 13px; font-weight: bold">如有故障请联系服务中心:88518702</div>
  82. </div>
  83. </el-main>
  84. </el-container>
  85. </el-container>
  86. </template>
  87. <script>
  88. import { onMounted, reactive, ref } from 'vue'
  89. import { getRoughList, getDetailFees } from '@/api/mz-pay-qrcode'
  90. import { qrcanvas } from 'qrcanvas'
  91. import JsBarcode from 'jsbarcode'
  92. import { initLodop, getLodop } from '@/utils/c-lodop'
  93. import logo from '@/assets/csthyylogoplain.png'
  94. export default {
  95. setup() {
  96. const patientId = ref('')
  97. const tableHeight = window.innerHeight - 45
  98. const listTable = ref(null)
  99. const roughList = ref([])
  100. const detail = reactive({
  101. sum: 0,
  102. list: [],
  103. wxQrcode: '',
  104. })
  105. const fetchList = () => {
  106. getRoughList(patientId.value).then((res) => {
  107. roughList.value = res
  108. if (res.length > 0) {
  109. listTable.value.setCurrentRow(res[0])
  110. fetchDetail(res[0])
  111. }
  112. })
  113. }
  114. const currentRow = ref({})
  115. const fetchDetail = (row) => {
  116. JsBarcode('#barcode', patientId.value, {
  117. lineColor: '#333', //线条颜色
  118. width: 2, //线宽
  119. height: 26, //条码高度
  120. displayValue: false, //是否显示文字信息
  121. })
  122. currentRow.value = row
  123. row.patientId = patientId.value
  124. getDetailFees(row).then((res) => {
  125. detail.list = res.list
  126. detail.wxQrcode = res.wxQrcode
  127. detail.sum = 0
  128. res.list.forEach((item) => {
  129. detail.sum += Number(item.fixedAmt)
  130. })
  131. detail.sum = detail.sum.toFixed(2)
  132. const wxcanvas = qrcanvas({
  133. data: decodeURIComponent(detail.wxQrcode),
  134. size: 100,
  135. })
  136. document.getElementById('wxqrcode').appendChild(wxcanvas)
  137. })
  138. }
  139. const printObj = () => {
  140. // A5 = 559.37px * 793.70px
  141. const topHeight = 250 + detail.list.length * 30
  142. const LODOP = getLodop()
  143. LODOP.PRINT_INIT('')
  144. LODOP.SET_PRINT_PAGESIZE(3, 0, 20, 'A5')
  145. const strFormHtml = document.getElementById('printArea').innerHTML
  146. LODOP.ADD_PRINT_HTM(0, 0, 520, 750, strFormHtml)
  147. LODOP.ADD_PRINT_BARCODE(topHeight, 25, 100, 100, 'QRCode', decodeURIComponent(detail.wxQrcode))
  148. LODOP.PREVIEW()
  149. }
  150. const reset = () => {
  151. document.getElementById('wxqrcode').innerHTML = ''
  152. patientId.value = ''
  153. roughList.value = []
  154. detail.sum = 0
  155. detail.list = []
  156. detail.wxQrcode = ''
  157. }
  158. onMounted(() => {
  159. initLodop()
  160. })
  161. return {
  162. listTable,
  163. tableHeight,
  164. patientId,
  165. fetchList,
  166. roughList,
  167. fetchDetail,
  168. detail,
  169. currentRow,
  170. printObj,
  171. logo,
  172. fixTime,
  173. reset,
  174. }
  175. },
  176. }
  177. function fixTime(val) {
  178. if (val) {
  179. return val.substring(0, 10)
  180. }
  181. return ''
  182. }
  183. </script>