index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  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">
  118. <view class="flex align-center">
  119. <image class="img" src="@/static/images/mine/appUpdate.png" mode='widthFix'>
  120. </image>
  121. <view>检查更新</view>
  122. </view>
  123. <view>
  124. <view class="version_css" @click="onAPPUpdate">
  125. {{version}}
  126. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  127. </view>
  128. </view>
  129. </view>
  130. <view class="flex flex-space-between" @click="goDetailPage('/pages/mine/set')">
  131. <view class="flex align-center">
  132. <image class="img" src="@/static/images/mine/set.png" mode='widthFix'>
  133. </image>
  134. <view>设置</view>
  135. </view>
  136. <view>
  137. <image src="../../static/images/myimg/gengduo1@3x.png" class="arrow"></image>
  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. plus.runtime.getProperty(plus.runtime.appid, (info) => {
  201. //版本号
  202. this.version = info.version;
  203. console.log("当前版本为:", this.version)
  204. this.checkVersion()
  205. })
  206. // this.version = plus.runtime.version
  207. // this.checkVersion()
  208. // #endif
  209. uni.setTabBarItem({
  210. index: 0,
  211. text: '货源',
  212. iconPath: 'static/images/common/huoyuan@2x(1).png',
  213. selectedIconPath: 'static/images/common/huoyuan@2x.png'
  214. })
  215. uni.setTabBarItem({
  216. index: 2,
  217. text: '订单',
  218. iconPath: 'static/images/common/dingdan@2x(1).png',
  219. selectedIconPath: 'static/images/common/dingdan@2x.png'
  220. })
  221. //获取认证状态
  222. // console.log(userInfo)
  223. // console.log(hasLogin)
  224. if (!this.hasLogin) {
  225. this.isShowAlert = true
  226. return
  227. }
  228. this.getAuthenticationStatus()
  229. that.$request.baseRequest('get', '/newsInfo/unreadMessage', {
  230. reCommonId: this.userInfo.id,
  231. }).then(res3 => {
  232. if (res3.data || res3.data == 0) {
  233. let name = 'myTip';
  234. let value = res3.data
  235. if (value == 0) {
  236. uni.removeTabBarBadge({
  237. index: 3
  238. })
  239. }
  240. that.$store.commit('$uStore', {
  241. name,
  242. value
  243. });
  244. if (value != 0 && value) {
  245. uni.setTabBarBadge({
  246. index: 3,
  247. text: value + ""
  248. })
  249. }
  250. }
  251. })
  252. },
  253. async onLoad() {
  254. that = this
  255. // let _status = await that.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  256. // driverPhone: this.userInfo.phone,
  257. // }).then(res => {
  258. // return res.data.authenticationStatus
  259. // })
  260. // if (_status == '已禁用') {
  261. // this.isShowAlert = true
  262. // this.alertTitle = '账号审核中'
  263. // this.confirmText = '退出APP'
  264. // this.showCancelButton = false
  265. // } else {
  266. // console.log(1231233212332312312213)
  267. // }
  268. },
  269. computed: {
  270. ...mapState(['hasLogin', 'userInfo']),
  271. // 手机号中间4位加*
  272. starUserphone() {
  273. let reg = /^(\d{3})\d{4}(\d{4})$/;
  274. if (this.phone) {
  275. return this.phone.replace(reg, "$1****$2");
  276. }
  277. }
  278. },
  279. methods: {
  280. // 检查APP是否有新版本
  281. onAPPUpdate() {
  282. // true 没有新版本的时候有提示,默认:false
  283. if (this.version == "发现新版本,立即更新") {
  284. // #ifdef APP-PLUS
  285. APPUpdate(true);
  286. // #endif
  287. }
  288. },
  289. checkVersion() {
  290. const baseUrlNew = config.def().baseUrlNew
  291. uni.request({
  292. url: baseUrlNew + '/appVersion/selectInfo',
  293. data: {
  294. appid: plus.runtime.appid,
  295. version: this.version,
  296. imei: "1",
  297. type: 'sj'
  298. },
  299. method: 'GET',
  300. success: (res) => {
  301. console.log("查看1111",this.version)
  302. console.log("查看11111",res)
  303. if (!res.data.data.version) {//有返回值证明需要更新 没有则不需要
  304. this.version = "当前为最新版" + this.version
  305. } else {
  306. this.version = "发现新版本,立即更新"
  307. }
  308. }
  309. })
  310. },
  311. async getAuthenticationStatus() {
  312. await this.$request.baseRequest('', '/driverInfo/firstAuthentication', {
  313. driverPhone: this.userInfo.phone,
  314. }).then(res => {
  315. if (res.data) {
  316. uni.setStorageSync("firstAuthentication", res.data) //更新缓存数据(解决pc端审核后未及时更新缓存 用于车友判断)
  317. }
  318. this.firstAuthentication = res.data
  319. if (this.firstAuthentication) {
  320. this.isFirstSH = false
  321. if (this.firstAuthentication.driverSex == '女') {
  322. this.driverSex = "女士"
  323. this.userName = this.firstAuthentication.driverCall
  324. } else if (this.firstAuthentication.driverSex == '男') {
  325. this.userName = this.firstAuthentication.driverCall
  326. this.driverSex = "先生"
  327. } else {
  328. // this.userName = this.firstAuthentication.driverCall
  329. this.userName = this.userInfo.userName //未认证时 显示(用户 + 电话号)未认证没有性别,通过性别判断认证或未认证
  330. this.driverSex = ""
  331. }
  332. if (this.firstAuthentication.authenticationStatus == '审核中') {
  333. this.statusVal = '身份认证审核中'
  334. } else if (this.firstAuthentication.authenticationStatus == '未通过') {
  335. this.statusVal = '身份认证未通过'
  336. } else if (this.firstAuthentication.authenticationStatus == '已驳回') {
  337. this.statusVal = '已驳回'
  338. } else if (this.firstAuthentication.authenticationStatus == '已过期') {
  339. this.statusVal = '证件已过期'
  340. } else if (this.firstAuthentication.authenticationStatus == '未认证') {
  341. this.statusVal = '未认证'
  342. } else {
  343. this.statusVal = '已认证'
  344. }
  345. } else {
  346. this.statusVal = '你还没有完成身份认证'
  347. this.userName = this.userInfo.userName
  348. this.isFirstSH = true
  349. }
  350. this.phone = this.userInfo.phone
  351. if (this.userInfo) {
  352. if (!this.userInfo.avatarUrl) {
  353. this.headUrl = "../../static/images/myimg/YongHu@3x.png"
  354. } else {
  355. this.headUrl = this.userInfo.avatarUrl
  356. }
  357. this.userphone = this.userInfo.phone
  358. } else {
  359. this.headUrl = "../../static/images/myimg/YongHu@3x.png"
  360. this.username = "立即登录"
  361. }
  362. })
  363. .catch(res => {
  364. uni.$u.toast(res.message);
  365. });
  366. },
  367. confirmClick() {
  368. // #ifdef APP-PLUS
  369. if (this.alertTitle == '账号审核中') {
  370. if (uni.getSystemInfoSync().platform == 'ios') {
  371. plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
  372. } else if (uni.getSystemInfoSync().platform == 'android') {
  373. plus.runtime.quit();
  374. }
  375. return
  376. }
  377. // #endif
  378. this.isShowAlert = false
  379. uni.$u.route('/pages/public/login');
  380. },
  381. cancelClick() {
  382. this.isShowAlert = false
  383. },
  384. goDetailPage(src, type) {
  385. if (!this.hasLogin) {
  386. this.isShowAlert = true;
  387. } else {
  388. if (type == 1 && this.statusVal == '已认证' || type == 1 && this.statusVal == '证件已过期' || type == 1 && this
  389. .statusVal == '身份认证未通过' || type == 1 && this.statusVal == '已驳回') {
  390. src = '/pages/mine/editDriverCertification'
  391. }
  392. if ((type == 2 || type == 3) && this.isFirstSH) {
  393. this.$refs.uToast.show({
  394. type: 'error',
  395. message: "请先完成司机身份认证",
  396. })
  397. } else if (type == 1 && this.statusVal == '身份认证审核中') {
  398. this.$refs.uToast.show({
  399. type: 'error',
  400. message: "正在审核中,请耐心等待!",
  401. })
  402. return
  403. } else {
  404. uni.$u.route(src);
  405. }
  406. }
  407. },
  408. toLogin() {
  409. console.log("userInfo", this.userInfo)
  410. if (!this.hasLogin || !this.userInfo || this.userName == "立即登录") {
  411. uni.$u.route('/pages/public/login');
  412. } else {}
  413. // else if(!this.userInfo.nickname){
  414. // this.inputShow = true
  415. // this.inputStatus = 'inline'
  416. // this.feild = "nickname"
  417. // this.inputContent = ''
  418. // }
  419. },
  420. }
  421. }
  422. </script>
  423. <style lang="scss" scoped>
  424. .content {
  425. background: url(../../static/images/mine/bg@2x.png);
  426. background-size: 100% 100%;
  427. height: 100vh;
  428. padding: 0 25rpx;
  429. }
  430. .top-height {
  431. height: var(--status-bar-height);
  432. }
  433. .arrow {
  434. margin-left: 15px;
  435. width: 8px;
  436. height: 12px;
  437. // justify-content: flex-end
  438. }
  439. .head {
  440. .row1 {
  441. display: flex;
  442. justify-content: flex-end;
  443. margin-top: 46rpx;
  444. }
  445. .row2 {
  446. .right-text {
  447. margin-left: 40rpx;
  448. }
  449. .name {
  450. font-size: 42rpx;
  451. font-weight: 700;
  452. color: #333333;
  453. }
  454. .phone {
  455. font-size: 26rpx;
  456. font-weight: 500;
  457. color: #8F97AB;
  458. }
  459. }
  460. }
  461. .content1 {
  462. display: flex;
  463. justify-content: space-between;
  464. margin-top: 60rpx;
  465. .left,
  466. .right {
  467. width: 49%;
  468. padding: 30rpx 20rpx;
  469. background: white;
  470. border-radius: 25rpx;
  471. box-sizing: border-box;
  472. display: flex;
  473. align-items: center;
  474. .sfrz-icon {
  475. width: 42rpx;
  476. height: 42rpx;
  477. }
  478. .right-text {
  479. margin-left: 20rpx;
  480. .top {
  481. font-size: 28rpx;
  482. font-weight: 700;
  483. color: #000000;
  484. }
  485. .bottom {
  486. margin-top: 6rpx;
  487. font-size: 24rpx;
  488. color: #898989;
  489. }
  490. }
  491. }
  492. }
  493. .content2 {
  494. background: white;
  495. padding: 20rpx;
  496. border-radius: 20rpx;
  497. margin-top: 20rpx;
  498. .img {
  499. margin-right: 10rpx;
  500. width: 40rpx;
  501. height: 40rpx;
  502. top: 2rpx;
  503. }
  504. .flex-space-between {
  505. margin: 10rpx 0 50rpx 0;
  506. }
  507. }
  508. .version_css {
  509. // margin-right: 10rpx;
  510. color: #9D9D9D;
  511. font-size: 32rpx;
  512. text-align: center;
  513. }
  514. </style>