index.vue 16 KB

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