overduePerson.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <template>
  2. <view>
  3. <view class="public_dialog" v-if="(otherList.length != 0 || list.length != 0) && Next == 0">
  4. <view class="dialog_item">
  5. <view :class="pageType == 'slb' ? 'header_slb' : 'header'">温馨提醒</view>
  6. <view>
  7. <view :class="[pageType == 'slb' ? 'dialog_txt_slb' : 'dialog_txt', 'displayFlexLeft']">
  8. <view v-if="list.length != 0">
  9. 您在{{ hosName }}(我院)尚有【
  10. <text v-for="(item, index) in list" :key="index">
  11. <text>{{ index + 1 }}、{{ item.ActualTime }}{{ item.ItemName }}就诊费用{{ item.Amount }}元,</text>
  12. </text>
  13. 】未结算,您是否进行充值?
  14. </view>
  15. <view v-if="otherList.length != 0">
  16. 您在【
  17. <text v-for="(item, index) in otherList" :key="index">
  18. {{ index + 1 }}、{{ item.OrgName }}(他院)尚有
  19. <text>{{ item.ActualTime }}{{ item.ItemName }}就诊费用{{ item.Amount }}元 <text>,</text></text>
  20. </text>
  21. 】未结算,请您本次先预存门诊预交金后进行就诊。您可以咨询对应医院相关未结算费用如何结算事宜,避免造成下次就诊不便。谢谢!
  22. </view>
  23. </view>
  24. <view class="p_flexCenter" v-if="otherList.length != 0">
  25. <view :class="[pageType == 'slb' ? 'dialog_btn_slb' : 'dialog_btn', 'p_border_top', 'backgroundCustom_F08', 'confirmNext']" @click="confirmClick('receive')">知道了</view>
  26. </view>
  27. <view class="p_flexBetween" v-if="list.length != 0">
  28. <view :class="[pageType == 'slb' ? 'dialog_btn_slb' : 'dialog_btn', 'p_color', 'p_border_top', 'colorCustom_999']" @click="confirmClick('cancel')">否</view>
  29. <view :class="[pageType == 'slb' ? 'dialog_btn_slb' : 'dialog_btn', 'p_border_top', 'backgroundCustom_F08']" @click="confirmClick('confirm')">是</view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="public_dialog" v-if="Next == 1">
  35. <view class="dialog_item">
  36. <view :class="pageType == 'slb' ? 'header_slb' : 'header'">温馨提醒</view>
  37. <view>
  38. <view :class="[pageType == 'slb' ? 'dialog_txt_slb' : 'dialog_txt', 'displayFlexLeft']">
  39. <view>
  40. 尊敬的患者:
  41. </view>
  42. <view class="textIndent">
  43. 您的诊疗信用记录良好,可直接预约取号并前往相关科室就诊。完成就诊后,您可通过微信公众号、结算码、自助机等渠道及时办理结算业务。
  44. </view>
  45. </view>
  46. <view class="p_flexCenter">
  47. <view :class="[pageType == 'slb' ? 'dialog_btn_slb' : 'dialog_btn', 'p_border_top', 'backgroundCustom_F08', 'confirmNext']" @click="confirmClick('receive')">知道了</view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </template>
  54. <script lang="ts" setup>
  55. import { ref, onMounted } from 'vue';
  56. import { useGetMember } from '@/hook';
  57. import { common } from '@/utils';
  58. import icon from '@/utils/icon';
  59. import { queryOverdueData as queryOverdueDataApi } from '@/pagesPersonal/service/patientManagement';
  60. const props = withDefaults(defineProps<{
  61. currentUser?: any;
  62. BusinessType?: string;
  63. pageType?: string;
  64. }>(), {
  65. currentUser: () => ({}),
  66. BusinessType: '',
  67. pageType: 'normal'
  68. });
  69. const app = getApp();
  70. const iconUrl = ref(icon);
  71. const list = ref<any[]>([]);
  72. const otherList = ref<any[]>([]);
  73. const Next = ref<any>(null);
  74. const Balance = ref(0);
  75. const changCardInfo = ref<any>({});
  76. const hosName = ref('');
  77. // 暴露 main 方法供外部调用(如果使用了 ref 获取组件实例)
  78. // 但在 Vue 3 中,更推荐通过 props 变化或事件驱动。
  79. // 考虑到原小程序是在 show 生命周期调用 main,这里我们可以在 onMounted 时尝试调用
  80. // 或者如果父组件需要显式调用,需要通过 defineExpose 暴露。
  81. // 鉴于小程序逻辑是 pageLifetimes.show 调用 main,
  82. // 且 main 接收 changCardInfo 参数,我们这里暴露 main 方法。
  83. const main = async (info?: any) => {
  84. iconUrl.value = icon;
  85. list.value = [];
  86. otherList.value = [];
  87. changCardInfo.value = info || {};
  88. hosName.value = app.globalData.hospitalInfo?.HospitalAlias || '';
  89. await queryOverdueData();
  90. };
  91. const queryOverdueData = async () => {
  92. // 获取绑定就诊人列表
  93. let memberList: any = await useGetMember('memberList');
  94. // 过滤本人信息 主要用于判断是否开启了信用付
  95. let myInfo = memberList.filter((item: any) => item.memberType == 1);
  96. // 判断的到了本人的数据,且本人设置了不开启信用付方式
  97. if (common.isNotEmpty(myInfo) && myInfo[0].acceptCredit == 0) return;
  98. if (myInfo[0].acceptCredit == 1 || props.currentUser.acceptCredit == 1) {
  99. let queryData = {
  100. MemberId: props.currentUser.memberId,
  101. // 01101=挂号
  102. BusinessType: props.BusinessType,
  103. CardType: props.currentUser.cardType || changCardInfo.value.cardType,
  104. CardNo: props.currentUser.cardNo || changCardInfo.value.cardNo,
  105. // ExtData false String 扩展参数 ;
  106. };
  107. // 使用新封装的接口
  108. let { resp } = await queryOverdueDataApi(queryData);
  109. let nextVal = null;
  110. let listVal = [];
  111. let otherListVal = [];
  112. let balanceVal = 0;
  113. if (!common.isEmpty(resp)) {
  114. let result = resp[0];
  115. // 未获取id 则跳去授权
  116. if (!common.isEmpty(result.WxMiniPath)) {
  117. let MiniProgram = result;
  118. let pages = getCurrentPages();
  119. let goPage = pages[pages.length - 1];
  120. let options = (goPage as any).options || {}; // uni-app 获取 options 可能不同,这里兼容处理
  121. if (goPage.route?.indexOf('yyghClinicMsg') != -1) {
  122. // @ts-ignore
  123. options.queryBean = (goPage as any).queryBean;
  124. }
  125. let overdueOptions = JSON.stringify({
  126. options: options,
  127. route: goPage.route,
  128. });
  129. uni.setStorageSync('overdueOptions', '');
  130. uni.setStorageSync('overdueOptions', overdueOptions);
  131. common.showModal(`前往授权`, () => {
  132. uni.navigateToMiniProgram({
  133. appId: MiniProgram.WxMiniAppId,
  134. path: `${MiniProgram.WxMiniPath}&authSource=WX_MINI&authAppId=wx3cf937079d74124f&authBackUrl=${encodeURIComponent(`/pages/st1/business/tabbar/transferPage/transferPage?type=overduePerson`)}`,
  135. extraData: {},
  136. envVersion: 'release',
  137. success(res) {
  138. uni.setStorageSync('overdueOptions', overdueOptions);
  139. // 打开成功
  140. }
  141. });
  142. });
  143. } else {
  144. // 是否享受先诊后付:0否、1是
  145. nextVal = result.Next;
  146. // 如果是1 不做判断
  147. if (nextVal == 0) {
  148. // 余额 后端返回元
  149. balanceVal = result.Balance;
  150. listVal = result.OneselfItemList;
  151. otherListVal = result.ExternalItemList;
  152. }
  153. }
  154. list.value = listVal;
  155. otherList.value = otherListVal;
  156. Next.value = nextVal;
  157. Balance.value = balanceVal;
  158. }
  159. }
  160. };
  161. const confirmClick = (type: string) => {
  162. let sumOfMoney = list.value.reduce((acc, item) => acc + parseFloat(item.Amount), 0);
  163. if (type == "confirm") {
  164. let userInfo = Object.assign({}, props.currentUser, changCardInfo.value);
  165. app.globalData.currentUser = userInfo;
  166. let payMoney = common.yuanToCent(Math.ceil(common.sub(sumOfMoney, Balance.value)));
  167. console.log(payMoney, 'payMoney');
  168. let url = `/${uni.getStorageSync('wx_Slb') ? 'pagesSlb' : 'pagesPatient'}/st1/business/recharge/rechargeMoney/rechargeMoney?pageType=mzjf&payMoney=${payMoney}`;
  169. common.goToUrl(url);
  170. return;
  171. } else if (type == "cancel") {
  172. setvalue();
  173. return;
  174. } else if (type == "receive") {
  175. setvalue();
  176. return;
  177. }
  178. };
  179. const setvalue = () => {
  180. Next.value = null;
  181. // 如果为签到页 需要往签到也存一个值 控制签到的点击时间是否走失信逻辑,needOverduePerson true false
  182. let pages = getCurrentPages();
  183. console.log(pages, 'pages');
  184. let goPage = pages[pages.length - 1];
  185. // 兼容 uni-app 获取 route
  186. if (goPage.route && goPage.route.indexOf("signIn/signInDetails/signInDetails") !== -1) {
  187. // Vue 3 中无法直接 setData 修改页面数据,这里假设父组件提供了方法或者通过其他方式
  188. // 但为了保持原有逻辑,如果是 uni-app 页面,可能需要通过事件通信
  189. // 此处保留 setData 尝试,如果是在 uni-app nvue 或 vue2 混合模式下可能有效
  190. // 但标准 Vue3 做法是 emit 事件
  191. // (goPage as any).setData({ needOverduePerson: false });
  192. // 更好的方式是 emit 一个事件,让父组件处理
  193. // emit('update:needOverduePerson', false);
  194. // 由于这是迁移代码,且涉及跨页面/组件通信,如果原逻辑是直接操作页面实例
  195. // 在 Vue3 中这是不推荐的。
  196. // 尝试获取组件实例并修改属性(如果不推荐但为了兼容):
  197. if ((goPage as any).$vm) {
  198. (goPage as any).$vm.needOverduePerson = false;
  199. }
  200. }
  201. };
  202. defineExpose({
  203. main
  204. });
  205. onMounted(() => {
  206. // 组件挂载时逻辑,原小程序 pageLifetimes.show 调用 main
  207. // 这里如果组件是随页面一起显示的,可以在这里调用
  208. // 但 main 依赖外部传入 changCardInfo,如果不传则为空
  209. main();
  210. });
  211. </script>
  212. <style lang="scss" scoped>
  213. /* 暂无数据 */
  214. /* @import "/pages/st1/blue/static/style/common"; */
  215. /* @import "/app"; */
  216. /* #region */
  217. /* 普通版本 */
  218. .public_dialog {
  219. background-color: rgba(1, 1, 1, 0.6);
  220. position: fixed;
  221. top: 0;
  222. left: 0;
  223. width: 100%;
  224. height: 100%;
  225. z-index: 15;
  226. display: flex;
  227. align-items: center;
  228. justify-content: center;
  229. }
  230. .dialog_item {
  231. width: 600upx;
  232. background-color: #fff;
  233. border-radius: 24upx;
  234. padding-top: 35upx;
  235. display: flex;
  236. align-items: center;
  237. justify-content: center;
  238. flex-direction: column;
  239. }
  240. .dialog_img {
  241. width: 167upx;
  242. height: 167upx;
  243. }
  244. .dialog_txt {
  245. font-size: 34upx;
  246. font-weight: 500;
  247. line-height: 50upx !important;
  248. margin-bottom: 42upx;
  249. padding: 0 55upx;
  250. text-align: left;
  251. word-break: break-all;
  252. }
  253. .dialog_txt text {
  254. color: red;
  255. line-height: 50upx !important;
  256. }
  257. .dialog_txt view {
  258. line-height: 50upx !important;
  259. }
  260. .dialog_btn {
  261. width: 100%;
  262. height: 97upx;
  263. text-align: center;
  264. line-height: 97upx;
  265. font-size: 32upx;
  266. font-family: Source Han Sans CN;
  267. font-weight: 500;
  268. border-radius: 0 0 24upx 0;
  269. }
  270. .dialog_btn:first-child {
  271. border-top: 1px solid #efefef;
  272. border-right: 1px solid #efefef;
  273. }
  274. .dialog_btn:nth-child(2) {
  275. border-top: 1px solid #efefef;
  276. }
  277. .header {
  278. font-size: 34upx;
  279. font-weight: 600;
  280. padding-bottom: 50upx;
  281. }
  282. .confirmNext {
  283. width: 60%;
  284. border-radius: 36upx;
  285. margin-bottom: 57upx;
  286. }
  287. .textIndent {
  288. text-indent: 2em;
  289. }
  290. /* #endregion */
  291. /* #region */
  292. /* 适老版 */
  293. // 注意:原 CSS 中有两段 .public_dialog 等定义,后一段会覆盖前一段,但这里根据 pageType 区分样式类
  294. // 原小程序代码并没有区分 public_dialog 的类名,只是内部元素区分了 _slb
  295. // 但这里为了完整迁移,我们将 _slb 的样式也保留并转换单位
  296. .dialog_txt_slb {
  297. font-size: 36upx;
  298. font-weight: 500;
  299. line-height: 50upx !important;
  300. margin-bottom: 42upx;
  301. padding: 0 55upx;
  302. text-align: left;
  303. word-break: break-all;
  304. }
  305. .dialog_txt_slb text {
  306. color: red;
  307. line-height: 65upx !important;
  308. }
  309. .dialog_txt_slb view {
  310. line-height: 65upx !important;
  311. }
  312. .dialog_btn_slb {
  313. width: 100%;
  314. height: 97upx;
  315. text-align: center;
  316. line-height: 97upx;
  317. font-size: 36upx;
  318. font-family: Source Han Sans CN;
  319. font-weight: 500;
  320. border-radius: 0 0 24upx 0;
  321. }
  322. .header_slb {
  323. font-size: 40upx;
  324. font-weight: 700;
  325. padding-bottom: 50upx;
  326. }
  327. /* #endregion */
  328. </style>