UnPaidList.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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. import Cookies from "js-cookie";
  37. const props = defineProps({
  38. patientId: {
  39. type: String,
  40. required: true
  41. }
  42. })
  43. const unpaidFees = ref([])
  44. const showEmpty = computed(() => {
  45. return unpaidFees.value.length === 0
  46. })
  47. const showPayMethodPicker = ref(false)
  48. const currentHisItem = ref({})
  49. function handleClickHisItem(item) {
  50. Cookies.set('hisOrdNum', item.hisOrdNum)
  51. currentHisItem.value = item
  52. showPayMethodPicker.value = true
  53. }
  54. const toWxPay = (item) => {
  55. getFundPayAmt(item.hisOrdNum).then(res => {
  56. const params = {
  57. patientId: props.patientId,
  58. hisOrdNum: item.hisOrdNum,
  59. patientName: item.patName,
  60. deptName: item.deptName,
  61. doctorCode: item.doctorCode,
  62. doctorName: item.doctorName,
  63. totalAmt: item.totalAmt,
  64. fundPay: res.fundPaySumamt,
  65. acctPay: res.acctPay,
  66. selfAmt: item.totalAmt - res.fundPaySumamt - res.acctPay
  67. }
  68. router.push({
  69. name: 'unPaidDetail',
  70. params,
  71. })
  72. })
  73. }
  74. function makeTitle(item) {
  75. return item.deptName + ' | ' + item.doctorName
  76. }
  77. function makeMoney(money) {
  78. const m = money / 100
  79. return '¥' + m.toFixed(2)
  80. }
  81. const payMethodColumns = [
  82. {text: '微信支付', value: 'WX'},
  83. {text: '医保支付(限本人)', value: 'YB'}
  84. ]
  85. function handleConfirmPayMethod({selectedValues}) {
  86. const payMethod = selectedValues[0]
  87. const hisOrdNum = Cookies.get('hisOrdNum')
  88. if (payMethod === 'YB') {
  89. lockYbOrder({hisOrdNum}).then(openid => {
  90. store.commit('SET_LOADING', true);
  91. startMedInsMobilePay(openid)
  92. })
  93. } else {
  94. lockOrder({hisOrdNum}).then(() => {
  95. store.commit('SET_LOADING', true);
  96. toWxPay(currentHisItem.value)
  97. })
  98. }
  99. }
  100. function startMedInsMobilePay(openid) {
  101. location.href = 'https://pss.ybj.hunan.gov.cn' +
  102. '/pss-hunan-h5/mobilePayment/paymentRecordList?' +
  103. 'channelCode=d32IFCxMsT&openId=' + openid
  104. }
  105. function clickUnlockOrder() {
  106. const hisOrdNum = Cookies.get('hisOrdNum')
  107. unlockOrder({hisOrdNum}).then(res => {
  108. showToast({
  109. position: 'top',
  110. message: '操作成功'
  111. })
  112. showPayMethodPicker.value = false
  113. router.push('/hospitalService')
  114. })
  115. }
  116. onMounted(() => {
  117. getUnPaidFee(props.patientId).then((res) => {
  118. unpaidFees.value = res
  119. let hisOrdNum = Cookies.get('hisOrdNum')
  120. if (hisOrdNum) {
  121. for (let i = 0; i < res.length; i++) {
  122. if (res[i].hisOrdNum === hisOrdNum) {
  123. currentHisItem.value = res[i]
  124. }
  125. }
  126. }
  127. })
  128. })
  129. </script>
  130. <style lang="scss">
  131. .med-ins-mobile-pay {
  132. .wrapper {
  133. width: 100vw;
  134. height: 100vh;
  135. display: flex;
  136. align-items: center;
  137. justify-content: center;
  138. }
  139. .block {
  140. border-radius: 8px;
  141. width: 90%;
  142. background-color: #fff;
  143. padding-bottom: 80px;
  144. .title {
  145. padding: 20px 8px;
  146. font-weight: bold;
  147. margin-bottom: 30px;
  148. }
  149. .fund-title {
  150. width: 100%;
  151. text-align: center;
  152. background-color: lightgrey;
  153. padding: 4px 0;
  154. font-size: 14px;
  155. margin-bottom: 24px;
  156. }
  157. .fund-detail {
  158. width: 100%;
  159. display: flex;
  160. > div {
  161. font-size: 12px;
  162. padding-left: 30px;
  163. width: 50%;
  164. }
  165. }
  166. .pay-button {
  167. width: 100%;
  168. text-align: center;
  169. margin-top: 24px;
  170. }
  171. }
  172. }
  173. </style>