medicalCardBind.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <view class="container">
  3. <view class="content" v-if="showCon">
  4. <view class="contentTop backgroundCustom">
  5. <view class="contentTop_title">已获取医保电子凭证授权信息</view>
  6. <view class="contentTop_tip">请点击授权获取手机号码</view>
  7. </view>
  8. <view class="contentBox">
  9. <view class="contentBox_item border_bottom displayFlexLeft">
  10. <view class="contentBoxItem_left">姓名</view>
  11. <view class="contentBoxItem_right">{{codeInfo.memberName}}</view>
  12. </view>
  13. <view class="contentBox_item border_bottom displayFlexLeft">
  14. <view class="contentBoxItem_left">身份证号</view>
  15. <view class="contentBoxItem_right">{{codeInfo.certNum}}</view>
  16. </view>
  17. <view class="contentBox_item displayFlexLeft">
  18. <view class="contentBoxItem_left">医保卡号</view>
  19. <view class="contentBoxItem_right">{{codeInfo.cardNo}}</view>
  20. </view>
  21. </view>
  22. <!-- #ifdef MP-WEIXIN -->
  23. <button class="backgroundCustom_F08 btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">授权获取手机号码</button>
  24. <!-- #endif -->
  25. <!-- #ifndef MP-WEIXIN -->
  26. <view class="backgroundCustom_F08 btn" style="text-align:center;color:#fff;" @click="getPhoneNumber">授权获取手机号码(模拟)</view>
  27. <!-- #endif -->
  28. </view>
  29. <view class="dialogContiner mask" v-show="showHealth">
  30. <view class="dialog">
  31. <!-- <view class="title">微信授权</view> -->
  32. <view class="info">获取你的公开信息(昵称,头像,地区,及性别)</view>
  33. <!-- #ifdef MP-WEIXIN -->
  34. <healthCardLogin :encrypt="true" :authLogin="false" @authFail="authFail" @authSucess="authSuccess" :wechatcode="true" :healthcode="true">
  35. <view @click="auth" class="btn-agree">前往授权</view>
  36. </healthCardLogin>
  37. <!-- #endif -->
  38. <!-- #ifndef MP-WEIXIN -->
  39. <view @click="auth" class="btn-agree">前往授权(模拟)</view>
  40. <!-- #endif -->
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script lang="ts" setup>
  46. import { ref } from 'vue';
  47. import { onLoad } from '@dcloudio/uni-app';
  48. import { common } from '@/utils';
  49. import {
  50. getYbzfMemberUserInfo,
  51. getPhoneNumber as getPhoneNumberApi,
  52. addBaseMember_V3New
  53. } from '@/pagesPersonal/service/patientManagement';
  54. import { usePreserMember, useGetDefaultMember } from '@/hook';
  55. const app = getApp();
  56. const codeInfo = ref<any>({}); // 授权后得到的本人参数
  57. const showCon = ref(false); //页面加载完参数
  58. const showHealth = ref(true); // 健康卡授权弹窗
  59. onLoad((options: any) => {
  60. main(options);
  61. });
  62. const main = async (options: any) => {
  63. if(options.medicalCode){
  64. let { resData } = await getYbzfMemberUserInfo({
  65. openId : uni.getStorageSync("openid"),
  66. hosId: app.globalData.hosId,
  67. code: options.medicalCode
  68. });
  69. if(common.isNotEmpty(resData)){
  70. codeInfo.value = resData[0];
  71. showCon.value = true;
  72. }
  73. }
  74. };
  75. /**点击授权按钮 */
  76. const auth = () => {
  77. showHealth.value = false;
  78. };
  79. /**
  80. * 电子健康卡授权成功后返回执行
  81. */
  82. const authSuccess = async (data: any) => {
  83. console.log(data);
  84. // 原逻辑被注释,保持原样
  85. };
  86. const authFail = (err: any) => {
  87. console.log(err);
  88. };
  89. const getPhoneNumber = async (e: any) => {
  90. // #ifdef MP-WEIXIN
  91. let { resData } = await getPhoneNumberApi({
  92. ConfigKey: app.globalData.configKey,
  93. Code: e.detail.code
  94. });
  95. // #endif
  96. // #ifndef MP-WEIXIN
  97. // 模拟数据
  98. let resData = [{ phone_info: { phoneNumber: '13800138000' } }];
  99. common.showToast('模拟获取手机号成功');
  100. // #endif
  101. if(common.isNotEmpty(resData)){
  102. let info = codeInfo.value;
  103. let quer = {
  104. memberName: info.MemberName,
  105. certNum : info.IdCardNo,
  106. mobile: resData[0].phone_info.phoneNumber,
  107. userMobile: resData[0].phone_info.phoneNumber,
  108. certType: "01",
  109. memberType: 1, //医保添加都为本人
  110. };
  111. let { resData: addMember } = await addBaseMember_V3New(quer);
  112. if(addMember.RespCode == 10000){
  113. await usePreserMember();
  114. // 判断是否有存储跳转地址
  115. if (app.globalData.toUrl) {
  116. // 判断为(selecteCardOrHos)选择患者界面进入添加
  117. if(app.globalData.isSelectAdd){
  118. app.globalData.isSelectAdd = false;
  119. common.navigateBack(1);
  120. return;
  121. }
  122. let member = await useGetDefaultMember({cardType: app.globalData.cardType, url: app.globalData.toUrl});
  123. if(common.isNotEmpty(member)){
  124. common.goToUrl(app.globalData.toUrl, {skipWay: "redirectTo"});
  125. }
  126. } else {
  127. common.navigateBack(1);
  128. }
  129. }
  130. }
  131. };
  132. </script>
  133. <style lang="scss" scoped>
  134. .contentTop{
  135. height: 230upx;
  136. padding: 40upx 30upx;
  137. }
  138. .contentTop .contentTop_title{
  139. font-size: 32upx;
  140. font-weight: bold;
  141. margin-bottom: 24upx;
  142. }
  143. .contentTop .contentTop_tip{
  144. font-size: 26upx;
  145. font-family: PingFang SC;
  146. }
  147. .contentBox{
  148. background: #FFFFFF;
  149. border-radius: 24upx;
  150. padding: 0 30upx;
  151. margin: -70upx 30upx 60upx;
  152. }
  153. .contentBox_item{
  154. height: 110upx;
  155. line-height: 110upx;
  156. font-size: 32upx;
  157. font-family: PingFang SC;
  158. color: #222326;
  159. }
  160. .contentBoxItem_left{
  161. color: #8A8A99;
  162. width: 150upx;
  163. margin-right: 60upx;
  164. text-align: justify;
  165. text-align-last: justify;
  166. }
  167. .btn{
  168. width: 690upx !important;
  169. height: 92upx;
  170. line-height: 92upx;
  171. border-radius: 46upx;
  172. margin: 0 auto !important;
  173. font-size: 32upx;
  174. }
  175. /* 健康卡授权 */
  176. .dialogContiner .dialog {
  177. position: absolute;
  178. top: 50%;
  179. left: 50%;
  180. width: 450upx;
  181. transform: translate(-50%, -50%);
  182. background-color: #fff;
  183. box-shadow: 0 -2px 25px 0 rgba(0, 0, 0, 0.15), 0 13px 25px 0 rgba(0, 0, 0, 0.3);
  184. z-index: 100000;
  185. text-align: center;
  186. border-radius: 10upx;
  187. }
  188. .dialogContiner .dialog .btn-agree {
  189. position: relative;
  190. line-height: 100upx;
  191. font-size: 35upx;
  192. color: #4DB371;
  193. }
  194. .dialogContiner .dialog .btn-agree::before {
  195. content: '';
  196. position: absolute;
  197. left: 0;
  198. right: 0;
  199. top: 0;
  200. height: 1px;
  201. transform: scaleY(0.5);
  202. background-color: rgba(234, 234, 234, 1);
  203. }
  204. .dialogContiner .dialog .btn-agree:hover {
  205. background-color: #fff;
  206. }
  207. .dialogContiner .dialog view.title {
  208. font-size: 40upx;
  209. line-height: 100upx;
  210. position: relative;
  211. }
  212. .dialogContiner .dialog view.title::after {
  213. content: '';
  214. position: absolute;
  215. left: 0;
  216. right: 0;
  217. bottom: 0;
  218. height: 1px;
  219. transform: scaleY(0.5);
  220. background-color: rgba(234, 234, 234, 1);
  221. }
  222. .dialogContiner .dialog view.info {
  223. font-size: 26upx;
  224. line-height: 30upx;
  225. color: rgba(22, 23, 42, 0.5);
  226. padding: 40upx;
  227. }
  228. </style>