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