index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  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 : '立即登录' }} -->
  15. <!-- {{hasLogin?driverSex:""}} -->
  16. <!-- <view class="name" v-if='userName'></view> -->
  17. <view @click="toLogin" class="name">{{hasLogin? userName : '立即登录' }} {{hasLogin?driverSex:""}}
  18. </view>
  19. <view @click="toLogin" class="phone" v-if="hasLogin">{{starUserphone}}</view>
  20. </view>
  21. </view>
  22. <view></view>
  23. </view>
  24. <view class="content1">
  25. <view @click="goDetailPage('/pages/mine/driverCertification',1)" class="left">
  26. <view class="icon">
  27. <image class="sfrz-icon" src="@/static/images/mine/sfrz.png" mode='widthFix'>
  28. </image>
  29. </view>
  30. <view class="right-text">
  31. <view class="top">司机认证</view>
  32. <view class="bottom">{{hasLogin? statusVal : '你还没有完成身份认证' }}</view>
  33. </view>
  34. </view>
  35. <view @click="goDetailPage('/pages/mine/evaluate')" class="right">
  36. <view class="icon">
  37. <image class="sfrz-icon" src="@/static/images/mine/pingjia@2x.png" mode='widthFix'>
  38. </image>
  39. </view>
  40. <view class="right-text">
  41. <view class="top">货主评价</view>
  42. <view class="bottom">看看货主对你的评价吧</view>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="content2">
  47. <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/manageBankCards/index',2)">
  48. <view class="flex align-center">
  49. <image class="img" src="@/static/images/mine/yhk@2x.png" mode='widthFix'>
  50. </image>
  51. <view>管理银行卡</view>
  52. </view>
  53. <view>
  54. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  55. </view>
  56. </view>
  57. <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/manageVehicles/index',3)">
  58. <view class="flex align-center">
  59. <image class="img" src="@/static/images/mine/cheliang@2x.png" mode='widthFix'>
  60. </image>
  61. <view>管理车辆</view>
  62. </view>
  63. <view>
  64. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  65. </view>
  66. </view>
  67. <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/fleet/bindingCarCaptain',3)">
  68. <view class="flex align-center">
  69. <image class="img" src="@/static/images/mine/cheliang@2x.png" mode='widthFix'>
  70. </image>
  71. <view>绑定车队长</view>
  72. </view>
  73. <view>
  74. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  75. </view>
  76. </view>
  77. <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/fleet/fleetManage',3)">
  78. <view class="flex align-center">
  79. <image class="img" src="@/static/images/mine/cheliang@2x.png" mode='widthFix'>
  80. </image>
  81. <view>车队管理</view>
  82. </view>
  83. <view>
  84. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  85. </view>
  86. </view>
  87. <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/often/oftenRoute',3)">
  88. <view class="flex align-center">
  89. <image class="img" src="@/static/images/mine/changyongluxian.png" mode='widthFix'>
  90. </image>
  91. <view>常用路线</view>
  92. </view>
  93. <view>
  94. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  95. </view>
  96. </view>
  97. <view class="flex flex-space-between" @click="$helper.contactCustomerService()">
  98. <view class="flex align-center">
  99. <image class="img" src="@/static/images/mine/kf.png" mode='widthFix'>
  100. </image>
  101. <view>联系客服</view>
  102. </view>
  103. <view>
  104. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  105. </view>
  106. </view>
  107. <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/helpDescription')">
  108. <view class="flex align-center">
  109. <image class="img" src="@/static/images/mine/icon-help@2x.png" mode='widthFix' style="top: 6rpx;">
  110. </image>
  111. <view>帮助说明</view>
  112. </view>
  113. <view>
  114. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  115. </view>
  116. </view>
  117. <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/set')">
  118. <view class="flex align-center">
  119. <image class="img" src="@/static/images/mine/set.png" mode='widthFix'>
  120. </image>
  121. <view>设置</view>
  122. </view>
  123. <view>
  124. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  125. </view>
  126. </view>
  127. <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/set')">
  128. <view class="flex align-center">
  129. <image class="img" src="@/static/images/mine/appUpdate.png" mode='widthFix'>
  130. </image>
  131. <view>检查更新</view>
  132. </view>
  133. <view>
  134. <view class="version_css" @click="onAPPUpdate">
  135. {{version}}
  136. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  137. </view>
  138. </view>
  139. </view>
  140. <!-- <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/index1')">
  141. <view class="flex align-center">
  142. <image class="img" src="@/static/images/mine/set.png" mode='widthFix'>
  143. </image>
  144. <view>测试</view>
  145. </view>
  146. <view>
  147. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  148. </view>
  149. </view> -->
  150. <!-- <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/evaluate')">
  151. <view class="flex align-center">
  152. <image class="img" src="@/static/images/mine/set.png" mode='widthFix'>
  153. </image>
  154. <view>货主评价</view>
  155. </view>
  156. <view>
  157. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  158. </view>
  159. </view> -->
  160. </view>
  161. <!-- <view class="version_css">当前版本: {{ version}}</view> -->
  162. <u-modal :show="isShowAlert" :title="alertTitle" :closeOnClickOverlay='true' :confirmText='confirmText'
  163. :showCancelButton='showCancelButton' confirmColor='#2772FB' @confirm="confirmClick" @close="cancelClick"
  164. @cancel="cancelClick"></u-modal>
  165. <u-toast ref="uToast"></u-toast>
  166. </view>
  167. </template>
  168. <script>
  169. var that;
  170. import {
  171. mapState
  172. } from 'vuex';
  173. // #ifdef APP-PLUS
  174. import APPUpdate, {
  175. getCurrentNo
  176. } from '@/uni_modules/zhouWei-APPUpdate/js_sdk/appUpdate';
  177. import * as config from '@/config/index.js'
  178. // #endif
  179. export default {
  180. data() {
  181. return {
  182. confirmText: '确定',
  183. showCancelButton: true,
  184. userName: '',
  185. phone: '',
  186. headUrl: "../../static/images/myimg/YongHu@3x.png",
  187. isShowAlert: false,
  188. alertTitle: '您尚未登录,是否立即登录?',
  189. // alertContent: '您尚未登录,是否立即登录?',
  190. statusVal: '',
  191. isFirstRZ: null,
  192. driverCall: '',
  193. isFirstSH: false,
  194. driverSex: "",
  195. version: "1.1.0" //版本号
  196. };
  197. },
  198. onShow() {
  199. // #ifdef APP-PLUS
  200. this.version = plus.runtime.version
  201. this.checkVersion()
  202. // #endif
  203. uni.setTabBarItem({
  204. index: 0,
  205. text: '货源',
  206. iconPath: 'static/images/common/huoyuan@2x(1).png',
  207. selectedIconPath: 'static/images/common/huoyuan@2x.png'
  208. })
  209. uni.setTabBarItem({
  210. index: 2,
  211. text: '订单',
  212. iconPath: 'static/images/common/dingdan@2x(1).png',
  213. selectedIconPath: 'static/images/common/dingdan@2x.png'
  214. })
  215. //获取认证状态
  216. // console.log(userInfo)
  217. // console.log(hasLogin)
  218. if (!this.hasLogin) {
  219. this.isShowAlert = true
  220. return
  221. }
  222. this.getAuthenticationStatus()
  223. that.$request.baseRequest('get', '/newsInfo/unreadMessage', {
  224. reCommonId: this.userInfo.id,
  225. }).then(res3 => {
  226. if (res3.data || res3.data == 0) {
  227. let name = 'myTip';
  228. let value = res3.data
  229. if (value == 0) {
  230. uni.removeTabBarBadge({
  231. index: 3
  232. })
  233. }
  234. that.$store.commit('$uStore', {
  235. name,
  236. value
  237. });
  238. if (value != 0 && value) {
  239. uni.setTabBarBadge({
  240. index: 3,
  241. text: value + ""
  242. })
  243. }
  244. }
  245. })
  246. },
  247. async onLoad() {
  248. that = this
  249. // let _status = await that.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  250. // driverPhone: this.userInfo.phone,
  251. // }).then(res => {
  252. // return res.data.authenticationStatus
  253. // })
  254. // if (_status == '已禁用') {
  255. // this.isShowAlert = true
  256. // this.alertTitle = '账号审核中'
  257. // this.confirmText = '退出APP'
  258. // this.showCancelButton = false
  259. // } else {
  260. // console.log(1231233212332312312213)
  261. // }
  262. },
  263. computed: {
  264. ...mapState(['hasLogin', 'userInfo']),
  265. // 手机号中间4位加*
  266. starUserphone() {
  267. let reg = /^(\d{3})\d{4}(\d{4})$/;
  268. if (this.phone) {
  269. return this.phone.replace(reg, "$1****$2");
  270. }
  271. }
  272. },
  273. methods: {
  274. // 检查APP是否有新版本
  275. onAPPUpdate() {
  276. // true 没有新版本的时候有提示,默认:false
  277. if (this.version == "发现新版本,立即更新") {
  278. // #ifdef APP-PLUS
  279. APPUpdate(true);
  280. // #endif
  281. }
  282. },
  283. checkVersion() {
  284. const baseUrlNew = config.def().baseUrlNew
  285. uni.request({
  286. url: baseUrlNew + '/appVersion/selectInfo',
  287. data: {
  288. appid: plus.runtime.appid,
  289. version: plus.runtime.version,
  290. imei: "1",
  291. type: 'sj'
  292. },
  293. method: 'GET',
  294. success: (res) => {
  295. if (this.version == res.data.data.version) {
  296. this.version = "当前为最新版" + this.version
  297. } else {
  298. this.version = "发现新版本,立即更新"
  299. }
  300. }
  301. })
  302. },
  303. async getAuthenticationStatus() {
  304. await this.$request.baseRequest('', '/driverInfo/firstAuthentication', {
  305. driverPhone: this.userInfo.phone,
  306. }).then(res => {
  307. if (res.data) {
  308. uni.setStorageSync("firstAuthentication", res.data) //更新缓存数据(解决pc端审核后未及时更新缓存 用于车友判断)
  309. }
  310. this.firstAuthentication = res.data
  311. if (this.firstAuthentication) {
  312. this.isFirstSH = false
  313. if (this.firstAuthentication.driverSex == '女') {
  314. this.driverSex = "女士"
  315. this.userName = this.firstAuthentication.driverCall
  316. } else if (this.firstAuthentication.driverSex == '男') {
  317. this.userName = this.firstAuthentication.driverCall
  318. this.driverSex = "先生"
  319. } else {
  320. // this.userName = this.firstAuthentication.driverCall
  321. this.userName = this.userInfo.userName //未认证时 显示(用户 + 电话号)未认证没有性别,通过性别判断认证或未认证
  322. this.driverSex = ""
  323. }
  324. if (this.firstAuthentication.authenticationStatus == '审核中') {
  325. this.statusVal = '身份认证审核中'
  326. } else if (this.firstAuthentication.authenticationStatus == '未通过') {
  327. this.statusVal = '身份认证未通过'
  328. } else if (this.firstAuthentication.authenticationStatus == '已驳回') {
  329. this.statusVal = '已驳回'
  330. } else if (this.firstAuthentication.authenticationStatus == '已过期') {
  331. this.statusVal = '证件已过期'
  332. } else if (this.firstAuthentication.authenticationStatus == '未认证') {
  333. this.statusVal = '未认证'
  334. } else {
  335. this.statusVal = '已认证'
  336. }
  337. } else {
  338. this.statusVal = '你还没有完成身份认证'
  339. this.userName = this.userInfo.userName
  340. this.isFirstSH = true
  341. }
  342. this.phone = this.userInfo.phone
  343. if (this.userInfo) {
  344. if (!this.userInfo.avatarUrl) {
  345. this.headUrl = "../../static/images/myimg/YongHu@3x.png"
  346. } else {
  347. this.headUrl = this.userInfo.avatarUrl
  348. }
  349. this.userphone = this.userInfo.phone
  350. } else {
  351. this.headUrl = "../../static/images/myimg/YongHu@3x.png"
  352. this.username = "立即登录"
  353. }
  354. })
  355. .catch(res => {
  356. uni.$u.toast(res.message);
  357. });
  358. },
  359. confirmClick() {
  360. // #ifdef APP-PLUS
  361. if (this.alertTitle == '账号审核中') {
  362. if (uni.getSystemInfoSync().platform == 'ios') {
  363. plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
  364. } else if (uni.getSystemInfoSync().platform == 'android') {
  365. plus.runtime.quit();
  366. }
  367. return
  368. }
  369. // #endif
  370. this.isShowAlert = false
  371. uni.$u.route('/pages/public/login');
  372. },
  373. cancelClick() {
  374. this.isShowAlert = false
  375. },
  376. goDetailPage(src, type) {
  377. if (!this.hasLogin) {
  378. this.isShowAlert = true;
  379. } else {
  380. if (type == 1 && this.statusVal == '已认证' || type == 1 && this.statusVal == '证件已过期' || type == 1 && this
  381. .statusVal == '身份认证未通过' || type == 1 && this.statusVal == '已驳回') {
  382. src = '/pages/mine/editDriverCertification'
  383. }
  384. if ((type == 2 || type == 3) && this.isFirstSH) {
  385. this.$refs.uToast.show({
  386. type: 'error',
  387. message: "请先完成司机身份认证",
  388. })
  389. } else if (type == 1 && this.statusVal == '身份认证审核中') {
  390. this.$refs.uToast.show({
  391. type: 'error',
  392. message: "正在审核中,请耐心等待!",
  393. })
  394. return
  395. } else {
  396. uni.$u.route(src);
  397. }
  398. }
  399. },
  400. toLogin() {
  401. console.log("userInfo", this.userInfo)
  402. if (!this.hasLogin || !this.userInfo || this.userName == "立即登录") {
  403. uni.$u.route('/pages/public/login');
  404. } else {}
  405. // else if(!this.userInfo.nickname){
  406. // this.inputShow = true
  407. // this.inputStatus = 'inline'
  408. // this.feild = "nickname"
  409. // this.inputContent = ''
  410. // }
  411. },
  412. }
  413. }
  414. </script>
  415. <style lang="scss" scoped>
  416. .content {
  417. background: url(../../static/images/mine/bg@2x.png);
  418. background-size: 100% 100%;
  419. height: 100vh;
  420. padding: 0 25rpx;
  421. }
  422. .top-height {
  423. height: var(--status-bar-height);
  424. }
  425. .arrow {
  426. margin-left: 15px;
  427. width: 8px;
  428. height: 12px;
  429. // justify-content: flex-end
  430. }
  431. .head {
  432. .row1 {
  433. display: flex;
  434. justify-content: flex-end;
  435. margin-top: 46rpx;
  436. }
  437. .row2 {
  438. .right-text {
  439. margin-left: 40rpx;
  440. }
  441. .name {
  442. font-size: 42rpx;
  443. font-weight: 700;
  444. color: #333333;
  445. }
  446. .phone {
  447. font-size: 26rpx;
  448. font-weight: 500;
  449. color: #8F97AB;
  450. }
  451. }
  452. }
  453. .content1 {
  454. display: flex;
  455. justify-content: space-between;
  456. margin-top: 60rpx;
  457. .left,
  458. .right {
  459. width: 49%;
  460. padding: 30rpx 20rpx;
  461. background: white;
  462. border-radius: 25rpx;
  463. box-sizing: border-box;
  464. display: flex;
  465. align-items: center;
  466. .sfrz-icon {
  467. width: 42rpx;
  468. height: 42rpx;
  469. }
  470. .right-text {
  471. margin-left: 20rpx;
  472. .top {
  473. font-size: 28rpx;
  474. font-weight: 700;
  475. color: #000000;
  476. }
  477. .bottom {
  478. margin-top: 6rpx;
  479. font-size: 24rpx;
  480. color: #898989;
  481. }
  482. }
  483. }
  484. }
  485. .content2 {
  486. background: white;
  487. padding: 20rpx;
  488. border-radius: 20rpx;
  489. margin-top: 20rpx;
  490. .img {
  491. margin-right: 10rpx;
  492. width: 40rpx;
  493. height: 40rpx;
  494. top: 2rpx;
  495. }
  496. .flex-space-between {
  497. margin: 10rpx 0 50rpx 0;
  498. }
  499. }
  500. // .version_css {
  501. // margin: 0 auto;
  502. // bottom: 120rpx;
  503. // color: #9D9D9D;
  504. // font-size: 32rpx;
  505. // // position:fixed;
  506. // position: absolute;
  507. // text-align: center;
  508. // left: 0;
  509. // right: 0;
  510. // margin: 0 auto;
  511. // }
  512. </style>