my.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <view class="container-view zx-page-linear">
  3. <view class="user-switch-row">
  4. <image :src="QINIU_URL + 'FlL5BtEdMES2-mntjR9D3CX_LWYv'" class="message"
  5. @tap="routerLink({ url: '/pages/message/index' })" />
  6. </view>
  7. <view class="user-info-wrap" @tap="loginHandle">
  8. <image :src="userInfo.headimg || defaultAvatarUrl" class="head-img" />
  9. <view class="user-name">{{ userInfo.nickname || '请点击登录' }}</view>
  10. <view v-if="userInfo.user_name" class="e-mail">
  11. {{ userInfo.user_name }}
  12. </view>
  13. </view>
  14. <view v-if="car_info.car_sn" class="common-tabs">
  15. <view class="item" @click="routerLink({url:'/pages/dashboard/dashboard'})">
  16. <image :src="QINIU_URL + 'Fp6G-Kzb-YUGkP2WR-kjTlIbbTj1'" class="icon" />
  17. <view class="name">{{ $t('我的车辆') }}</view>
  18. </view>
  19. <view class="item" @click="routerLink({url:'/pages/userManagement/userManagement'})">
  20. <image :src="QINIU_URL + 'FnxGW52BCkTkK9HxsTdVrghU7B4D'" class="icon" />
  21. <view class="name">{{ $t('用车人') }}</view>
  22. </view>
  23. <view v-if="car_info.sold_time" class="item" @click="routerLink({url:'',jumpCheck:'combo'})">
  24. <image :src="QINIU_URL + 'FsOsd1SxYDHDm00aiwrTib_k0Mbr'" class="icon" />
  25. <view class="name">{{ $t('换电套餐') }}</view>
  26. </view>
  27. </view>
  28. <view class="tabs-wrap">
  29. <view v-for="(item, index) in baseTabs" :key="index" class="tab-item" @click="routerLink(item)">
  30. <image :src="QINIU_URL + item.icon" class="icon" />
  31. <view class="name">{{ item.name }}</view>
  32. </view>
  33. </view>
  34. <Confirm v-model="comboDialoginfo.showConfirm" :dialog-info="comboDialoginfo" @confirm="dialogConfirm" />
  35. <CustomTabbar curt-tab="my" />
  36. </view>
  37. </template>
  38. <script>
  39. const storage = require('@/common/storage.js')
  40. import Confirm from '@/component/comPopup/Confirm'
  41. import {
  42. QINIU_URL,
  43. defaultHeadImg
  44. } from '@/common/constant'
  45. import CustomTabbar from '@/component/customTabbar/index'
  46. var config = require('../../common/config_gyq.js');
  47. var http = require('../../common/request.js');
  48. export default {
  49. components: {
  50. Confirm,
  51. CustomTabbar
  52. },
  53. data() {
  54. return {
  55. car_info: {},
  56. QINIU_URL,
  57. defaultAvatarUrl: defaultHeadImg,
  58. comboDialoginfo: {
  59. showConfirm: false,
  60. title: '温馨提示',
  61. opType: 'combo',
  62. text: '您还未购买换电套餐,是否前往进行换电套餐?',
  63. confirmBtnText: '前往购买',
  64. showCancelButton: false
  65. },
  66. userInfo: {}
  67. }
  68. },
  69. computed: {
  70. // commonTabs() {
  71. // return [
  72. // { name: `${this.$t('我的车辆')}`, url: '/pages/dashboard/dashboard', icon: 'Fp6G-Kzb-YUGkP2WR-kjTlIbbTj1' },
  73. // { name: `${this.$t('用车人')}`, url: '/pages/userManagement/userManagement', icon: 'FnxGW52BCkTkK9HxsTdVrghU7B4D' },
  74. // { name: `${this.$t('换电套餐')}`, jumpCheck: 'combo', url: '', icon: 'FsOsd1SxYDHDm00aiwrTib_k0Mbr' }
  75. // ]
  76. // },
  77. baseTabs() {
  78. const lang = t => this.$t(t)
  79. return [{
  80. name: `${lang('我的订单')}`,
  81. url: '/pages/order/order',
  82. icon: 'FkLJGLo1faYtJWhW4Q0gt5dphI7g'
  83. },
  84. {
  85. name: `${lang('换电记录')}`,
  86. url: '/pages/batteryRecord/batteryRecord',
  87. icon: 'FnSjwcN7Mcpa-WA7Cqx2cGTvX2V1'
  88. },
  89. {
  90. name: `${lang('意见反馈')}`,
  91. url: '/pages/feedback/index',
  92. icon: 'FnSjwcN7Mcpa-WA7Cqx2cGTvX2V1'
  93. },
  94. // { name: `${lang('关于我们')}`, url: '/pages/bluetoothUnlock/unlockSet', icon: 'Fmin1_DG6ZkENCdsI1qJZJpDNkhQ' },
  95. {
  96. name: `${lang('客服中心')}`,
  97. url: '/pages/bluetoothUnlock/bluetoothPair',
  98. icon: 'FhA9TUbTMF0e7ma6NZXqPrkscN6l'
  99. },
  100. {
  101. name: `${lang('设置')}`,
  102. url: '/pages/my/set',
  103. icon: 'Fu3f2iRi5BspRfbVLPcw8ryWc4lu'
  104. }
  105. ]
  106. }
  107. },
  108. onShow() {
  109. this.car_info = uni.getStorageSync('car_info') || {};
  110. const user_token = storage.getUserToken()
  111. user_token && this.loadUserInfo()
  112. },
  113. methods: {
  114. async loadUserInfo() {
  115. const userInfo = storage.getUserInfoData()
  116. this.setData({
  117. userInfo
  118. })
  119. let {
  120. data
  121. } = await http.postApi(config.API_USER_INFO, {})
  122. if (data.code == 200) {
  123. this.userInfo = data.data.userInfo
  124. storage.setUserInfoData(this.userInfo)
  125. }
  126. },
  127. loginHandle() {
  128. if (!userInfo.nickname) {
  129. uni.navigateTo({
  130. url: '/pages/loginRegister/login'
  131. })
  132. }
  133. },
  134. checkHandle_combo() {
  135. if(this.car_info.exchange_package_info){
  136. uni.navigateTo({
  137. url: `/pages/package/package`
  138. })
  139. return
  140. }
  141. this.comboDialoginfo.showConfirm = true
  142. },
  143. dialogConfirm(type) {
  144. uni.navigateTo({
  145. url: `/pages/batteryPackage/batteryPackage`
  146. })
  147. },
  148. routerLink({
  149. url,
  150. jumpCheck
  151. }) {
  152. console.log(url);
  153. if (jumpCheck) {
  154. this[`checkHandle_${jumpCheck}`]()
  155. return
  156. }
  157. uni.navigateTo({
  158. url
  159. })
  160. }
  161. }
  162. }
  163. </script>
  164. <style lang="scss" scoped>
  165. @import './my.scss';
  166. </style>