index.vue 15 KB

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