index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  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: true,
  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. this.$request.baseRequest('get', '/publishTaskInfo/seeTask', {
  300. id: this.id
  301. }).then(res => {
  302. console.log(res)
  303. res.data.driverCommonId=this.userInfo.id
  304. this.$request.baseRequest('post', '/publishTaskInfo/api/addOrder ', res.data).then(res => {
  305. console.log(res)
  306. if (res.code == 200) {
  307. this.$refs.uToast.show({
  308. type: 'success',
  309. message: "抢单成功!",
  310. complete() {
  311. uni.switchTab({
  312. url: "/pages/order/index"
  313. })
  314. }
  315. })
  316. } else {
  317. this.$refs.uToast.show({
  318. type: 'error',
  319. message: res.message,
  320. })
  321. }
  322. })
  323. })
  324. },
  325. // 检查APP是否有新版本
  326. onAPPUpdate() {
  327. // true 没有新版本的时候有提示,默认:false
  328. if (this.version == "发现新版本,立即更新") {
  329. // #ifdef APP-PLUS
  330. APPUpdate(true);
  331. // #endif
  332. }
  333. },
  334. checkVersion() {
  335. const baseUrlNew = config.def().baseUrlNew
  336. uni.request({
  337. url: baseUrlNew + '/appVersion/selectInfo',
  338. data: {
  339. appid: plus.runtime.appid,
  340. version: this.version,
  341. imei: "1",
  342. type: 'sj'
  343. },
  344. method: 'GET',
  345. success: (res) => {
  346. console.log("查看1111", this.version)
  347. console.log("查看11111", res)
  348. if (!res.data.data.version) { //有返回值证明需要更新 没有则不需要
  349. this.version = "当前为最新版" + this.version
  350. } else {
  351. this.version = "发现新版本,立即更新"
  352. }
  353. }
  354. })
  355. },
  356. async getAuthenticationStatus() {
  357. await this.$request.baseRequest('', '/driverInfo/firstAuthentication', {
  358. driverPhone: this.userInfo.phone,
  359. }).then(res => {
  360. if (res.data) {
  361. uni.setStorageSync("firstAuthentication", res.data) //更新缓存数据(解决pc端审核后未及时更新缓存 用于车友判断)
  362. }
  363. this.firstAuthentication = res.data
  364. if (this.firstAuthentication) {
  365. this.isFirstSH = false
  366. if (this.firstAuthentication.driverSex == '女') {
  367. this.driverSex = "女士"
  368. this.userName = this.firstAuthentication.driverCall
  369. } else if (this.firstAuthentication.driverSex == '男') {
  370. this.userName = this.firstAuthentication.driverCall
  371. this.driverSex = "先生"
  372. } else {
  373. // this.userName = this.firstAuthentication.driverCall
  374. this.userName = this.userInfo.userName //未认证时 显示(用户 + 电话号)未认证没有性别,通过性别判断认证或未认证
  375. this.driverSex = ""
  376. }
  377. if (this.firstAuthentication.authenticationStatus == '审核中') {
  378. this.statusVal = '身份认证审核中'
  379. } else if (this.firstAuthentication.authenticationStatus == '未通过') {
  380. this.statusVal = '身份认证未通过'
  381. } else 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 {
  388. this.statusVal = '已认证'
  389. }
  390. } else {
  391. this.statusVal = '你还没有完成身份认证'
  392. this.userName = this.userInfo.userName
  393. this.isFirstSH = true
  394. }
  395. this.phone = this.userInfo.phone
  396. if (this.userInfo) {
  397. if (!this.userInfo.avatarUrl) {
  398. this.headUrl = "../../static/images/myimg/YongHu@3x.png"
  399. } else {
  400. this.headUrl = this.userInfo.avatarUrl
  401. }
  402. this.userphone = this.userInfo.phone
  403. } else {
  404. this.headUrl = "../../static/images/myimg/YongHu@3x.png"
  405. this.username = "立即登录"
  406. }
  407. })
  408. .catch(res => {
  409. uni.$u.toast(res.message);
  410. });
  411. },
  412. confirmClick() {
  413. // #ifdef APP-PLUS
  414. if (this.alertTitle == '账号审核中') {
  415. if (uni.getSystemInfoSync().platform == 'ios') {
  416. plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
  417. } else if (uni.getSystemInfoSync().platform == 'android') {
  418. plus.runtime.quit();
  419. }
  420. return
  421. }
  422. // #endif
  423. this.isShowAlert = false
  424. uni.$u.route('/pages/public/login');
  425. },
  426. cancelClick() {
  427. this.isShowAlert = false
  428. },
  429. goDetailPage(src, type) {
  430. if (!this.hasLogin) {
  431. this.isShowAlert = true;
  432. } else {
  433. if (type == 1 && this.statusVal == '已认证' || type == 1 && this.statusVal == '证件已过期' || type == 1 && this
  434. .statusVal == '身份认证未通过' || type == 1 && this.statusVal == '已驳回') {
  435. src = '/pages/mine/editDriverCertification'
  436. }
  437. if ((type == 2 || type == 3) && this.isFirstSH) {
  438. this.$refs.uToast.show({
  439. type: 'error',
  440. message: "请先完成司机身份认证",
  441. })
  442. } else if (type == 1 && this.statusVal == '身份认证审核中') {
  443. this.$refs.uToast.show({
  444. type: 'error',
  445. message: "正在审核中,请耐心等待!",
  446. })
  447. return
  448. } else {
  449. uni.$u.route(src);
  450. }
  451. }
  452. },
  453. toLogin() {
  454. console.log("userInfo", this.userInfo)
  455. if (!this.hasLogin || !this.userInfo || this.userName == "立即登录") {
  456. uni.$u.route('/pages/public/login');
  457. } else {}
  458. // else if(!this.userInfo.nickname){
  459. // this.inputShow = true
  460. // this.inputStatus = 'inline'
  461. // this.feild = "nickname"
  462. // this.inputContent = ''
  463. // }
  464. },
  465. }
  466. }
  467. </script>
  468. <style lang="scss" scoped>
  469. .content {
  470. background: url(../../static/images/mine/bg@2x.png);
  471. background-size: 100% 100%;
  472. height: 100vh;
  473. padding: 0 25rpx;
  474. }
  475. .top-height {
  476. height: var(--status-bar-height);
  477. }
  478. .arrow {
  479. margin-left: 15px;
  480. width: 8px;
  481. height: 12px;
  482. // justify-content: flex-end
  483. }
  484. .head {
  485. .row1 {
  486. display: flex;
  487. justify-content: flex-end;
  488. margin-top: 46rpx;
  489. }
  490. .row2 {
  491. .right-text {
  492. margin-left: 40rpx;
  493. }
  494. .name {
  495. font-size: 42rpx;
  496. font-weight: 700;
  497. color: #333333;
  498. }
  499. .phone {
  500. font-size: 26rpx;
  501. font-weight: 500;
  502. color: #8F97AB;
  503. }
  504. }
  505. }
  506. .content1 {
  507. display: flex;
  508. justify-content: space-between;
  509. margin-top: 60rpx;
  510. .left,
  511. .right {
  512. width: 49%;
  513. padding: 30rpx 20rpx;
  514. background: white;
  515. border-radius: 25rpx;
  516. box-sizing: border-box;
  517. display: flex;
  518. align-items: center;
  519. .sfrz-icon {
  520. width: 42rpx;
  521. height: 42rpx;
  522. }
  523. .right-text {
  524. margin-left: 20rpx;
  525. .top {
  526. font-size: 28rpx;
  527. font-weight: 700;
  528. color: #000000;
  529. }
  530. .bottom {
  531. margin-top: 6rpx;
  532. font-size: 24rpx;
  533. color: #898989;
  534. }
  535. }
  536. }
  537. }
  538. .content2 {
  539. background: white;
  540. padding: 20rpx;
  541. border-radius: 20rpx;
  542. margin-top: 20rpx;
  543. .img {
  544. margin-right: 10rpx;
  545. width: 40rpx;
  546. height: 40rpx;
  547. top: 2rpx;
  548. }
  549. .flex-space-between {
  550. margin: 10rpx 0 50rpx 0;
  551. }
  552. }
  553. .version_css {
  554. // margin-right: 10rpx;
  555. color: #9D9D9D;
  556. font-size: 32rpx;
  557. text-align: center;
  558. }
  559. .scan{
  560. position:relative;
  561. top: -1px;
  562. left: -4px;
  563. }
  564. </style>