index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. <!-- 我的 -->
  2. <template>
  3. <view class="content">
  4. <view class="top-height"></view>
  5. <view class="head">
  6. <view class="row1">
  7. <u--image class="flex-end" :showLoading="true" src="../../static/images/mine/saoma.png" width="30px"
  8. height="30px"></u--image>
  9. </view>
  10. <view class="row2 flex align-center">
  11. <u--image class="flex-end" :showLoading="true" :src="headUrl" width="60px" height="60px" shape='circle'>
  12. </u--image>
  13. <view class="right-text">
  14. <view @click="toLogin" class="name">{{hasLogin? userName : '立即登录' }}</view>
  15. <view @click="toLogin" class="phone" v-if="hasLogin">{{starUserphone}}</view>
  16. </view>
  17. </view>
  18. <view></view>
  19. </view>
  20. <view class="content1">
  21. <view class="left">
  22. <view class="icon">
  23. <image class="sfrz-icon" src="@/static/images/mine/sfrz.png" mode='widthFix'>
  24. </image>
  25. </view>
  26. <view class="right-text" @click="goDetailPage('/pages/mine/driverCertification',1)">
  27. <view class="top">司机认证</view>
  28. <view class="bottom">{{hasLogin? statusVal : '你还没有完成身份认证' }}</view>
  29. </view>
  30. </view>
  31. <view class="right">
  32. <view class="icon">
  33. <image class="sfrz-icon" src="@/static/images/mine/pingjia@2x.png" mode='widthFix'>
  34. </image>
  35. </view>
  36. <view class="right-text">
  37. <view class="top">货主评价</view>
  38. <view class="bottom">看看货主对你的评价吧</view>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="content2">
  43. <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/manageBankCards/index',2)">
  44. <view class="flex align-center">
  45. <image class="img" src="@/static/images/mine/yhk@2x.png" mode='widthFix'>
  46. </image>
  47. <view>管理银行卡</view>
  48. </view>
  49. <view> > </view>
  50. </view>
  51. <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/manageVehicles/index',3)">
  52. <view class="flex align-center">
  53. <image class="img" src="@/static/images/mine/cheliang@2x.png" mode='widthFix'>
  54. </image>
  55. <view>管理车辆</view>
  56. </view>
  57. <view> > </view>
  58. </view>
  59. <view class="flex flex-space-between" @click="$helper.contactCustomerService">
  60. <view class="flex align-center">
  61. <image class="img" src="@/static/images/mine/kf.png" mode='widthFix'>
  62. </image>
  63. <view>联系客服</view>
  64. </view>
  65. <view> > </view>
  66. </view>
  67. <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/helpDescription')">
  68. <view class="flex align-center">
  69. <image class="img" src="@/static/images/mine/icon-help@2x.png" mode='widthFix'>
  70. </image>
  71. <view>帮助说明</view>
  72. </view>
  73. <view> > </view>
  74. </view>
  75. <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/set')">
  76. <view class="flex align-center">
  77. <image class="img" src="@/static/images/mine/set.png" mode='widthFix'>
  78. </image>
  79. <view>设置</view>
  80. </view>
  81. <view> > </view>
  82. </view>
  83. </view>
  84. <u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :closeOnClickOverlay='true'
  85. :showCancelButton='true' confirmColor='#2772FB' @confirm="confirmClick" @close="cancelClick"
  86. @cancel="cancelClick"></u-modal>
  87. <u-toast ref="uToast"></u-toast>
  88. </view>
  89. </template>
  90. <script>
  91. var that;
  92. import {
  93. mapState
  94. } from 'vuex';
  95. export default {
  96. data() {
  97. return {
  98. userName: '',
  99. phone: '',
  100. headUrl: "../../static/images/myimg/YongHu@3x.png",
  101. isShowAlert: false,
  102. alertTitle: '提示',
  103. alertContent: '您尚未登录,是否立即登录?',
  104. statusVal: '',
  105. isFirstRZ: null,
  106. driverCall: '',
  107. isFirstSH: false
  108. };
  109. },
  110. onShow() {
  111. // console.log("111111111111111111111111111", this.firstAuthentication)
  112. //获取认证状态
  113. // console.log(userInfo)
  114. // console.log(hasLogin)
  115. if (!this.hasLogin) {
  116. this.isShowAlert = true
  117. return
  118. }
  119. this.getAuthenticationStatus()
  120. that.$request.baseRequest('get', '/newsInfo/unreadMessage', {
  121. reCommonId: this.userInfo.id,
  122. }).then(res3 => {
  123. if (res3.data) {
  124. let name = 'myTip';
  125. let value = res3.data
  126. if (value == 0) {
  127. uni.removeTabBarBadge({
  128. index: 2
  129. })
  130. }
  131. that.$store.commit('$uStore', {
  132. name,
  133. value
  134. });
  135. if (value != 0 && value) {
  136. uni.setTabBarBadge({
  137. index: 2,
  138. text: value + ""
  139. })
  140. }
  141. }
  142. })
  143. },
  144. onLoad() {
  145. debugger
  146. that = this
  147. },
  148. computed: {
  149. ...mapState(['hasLogin', 'userInfo']),
  150. // 手机号中间4位加*
  151. starUserphone() {
  152. let reg = /^(\d{3})\d{4}(\d{4})$/;
  153. if (this.phone) {
  154. return this.phone.replace(reg, "$1****$2");
  155. }
  156. }
  157. },
  158. methods: {
  159. async getAuthenticationStatus() {
  160. await this.$request.baseRequest('', '/driverInfo/firstAuthentication', {
  161. driverPhone: this.userInfo.phone,
  162. }).then(res => {
  163. debugger
  164. this.firstAuthentication = res.data
  165. console.log("this.firstAuthentication", this.firstAuthentication)
  166. if (this.firstAuthentication) {
  167. this.isFirstSH = false
  168. if (this.firstAuthentication.driverSex == '女') {
  169. this.userName = this.firstAuthentication.driverCall + '女士'
  170. } else {
  171. this.userName = this.firstAuthentication.driverCall + '先生'
  172. }
  173. if (this.firstAuthentication.authenticationStatus == '审核中') {
  174. this.statusVal = '身份认证审核中'
  175. } else if (this.firstAuthentication.authenticationStatus == '未通过') {
  176. this.statusVal = '身份认证未通过'
  177. } else {
  178. this.statusVal = '已认证'
  179. }
  180. } else {
  181. this.statusVal = '你还没有完成身份认证'
  182. this.userName = this.userInfo.userName
  183. this.isFirstSH = true
  184. }
  185. this.phone = this.userInfo.phone
  186. if (this.userInfo) {
  187. if (!this.userInfo.avatarUrl) {
  188. this.headUrl = "../../static/images/myimg/YongHu@3x.png"
  189. } else {
  190. this.headUrl = this.userInfo.avatarUrl
  191. }
  192. this.userphone = this.userInfo.phone
  193. } else {
  194. this.headUrl = "../../static/images/myimg/YongHu@3x.png"
  195. this.username = "立即登录"
  196. }
  197. })
  198. .catch(res => {
  199. uni.$u.toast(res.message);
  200. });
  201. },
  202. confirmClick() {
  203. this.isShowAlert = false
  204. uni.$u.route('/pages/public/login');
  205. },
  206. cancelClick() {
  207. this.isShowAlert = false
  208. },
  209. goDetailPage(src, type) {
  210. if (!this.hasLogin) {
  211. this.isShowAlert = true;
  212. } else {
  213. if (type == 1 && this.statusVal == '已认证') {
  214. src = '/pages/mine/editDriverCertification'
  215. }
  216. console.log('this.isFirstSH', this.isFirstSH)
  217. if ((type == 2 || type == 3) && this.isFirstSH) {
  218. this.$refs.uToast.show({
  219. type: 'error',
  220. message: "请先完成司机身份认证",
  221. })
  222. } else {
  223. uni.$u.route(src);
  224. }
  225. }
  226. },
  227. toLogin() {
  228. console.log("userInfo", this.userInfo)
  229. if (!this.hasLogin || !this.userInfo || this.userName == "立即登录") {
  230. uni.$u.route('/pages/public/login');
  231. } else {}
  232. // else if(!this.userInfo.nickname){
  233. // this.inputShow = true
  234. // this.inputStatus = 'inline'
  235. // this.feild = "nickname"
  236. // this.inputContent = ''
  237. // }
  238. },
  239. }
  240. }
  241. </script>
  242. <style lang="scss" scoped>
  243. .content {
  244. background: url(../../static/images/mine/bg@2x.png);
  245. background-size: 100% 100%;
  246. height: 100vh;
  247. padding: 0 20rpx;
  248. }
  249. .top-height {
  250. height: var(--status-bar-height);
  251. }
  252. .head {
  253. .row1 {
  254. display: flex;
  255. justify-content: flex-end;
  256. margin-top: 46rpx;
  257. }
  258. .row2 {
  259. .right-text {
  260. margin-left: 40rpx;
  261. }
  262. .name {
  263. font-size: 42rpx;
  264. font-weight: 700;
  265. color: #333333;
  266. }
  267. .phone {
  268. font-size: 26rpx;
  269. font-weight: 500;
  270. color: #8F97AB;
  271. }
  272. }
  273. }
  274. .content1 {
  275. display: flex;
  276. justify-content: space-between;
  277. margin-top: 60rpx;
  278. .left,
  279. .right {
  280. width: 49%;
  281. padding: 30rpx 20rpx;
  282. background: white;
  283. border-radius: 25rpx;
  284. box-sizing: border-box;
  285. display: flex;
  286. align-items: center;
  287. .sfrz-icon {
  288. width: 42rpx;
  289. height: 42rpx;
  290. }
  291. .right-text {
  292. margin-left: 20rpx;
  293. .top {
  294. font-size: 28rpx;
  295. font-weight: 700;
  296. color: #000000;
  297. }
  298. .bottom {
  299. margin-top: 6rpx;
  300. font-size: 24rpx;
  301. color: #898989;
  302. }
  303. }
  304. }
  305. }
  306. .content2 {
  307. background: white;
  308. padding: 20rpx;
  309. border-radius: 20rpx;
  310. margin-top: 20rpx;
  311. .img {
  312. margin-right: 10rpx;
  313. width: 40rpx;
  314. height: 40rpx;
  315. }
  316. .flex-space-between {
  317. margin: 40rpx 0;
  318. }
  319. }
  320. </style>