personalCenter.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <template>
  2. <view class="container">
  3. <view class="content">
  4. <image :src="iconUrl.page_topBg" class="topBg_img"></image>
  5. <view class="top_box">
  6. <view class="topBox_title" :style="{marginTop: statusBarHeight + 'px', height: '44px', lineHeight: '44px'}">我的</view>
  7. </view>
  8. <view class="userBox" @click="currentUser.memberId ? goMemberList($event) : perfectInfo($event)">
  9. <image class="personalCenter_topBg" :src="iconUrl.personalCenter_memberbg"></image>
  10. <view class="user_wxinfo_box displayFlexBetween">
  11. <view class="displayFlexLeft">
  12. <view class="">
  13. <image class="personalImg" :src="iconUrl.personalCenter_memberT"/>
  14. <image class="credit_Img" v-if="currentUser.memberName" :src="currentUser.creditRemark !='1' ? iconUrl.credit_iconStateRisk:iconUrl.credit_iconStateExcellent"/>
  15. </view>
  16. <view v-if="currentUser.memberId">
  17. <view class="info_memberMsg">
  18. <text>{{currentUser.memberName}}</text>
  19. <text class="tag" v-if="currentUser.memberType == 1">{{currentUser.relationName}}</text>
  20. <text class="tag">默认就诊人</text>
  21. </view>
  22. <view class="memberInfo_cardInfo">
  23. {{currentUser.cardType == 14 ? "住院号" : "就诊卡号"}}:{{currentUser.cardNo ? currentUser.cardNo : "无" }}
  24. </view>
  25. </view>
  26. <block v-else>
  27. <text class="addMemberText">添加就诊人</text>
  28. </block>
  29. </view>
  30. <view class="electronMedical displayFlexCol" @click.stop="clickElectronMedical" v-if="currentUser.memberType == 1">
  31. <image class="electronMedical_img" :src="iconUrl.dzybpz"></image>
  32. <view class="electronMedical_txt">刷医保码</view>
  33. </view>
  34. <view class="choice_patient_btn">
  35. 就诊卡管理
  36. </view>
  37. </view>
  38. </view>
  39. <view class="operationModule" v-if="currentUser.memberId">
  40. <view class="moduleBox displayFlexBetween">
  41. <view class="displayFlexLeft">
  42. <image class="moduleImag" :src="iconUrl.personalCenter_ref"></image>
  43. <view class="moduleInfo">
  44. <view class="moduleInfo_txt">预缴退费</view>
  45. <view>预缴金充值后,是否14天后自动进行退费</view>
  46. </view>
  47. </view>
  48. <switch color="var(--dominantColor)" :checked="currentUser.autoRemark == 1" @change="switchChangeFn"/>
  49. </view>
  50. </view>
  51. <view class="menuBox">
  52. <template v-for="(item, index) in menuObj.Children" :key="index">
  53. <view class="menuBox_list" v-if="item.IsShow=='1'">
  54. <view class="menuBox_listTitle">{{item.MenuName}}</view>
  55. <view class="displayFlexLeft">
  56. <template v-for="(subItem, subIndex) in item.Children" :key="subIndex">
  57. <view class="list_item displayFlexCol" v-if="subItem.IsShow=='1'" @click="menuClickFn(subItem, item)">
  58. <image class="list_item_img" :src="subItem.Icon"></image>
  59. <text class="list_item_text">{{subItem.MenuName}}</text>
  60. </view>
  61. </template>
  62. </view>
  63. </view>
  64. </template>
  65. </view>
  66. </view>
  67. </view>
  68. </template>
  69. <script lang="ts" setup>
  70. import { getCurrentInstance, nextTick, ref } from 'vue';
  71. import { useIsToAuthPage, usePreserMember, queryMemberCardList_V3 } from '../../../../../hook';
  72. import { onShow } from '@dcloudio/uni-app';
  73. import { common, menuClick } from '@/utils';
  74. import icon from '@/utils/icon';
  75. import store from '@/store';
  76. import { queryMemberHeaderInfo, saveAutoRefundMark } from '@/pages/st1/service';
  77. const { proxy } = getCurrentInstance() as any;
  78. const app = getApp();
  79. const iconUrl = ref(icon)
  80. const memberNum = ref(0)
  81. const relativesNum = ref(0)
  82. const menuObj = ref<any>({}) //菜单选项
  83. const currentUser = ref<any>({})
  84. const statusBarHeight = ref<any>("")
  85. onShow(async () => {
  86. /**当前的业务类型,006表示互联网医院 空表示普通的挂号业务 */
  87. app.globalData.sourceType = ""
  88. /**点击menu时进入添加就诊人 会设置toUrl 如果后退 需清空 否则从个人中心进入添加就诊人后 会进入toUrl页面 */
  89. app.globalData.toUrl = ""
  90. if (useIsToAuthPage()) {
  91. return
  92. }
  93. main()
  94. })
  95. const main = async () => {
  96. statusBarHeight.value = JSON.parse(app.globalData.smallPro_systemInfo).statusBarHeight || 20
  97. menuObj.value = (uni.getStorageSync('menuList') || []).filter((item: any) => item.MenuName == 'PersonalCenter')[0] || {}
  98. getMember()
  99. }
  100. /**
  101. * 获取就诊人
  102. */
  103. const getMember = async () => {
  104. let currentUsertemp = null
  105. let memberList = store.state.memberList || []
  106. if (!memberList.length) {
  107. await usePreserMember()
  108. memberList = store.state.memberList || []
  109. }
  110. if (common.isNotEmpty(memberList)) {
  111. let memberLists = memberList.filter((item: any) => item.userMemberList[0].isDefaultMember == 1)
  112. // 判断过滤默认操作人 : 没有默认操作人查询人列表第一条
  113. currentUsertemp = common.isNotEmpty(memberLists) ? memberLists[0] : memberList[0]
  114. if (common.isNotEmpty(currentUsertemp)) {
  115. let cardInfo = typeof currentUsertemp.memberOtherInfo == 'object' ? currentUsertemp.memberOtherInfo : JSON.parse(currentUsertemp.memberOtherInfo)
  116. if (common.isEmpty(cardInfo.defaultCard)) {
  117. let cardResp = await queryMemberCardList_V3(currentUsertemp.memberId)
  118. cardInfo = cardResp.filter((item: any) => item.cardType == 1)[0]
  119. }else{
  120. cardInfo = cardInfo.defaultCard
  121. }
  122. // 判断是否存在默认就诊卡
  123. currentUsertemp = {
  124. ...currentUsertemp,
  125. cardNo: cardInfo?.cardNo,
  126. encryptionStore: cardInfo?.cardEncryptionStore || cardInfo?.encryptionStore || '',
  127. cardType: '1' //返回的默认就诊卡都为就诊卡类型
  128. }
  129. app.globalData.currentUser = currentUsertemp
  130. getQueryMemberHeaderInfo(currentUsertemp)
  131. }
  132. }
  133. currentUser.value = currentUsertemp || {}
  134. console.log("currentUser.value======",currentUser.value)
  135. }
  136. /**
  137. * 点击就诊人列表
  138. */
  139. const goMemberList = (e: any) => {
  140. common.goToUrl(`/pagesPersonal/st1/business/patientManagement/memberList/memberList?pageType=memberList`)
  141. }
  142. // 打开医保电子凭证
  143. const clickElectronMedical = () => {
  144. uni.navigateToMiniProgram({
  145. appId: "wxb032bc789053daf4",
  146. path: "pages/esscard/scancode-nhsa/main?channel=AAEQHg2Pe4b-JhLqiIyHf2g0&cityCode=350000",
  147. })
  148. }
  149. // 菜单点击
  150. // 封装后的菜单点击,适配 data-item 传参
  151. const menuClickFn = (item: any, parent: any) => {
  152. // 构造类似小程序事件对象的结构,或者直接传参给 menuClick 如果它支持
  153. // 这里为了兼容 utils/menuClick 的调用方式 (e, proxy),我们构造一个伪事件对象
  154. const e = {
  155. currentTarget: {
  156. dataset: {
  157. item: item,
  158. 'item-parent': parent
  159. }
  160. }
  161. };
  162. menuClick(e, proxy)
  163. }
  164. // 添加就诊人
  165. const perfectInfo = () => {
  166. common.goToUrl(`/pagesPersonal/st1/business/patientManagement/selecteBindCardMode/selecteBindCardMode`)
  167. }
  168. /** 获取信用分 */
  169. const getQueryMemberHeaderInfo = async (user: any) => {
  170. let { resp } = await queryMemberHeaderInfo({
  171. memberId: user.memberId,
  172. // accountSn:currentUser.accountSn
  173. })
  174. let creditList: any = {
  175. "信用较好":1,
  176. "信用良好":1,
  177. "信用一般":1,
  178. "信用欠佳":2,
  179. "信用宜昌":2,
  180. }
  181. currentUser.value.autoRemark = common.isNotEmpty(resp)?resp[0].autoRemark : ''
  182. currentUser.value.creditRemark = common.isNotEmpty(resp)?creditList[resp[0].credit] : ''
  183. }
  184. /**
  185. * 设置是否可退费
  186. */
  187. const switchChangeFn = async (e: any) => {
  188. let value = e.detail.value;
  189. await saveAutoRefundMark({
  190. memberId: currentUser.value.memberId,
  191. autoRefundMark : value?1:0
  192. })
  193. getQueryMemberHeaderInfo(currentUser.value)
  194. }
  195. </script>
  196. <style lang="scss" scoped>
  197. .container,
  198. .content {
  199. background-color: #f6f7f8;
  200. }
  201. .topBg_img {
  202. width: 100%;
  203. height: 750upx;
  204. position: fixed;
  205. top: 0;
  206. left: 0;
  207. }
  208. .top_box {
  209. position: relative;
  210. z-index: 1;
  211. padding: 0 30upx;
  212. }
  213. .topBox_title {
  214. width: 100%;
  215. font-size: 32upx;
  216. font-family: Source Han Sans CN;
  217. font-weight: 500;
  218. color: #000000;
  219. text-align: center;
  220. }
  221. .userBox {
  222. position: relative;
  223. margin: 30upx ;
  224. }
  225. .userBox .personalCenter_topBg {
  226. position: absolute;
  227. width: 100%;
  228. height: 205upx;
  229. }
  230. .user_wxinfo_box {
  231. background-color: initial;
  232. padding: 0 25upx;
  233. position: relative;
  234. display: flex;
  235. height: 205upx;
  236. }
  237. .user_wxinfo_box .personalImg {
  238. width: 109upx;
  239. height: 109upx;
  240. margin-right: 19upx;
  241. }
  242. .user_wxinfo_box .credit_Img {
  243. width: 109upx;
  244. height: 34upx;
  245. margin-top: -17upx;
  246. }
  247. .user_wxinfo_box .info_memberMsg {
  248. font-size: 36upx;
  249. font-family: PingFang SC;
  250. font-weight: bold;
  251. color: #FFFFFF;
  252. margin-bottom: 20upx;
  253. }
  254. .user_wxinfo_box .info_memberMsg .tag{
  255. font-size: 22upx;
  256. background-color: #fff;
  257. height: 32upx;
  258. line-height: 32upx;
  259. padding: 0 6upx;
  260. margin-left: 10upx;
  261. border-radius: 4upx;
  262. color: var(--dominantColor);
  263. }
  264. .user_wxinfo_box .addMemberText{
  265. font-size: 36upx;
  266. color: #fff;
  267. }
  268. .user_wxinfo_box .memberInfo_cardInfo{
  269. color: #FFFFFF;
  270. font-size: 28upx;
  271. }
  272. .user_wxinfo_box image.right-arrow {
  273. width: 16upx;
  274. height: 20upx;
  275. margin-left: 14upx;
  276. }
  277. .user_wxinfo_box .electronMedical {
  278. position: absolute;
  279. right: 32upx;
  280. top: 70upx;
  281. }
  282. .user_wxinfo_box .electronMedical_img{
  283. width: 104upx;
  284. height: 104upx;
  285. }
  286. .user_wxinfo_box .electronMedical_txt{
  287. margin-top: -10upx;
  288. color: #fff;
  289. font-size: 20upx;
  290. }
  291. .user_wxinfo_box .choice_patient_btn{
  292. font-size: 22upx;
  293. text-align: center;
  294. position: absolute;
  295. right: 32upx;
  296. top: 32upx;
  297. color: var(--dominantColor);
  298. }
  299. .operationModule{
  300. position: relative;
  301. background: #FFFFFF;
  302. border-radius: 24upx;
  303. margin: 30upx;
  304. padding: 0 20upx;
  305. }
  306. .operationModule .moduleBox{
  307. height: 132upx;
  308. }
  309. .operationModule .moduleImag{
  310. width: 58upx;
  311. height: 58upx;
  312. margin-right: 18upx;
  313. }
  314. .operationModule .moduleInfo{
  315. font-size: 22upx;
  316. color: #999999;
  317. }
  318. .operationModule .moduleInfo_txt{
  319. font-size: 28upx;
  320. color: #43434A;
  321. margin-bottom: 12upx;
  322. }
  323. .operationModule .credit .credit_btn{
  324. width: 130upx;
  325. height: 50upx;
  326. position: relative;
  327. font-size: 24upx;
  328. color: var(--dominantColor) !important;
  329. }
  330. .operationModule .credit .credit_btn .bg{
  331. background-color: var(--dominantColor);
  332. opacity: .2;
  333. position: absolute;
  334. width: 100%;
  335. height: 100%;
  336. top: 0upx;
  337. left: 0upx;
  338. z-index: 0;
  339. border-radius: 25upx;
  340. }
  341. .menuBox{
  342. position: relative;
  343. }
  344. .menuBox_list {
  345. background: #FFFFFF;
  346. border-radius: 24upx;
  347. margin: 30upx;
  348. padding: 30upx 0 40upx;
  349. }
  350. .menuBox_list .menuBox_listTitle{
  351. font-size: 32upx;
  352. font-family: PingFang SC;
  353. font-weight: bold;
  354. color: #222326;
  355. padding-left: 37upx;
  356. }
  357. .menuBox_list .list_item {
  358. width: 25%;
  359. margin-top: 47upx;
  360. }
  361. .menuBox_list .list_item .list_item_img {
  362. width: 56upx;
  363. height: 56upx;
  364. margin-bottom: 16upx;
  365. }
  366. .menuBox_list .list_item .list_item_text {
  367. font-size: 28upx;
  368. font-family: PingFang SC;
  369. color: #222326;
  370. }
  371. </style>