info.vue 14 KB

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