info.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. <template>
  2. <view class="center">
  3. <view
  4. :style="'position: relative;border:0;background:url('+img.infoBg+');background-size:100% 100%;background-color: #fff;padding:80rpx 56rpx;margin:32rpx;border-style: none;'">
  5. <view class="top-setting" @click="doSomething(setting)">
  6. <view class="main">
  7. <image src="../../static/czzn-img/info/info-setting.png" class="setting-icon" />
  8. </view>
  9. </view>
  10. <view class="userInfo" @click.capture="toUserInfo">
  11. <!-- <u-avatar :src="userInfo.avatar" size="120rpx"></u-avatar> -->
  12. <view class="logo-title">
  13. <view class="user-name" v-if="hasLogin">
  14. <span>{{userInfo.displayName||userInfo.username}}</span>
  15. <span class="role-tag" v-if="isDriverUser">{{$t('mine.driver')}}</span>
  16. <span class="role-tag" v-if="isDealerUser">{{$t('mine.dealer')}}</span>
  17. <span class="role-tag" v-if="isAuditUser">{{$t('mine.auditUser')}}</span>
  18. <span class="role-tag" v-if="isTransUser">{{$t('order.transporter')}}</span>
  19. </view>
  20. <text class="user-name" v-else>{{$t('mine.notLogged')}}</text>
  21. <text class="user-phone">{{userInfo.phone}}</text>
  22. </view>
  23. </view>
  24. </view>
  25. <!-- <template v-if="isDealerUser || isDriverUser">
  26. <view class="menu-wrap">
  27. <u-cell :isLink="true" arrow-direction="right" @click="doSomething(allOrder)" :border="false"
  28. :customStyle="{'background':'#fff','font-weight':'bold','padding':'10rpx 10rpx','borderBottom':'2rpx solid #f5f7fa'}"
  29. :title="$t('mine.order')"></u-cell>
  30. <uni-grid class="grid" :column="5" :showBorder="false" :square="true">
  31. <uni-grid-item class="item" v-for="(item,index) in gridList" @click.native="toOrdering(item)"
  32. :key="index">
  33. <image :src="item.icon" class="grid-icon" />
  34. <text class="grid-text">{{item.title}}</text>
  35. </uni-grid-item>
  36. </uni-grid>
  37. </view>
  38. <view class="menu-wrap">
  39. <u-cell :border="false"
  40. :customStyle="{'background':'#f5f7fa','font-weight':'bold','padding':'10rpx 10rpx'}"
  41. :title="$t('mine.service')"></u-cell>
  42. <template v-if="isDealerUser">
  43. <u-cell-group class="cell-wrap" :border="false">
  44. <u-cell :isLink="true" arrow-direction="right" :border="false" class="cell-item"
  45. v-for="(item,index) in dealerMenuList" @click.native="doSomething(item)" :key="index"
  46. :title="item.title">
  47. <u-icon slot="icon" :name="item.icon" color="#2979ff" size="24" class="cell-icon"></u-icon>
  48. </u-cell>
  49. </u-cell-group>
  50. </template>
  51. <template v-if="isDriverUser">
  52. <u-cell-group class="cell-wrap" :border="false">
  53. <u-cell :isLink="true" arrow-direction="right" :border="false" class="cell-item"
  54. v-for="(item,index) in driverMenuList" @click.native="doSomething(item)" :key="index"
  55. :title="item.title">
  56. <u-icon slot="icon" :name="item.icon" color="#2979ff" size="24" class="cell-icon"></u-icon>
  57. </u-cell>
  58. </u-cell-group>
  59. </template>
  60. </view>
  61. </template> -->
  62. <Bars></Bars>
  63. </view>
  64. </template>
  65. <script>
  66. import {
  67. mapGetters,
  68. mapMutations
  69. } from "vuex";
  70. import {
  71. getTenantCacheList
  72. } from '../../utils/util.js'
  73. import Bars from '../../components/tabBar/tabBar.vue';
  74. import imgUtil from '../../utils/imgUtil'
  75. export default {
  76. components: {
  77. Bars
  78. },
  79. // #ifdef APP
  80. onBackPress({
  81. from
  82. }) {
  83. if (from == "backbutton") {
  84. this.$nextTick(function() {
  85. uniShare.hide();
  86. });
  87. return uniShare.isShow;
  88. }
  89. },
  90. // #endif
  91. data() {
  92. return {
  93. img:imgUtil,
  94. setting: {
  95. title: this.$t("mine.settings"),
  96. to: "/pages/ucenter/settings",
  97. icon: "gear",
  98. show: true,
  99. },
  100. allOrder: {
  101. title: this.$t("mine.all"),
  102. icon: "file-text",
  103. to: '/subpages/order/dealerList?index=0'
  104. },
  105. gridList: [{
  106. title: this.$t("mine.reviewed"),
  107. icon: "../../static/czzn-img/info/info-order.png",
  108. dealerTo: '/subpages/order/dealerList?orderType=0&orderStatus=0',
  109. driverTo: '/subpages/order/driverList?orderType=0&orderStatus=0'
  110. },
  111. {
  112. title: this.$t("mine.unpaid"),
  113. icon: "../../static/czzn-img/info/info-jc.png",
  114. dealerTo: '/subpages/order/dealerList?orderType=0&orderStatus=1',
  115. driverTo: '/subpages/order/driverList?orderType=0&orderStatus=1'
  116. },
  117. {
  118. title: this.$t("mine.weigh"),
  119. icon: "../../static/czzn-img/info/info-gb.png",
  120. dealerTo: '/subpages/order/dealerList?orderType=0&orderStatus=3',
  121. driverTo: '/subpages/order/driverList?orderType=0&orderStatus=3'
  122. },
  123. {
  124. title: this.$t("mine.ongoing"),
  125. icon: "../../static/czzn-img/info/info-cc.png",
  126. dealerTo: '/subpages/order/dealerList?orderType=0&orderStatus=2',
  127. driverTo: '/subpages/order/driverList?orderType=0&orderStatus=2'
  128. },
  129. {
  130. title: this.$t("mine.invalid"),
  131. icon: "../../static/czzn-img/info/info-zf.png",
  132. dealerTo: '/subpages/order/dealerList?orderType=0&orderStatus=4',
  133. driverTo: '/subpages/order/driverList?orderType=0&orderStatus=4'
  134. },
  135. ],
  136. driverMenuList: [{
  137. title: this.$t("mine.vehicle"),
  138. icon: "../../static/czzn-img/info/info-cl.png",
  139. to: '/subpages/driver/driverList',
  140. count: 0,
  141. },
  142. {
  143. title: this.$t("mine.feedback"),
  144. icon: imgUtil.feedbackIcon,
  145. to: '/substaticpages/info/feedback',
  146. count: 0,
  147. },
  148. // {
  149. // title: this.$t("mine.mp"),
  150. // icon: "../../static/czzn-img/info/info-msg.png",
  151. // to: '/subpages/mp/index',
  152. // count: 0,
  153. // },
  154. ],
  155. dealerMenuList: [{
  156. title: this.$t("mine.enterprise"),
  157. icon: imgUtil.enterpriseIcon,
  158. to: '/subpages/tenant/list',
  159. count: 0,
  160. },
  161. {
  162. title: this.$t("mine.driver"),
  163. icon: imgUtil.driverIcon,
  164. to: '/subpages/driver/dealerList',
  165. count: 0,
  166. },
  167. {
  168. title: this.$t("mine.feedback"),
  169. icon: imgUtil.feedbackIcon,
  170. to: '/substaticpages/info/feedback',
  171. count: 0,
  172. },
  173. // {
  174. // title: this.$t("mine.mp"),
  175. // icon: "../../static/czzn-img/info/info-msg.png",
  176. // to: '/subpages/mp/index',
  177. // count: 0,
  178. // },
  179. ],
  180. role: [],
  181. userType: "0",
  182. tenantCount: 0,
  183. version: "",
  184. versionCode: "",
  185. mpVersion: "",
  186. isAuditUser: false,
  187. isDealerUser: false,
  188. isDriverUser: false,
  189. isAcceptUser: false,
  190. isDeliverUser: false,
  191. isTransUser: false,
  192. };
  193. },
  194. onLoad() {
  195. this.isAuditUser = uni.getStorageSync('isAuditUser')
  196. this.isDealerUser = uni.getStorageSync('isDealerUser')
  197. this.isDriverUser = uni.getStorageSync('isDriverUser')
  198. this.isAcceptUser = uni.getStorageSync('isAcceptUser')
  199. this.isDeliverUser = uni.getStorageSync('isDeliverUser')
  200. this.isTransUser = uni.getStorageSync('isTransUser')
  201. // const routers = getCurrentPages();
  202. // console.log(routers);
  203. if(this.isDealerUser){
  204. this.allOrder.to = '/subpages/order/dealerList?index=0'
  205. }else if(this.isDriverUser){
  206. this.allOrder.to = '/subpages/order/driverList'
  207. }
  208. console.log("开始加载");
  209. uni.hideTabBar()
  210. this.userType = uni.getStorageSync('userType')
  211. this.bindUserInfo()
  212. var that = this;
  213. uni.getSystemInfo({
  214. success: function(res) {
  215. console.log("系统信息、", res)
  216. console.log("系统版本号、", res.appVersionCode, res.appVersion)
  217. that.version = res.appVersion;
  218. that.versionCode = res.appVersionCode;
  219. console.log("系统版本号、", that.version, that.versionCode)
  220. }
  221. });
  222. // #ifdef MP-WEIXIN
  223. const accountInfo = wx.getAccountInfoSync();
  224. this.mpVersion = accountInfo.miniProgram.version // 小程序 版本号
  225. // #endif
  226. },
  227. computed: {
  228. ...mapGetters({
  229. userInfo: "user/info",
  230. hasLogin: "user/hasLogin",
  231. }),
  232. // #ifdef APP-PLUS
  233. appVersion() {
  234. return getApp().appVersion;
  235. },
  236. // #endif
  237. appConfig() {
  238. return getApp().globalData.config;
  239. },
  240. },
  241. methods: {
  242. bindUserInfo() {
  243. var tenantList = getTenantCacheList();
  244. console.log("当前租户信息、", tenantList);
  245. },
  246. //宫格点击事件
  247. doSomething(item) {
  248. if (item.to) {
  249. uni.navigateTo({
  250. url: item.to,
  251. });
  252. }
  253. if (item.event) {
  254. this[item.event]
  255. }
  256. },
  257. toOrdering(item) {
  258. if (this.isDealerUser == true) {
  259. uni.navigateTo({
  260. url: item.dealerTo,
  261. });
  262. } else {
  263. uni.navigateTo({
  264. url: item.driverTo,
  265. });
  266. }
  267. },
  268. ...mapMutations({
  269. setUserInfo: "user/login",
  270. }),
  271. toUserInfo() {
  272. if(this.hasLogin){
  273. uni.navigateTo({
  274. url: "/substaticpages/info/userInfo",
  275. });
  276. }else{
  277. uni.reLaunch({
  278. url: "/pages/login/login"
  279. })
  280. }
  281. },
  282. toPage(url) {
  283. uni.navigateTo({
  284. url: url,
  285. });
  286. },
  287. tapGrid(item) {
  288. // uni.showToast({
  289. // // title: '你点击了,第' + (index + 1) + '个',
  290. // title: this.$t('mine.clicked') + " " + (index + 1) ,
  291. // icon: 'none'
  292. // });
  293. },
  294. },
  295. };
  296. </script>
  297. <style lang="scss" scoped>
  298. /* #ifndef APP-NVUE */
  299. view {
  300. display: flex;
  301. box-sizing: border-box;
  302. flex-direction: column;
  303. }
  304. page {
  305. background-color: #f5f7fa;
  306. }
  307. /* #endif */
  308. .center {
  309. flex: 1;
  310. flex-direction: column;
  311. min-height: 100vh;
  312. background-color: #f5f7fa;
  313. .sevice {
  314. display: flex;
  315. flex-direction: row;
  316. justify-content: space-between;
  317. border-radius: 20rpx;
  318. margin-bottom: 24rpx;
  319. padding: 24rpx 0;
  320. overflow: hidden;
  321. background-color: #fff;
  322. .sevice-item {
  323. display: flex;
  324. width: 25%;
  325. text-align: center;
  326. .count {
  327. line-height: 48rpx;
  328. font-size: 32rpx;
  329. font-weight: bold;
  330. color: #333;
  331. }
  332. .title {
  333. line-height: 48rpx;
  334. font-size: 24rpx;
  335. color: #333;
  336. }
  337. }
  338. }
  339. .menu-wrap {
  340. // padding: 32rpx 0;
  341. // border-radius: 20rpx;
  342. overflow: hidden;
  343. background-color: #fff;
  344. .title {
  345. padding: 44rpx 44rpx 12rpx;
  346. display: flex;
  347. font-size: 32rpx;
  348. flex-direction: row;
  349. justify-content: space-between;
  350. .all {
  351. font-size: 28rpx;
  352. color: #999;
  353. display: flex;
  354. flex-direction: row;
  355. align-items: center;
  356. }
  357. }
  358. .version {
  359. padding: 8rpx 8rpx 8rpx;
  360. display: flex;
  361. font-size: 32rpx;
  362. flex-direction: row;
  363. justify-content: space-between;
  364. }
  365. .cell-icon {
  366. width: 65rpx;
  367. height: 65rpx;
  368. }
  369. .cell-wrap {
  370. padding-bottom: 40rpx;
  371. .cell-item {
  372. border-bottom: 1rpx solid #f5f7fa;
  373. }
  374. }
  375. .grid-icon {
  376. width: 60rpx;
  377. height: 60rpx;
  378. }
  379. .grid-text {
  380. margin-top: 8rpx;
  381. font-size: 24rpx;
  382. color: #333333;
  383. line-height: 48rpx;
  384. text-align: center;
  385. }
  386. }
  387. .top-set-user {
  388. background-size: 750rpx auto;
  389. background-color: #fff;
  390. padding: 40rpx 40rpx 56rpx;
  391. }
  392. .top-setting {
  393. position: absolute;
  394. top: 0rpx;
  395. right: 0rpx;
  396. z-index: 2001;
  397. .main {
  398. display: flex;
  399. flex-direction: row;
  400. align-items: center;
  401. justify-content: center;
  402. width: 100rpx;
  403. height: 100rpx;
  404. .setting-version {
  405. text-align: left;
  406. width: 50%;
  407. font-size: 24rpx;
  408. color: #999;
  409. }
  410. .setting-icon {
  411. width: 38rpx;
  412. height: 35rpx;
  413. }
  414. }
  415. }
  416. .message-wrap {
  417. margin: 40rpx 32rpx;
  418. background-color: #fff;
  419. padding: 40rpx;
  420. border-radius: 10rpx;
  421. .message-title {
  422. display: flex;
  423. flex-direction: row;
  424. justify-content: space-between;
  425. line-height: 32rpx;
  426. .label {
  427. color: #222;
  428. font-size: 28rpx;
  429. font-weight: bold;
  430. }
  431. .message {
  432. display: flex;
  433. flex-direction: row;
  434. color: #999;
  435. font-size: 24rpx;
  436. }
  437. }
  438. .message-item {
  439. margin-top: 32rpx;
  440. background-color: #f9f9f9;
  441. border-radius: 10rpx;
  442. padding: 28rpx 32rpx;
  443. .title {
  444. justify-content: space-between;
  445. display: flex;
  446. flex-direction: row;
  447. // width: 176rpx;
  448. color: #999;
  449. font-size: 24rpx;
  450. align-items: center;
  451. justify-content: space-between;
  452. margin-bottom: 32rpx;
  453. }
  454. .info {
  455. flex-direction: row;
  456. .cell-icon {
  457. width: 50rpx;
  458. height: 50rpx;
  459. background-color: #E1EBFF;
  460. border-radius: 10rpx;
  461. display: flex;
  462. justify-content: space-around;
  463. align-items: center;
  464. margin-right: 32rpx;
  465. }
  466. .info-text {
  467. flex: 1;
  468. overflow: hidden;
  469. text-overflow: ellipsis;
  470. white-space: nowrap;
  471. font-size: 22rpx;
  472. color: #666;
  473. }
  474. }
  475. }
  476. }
  477. }
  478. .versionInfo {
  479. position: absolute;
  480. bottom: 0px;
  481. right: 10rpx;
  482. size: 10pt;
  483. color: #fff;
  484. font-size: 13px;
  485. height: 28px;
  486. line-height: 28px;
  487. }
  488. .userInfo {
  489. // position: relative;
  490. flex-direction: row;
  491. align-items: center;
  492. // margin-bottom: 24rpx;
  493. }
  494. .logo-img {
  495. width: 150rpx;
  496. height: 150rpx;
  497. border-radius: 150rpx;
  498. }
  499. .logo-title {
  500. flex: 1;
  501. margin-left: 32rpx;
  502. // align-items: center;
  503. justify-content: space-between;
  504. flex-direction: column;
  505. }
  506. .user-name {
  507. height: 48rpx;
  508. line-height: 48rpx;
  509. font-size: 30rpx;
  510. display: flex;
  511. flex-direction: row;
  512. align-items: center;
  513. font-weight: bold;
  514. color: #fff;
  515. .role-tag {
  516. font-size: 20rpx;
  517. padding: 0 18rpx;
  518. border-radius: 8rpx;
  519. margin-left: 24rpx;
  520. background-color: #6695F9;
  521. box-shadow: 0px 0px 24px 0px rgba(46, 56, 181, 0.44);
  522. color: #fff;
  523. font-weight: normal;
  524. }
  525. }
  526. .user-phone {
  527. color: #fff;
  528. font-size: 26rpx;
  529. height: 56rpx;
  530. line-height: 56rpx;
  531. }
  532. .grid {
  533. background-color: #fff;
  534. // padding: 32rpx;
  535. }
  536. .uni-grid .text {
  537. font-size: 16px;
  538. height: 25px;
  539. line-height: 25px;
  540. color: #817f82;
  541. }
  542. .uni-grid .item ::v-deep .uni-grid-item__box {
  543. justify-content: center;
  544. align-items: center;
  545. }
  546. /deep/ .u-grid-item {
  547. padding: 20rpx 0;
  548. }
  549. </style>