info.vue 14 KB

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