index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. <!-- 我的 -->
  2. <template>
  3. <view class="container">
  4. <view class='container_content'>
  5. <view class="head">
  6. <view style='margin-bottom:14px;' class="row flex flex-end">
  7. <u--image class='image' :showLoading="true" src="../../static/mine/saoma.png" width="20px"
  8. height="20px" @click="scanCode()" v-if='hasLogin'></u--image>
  9. <u--image @click="goDetailPage('/pages/mine/set',true)" style='margin-right:0;' class='image'
  10. :showLoading="true" src="../../static/mine/shezhi.png" width="20px" height="20px"></u--image>
  11. </view>
  12. <view class="flex">
  13. <u--image :showLoading="true"
  14. :src="userInfo.avatarUrl?userInfo.avatarUrl:'../../static/mine/avatar1.png'" width="56px"
  15. height="56px" shape='circle'></u--image>
  16. <view class='information' v-if='hasLogin'>
  17. <view class='flex items-center'>
  18. <view v-if='userName' class='username'>{{userName}} {{cargoCall}}</view>
  19. <view v-else class='username'>{{userInfo.userName}} </view>
  20. <view @click="goDetailPage('/pages/mine/cargoowner/cargoowner',true)" v-if='status'
  21. class='currectstatus'>已认证</view>
  22. <view @click="goDetailPage('/pages/mine/cargoowner/cargoowner',true)" v-if='!status'
  23. class='currectstatus1'>
  24. {{CargoOwner.authenticationStatus?CargoOwner.authenticationStatus:'未认证'}}
  25. </view>
  26. </view>
  27. <view class='phone'>{{starUserphone}}</view>
  28. </view>
  29. <view class='information' v-else @click="toLogin">立即登录</view>
  30. </view>
  31. <view v-if='hasLogin&&!status1' class='authentication flex flex-space-between'>
  32. <view>
  33. <view style='font-size:14px;'>货主身份认证</view>
  34. <view style='color:#DDA558;font-size:12px;'>您还没有完成货主认证哦~</view>
  35. </view>
  36. <view @click="goDetailPage('/pages/mine/cargoowner/cargoowner',true)"
  37. class='promptlyAuthentication'>立即认证
  38. </view>
  39. </view>
  40. </view>
  41. <view class='flex operate flex-space-around'>
  42. <view style='font-size:14px;' class='flex items-center' @click="toMyRelease">
  43. <u--image style='margin-right:8px;position:relative;top:3px;' :showLoading="true"
  44. src="../../static/mine/wodefabu.png" width="42px" height="42px"></u--image>我的发布
  45. </view>
  46. <view style='font-size:14px;' class='flex items-center' @click="goDetailPage('/pages/mine/evaluate')">
  47. <u--image style='margin-right:8px;position:relative;top:3px;' :showLoading="true"
  48. src="../../static/mine/pingjia.png" width="42px" height="42px"></u--image>
  49. 司机评价
  50. </view>
  51. </view>
  52. <view class="content1">
  53. <view class="flex flex-space-between content1-item"
  54. @click="goDetailPage('/pages/mine/myAccount/index',false)">
  55. <view class='flex items-center'>
  56. <u--image style='margin-right:8px;' :showLoading="true" src="../../static/mine/zhanghu.png"
  57. width="20px" height="20px"></u--image>我的账户
  58. </view>
  59. <view>
  60. <image class='right' src="@/static/mine/right.png" mode=""></image>
  61. <!-- <u-icon name="arrow-right" color="#7E7E7E" size="10"></u-icon> -->
  62. </view>
  63. </view>
  64. <view class="flex flex-space-between content1-item"
  65. @click="goDetailPage('/pages/mine/company/index',false)">
  66. <view class='flex items-center'>
  67. <u--image style='margin-right:8px;' :showLoading="true" src="../../static/mine/wodegongsi.png"
  68. width="20px" height="20px"></u--image>我的公司
  69. </view>
  70. <view class='flex'>
  71. <image class='right' src="@/static/mine/right.png" mode=""></image>
  72. <!-- <u-icon name="arrow-right" color="#7E7E7E" size="10"></u-icon> -->
  73. </view>
  74. </view>
  75. <view class="flex flex-space-between content1-item"
  76. @click="goDetailPage('/pages/mine/manageBankCards/index',false)">
  77. <view class='flex items-center'>
  78. <u--image style='margin-right:8px;' :showLoading="true" src="../../static/mine/yinhangka.png"
  79. width="20px" height="20px"></u--image>我的银行卡
  80. </view>
  81. <view>
  82. <image class='right' src="@/static/mine/right.png" mode=""></image>
  83. <!-- <u-icon name="arrow-right" color="#7E7E7E" size="10"></u-icon> -->
  84. </view>
  85. </view>
  86. <view class="flex flex-space-between content1-item"
  87. @click="goDetailPage('/pages/mine/cargoowner/cargoowner',true)">
  88. <view class='flex items-center'>
  89. <u--image style='margin-right:8px;' :showLoading="true" src="../../static/mine/huozhu.png"
  90. width="20px" height="20px"></u--image>货主认证
  91. </view>
  92. <view class='flex'>
  93. <image class='right' src="@/static/mine/right.png" mode=""></image>
  94. <!-- <u-icon name="arrow-right" color="#7E7E7E" size="10"></u-icon> -->
  95. </view>
  96. </view>
  97. <view class="flex flex-space-between content1-item"
  98. @click="goDetailPage('/pages/mine/agentCargoOwner',false)">
  99. <view class='flex'>
  100. <view class='flex items-center'>
  101. <u--image style='margin-right:8px;' :showLoading="true"
  102. src="../../static/mine/dailihuozhu.png" width="20px" height="20px"></u--image>代理货主
  103. </view>
  104. <u-badge v-if='redDotPrompt==0 && hasLogin' :isDot="true" type="error"></u-badge>
  105. </view>
  106. <view>
  107. <image class='right' src="@/static/mine/right.png" mode=""></image>
  108. <!-- <u-icon name="arrow-right" color="#7E7E7E" size="10"></u-icon> -->
  109. </view>
  110. </view>
  111. <view class="flex flex-space-between content1-item" @click="$helper.contactCustomerService()">
  112. <view class="flex align-center">
  113. <u--image style='margin-right:8px;' :showLoading="true" src="../../static/images/mine/kf.png"
  114. width="20px" height="20px"></u--image>
  115. <view>联系客服</view>
  116. </view>
  117. <view>
  118. <image class='right' src="@/static/mine/right.png" mode=""></image>
  119. </view>
  120. </view>
  121. <view class="flex flex-space-between content1-item"
  122. @click="goDetailPage('/pages/mine/helpDescription',true)">
  123. <view class='flex items-center'>
  124. <u--image style='margin-right:8px;' :showLoading="true"
  125. src="../../static/mine/bangzhushuoming.png" width="20px" height="20px"></u--image>帮助说明
  126. </view>
  127. <view>
  128. <image class='right' src="@/static/mine/right.png" mode=""></image>
  129. <!-- <u-icon name="arrow-right" color="#7E7E7E" size="10"></u-icon> -->
  130. </view>
  131. </view>
  132. <view class="flex flex-space-between content1-item">
  133. <view class="flex align-center">
  134. <u--image style='margin-right:8px;' :showLoading="true" src="../../static/images/mine/appUpdate.png"
  135. width="20px" height="20px"></u--image>
  136. <view>检查更新</view>
  137. </view>
  138. <view @click="onAPPUpdate">
  139. <text class="version_css">{{version}}</text>
  140. <image class='right' src="@/static/mine/right.png" mode=""></image>
  141. </view>
  142. </view>
  143. <!-- <view class="flex flex-space-between content1-item"
  144. @click="goDetailPage('/pages/mine/driverEvaluation')">
  145. <view class='flex items-center'>
  146. <u--image style='margin-right:8px;' :showLoading="true" src="../../static/mine/dailihuozhu.png"
  147. width="20px" height="20px"></u--image>司机评价
  148. </view>
  149. <view>
  150. <u-icon name="arrow-right" color="#7E7E7E" size="10"></u-icon>
  151. </view>
  152. </view> -->
  153. <!-- <view class="flex flex-space-between content1-item" @click="goDetailPage('/pages/mine/set')">
  154. <view class='flex items-center'>
  155. <u--image style='margin-right:8px;' :showLoading="true" src="../../static/mine/dailihuozhu.png"
  156. width="20px" height="20px"></u--image>设置
  157. </view>
  158. <view>
  159. <u-icon name="arrow-right" color="#7E7E7E" size="10"></u-icon>
  160. </view>
  161. </view> -->
  162. </view>
  163. </view>
  164. <u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :closeOnClickOverlay='true'
  165. :showCancelButton='showCancelButton' confirmColor='#2772FB' @confirm="confirmClick" @close="cancelClick"
  166. @cancel="cancelClick"></u-modal>
  167. <u-toast ref="uToast"></u-toast>
  168. </view>
  169. </template>
  170. <script>
  171. import {
  172. mapState
  173. } from 'vuex';
  174. import APPUpdate, {
  175. getCurrentNo
  176. } from '@/uni_modules/zhouWei-APPUpdate/js_sdk/appUpdate';
  177. import * as config from '@/config/index.js'
  178. export default {
  179. data() {
  180. return {
  181. confirmText: '',
  182. CargoOwner: {},
  183. redDotPrompt: 1,
  184. showCancelButton: true,
  185. isShowAlert: false,
  186. alertTitle: '',
  187. userName: '',
  188. phone: '',
  189. status: false,
  190. status1: false,
  191. alertContent: '您尚未登录,是否立即登录?',
  192. cargoCall: "",
  193. version: "1.1.0"
  194. };
  195. },
  196. onShow() {
  197. // #ifdef APP-PLUS
  198. this.version = plus.runtime.version
  199. this.checkVersion()
  200. // #endif
  201. uni.setTabBarItem({
  202. index: 0,
  203. text: '订单',
  204. iconPath: 'static/images/common/dingdan@2x(1).png',
  205. selectedIconPath: 'static/images/common/dingdan@2x.png'
  206. })
  207. if (this.hasLogin) {
  208. uni.showLoading({
  209. title: '加载中',
  210. mask: true
  211. })
  212. this.$request.baseRequest('get', '/cargoOwnerInfo/selectCargoOwner', {
  213. commonId: this.userInfo.id
  214. }).then(res => {
  215. uni.hideLoading()
  216. if (res.data) {
  217. this.CargoOwner = res.data
  218. if (res.data.authenticationStatus == '审核中' || res.data.authenticationStatus == '已驳回' || res
  219. .data.authenticationStatus == '未认证' || res.data.authenticationStatus == '已过期') {
  220. if (res.data.authenticationStatus == '未认证') {
  221. this.status1 = false
  222. } else {
  223. this.status1 = true
  224. }
  225. this.status = false
  226. } else {
  227. this.status = true
  228. this.status1 = true
  229. }
  230. } else {
  231. this.status = false
  232. this.status1 = false
  233. }
  234. })
  235. .catch(res => {
  236. uni.hideLoading()
  237. uni.showToast({
  238. title: res.message,
  239. icon: 'none',
  240. duration: 2000
  241. })
  242. });
  243. this.$request.baseRequest('get', '/cargoOwnerInfo/firstAuthentication', {
  244. phone: this.userInfo.phone
  245. }).then(res => {
  246. uni.setStorageSync("firstAuthentication", res.data)
  247. if (res.data) {
  248. this.redDotPrompt = res.data.redDotPrompt
  249. this.userName = res.data.call
  250. if (res.data.sex) {
  251. if (res.data.sex == '男') {
  252. this.cargoCall = "先生"
  253. } else {
  254. this.cargoCall = "女士"
  255. }
  256. }
  257. }
  258. this.$forceUpdate()
  259. })
  260. // this.phone = this.userInfo.phone ? this.userInfo.phone.replace(this.userInfo.phone.substring(3, 7),"****") : ''
  261. this.phone = this.userInfo.phone
  262. if (!this.cargoCall) {
  263. this.userName = this.userInfo.userName
  264. }
  265. if (!this.hasLogin) {
  266. this.isShowAlert = true
  267. return
  268. }
  269. }
  270. },
  271. onLoad() {
  272. },
  273. computed: {
  274. ...mapState(['hasLogin', 'userInfo', "firstAuthentication"]),
  275. // 手机号中间4位加*
  276. starUserphone() {
  277. let reg = /^(\d{3})\d{4}(\d{4})$/;
  278. if (this.phone) {
  279. return this.phone.replace(reg, "$1****$2");
  280. }
  281. }
  282. },
  283. methods: {
  284. // 检查APP是否有新版本
  285. onAPPUpdate() {
  286. // true 没有新版本的时候有提示,默认:false
  287. if (this.version == "发现新版本,立即更新") {
  288. APPUpdate(true);
  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: plus.runtime.version,
  298. imei: "1",
  299. type: 'hz'
  300. },
  301. method: 'GET',
  302. success: (res) => {
  303. var versionNo = plus.runtime.version
  304. if (versionNo == res.data.data.version) {
  305. this.version = "当前为最新版" + res.data.data.version
  306. } else {
  307. this.version = "发现新版本,立即更新"
  308. }
  309. }
  310. })
  311. },
  312. scanCode() {
  313. let _this = this;
  314. uni.scanCode({
  315. onlyFromCamera: true,
  316. success: function(res) {
  317. console.log('条码内容:' + res.result);
  318. _this.token = res.result.split('?token=')[1];
  319. _this.mobileScanOk();
  320. }
  321. });
  322. },
  323. mobileScanOk() {
  324. this.$request.baseRequest('get', '/login/loginInfo', {
  325. token: this.token
  326. }).then(res => {
  327. console.log('111111111111111111111')
  328. console.log(res)
  329. let resultData = res;
  330. console.log(resultData);
  331. uni.navigateTo({
  332. url: `./confirm?token=${this.token}`
  333. });
  334. })
  335. },
  336. confirmClick() {
  337. // #ifdef APP-PLUS
  338. if (this.alertTitle == '账号审核中') {
  339. if (uni.getSystemInfoSync().platform == 'ios') {
  340. plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
  341. } else if (uni.getSystemInfoSync().platform == 'android') {
  342. plus.runtime.quit();
  343. }
  344. return
  345. }
  346. // #endif
  347. this.isShowAlert = false
  348. uni.$u.route('/pages/public/login');
  349. },
  350. cancelClick() {
  351. this.isShowAlert = false
  352. },
  353. toMyRelease() {
  354. if (!this.hasLogin || !this.userInfo || this.userName == "立即登录") {
  355. uni.$u.route('/pages/public/login');
  356. } else {
  357. uni.$u.route('/pages/release/record');
  358. }
  359. },
  360. goDetailPage(src, isClick) {
  361. if (!this.hasLogin || !this.userInfo || this.userName == "立即登录") {
  362. // if(src!='/pages/mine/helpDescription'){
  363. uni.$u.route('/pages/public/login');
  364. // }else{
  365. // uni.$u.route(src);
  366. // }
  367. } else {
  368. this.$request.baseRequest('get', '/cargoOwnerInfo/firstAuthentication', {
  369. phone: this.userInfo.phone
  370. }).then(res => {
  371. uni.setStorageSync("firstAuthentication", res.data)
  372. if (res.data.authenticationStatus != '已认证' && !isClick) {
  373. uni.$u.toast('请先完成货主认证!')
  374. } else {
  375. if (src == '/pages/mine/agentCargoOwner') {
  376. this.$request.baseRequest('post', '/cargoOwnerInfo/api/readRed', {
  377. id: res.data.id
  378. }).then(res1 => {
  379. uni.$u.route(src);
  380. })
  381. } else {
  382. uni.$u.route(src);
  383. }
  384. }
  385. })
  386. // if (isClick) {
  387. // uni.$u.route(src);
  388. // } else {
  389. // uni.$u.toast('请先完成货主认证!')
  390. // }
  391. }
  392. },
  393. toLogin() {
  394. console.log("userInfo", this.userInfo)
  395. if (!this.hasLogin || !this.userInfo || this.userName == "立即登录") {
  396. uni.$u.route('/pages/public/login');
  397. } else {}
  398. // else if(!this.userInfo.nickname){
  399. // this.inputShow = true
  400. // this.inputStatus = 'inline'
  401. // this.feild = "nickname"
  402. // this.inputContent = ''
  403. // }
  404. }
  405. }
  406. }
  407. </script>
  408. <style lang="scss" scoped>
  409. .container {
  410. // padding-top: 85px;
  411. padding-top: 35px;
  412. background-color: #F5F6FA;
  413. position: relative;
  414. width: 100vw;
  415. overflow: hidden;
  416. background: url('~@/static/mine/bg@3x.png');
  417. background-size: 100% 100%;
  418. margin: 0 auto;
  419. height: calc(100vh - 80rpx);
  420. .container_content {
  421. padding: 18px;
  422. }
  423. }
  424. .image {
  425. margin: 0 7px;
  426. }
  427. .username {
  428. font-size: 21px;
  429. }
  430. .information {
  431. margin: 0 0 10px 17px;
  432. }
  433. .currectstatus {
  434. display: flex;
  435. align-items: center;
  436. justify-content: center;
  437. width: 100rpx;
  438. height: 40rpx;
  439. background: #161111;
  440. border-radius: 16px;
  441. color: #D6B798;
  442. font-size: 24rpx;
  443. margin-left: 10rpx;
  444. }
  445. .currectstatus1 {
  446. display: flex;
  447. align-items: center;
  448. justify-content: center;
  449. width: 100rpx;
  450. height: 40rpx;
  451. background: linear-gradient(145deg, #C1C3CC 0%, #85909E 100%);
  452. ;
  453. border-radius: 16px;
  454. color: #D6B798;
  455. font-size: 24rpx;
  456. margin-left: 10rpx;
  457. }
  458. .phone {
  459. color: #8F97AB;
  460. font-size: 13px;
  461. margin-top: 5px;
  462. }
  463. .operate {
  464. font-size: 16px;
  465. font-weight: 600;
  466. background: #fff;
  467. border-radius: 10px;
  468. padding: 10px 15px;
  469. margin: 15px 0;
  470. }
  471. .content1 {
  472. background: #fff;
  473. padding: 10px;
  474. border-radius: 10px;
  475. .content1-item {
  476. padding: 10px;
  477. }
  478. }
  479. .authentication {
  480. border: 1px solid #F3EACF;
  481. margin: 10px 0;
  482. height: 64px;
  483. border-radius: 10px;
  484. padding: 15px;
  485. box-sizing: border-box;
  486. background: linear-gradient(144deg, #FEFAEE 0%, #FEFDF8 100%);
  487. }
  488. .promptlyAuthentication {
  489. font-size: 13px;
  490. padding: 8px 16px;
  491. border-radius: 15px;
  492. background: linear-gradient(327deg, #EDBB63 0%, #FFDEA5 100%);
  493. ;
  494. }
  495. .items-center {
  496. align-items: center;
  497. }
  498. .right {
  499. width: 10px;
  500. height: 10px;
  501. }
  502. .u-badge--error {
  503. background: #EE5032;
  504. width: 6px;
  505. height: 6px;
  506. }
  507. .version_css {
  508. margin-right: 10rpx;
  509. color: #9D9D9D;
  510. font-size: 32rpx;
  511. text-align: center;
  512. }
  513. </style>