index.vue 17 KB

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