index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. <template>
  2. <view style="">
  3. <view class="userInfo" style="padding: 0 13px">
  4. <u-row customStyle="padding-bottom: 5px">
  5. <u-col span="4">
  6. <view style="text-align: center;font-size: 14px; margin: 0 0 0 10px;border-radius: 10px;">
  7. <u-avatar shape="square" size="70" :showLoading="true" :src="baseURL+userInfo.avatar"
  8. width="70px" height="70px" lazyLoad="false"></u-avatar>
  9. <!-- <image class="avatar" src=""> -->
  10. </view>
  11. </u-col>
  12. <u-col span="5">
  13. <view>
  14. <u-col>
  15. <view style="font: 25px Verdana;">
  16. {{userInfo.nickName}}
  17. </view>
  18. </u-col>
  19. </view>
  20. </u-col>
  21. </u-row>
  22. <u-row style="font-size: 12px;padding-top: 5px;">
  23. <u-col span="4">
  24. <view v-if="type !== 0" style="padding-left: 20px;">
  25. <span v-if="userInfo.userType === null">
  26. </span>
  27. <span v-if="userInfo.userType === '1'">事业编群
  28. </span>
  29. <span v-if="userInfo.userType === '2'">非事业编群
  30. </span>
  31. <span v-if="userInfo.userType === '3'">第三方外包
  32. </span>
  33. <span v-if="userInfo.userType === '4'">护工群
  34. </span>
  35. </view>
  36. </u-col>
  37. <u-col span="4">
  38. <view>
  39. <span>{{"至:"+userInfo.effectiveDate}}</span>
  40. </view>
  41. </u-col>
  42. <u-col span="4">
  43. <view style="text-align: center;">
  44. <span>
  45. {{userInfo.userName}}
  46. </span>
  47. </view>
  48. </u-col>
  49. </u-row>
  50. </view>
  51. <view class="gongNengList">
  52. <u-cell-group>
  53. <view>
  54. <!-- style="border: 10rpx #f5f5f5 solid;" -->
  55. <picker @change="bindPickerChange" :value="index" :range="columns[0]">
  56. <view
  57. style="
  58. padding: 5rpx 0;
  59. margin-bottom: 20rpx;
  60. border-bottom-left-radius: 150rpx;
  61. border-bottom-right-radius: 150rpx;
  62. background-color: rgb(55,186,189);color:#FFFFFF;text-align: center;font-size: 30rpx;letter-spacing:20rpx;font-weight: bold;">
  63. <view style="margin: 0 auto;">
  64. <u--text bold :iconStyle="{color: 'rgb(255, 255, 255)',fontSize:'40rpx'}"
  65. suffixIcon="arrow-down" :text="orgName" color="rgb(255, 255, 255)" size="18">
  66. </u--text>
  67. </view>
  68. </view>
  69. </picker>
  70. </view>
  71. <u-cell icon="account" title="个人档案" @click="toProFilePage" :isLink="true"></u-cell>
  72. <u-gap height="10" bgColor="#f5f5f5"></u-gap>
  73. <view v-if="type === 2">
  74. <u-cell icon="calendar" title="会积分" :isLink="true" @click="toHZLPage">
  75. </u-cell>
  76. <u-cell icon="rmb-circle" title="积分余额" value="">
  77. <u--text slot="right-icon" :text="acTitle" color="rgb(55,186,189)"></u--text>
  78. <u--text slot="right-icon" :text="amassScore" color="rgb(55,186,189)"></u--text>
  79. </u-cell>
  80. <u-cell icon="calendar" title="积分订单" @click="toExpenseCalendarPage2" :isLink="true">
  81. <u--text v-if="isNews !== '0'" slot="right-icon" text="新消息" color="rgb(55,186,189)"></u--text>
  82. </u-cell>
  83. </view>
  84. <view v-if="type !== 4">
  85. <u-cell icon="rmb-circle" title="积分余额" value="">
  86. <!-- <u-badge count="99" :absolute="false" slot="right-icon"></u-badge> -->
  87. <u--text slot="right-icon" :text="acTitle" color="rgb(55,186,189)"></u--text>
  88. <u--text slot="right-icon" :text="userInfo.integral" color="rgb(55,186,189)"></u--text>
  89. </u-cell>
  90. <u-cell icon="rmb-circle" title="记账额度" value="">
  91. <u--text slot="right-icon" :text="acTitle" color="rgb(55,186,189)"></u--text>
  92. <u--text slot="right-icon" :text="userInfo.quota" color="rgb(55,186,189)"></u--text>
  93. </u-cell>
  94. <u-cell icon="rmb-circle" title="押金" value="">
  95. <u--text slot="right-icon" :text="acTitle" color="rgb(55,186,189)"></u--text>
  96. <u--text slot="right-icon" :text="userInfo.deposit" color="rgb(55,186,189)"></u--text>
  97. </u-cell>
  98. <u-gap height="10" bgColor="#f5f5f5"></u-gap>
  99. <u-cell icon="calendar" title="消费记录" @click="toExpenseCalendarPage" :isLink="true">
  100. </u-cell>
  101. <u-cell icon="calendar" title="兑换记录" @click="toExpenseCalendarPageDh" :isLink="true">
  102. </u-cell>
  103. <u-cell icon="attach" title="绑定卡片" :isLink="true" @click="toCardPage" :value="isCardBindingText">
  104. </u-cell>
  105. <u-cell icon="clock" title="充值历史记录" @click="toRechargeHistoryPage" :isLink="true">
  106. </u-cell>
  107. </view>
  108. <u-gap height="10" bgColor="#f5f5f5"></u-gap>
  109. <!-- <u-cell icon="bell" title="消息提醒" @click="toNotificationPage" :isLink="true"></u-cell> -->
  110. <u-cell icon="setting" title="系统设置" :isLink="true" @click="toSetting"></u-cell>
  111. <u-cell icon="attach" title="公众号授权" :isLink="true" @click="toSouquan"></u-cell>
  112. <u-cell icon="reload" title="退出登录" @click="isOutLoginShow" :isLink="true"></u-cell>
  113. <view style="background-color: #f5f5f5;height: 30px;">
  114. <view style="text-align: center;width: 100%;padding: 0;font-size: 12px;color: #dedede;">
  115. <text style="margin: 5px;">会山科技 | hzl@willalp.com</text>
  116. </view>
  117. </view>
  118. </u-cell-group>
  119. </view>
  120. <u-modal :show="modalContent1.show" :title="modalContent1.title" :showCancelButton="true" confirmColor="#53a591"
  121. @confirm="outLogin" @cancel="isOutLoginShow">
  122. {{modalContent1.content}}
  123. </u-modal>
  124. <!-- <wp-tabbar pagePath="/pages/user/index" :type="type"></wp-tabbar> -->
  125. </view>
  126. </template>
  127. <script>
  128. export default {
  129. data() {
  130. return {
  131. amassScore: 0,
  132. index: 0,
  133. orgName: '',
  134. baseURL: this.$BASE_URL,
  135. orglistShow: false,
  136. avathrSrc: 'http://114.115.142.166/static/img/willalp.c4ec824a.jpg',
  137. //avathrSrc: 'D:/hs/WQX_HS/wqx_uniapp_demo/hs_uView_demo/static/uview/willalpImg/750x560-.png',
  138. acTitle: '',
  139. userInfo: {
  140. avatar: '',
  141. nickName: '',
  142. userName: '',
  143. userType: '',
  144. organizationCode: '',
  145. integral: 0.0,
  146. date: Number(new Date()),
  147. },
  148. modalContent1: {
  149. show: false,
  150. title: '提示',
  151. content: '确认退出登录吗?'
  152. },
  153. isCardBindingText: '未绑定',
  154. from: {
  155. },
  156. show: false,
  157. columns: [],
  158. orgInfo: {
  159. organizationName: '',
  160. organizationCode: '',
  161. },
  162. data: {
  163. },
  164. type: undefined,
  165. isNews: '0'
  166. }
  167. },
  168. mounted() {
  169. this.userInfo = null
  170. this.isGetUserInfo()
  171. this.getAppUserInfo()
  172. uni.setStorageSync('isTabLogin', 1)
  173. this.type = uni.getStorageSync("tabType")
  174. this.userInfo = null
  175. this.isGetUserInfo()
  176. this.getAppUserInfo()
  177. },
  178. onShow() {
  179. uni.reLaunch({
  180. url: '/pages/tabbar/wpTabbar'
  181. })
  182. this.type = uni.getStorageSync("tabType")
  183. this.userInfo = null
  184. this.isGetUserInfo()
  185. this.getAppUserInfo()
  186. },
  187. onPullDownRefresh() {
  188. this.getAppUserInfo()
  189. this.isGetUserInfo()
  190. },
  191. onHide() {
  192. },
  193. methods: {
  194. bindPickerChange: function(e) {
  195. this.index = parseInt(e.detail.value)
  196. this.subOrgLogin()
  197. this.show = false;
  198. uni.setStorageSync("isRefresh", 1)
  199. },
  200. async subOrgLogin(orgCode) {
  201. let form = uni.getStorageSync("loginForm")
  202. form.orgCode = this.columns[1][this.index].organizationCode
  203. uni.showLoading({
  204. mask: true,
  205. title: "正在切换"
  206. })
  207. // 发送请求
  208. const {
  209. data: res
  210. } = await this.$httpRequest({
  211. url: '/api/subOrgLogin',
  212. method: 'post',
  213. urlType: 1,
  214. data: form,
  215. isNotToken: true
  216. });
  217. if (res.code === 200) {
  218. uni.setStorageSync('refreshStart', 0)
  219. uni.setStorageSync('isTabLogin', 0)
  220. this.orgInfo = this.columns[1][this.index]
  221. uni.setStorageSync('orgInfo', this.orgInfo);
  222. this.orgName = this.columns[0][this.index]
  223. let port
  224. if (this.orgInfo.organizationCode === 'G00000003') {
  225. uni.setStorageSync("tabType", 2)
  226. this.type = 2
  227. port = 3010
  228. } else if (this.orgInfo.organizationCode === 'G00000007') {
  229. uni.setStorageSync("tabType", 3)
  230. this.type = 3
  231. port = 3005
  232. } else if (this.orgInfo.organizationCode === 'G00000005') {
  233. uni.setStorageSync("tabType", 4)
  234. this.type = 4
  235. port = 3012
  236. }
  237. //写入 【webSocket】 地址
  238. let ws = this.$BASE_SOCKET_URL + ':' + port
  239. uni.setStorageSync("wsServerUrl", ws)
  240. this.$wsConnection.close()
  241. this.$wsConnection.initRequest()
  242. const data = res.loginUser.user
  243. uni.setStorageSync('setUserName', data.userName);
  244. uni.setStorageSync('token', res.token);
  245. uni.setStorageSync('QRcodeToken', res.loginUser.token);
  246. uni.setStorageSync('refreshStart', 1)
  247. uni.setStorageSync('isTabLogin', 1)
  248. this.$emit('setType', this.type)
  249. this.getAppUserInfo()
  250. this.isGetUserInfo()
  251. this.$getAllConfigData()
  252. this.$getAllDicts()
  253. uni.setNavigationBarTitle({
  254. title: uni.getStorageSync("orgInfo").organizationName
  255. })
  256. setTimeout(() => {
  257. uni.hideLoading()
  258. }, 1200)
  259. } else {
  260. uni.setStorageSync('refreshStart', 0)
  261. uni.setStorageSync('isTabLogin', 0)
  262. setTimeout(() => {
  263. uni.hideLoading()
  264. }, 1200)
  265. }
  266. },
  267. async getOrderInfo() {
  268. const {
  269. data: res
  270. } = await this.$httpRequest({
  271. url: '/app/orderIsNews',
  272. method: 'get',
  273. })
  274. if (res.code == 200) {
  275. this.isNews = res.msg
  276. } else {}
  277. },
  278. async getDataAmassScore(data) {
  279. const {
  280. data: res
  281. } = await this.$httpRequest({
  282. url: '/app/ac?uc=' + uni.getStorageSync("setUserName"),
  283. method: 'get',
  284. urlType: this.$getUrlType()
  285. });
  286. if (res.code === 200) {
  287. this.amassScore = res.data
  288. } else {
  289. uni.showToast({
  290. duration: 2500,
  291. title: res.msg,
  292. icon: 'error',
  293. });
  294. }
  295. },
  296. async getWillalpAc(data) {
  297. const {
  298. data: res
  299. } = await this.$httpRequest({
  300. url: '/app/ac?uc=' + uni.getStorageSync("setUserName"),
  301. method: 'get',
  302. urlType: 2
  303. });
  304. if (res.code === 200) {
  305. this.$showModal("发放成功")
  306. } else {
  307. uni.showToast({
  308. duration: 2500,
  309. title: res.msg,
  310. icon: 'error',
  311. });
  312. }
  313. },
  314. toHZLPage() {
  315. this.$goto('../../pageA/card/index')
  316. },
  317. takeMeal() {
  318. var that = this;
  319. uni.scanCode({
  320. scanType: ['qrCode'],
  321. success: function(res) {
  322. // uni.showModal({
  323. // content: JSON.stringify(res),
  324. // })
  325. uni.setStorageSync("rfiCard", res.result)
  326. that.$goto('../../pageA/card/activetion');
  327. },
  328. fail: function(a) {},
  329. complete: function(b) {}
  330. })
  331. },
  332. //uniPush 2.0
  333. getPushCid() {
  334. if (undefined !== plus) {
  335. let pinf = plus.push.getClientInfo();
  336. //客户端标识
  337. //let cid = pinf && pinf.clientid || '';
  338. const userInfo = uni.getStorageSync('userInfo');
  339. const orgInfo = uni.getStorageSync('orgInfo');
  340. this.data.userNo = userInfo.userName
  341. this.data.userName = userInfo.nickName
  342. this.data.orgNo = orgInfo.organizationCode
  343. this.data.orgName = orgInfo.organizationName
  344. this.data.pushCid = cid //'b588d2a110c79b7591de409c17719ef2'
  345. this.savePushCid(this.data)
  346. }
  347. },
  348. async savePushCid(data) {
  349. const {
  350. data: res
  351. } = await this.$httpRequest({
  352. url: '/api/push/save/cid',
  353. method: 'post',
  354. data: data
  355. })
  356. if (res.code == 200) {
  357. console.log("update - push - cid")
  358. } else {}
  359. },
  360. async getAppUserInfo() {
  361. this.acTitle = this.orgInfo.organizationName.substring(0, 1) + ":"
  362. this.from.userName = uni.getStorageSync('setUserName');
  363. this.from.organizationCode = uni.getStorageSync("orgInfo").organizationCode;
  364. // 发送请求
  365. const {
  366. data: res
  367. } = await this.$httpRequest({
  368. url: '/app/getUser',
  369. data: this.from,
  370. urlType: this.$getUrlType()
  371. });
  372. if (res.code === 200) {
  373. const data = res.data
  374. uni.setStorageSync("userInfo", data)
  375. this.userInfo = uni.getStorageSync("userInfo")
  376. this.getDataAmassScore()
  377. }
  378. uni.stopPullDownRefresh()
  379. },
  380. confirm(e) {
  381. this.orgInfo = e.value[0];
  382. let port
  383. if (this.orgInfo.organizationCode === 'G00000003') {
  384. uni.setStorageSync("tabType", 2)
  385. port = 3010
  386. } else if (this.orgInfo.organizationCode === 'G00000007') {
  387. uni.setStorageSync("tabType", 3)
  388. port = 3005
  389. } else if (this.orgInfo.organizationCode === 'G00000005') {
  390. uni.setStorageSync("tabType", 4)
  391. port = 3012
  392. }
  393. //写入 【webSocket】 地址
  394. let ws = this.$BASE_SOCKET_URL + ':' + port
  395. uni.setStorageSync("wsServerUrl", ws)
  396. uni.setStorageSync("orgInfo", this.orgInfo);
  397. uni.setStorageSync("isRefresh", 1);
  398. this.getAppUserInfo()
  399. this.isGetUserInfo()
  400. this.$wsConnection.close()
  401. this.$wsConnection.initRequest()
  402. this.show = false;
  403. },
  404. cancel() {
  405. this.show = false
  406. },
  407. isOutLoginShow() {
  408. if (this.modalContent1.show) {
  409. this.modalContent1.show = false
  410. } else {
  411. this.modalContent1.show = true
  412. }
  413. },
  414. isShowOrgInfo() {
  415. if (0 === this.columns[0].length) {
  416. uni.showModal({
  417. title: '提示',
  418. content: '请联系机构管理员激活账户',
  419. showCancel: false
  420. });
  421. return;
  422. }
  423. this.show = true
  424. },
  425. isGetUserInfo() {
  426. const value = uni.getStorageSync('userInfo');
  427. if (value) {
  428. //有登录信息
  429. this.userInfo = value
  430. const {
  431. userName,
  432. cardNumber
  433. } = this.userInfo
  434. this.from.userName = userName
  435. this.isCardBindingText = cardNumber ? '已绑定' : '未绑定'
  436. //console.log("已登录用户:", value);
  437. const orgInfo = uni.getStorageSync("orgInfo");
  438. if (orgInfo) {
  439. let orgList = uni.getStorageSync("orglist")
  440. this.columns = [
  441. [],
  442. []
  443. ]
  444. orgList[0].forEach(item => {
  445. this.columns[0].push(item.organizationName)
  446. })
  447. this.columns[1] = orgList[0]
  448. this.orgName = uni.getStorageSync("orgInfo").organizationName
  449. this.index = uni.getStorageSync("tabType")
  450. //获取提交的机构信息
  451. const {
  452. organizationName,
  453. organizationCode
  454. } = orgInfo
  455. this.orgInfo.organizationName = organizationName
  456. } else {
  457. uni.showToast({
  458. icon: 'none',
  459. title: '未选择机构',
  460. duration: 2000
  461. });
  462. uni.redirectTo({
  463. url: '../../pageA/login/selectOrg'
  464. })
  465. }
  466. } else {
  467. uni.showToast({
  468. icon: 'none',
  469. title: '用户信息过期请重新登录',
  470. duration: 2000
  471. });
  472. uni.redirectTo({
  473. url: '../../pageA/login/login'
  474. });
  475. }
  476. },
  477. async getNotRead() {
  478. const {
  479. data: res
  480. } = await this.$httpRequest({
  481. url: '/api/yq/notRead/?userNo=' + uni.getStorageSync("setUserName") +
  482. "&orgNo=" + uni.getStorageSync("orgInfo").organizationCode,
  483. method: 'get',
  484. })
  485. if (res.code == 200) {
  486. var num = res.data
  487. if (0 < num) {
  488. uni.setTabBarBadge({
  489. index: 1,
  490. text: num + ""
  491. })
  492. }
  493. }
  494. },
  495. toSetting() {
  496. uni.navigateTo({
  497. url: "../../pages/user/settings/settings"
  498. })
  499. },
  500. toSouquan() {
  501. uni.navigateTo({
  502. url: "../../pageA/login/getOpenId"
  503. })
  504. },
  505. //退出登录
  506. outLogin() {
  507. //关闭WebSocket连接
  508. this.$wsConnection.close()
  509. //清空所有本地缓存
  510. uni.clearStorageSync()
  511. uni.reLaunch({
  512. url: '../../pageA/login/login'
  513. })
  514. },
  515. toProFilePage() {
  516. uni.navigateTo({
  517. url: "../../pages/user/profile"
  518. })
  519. },
  520. toExpenseCalendarPage2() {
  521. uni.navigateTo({
  522. url: "../../pageA/card/expense/expenseCalendar"
  523. })
  524. },
  525. toExpenseCalendarPage() {
  526. uni.navigateTo({
  527. url: "../../pages/user/expense/expenseCalendar"
  528. })
  529. },
  530. toExpenseCalendarPageDh() {
  531. uni.navigateTo({
  532. url: "../../pageA/integral/expenseCalendar"
  533. })
  534. },
  535. toRechargeHistoryPage() {
  536. uni.navigateTo({
  537. url: "../../pages/user/rechargeHistory"
  538. })
  539. },
  540. toCardPage() {
  541. uni.navigateTo({
  542. url: "../../pages/user/card"
  543. })
  544. },
  545. toNotificationPage() {
  546. uni.navigateTo({
  547. url: "../../pages/user/notification"
  548. })
  549. },
  550. toControlPage() {
  551. uni.navigateTo({
  552. url: "../control/index"
  553. })
  554. }
  555. }
  556. }
  557. </script>
  558. <style>
  559. .userInfo {
  560. box-shadow: 0px 2px 2px #9e9e9e;
  561. margin-top: 10rpx;
  562. }
  563. .avatar {
  564. margin: 10px;
  565. width: 70px;
  566. height: 70px;
  567. border-radius: 50px;
  568. }
  569. .gongNengList {
  570. border-radius: 10px;
  571. }
  572. .uni-fixed-bottom {
  573. width: 100%;
  574. bottom: 0upx;
  575. padding: 0upx;
  576. position: fixed;
  577. background: #FFFFFF;
  578. transform: translateZ(0);
  579. bottom: env(safe-area-inset-bottom);
  580. bottom: constant(safe-area-inset-bottom);
  581. }
  582. </style>