index.vue 16 KB

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