mine.vue 9.0 KB

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