index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  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 : '立即登录' }} {{hasLogin?driverSex:""}}
  15. </view>
  16. <view @click="toLogin" class="phone" v-if="hasLogin">{{starUserphone}}</view>
  17. </view>
  18. </view>
  19. <view></view>
  20. </view>
  21. <view class="content1">
  22. <view class="left">
  23. <view class="icon">
  24. <image class="sfrz-icon" src="@/static/images/mine/sfrz.png" mode='widthFix'>
  25. </image>
  26. </view>
  27. <view class="right-text" @click="goDetailPage('/pages/mine/driverCertification',1)">
  28. <view class="top">司机认证</view>
  29. <view class="bottom">{{hasLogin? statusVal : '你还没有完成身份认证' }}</view>
  30. </view>
  31. </view>
  32. <view class="right">
  33. <view class="icon">
  34. <image class="sfrz-icon" src="@/static/images/mine/pingjia@2x.png" mode='widthFix'>
  35. </image>
  36. </view>
  37. <view class="right-text" @click="goDetailPage('/pages/mine/evaluate')">
  38. <view class="top">货主评价</view>
  39. <view class="bottom">看看货主对你的评价吧</view>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="content2">
  44. <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/manageBankCards/index',2)">
  45. <view class="flex align-center">
  46. <image class="img" src="@/static/images/mine/yhk@2x.png" mode='widthFix'>
  47. </image>
  48. <view>管理银行卡</view>
  49. </view>
  50. <view>
  51. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  52. </view>
  53. </view>
  54. <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/manageVehicles/index',3)">
  55. <view class="flex align-center">
  56. <image class="img" src="@/static/images/mine/cheliang@2x.png" mode='widthFix'>
  57. </image>
  58. <view>管理车辆</view>
  59. </view>
  60. <view>
  61. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  62. </view>
  63. </view>
  64. <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/often/oftenRoute',3)">
  65. <view class="flex align-center">
  66. <image class="img" src="@/static/images/mine/changyongluxian.png" mode='widthFix'>
  67. </image>
  68. <view>常用路线</view>
  69. </view>
  70. <view>
  71. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  72. </view>
  73. </view>
  74. <view class="flex flex-space-between" @click="$helper.contactCustomerService()">
  75. <view class="flex align-center">
  76. <image class="img" src="@/static/images/mine/kf.png" mode='widthFix'>
  77. </image>
  78. <view>联系客服</view>
  79. </view>
  80. <view>
  81. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  82. </view>
  83. </view>
  84. <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/helpDescription')">
  85. <view class="flex align-center">
  86. <image class="img" src="@/static/images/mine/icon-help@2x.png" mode='widthFix'>
  87. </image>
  88. <view>帮助说明</view>
  89. </view>
  90. <view>
  91. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  92. </view>
  93. </view>
  94. <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/set')">
  95. <view class="flex align-center">
  96. <image class="img" src="@/static/images/mine/set.png" mode='widthFix'>
  97. </image>
  98. <view>设置</view>
  99. </view>
  100. <view>
  101. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  102. </view>
  103. </view>
  104. <!-- <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/evaluate')">
  105. <view class="flex align-center">
  106. <image class="img" src="@/static/images/mine/set.png" mode='widthFix'>
  107. </image>
  108. <view>货主评价</view>
  109. </view>
  110. <view>
  111. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  112. </view>
  113. </view> -->
  114. </view>
  115. <u-modal :show="isShowAlert" :title="alertTitle" :closeOnClickOverlay='true' :confirmText='confirmText'
  116. :showCancelButton='showCancelButton' confirmColor='#2772FB' @confirm="confirmClick" @close="cancelClick"
  117. @cancel="cancelClick"></u-modal>
  118. <u-toast ref="uToast"></u-toast>
  119. </view>
  120. </template>
  121. <script>
  122. var that;
  123. import {
  124. mapState
  125. } from 'vuex';
  126. export default {
  127. data() {
  128. return {
  129. confirmText: '确定',
  130. showCancelButton: true,
  131. userName: '',
  132. phone: '',
  133. headUrl: "../../static/images/myimg/YongHu@3x.png",
  134. isShowAlert: false,
  135. alertTitle: '您尚未登录,是否立即登录?',
  136. // alertContent: '您尚未登录,是否立即登录?',
  137. statusVal: '',
  138. isFirstRZ: null,
  139. driverCall: '',
  140. isFirstSH: false,
  141. driverSex: ""
  142. };
  143. },
  144. onShow() {
  145. // console.log("111111111111111111111111111", this.firstAuthentication)
  146. //获取认证状态
  147. // console.log(userInfo)
  148. // console.log(hasLogin)
  149. if (!this.hasLogin) {
  150. this.isShowAlert = true
  151. return
  152. }
  153. this.getAuthenticationStatus()
  154. that.$request.baseRequest('get', '/newsInfo/unreadMessage', {
  155. reCommonId: this.userInfo.id,
  156. }).then(res3 => {
  157. if (res3.data) {
  158. let name = 'myTip';
  159. let value = res3.data
  160. if (value == 0) {
  161. uni.removeTabBarBadge({
  162. index: 3
  163. })
  164. }
  165. that.$store.commit('$uStore', {
  166. name,
  167. value
  168. });
  169. if (value != 0 && value) {
  170. uni.setTabBarBadge({
  171. index: 3,
  172. text: value + ""
  173. })
  174. }
  175. }
  176. })
  177. },
  178. async onLoad() {
  179. that = this
  180. // let _status = await that.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  181. // driverPhone: this.userInfo.phone,
  182. // }).then(res => {
  183. // return res.data.authenticationStatus
  184. // })
  185. // if (_status == '已禁用') {
  186. // this.isShowAlert = true
  187. // this.alertTitle = '账号审核中'
  188. // this.confirmText = '退出APP'
  189. // this.showCancelButton = false
  190. // } else {
  191. // console.log(1231233212332312312213)
  192. // }
  193. },
  194. computed: {
  195. ...mapState(['hasLogin', 'userInfo']),
  196. // 手机号中间4位加*
  197. starUserphone() {
  198. let reg = /^(\d{3})\d{4}(\d{4})$/;
  199. if (this.phone) {
  200. return this.phone.replace(reg, "$1****$2");
  201. }
  202. }
  203. },
  204. methods: {
  205. async getAuthenticationStatus() {
  206. await this.$request.baseRequest('', '/driverInfo/firstAuthentication', {
  207. driverPhone: this.userInfo.phone,
  208. }).then(res => {
  209. if(res.data){
  210. uni.setStorageSync("firstAuthentication", res.data) //更新缓存数据(解决pc端审核后未及时更新缓存 用于车友判断)
  211. }
  212. this.firstAuthentication = res.data
  213. if (this.firstAuthentication) {
  214. this.isFirstSH = false
  215. if (this.firstAuthentication.driverSex == '女') {
  216. this.driverSex = "女士"
  217. this.userName = this.firstAuthentication.driverCall
  218. } else if (this.firstAuthentication.driverSex == '男') {
  219. this.userName = this.firstAuthentication.driverCall
  220. this.driverSex = "先生"
  221. } else {
  222. this.userName = this.firstAuthentication.driverCall
  223. this.driverSex = ""
  224. }
  225. if (this.firstAuthentication.authenticationStatus == '审核中') {
  226. this.statusVal = '身份认证审核中'
  227. } else if (this.firstAuthentication.authenticationStatus == '未通过') {
  228. this.statusVal = '身份认证未通过'
  229. } else if (this.firstAuthentication.authenticationStatus == '已过期') {
  230. this.statusVal = '证件已过期'
  231. } else {
  232. this.statusVal = '已认证'
  233. }
  234. } else {
  235. this.statusVal = '你还没有完成身份认证'
  236. this.userName = this.userInfo.userName
  237. this.isFirstSH = true
  238. }
  239. this.phone = this.userInfo.phone
  240. if (this.userInfo) {
  241. if (!this.userInfo.avatarUrl) {
  242. this.headUrl = "../../static/images/myimg/YongHu@3x.png"
  243. } else {
  244. this.headUrl = this.userInfo.avatarUrl
  245. }
  246. this.userphone = this.userInfo.phone
  247. } else {
  248. this.headUrl = "../../static/images/myimg/YongHu@3x.png"
  249. this.username = "立即登录"
  250. }
  251. })
  252. .catch(res => {
  253. uni.$u.toast(res.message);
  254. });
  255. },
  256. confirmClick() {
  257. // #ifdef APP-PLUS
  258. if (this.alertTitle == '账号审核中') {
  259. if (uni.getSystemInfoSync().platform == 'ios') {
  260. plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
  261. } else if (uni.getSystemInfoSync().platform == 'android') {
  262. plus.runtime.quit();
  263. }
  264. return
  265. }
  266. // #endif
  267. this.isShowAlert = false
  268. uni.$u.route('/pages/public/login');
  269. },
  270. cancelClick() {
  271. this.isShowAlert = false
  272. },
  273. goDetailPage(src, type) {
  274. if (!this.hasLogin) {
  275. this.isShowAlert = true;
  276. } else {
  277. if (type == 1 && this.statusVal == '已认证' || this.statusVal == '证件已过期' || this.statusVal == '身份认证未通过') {
  278. src = '/pages/mine/editDriverCertification'
  279. }
  280. if ((type == 2 || type == 3) && this.isFirstSH) {
  281. this.$refs.uToast.show({
  282. type: 'error',
  283. message: "请先完成司机身份认证",
  284. })
  285. } else if (type == 1 && this.statusVal == '身份认证审核中') {
  286. this.$refs.uToast.show({
  287. type: 'error',
  288. message: "正在审核中,请耐心等待!",
  289. })
  290. return
  291. } else {
  292. uni.$u.route(src);
  293. }
  294. }
  295. },
  296. toLogin() {
  297. console.log("userInfo", this.userInfo)
  298. if (!this.hasLogin || !this.userInfo || this.userName == "立即登录") {
  299. uni.$u.route('/pages/public/login');
  300. } else {}
  301. // else if(!this.userInfo.nickname){
  302. // this.inputShow = true
  303. // this.inputStatus = 'inline'
  304. // this.feild = "nickname"
  305. // this.inputContent = ''
  306. // }
  307. },
  308. }
  309. }
  310. </script>
  311. <style lang="scss" scoped>
  312. .content {
  313. background: url(../../static/images/mine/bg@2x.png);
  314. background-size: 100% 100%;
  315. height: 100vh;
  316. padding: 0 25rpx;
  317. }
  318. .top-height {
  319. height: var(--status-bar-height);
  320. }
  321. .arrow {
  322. margin-left: 15px;
  323. width: 8px;
  324. height: 12px;
  325. // justify-content: flex-end
  326. }
  327. .head {
  328. .row1 {
  329. display: flex;
  330. justify-content: flex-end;
  331. margin-top: 46rpx;
  332. }
  333. .row2 {
  334. .right-text {
  335. margin-left: 40rpx;
  336. }
  337. .name {
  338. font-size: 42rpx;
  339. font-weight: 700;
  340. color: #333333;
  341. }
  342. .phone {
  343. font-size: 26rpx;
  344. font-weight: 500;
  345. color: #8F97AB;
  346. }
  347. }
  348. }
  349. .content1 {
  350. display: flex;
  351. justify-content: space-between;
  352. margin-top: 60rpx;
  353. .left,
  354. .right {
  355. width: 49%;
  356. padding: 30rpx 20rpx;
  357. background: white;
  358. border-radius: 25rpx;
  359. box-sizing: border-box;
  360. display: flex;
  361. align-items: center;
  362. .sfrz-icon {
  363. width: 42rpx;
  364. height: 42rpx;
  365. }
  366. .right-text {
  367. margin-left: 20rpx;
  368. .top {
  369. font-size: 28rpx;
  370. font-weight: 700;
  371. color: #000000;
  372. }
  373. .bottom {
  374. margin-top: 6rpx;
  375. font-size: 24rpx;
  376. color: #898989;
  377. }
  378. }
  379. }
  380. }
  381. .content2 {
  382. background: white;
  383. padding: 20rpx;
  384. border-radius: 20rpx;
  385. margin-top: 20rpx;
  386. .img {
  387. margin-right: 10rpx;
  388. width: 40rpx;
  389. height: 40rpx;
  390. }
  391. .flex-space-between {
  392. margin: 10rpx 0 50rpx 0;
  393. }
  394. }
  395. </style>