my.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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: '',
  98. statues:'service',
  99. icon: 'FhA9TUbTMF0e7ma6NZXqPrkscN6l'
  100. },
  101. {
  102. name: `${lang('设置')}`,
  103. url: '/pages/my/set',
  104. icon: 'Fu3f2iRi5BspRfbVLPcw8ryWc4lu'
  105. }
  106. ]
  107. }
  108. },
  109. onShow() {
  110. this.car_info = uni.getStorageSync('car_info') || {};
  111. const user_token = storage.getUserToken()
  112. user_token && this.loadUserInfo()
  113. },
  114. methods: {
  115. async loadUserInfo() {
  116. const userInfo = storage.getUserInfoData()
  117. this.setData({
  118. userInfo
  119. })
  120. let {
  121. data
  122. } = await http.postApi(config.API_USER_INFO, {})
  123. if (data.code == 200) {
  124. this.userInfo = data.data.userInfo
  125. storage.setUserInfoData(this.userInfo)
  126. }
  127. },
  128. loginHandle() {
  129. if (!this.userInfo.nickname) {
  130. uni.navigateTo({
  131. url: '/pages/loginRegister/login'
  132. })
  133. }
  134. },
  135. checkHandle_combo() {
  136. if(this.car_info.exchange_package_info){
  137. uni.navigateTo({
  138. url: `/pages/package/package`
  139. })
  140. return
  141. }
  142. this.comboDialoginfo.showConfirm = true
  143. },
  144. dialogConfirm(type) {
  145. uni.navigateTo({
  146. url: `/pages/batteryPackage/batteryPackage`
  147. })
  148. },
  149. routerLink({
  150. url,
  151. jumpCheck,
  152. statues
  153. }) {
  154. if(statues){
  155. return
  156. }
  157. if (jumpCheck) {
  158. this[`checkHandle_${jumpCheck}`]()
  159. return
  160. }
  161. uni.navigateTo({
  162. url
  163. })
  164. }
  165. }
  166. }
  167. </script>
  168. <style lang="scss" scoped>
  169. @import './my.scss';
  170. </style>