mine.vue 9.1 KB

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