UnPaidList.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <van-empty :image="empty" description="您没有待缴费记录" v-if="showEmpty"></van-empty>
  3. <div v-for="item in unpaidFees" :key="item.hisOrdNum">
  4. <van-cell
  5. :title="makeTitle(item)"
  6. :label="item.priceTime"
  7. is-link
  8. center
  9. @click="handleClickHisItem(item)">
  10. <template #default>
  11. <span style="color: orangered">{{ makeMoney(item.totalAmt) }}</span>
  12. </template>
  13. </van-cell>
  14. <div style="height: 5px"></div>
  15. </div>
  16. <van-popup v-model:show="showPayMethodPicker" position="bottom">
  17. <van-picker
  18. :columns="payMethodColumns"
  19. @cancel="showPayMethodPicker = false"
  20. @confirm="handleConfirmPayMethod"
  21. >
  22. <template #title>
  23. <van-button size="small" type="warning" plain @click="clickUnlockOrder">放弃支付</van-button>
  24. </template>
  25. </van-picker>
  26. </van-popup>
  27. </template>
  28. <script setup>
  29. import {getFundPayAmt, getUnPaidFee} from '@/api/pay-mz-fee'
  30. import empty from '@/assets/empty.png'
  31. import {computed, onMounted, ref} from 'vue'
  32. import {lockOrder,lockYbOrder,unlockOrder} from "@/api/medins-mobile-pay";
  33. import store from "@/store";
  34. import router from "@/router";
  35. import {showToast} from "vant";
  36. const props = defineProps({
  37. patientId: {
  38. type: String,
  39. required: true
  40. }
  41. })
  42. const unpaidFees = ref([])
  43. const showEmpty = computed(() => {
  44. return unpaidFees.value.length === 0
  45. })
  46. const showPayMethodPicker = ref(false)
  47. const currentHisItem = ref({})
  48. function handleClickHisItem(item) {
  49. localStorage.setItem('hisOrdNum', item.hisOrdNum)
  50. currentHisItem.value = item
  51. showPayMethodPicker.value = true
  52. }
  53. const toWxPay = (item) => {
  54. getFundPayAmt(item.hisOrdNum).then(res => {
  55. const params = {
  56. patientId: props.patientId,
  57. hisOrdNum: item.hisOrdNum,
  58. patientName: item.patName,
  59. deptName: item.deptName,
  60. doctorCode: item.doctorCode,
  61. doctorName: item.doctorName,
  62. totalAmt: item.totalAmt,
  63. fundPay: res.fundPaySumamt,
  64. acctPay: res.acctPay,
  65. selfAmt: item.totalAmt - res.fundPaySumamt - res.acctPay
  66. }
  67. router.push({
  68. name: 'unPaidDetail',
  69. params,
  70. })
  71. })
  72. }
  73. function makeTitle(item) {
  74. return item.deptName + ' | ' + item.doctorName
  75. }
  76. function makeMoney(money) {
  77. const m = money / 100
  78. return '¥' + m.toFixed(2)
  79. }
  80. const payMethodColumns = [
  81. {text: '微信支付', value: 'WX'},
  82. {text: '医保支付(限本人)', value: 'YB'}
  83. ]
  84. function handleConfirmPayMethod({selectedValues}) {
  85. const payMethod = selectedValues[0]
  86. const hisOrdNum = localStorage.getItem('hisOrdNum')
  87. if (payMethod === 'YB') {
  88. lockYbOrder({hisOrdNum}).then(openid => {
  89. store.commit('SET_LOADING', true);
  90. startMedInsMobilePay(openid)
  91. })
  92. } else {
  93. lockOrder({hisOrdNum}).then(() => {
  94. store.commit('SET_LOADING', true);
  95. toWxPay(currentHisItem.value)
  96. })
  97. }
  98. }
  99. function startMedInsMobilePay(openid) {
  100. location.href = 'https://pss.ybj.hunan.gov.cn' +
  101. '/pss-hunan-h5/mobilePayment/paymentRecordList?' +
  102. 'channelCode=d32IFCxMsT&openId=' + openid
  103. }
  104. function clickUnlockOrder() {
  105. const hisOrdNum = localStorage.getItem('hisOrdNum')
  106. unlockOrder({hisOrdNum}).then(res => {
  107. showToast({
  108. position: 'top',
  109. message: '操作成功'
  110. })
  111. showPayMethodPicker.value = false
  112. router.push('/hospitalService')
  113. })
  114. }
  115. onMounted(() => {
  116. getUnPaidFee(props.patientId).then((res) => {
  117. unpaidFees.value = res
  118. let hisOrdNum = localStorage.getItem('hisOrdNum')
  119. if (hisOrdNum) {
  120. for (let i = 0; i < res.length; i++) {
  121. if (res[i].hisOrdNum === hisOrdNum) {
  122. currentHisItem.value = res[i]
  123. }
  124. }
  125. }
  126. })
  127. })
  128. </script>
  129. <style lang="scss">
  130. .med-ins-mobile-pay {
  131. .wrapper {
  132. width: 100vw;
  133. height: 100vh;
  134. display: flex;
  135. align-items: center;
  136. justify-content: center;
  137. }
  138. .block {
  139. border-radius: 8px;
  140. width: 90%;
  141. background-color: #fff;
  142. padding-bottom: 80px;
  143. .title {
  144. padding: 20px 8px;
  145. font-weight: bold;
  146. margin-bottom: 30px;
  147. }
  148. .fund-title {
  149. width: 100%;
  150. text-align: center;
  151. background-color: lightgrey;
  152. padding: 4px 0;
  153. font-size: 14px;
  154. margin-bottom: 24px;
  155. }
  156. .fund-detail {
  157. width: 100%;
  158. display: flex;
  159. > div {
  160. font-size: 12px;
  161. padding-left: 30px;
  162. width: 50%;
  163. }
  164. }
  165. .pay-button {
  166. width: 100%;
  167. text-align: center;
  168. margin-top: 24px;
  169. }
  170. }
  171. }
  172. </style>