mine.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. <template>
  2. <!-- :class="{noVip : noVip}" -->
  3. <view class="my-box">
  4. <!-- <u-navbar leftIcon=" " titleStyle="font-size:36rpx;line-height: 36rpx;font-weight:bold;"
  5. :bgColor="noVip ? '#fff' : '#FACA2E'" title="我的" placeholder="">
  6. </u-navbar> -->
  7. <view class="user-top-box">
  8. <view class="user-info-box">
  9. <view class="info-box-l">
  10. <view class="img-box">
  11. <u-avatar :src="userInfo.avatar || defaultImg" size="121rpx" mode="aspectFill"></u-avatar>
  12. </view>
  13. <view class="info-r">
  14. <span class="name" v-if="isLogin" @click="toUserInfo">{{userInfo.nickname || '-'}}</span>
  15. <span class="name" v-else @click="toLogin">登录/注册</span>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="func-box">
  21. <view class="func-item" @click="toPath('/pages/mine/patient/patient')">
  22. <view class="func-item-l">
  23. <image class="icon" src="/static/my/icon-01.png" mode="aspectFill"></image>
  24. <span class="name">就诊人信息</span>
  25. </view>
  26. <view class="func-item-r">
  27. <image class="icon" src="/static/my/right.png" mode="aspectFill"></image>
  28. </view>
  29. </view>
  30. <view class="func-item">
  31. <button open-type="contact" class="btn">
  32. <view class="func-item-l">
  33. <image class="icon" src="/static/my/icon-02.png" mode="aspectFill"></image>
  34. <span class="name">微信客服</span>
  35. </view>
  36. <view class="func-item-r">
  37. <image class="icon" src="/static/my/right.png" mode="aspectFill"></image>
  38. </view>
  39. </button>
  40. </view>
  41. <view class="func-item" @click="toPath('/pages/mine/helpCenter')">
  42. <view class="func-item-l">
  43. <image class="icon" src="/static/my/icon-03.png" mode="aspectFill"></image>
  44. <span class="name">帮助中心</span>
  45. </view>
  46. <view class="func-item-r">
  47. <image class="icon" src="/static/my/right.png" mode="aspectFill"></image>
  48. </view>
  49. </view>
  50. <view class="func-item" @click="toPath('/pages/mine/agreement?type=user_protocol')">
  51. <view class="func-item-l">
  52. <image class="icon" src="/static/my/icon-04.png" mode="aspectFill"></image>
  53. <span class="name">用户协议</span>
  54. </view>
  55. <view class="func-item-r">
  56. <image class="icon" src="/static/my/right.png" mode="aspectFill"></image>
  57. </view>
  58. </view>
  59. </view>
  60. <!-- 护工端和管理端 -->
  61. <view class="platform-box">
  62. <view class="platform-item" @click="toPath('/pages/workbench/caregiver', 'hugong')" v-if="userInfo.workerId">
  63. <image class="platform-img" src="/static/my/icon-04.png" mode="aspectFill"></image>
  64. <span class="platform-name">护工工作台</span>
  65. </view>
  66. <view class="platform-item" @click="toPath('/pages/workbench/manager', 'guanli')" v-if="userInfo.teacherId">
  67. <image class="platform-img" src="/static/my/icon-03.png" mode="aspectFill"></image>
  68. <span class="platform-name">管理老师工作台</span>
  69. </view>
  70. </view>
  71. <view class="logout-btn" v-if="isLogin">
  72. <span class="btn" @click="logOut">退出登录</span>
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. import {
  78. UserInfo
  79. } from "@/utils/tools.js"
  80. export default {
  81. data() {
  82. return {
  83. defaultImg: require('@/static/default-head-photo.png'),
  84. // defaultImg: this.getImgSrc('shop/pro.jpg'),
  85. // more3: this.getImgSrc('my/more_3.png'),
  86. userInfo: {},
  87. funcList: [
  88. // {
  89. // icon: this.getImgSrc('my/icon-1.png'),
  90. // name: '会员礼包',
  91. // },
  92. // {
  93. // icon: this.getImgSrc('my/icon-2.png'),
  94. // name: '会员折扣',
  95. // },
  96. // {
  97. // icon: this.getImgSrc('my/icon-3.png'),
  98. // name: '极速派单',
  99. // },
  100. // {
  101. // icon: this.getImgSrc('my/icon-4.png'),
  102. // name: '专属客服',
  103. // },
  104. ],
  105. // bgImg: this.getImgSrc('my/bg-b.png'),
  106. // bgImg2: this.getImgSrc('my/bg-s.png'),
  107. // bgImg3: this.getImgSrc('my/w-bg.png'),
  108. noVip: false,
  109. isWork: false,
  110. accountBalance: '',
  111. isLogin: false,
  112. // text: '无头像'
  113. };
  114. },
  115. onLoad() {
  116. // if (this.$util.getStorageKey('accessToken')) {
  117. // this.isLogin = true;
  118. // }
  119. // uni.$on('login', () => {
  120. // this.isLogin = false;
  121. // this.init();
  122. // })
  123. },
  124. onUnload() {
  125. // 移除监听事件
  126. uni.$off('login');
  127. },
  128. onShow() {
  129. this.$nextTick(() => {
  130. this.init();
  131. })
  132. },
  133. methods: {
  134. //初始化
  135. init() {
  136. this.getUser();
  137. // this.getStoreUserInfo();
  138. },
  139. toPath(path,type) {
  140. uni.setStorageSync('patientType', 'mine')
  141. uni.navigateTo({
  142. url: path
  143. })
  144. if(type){
  145. uni.setStorageSync('roleType', type)
  146. }
  147. },
  148. toLogin() {
  149. uni.navigateTo({
  150. url: '/pages/login/index'
  151. })
  152. },
  153. logOut() {
  154. uni.showModal({
  155. title: '提示',
  156. content: '确认是否退出?',
  157. success: (e) => {
  158. if (e.confirm) {
  159. uni.showLoading({
  160. title: '退出中'
  161. });
  162. uni.removeStorageSync('apiToken')
  163. uni.removeStorageSync('USER_INFO')
  164. setTimeout(() => {
  165. uni.reLaunch({
  166. url: '/pages/tabBar/index'
  167. })
  168. }, 1000);
  169. }
  170. }
  171. });
  172. },
  173. toPage(path) {
  174. if (!path) {
  175. uni.$u.toast('暂未开放,敬请期待');
  176. return
  177. }
  178. if (path == '/pages/address/list') {
  179. this.$util.setStorageKey('addressType', 'my')
  180. }
  181. uni.navigateTo({
  182. url: path
  183. })
  184. },
  185. toMember() {
  186. uni.navigateTo({
  187. url: '/pages/user/member'
  188. })
  189. },
  190. toApply() {
  191. uni.switchTab({
  192. url: '/pages/tabBar/case'
  193. })
  194. },
  195. toOrderList(item) {
  196. if (item.value != '100') {
  197. uni.navigateTo({
  198. url: `/pages/mineOrders/list?type=${item.value}`
  199. })
  200. } else {
  201. uni.$u.toast('暂未开放,敬请期待');
  202. }
  203. },
  204. toAllOrder() {
  205. uni.navigateTo({
  206. url: '/pages/mineOrders/list'
  207. })
  208. },
  209. toUserInfo() {
  210. if (this.isLogin) {
  211. uni.navigateTo({
  212. url: '/pages/user/info'
  213. })
  214. } else {
  215. uni.navigateTo({
  216. url: '/pages/login/quickLogin'
  217. })
  218. }
  219. },
  220. onPullDownRefresh() {
  221. console.log('下拉刷新回调函数');
  222. this.init();
  223. setTimeout(function() {
  224. uni.stopPullDownRefresh();
  225. }, 1000);
  226. },
  227. //查询门店账户余额
  228. // getStoreUserInfo() {
  229. // let that = this;
  230. // that.$http
  231. // .get(`/api/storeUserAccount/info/${that.$util.getStorageKey('storeInfo').id}`)
  232. // .then((res) => {
  233. // let data = res.data;
  234. // if (data) {
  235. // this.accountBalance = data.accountBalance;
  236. // }
  237. // })
  238. // .catch((err) => {});
  239. // },
  240. // 获取用户信息
  241. async getUser() {
  242. UserInfo().then(res => {
  243. this.userInfo = res;
  244. if (this.userInfo) {
  245. this.isLogin = true;
  246. } else {
  247. this.isLogin = false;
  248. }
  249. }).finally(() => {
  250. uni.stopPullDownRefresh();
  251. })
  252. // this.noVip = this.userInfo.type == 0 ? true : false;
  253. },
  254. // 跳转会员
  255. jumpMember() {
  256. uni.navigateTo({
  257. url: '/pages/handleMember/memberPage',
  258. });
  259. },
  260. //去充值页面
  261. toVoucher() {
  262. uni.navigateTo({
  263. url: '/pages/voucherCenter/voucher',
  264. });
  265. },
  266. //下拉刷新回调函数
  267. onPullDownRefresh() {
  268. // wx.setStorageSync('isChangeBanner', true);
  269. this.init();
  270. setTimeout(function() {
  271. uni.stopPullDownRefresh();
  272. }, 1000);
  273. },
  274. },
  275. };
  276. </script>
  277. <style lang="scss" scoped>
  278. .my-box {
  279. display: flex;
  280. flex-direction: column;
  281. background-color: #fff;
  282. min-height: 100%;
  283. overflow: hidden;
  284. padding: 0 30rpx;
  285. .user-top-box {
  286. display: flex;
  287. flex-direction: column;
  288. padding: 50rpx 0;
  289. // background-color: #046EB8;
  290. .user-info-box {
  291. display: flex;
  292. justify-content: space-between;
  293. align-items: center;
  294. .info-box-l {
  295. display: flex;
  296. align-items: center;
  297. .info-r {
  298. display: flex;
  299. flex-direction: column;
  300. margin-left: 25rpx;
  301. .name {
  302. display: inline-flex;
  303. font-size: 36rpx;
  304. // margin-top: 21rpx;
  305. height: 36rpx;
  306. line-height: 36rpx;
  307. justify-content: center;
  308. font-weight: bold;
  309. // background-color: #FFF9D9;
  310. // color: #B16E55;
  311. // border-radius: 50rpx;
  312. }
  313. }
  314. }
  315. .info-box-r {
  316. display: flex;
  317. align-items: center;
  318. border-top-left-radius: 50rpx;
  319. border-bottom-left-radius: 50rpx;
  320. // background-color: #055B96;
  321. height: 60rpx;
  322. padding-left: 40rpx;
  323. .txt {
  324. font-size: 26rpx;
  325. // font-weight: bold;
  326. }
  327. image {
  328. width: 25rpx;
  329. height: 25rpx;
  330. margin: 0 20rpx
  331. }
  332. }
  333. }
  334. }
  335. .func-box {
  336. padding: 30rpx 0;
  337. box-shadow: 0rpx 0rpx 20rpx #f1f1f1;
  338. border-radius: 20rpx;
  339. .func-item {
  340. display: flex;
  341. align-items: center;
  342. justify-content: space-between;
  343. margin: 0 20rpx;
  344. height: 100rpx;
  345. border-bottom: 1rpx solid #F1F1F1;
  346. &:last-child {
  347. border-bottom: none;
  348. }
  349. .func-item-l {
  350. display: flex;
  351. align-items: center;
  352. .icon {
  353. width: 40rpx;
  354. height: 40rpx;
  355. margin-right: 20rpx;
  356. }
  357. .name {
  358. font-size: 30rpx;
  359. }
  360. }
  361. .func-item-r {
  362. display: flex;
  363. align-items: center;
  364. .icon {
  365. width: 14rpx;
  366. height: 22rpx;
  367. }
  368. }
  369. button {
  370. display: flex;
  371. align-items: center;
  372. justify-content: space-between;
  373. width: 100%;
  374. border: none;
  375. margin: 0;
  376. padding: 0;
  377. outline: none;
  378. border-radius: 0;
  379. background-color: transparent;
  380. line-height: normal;
  381. font-size: 30rpx;
  382. color: #1a1a1a;
  383. }
  384. button::after {
  385. border: none;
  386. }
  387. }
  388. }
  389. .platform-box {
  390. display: flex;
  391. flex-direction: column;
  392. margin-top: 40rpx;
  393. .platform-item {
  394. display: flex;
  395. align-items: center;
  396. justify-content: center;
  397. padding: 40rpx 0;
  398. border-radius: 20rpx;
  399. box-shadow: 0rpx 0rpx 20rpx #f1f1f1;
  400. margin-bottom: 30rpx;
  401. .platform-img {
  402. width: 70rpx;
  403. height: 70rpx;
  404. margin-right: 20rpx;
  405. }
  406. .platform-name {
  407. font-size: 36rpx;
  408. color: #1a1a1a;
  409. font-weight: bold;
  410. }
  411. }
  412. }
  413. .logout-btn {
  414. .btn {
  415. display: block;
  416. width: 690rpx;
  417. height: 91rpx;
  418. line-height: 91rpx;
  419. color: #FF0F0F;
  420. font-size: 32rpx;
  421. border-radius: 45rpx;
  422. margin: 0 auto;
  423. margin-top: 63rpx;
  424. border: 1rpx solid #FF0000;
  425. text-align: center;
  426. }
  427. }
  428. }
  429. </style>