index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  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/kf.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. console.log(this.version)
  304. console.log(res.data.data.version)
  305. if (this.version == res.data.data.version) {
  306. this.version = "当前为最新版" + this.version
  307. } else {
  308. this.version = "发现新版本,立即更新"
  309. }
  310. }
  311. })
  312. },
  313. scanCode() {
  314. let _this = this;
  315. uni.scanCode({
  316. onlyFromCamera: true,
  317. success: function(res) {
  318. console.log('条码内容:' + res.result);
  319. _this.token = res.result.split('?token=')[1];
  320. _this.mobileScanOk();
  321. }
  322. });
  323. },
  324. mobileScanOk() {
  325. this.$request.baseRequest('get', '/login/loginInfo', {
  326. token: this.token
  327. }).then(res => {
  328. console.log('111111111111111111111')
  329. console.log(res)
  330. let resultData = res;
  331. console.log(resultData);
  332. uni.navigateTo({
  333. url: `./confirm?token=${this.token}`
  334. });
  335. })
  336. },
  337. confirmClick() {
  338. // #ifdef APP-PLUS
  339. if (this.alertTitle == '账号审核中') {
  340. if (uni.getSystemInfoSync().platform == 'ios') {
  341. plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
  342. } else if (uni.getSystemInfoSync().platform == 'android') {
  343. plus.runtime.quit();
  344. }
  345. return
  346. }
  347. // #endif
  348. this.isShowAlert = false
  349. uni.$u.route('/pages/public/login');
  350. },
  351. cancelClick() {
  352. this.isShowAlert = false
  353. },
  354. toMyRelease() {
  355. if (!this.hasLogin || !this.userInfo || this.userName == "立即登录") {
  356. uni.$u.route('/pages/public/login');
  357. } else {
  358. uni.$u.route('/pages/release/record');
  359. }
  360. },
  361. goDetailPage(src, isClick) {
  362. if (!this.hasLogin || !this.userInfo || this.userName == "立即登录") {
  363. // if(src!='/pages/mine/helpDescription'){
  364. uni.$u.route('/pages/public/login');
  365. // }else{
  366. // uni.$u.route(src);
  367. // }
  368. } else {
  369. this.$request.baseRequest('get', '/cargoOwnerInfo/firstAuthentication', {
  370. phone: this.userInfo.phone
  371. }).then(res => {
  372. uni.setStorageSync("firstAuthentication", res.data)
  373. if (res.data.authenticationStatus != '已认证' && !isClick) {
  374. uni.$u.toast('请先完成货主认证!')
  375. } else {
  376. if (src == '/pages/mine/agentCargoOwner') {
  377. this.$request.baseRequest('post', '/cargoOwnerInfo/api/readRed', {
  378. id: res.data.id
  379. }).then(res1 => {
  380. uni.$u.route(src);
  381. })
  382. } else {
  383. uni.$u.route(src);
  384. }
  385. }
  386. })
  387. // if (isClick) {
  388. // uni.$u.route(src);
  389. // } else {
  390. // uni.$u.toast('请先完成货主认证!')
  391. // }
  392. }
  393. },
  394. toLogin() {
  395. console.log("userInfo", this.userInfo)
  396. if (!this.hasLogin || !this.userInfo || this.userName == "立即登录") {
  397. uni.$u.route('/pages/public/login');
  398. } else {}
  399. // else if(!this.userInfo.nickname){
  400. // this.inputShow = true
  401. // this.inputStatus = 'inline'
  402. // this.feild = "nickname"
  403. // this.inputContent = ''
  404. // }
  405. }
  406. }
  407. }
  408. </script>
  409. <style lang="scss" scoped>
  410. .container {
  411. // padding-top: 85px;
  412. padding-top: 35px;
  413. background-color: #F5F6FA;
  414. position: relative;
  415. width: 100vw;
  416. overflow: hidden;
  417. background: url('~@/static/mine/bg@3x.png');
  418. background-size: 100% 100%;
  419. margin: 0 auto;
  420. height: calc(100vh - 80rpx);
  421. .container_content {
  422. padding: 18px;
  423. }
  424. }
  425. .image {
  426. margin: 0 7px;
  427. }
  428. .username {
  429. font-size: 21px;
  430. }
  431. .information {
  432. margin: 0 0 10px 17px;
  433. }
  434. .currectstatus {
  435. display: flex;
  436. align-items: center;
  437. justify-content: center;
  438. width: 100rpx;
  439. height: 40rpx;
  440. background: #161111;
  441. border-radius: 16px;
  442. color: #D6B798;
  443. font-size: 24rpx;
  444. margin-left: 10rpx;
  445. }
  446. .currectstatus1 {
  447. display: flex;
  448. align-items: center;
  449. justify-content: center;
  450. width: 100rpx;
  451. height: 40rpx;
  452. background: linear-gradient(145deg, #C1C3CC 0%, #85909E 100%);
  453. ;
  454. border-radius: 16px;
  455. color: #D6B798;
  456. font-size: 24rpx;
  457. margin-left: 10rpx;
  458. }
  459. .phone {
  460. color: #8F97AB;
  461. font-size: 13px;
  462. margin-top: 5px;
  463. }
  464. .operate {
  465. font-size: 16px;
  466. font-weight: 600;
  467. background: #fff;
  468. border-radius: 10px;
  469. padding: 10px 15px;
  470. margin: 15px 0;
  471. }
  472. .content1 {
  473. background: #fff;
  474. padding: 10px;
  475. border-radius: 10px;
  476. .content1-item {
  477. padding: 10px;
  478. }
  479. }
  480. .authentication {
  481. border: 1px solid #F3EACF;
  482. margin: 10px 0;
  483. height: 64px;
  484. border-radius: 10px;
  485. padding: 15px;
  486. box-sizing: border-box;
  487. background: linear-gradient(144deg, #FEFAEE 0%, #FEFDF8 100%);
  488. }
  489. .promptlyAuthentication {
  490. font-size: 13px;
  491. padding: 8px 16px;
  492. border-radius: 15px;
  493. background: linear-gradient(327deg, #EDBB63 0%, #FFDEA5 100%);
  494. ;
  495. }
  496. .items-center {
  497. align-items: center;
  498. }
  499. .right {
  500. width: 10px;
  501. height: 10px;
  502. }
  503. .u-badge--error {
  504. background: #EE5032;
  505. width: 6px;
  506. height: 6px;
  507. }
  508. .version_css {
  509. margin-right: 10rpx;
  510. color: #9D9D9D;
  511. font-size: 32rpx;
  512. text-align: center;
  513. }
  514. </style>