homePage.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. <template>
  2. <view class="home_app_bgc">
  3. <u-navbar placeholder bgColor="#a9e3f1" leftIcon="" @rightClick="rightClick">
  4. <view class="u-nav-slot" slot="left">
  5. <view v-if="userInfo.dept">{{userInfo.dept.appName}}<span v-if="userInfo.dept.appName">-</span></view>智慧冰排管理系统
  6. </view>
  7. <view class="u-nav-slot" slot="right">
  8. <u-icon name="list-dot" size="30" color="#fff"></u-icon>
  9. </view>
  10. </u-navbar>
  11. <view class="column_center_card">
  12. <view class="mine_bg_card">
  13. <view class="card_mine">
  14. <view class="card_avatar" v-if="token != ''">
  15. <image class="mine_image" src="../static/portrait.png" mode=""></image>
  16. <view class="card_user_title">
  17. <view class="mine_phone">{{userInfo.username}}</view>
  18. <view class="mine_phone1">{{userInfo.nickName}}</view>
  19. </view>
  20. </view>
  21. <view class="card_avatar" v-else @click="login">
  22. <image class="mine_image" src="../static/portrait.png" mode=""></image>
  23. <view class="mine_title">登录/注册</view>
  24. </view>
  25. </view>
  26. <view class="order_card_home" v-if="!iceRaftManage">
  27. <view class="order_title_head" @click="getOperate('order',0)">
  28. <span>我的订单</span>
  29. <u-icon name="arrow-right-double" size="20" color="#000"></u-icon>
  30. </view>
  31. <view class="card_order">
  32. <view class="item_order" v-for="(item,index) in tableList" :key="index"
  33. @click="getOperate('order',index)">
  34. <view class="card_tab_image center_in"
  35. :style="{background: item.bgColor,backgroundColor:item.colorBg}">
  36. <span class="iconfont icon_image" :class="item.icon"></span>
  37. </view>
  38. <view class="order_title">{{item.title}}</view>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="bp_Card_width" v-else>
  43. <view class="bpzs_cardil" @click="getOperate('manage')">
  44. <span class="iconfont image_bp icon-bingpaiguanli"></span>
  45. <span class="title_bpzsil">冰排追溯管理</span>
  46. </view>
  47. <view class="right_bpzs_card">
  48. <view class="bpcrk_cardil" @click="getOperate('enter','冰排入库')">
  49. <span class="iconfont image_cr icon-bingpairuku"></span>
  50. <span class="title_bpzsil">冰排入库</span>
  51. </view>
  52. <view class="bpcrk_cardil" @click="getOperate('out','冰排装箱')">
  53. <span class="iconfont image_cr icon-bingpaichuku"></span>
  54. <span class="title_bpzsil">冰排装箱</span>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="bp_Card_width" v-if="!iceRaftManage">
  60. <view class="bpzs_card" @click="getOperate('manage')">
  61. <span class="iconfont image_bp icon-bingpaiguanli"></span>
  62. <span class="title_bpzs">冰排追溯管理</span>
  63. </view>
  64. <view class="right_bpzs_card">
  65. <view class="bpcrk_card" @click="getOperate('enter','冰排入库')">
  66. <span class="iconfont image_cr icon-bingpairuku"></span>
  67. <span class="title_bpzs">冰排入库</span>
  68. </view>
  69. <view class="bpcrk_card" @click="getOperate('out','冰排装箱')">
  70. <span class="iconfont image_cr icon-bingpaichuku"></span>
  71. <span class="title_bpzs">冰排装箱</span>
  72. </view>
  73. </view>
  74. </view>
  75. <view class="card_bottom_add" @click="getOperate('iceCold')" v-if="iceColdFlag">
  76. <view style="display: flex;align-items: center;">
  77. <span class="iconfont icon-binggui icon_bottom"></span>
  78. <span>冷冻柜管理</span>
  79. </view>
  80. <u-icon name="arrow-right" size="20"></u-icon>
  81. </view>
  82. <view class="card_bottom_add" @click="getOperate('incubator')">
  83. <view style="display: flex;align-items: center;">
  84. <span class="iconfont icon-incubator icon_bottom"></span>
  85. <span>保温箱管理</span>
  86. </view>
  87. <u-icon name="arrow-right" size="20"></u-icon>
  88. </view>
  89. <view class="card_bottom_add" @click="getOperate('iceRaft')">
  90. <view style="display: flex;align-items: center;">
  91. <span class="iconfont icon-bingpaiguanli icon_bottom"></span>
  92. <span>冰排管理</span>
  93. </view>
  94. <u-icon name="arrow-right" size="20"></u-icon>
  95. </view>
  96. <view class="card_bottom_add" @click="getOperate('add')" v-if="!iceRaftManage">
  97. <view style="display: flex;align-items: center;">
  98. <span class="iconfont icon-tianjiadingdan icon_bottom"></span>
  99. <span>添加订单</span>
  100. </view>
  101. <u-icon name="arrow-right" size="20"></u-icon>
  102. </view>
  103. <view class="card_bottom_add" @click="getOperate('book')" v-if="!iceRaftManage">
  104. <view style="display: flex;align-items: center;">
  105. <span class="iconfont icon-dizhibu icon_bottom"></span>
  106. <span>地址簿</span>
  107. </view>
  108. <u-icon name="arrow-right" size="20"></u-icon>
  109. </view>
  110. <view style="width: 100%;height: 100rpx;"></view>
  111. </view>
  112. <clh-popup position="right" round="0rpx" v-model="personalShow">
  113. <view :style="{paddingTop:height + 'px'}">
  114. <view class="head_mine">
  115. <view class="card_mine_message">
  116. <view class="card_rectangle">
  117. <view class="card_circle"></view>
  118. <view class="left_order_head" @click="getOperate('order',0)" v-if="!iceRaftManage">
  119. <!-- <u-icon name="order" size="30" color="#5ac725"></u-icon> -->
  120. <span class="iconfont icon_fast icon-quanbudingdan"></span>
  121. </view>
  122. <view class="right_exit_head" @click="getOperate('wait')">
  123. <!-- <u-icon name="edit-pen" size="30" color="#5ac725"></u-icon> -->
  124. <span class="iconfont icon_fast icon-bianji"></span>
  125. </view>
  126. <view class="card_content_area">
  127. <view class="card_name">姓名: <span>{{userInfo.username}}</span></view>
  128. <view class="card_name">账号: <span>{{userInfo.nickName}}</span></view>
  129. </view>
  130. </view>
  131. </view>
  132. <image class="card_mine_image" src="../static/portrait.png" mode=""></image>
  133. </view>
  134. <view class="classify_card" @click="getOperate('book')" v-if="!iceRaftManage">
  135. <span>地址簿</span>
  136. <u-icon name="arrow-right"></u-icon>
  137. </view>
  138. <view class="classify_card" @click="getOperate('password')">
  139. <span>修改密码</span>
  140. <u-icon name="arrow-right"></u-icon>
  141. </view>
  142. <view class="btn_exit" @click="logOut">
  143. <u-button text="退出登录"></u-button>
  144. </view>
  145. </view>
  146. </clh-popup>
  147. <u-modal :show="logoutShow" showCancelButton :title="title" :content='content' @cancel="cancel"
  148. @confirm="confirm"></u-modal>
  149. </view>
  150. </template>
  151. <script>
  152. export default {
  153. data() {
  154. return {
  155. personalShow: false,
  156. token: '',
  157. userInfo: {},
  158. tableList: [{
  159. title: '全部',
  160. icon: 'icon-dingdan',
  161. colorBg: '#4bc7fc',
  162. bgColor: 'linear-gradient(to right, #84d4f6, #4bc7fc)',
  163. }, {
  164. title: '待配送',
  165. icon: 'icon-cancel',
  166. colorBg: '#9ddd54',
  167. bgColor: 'linear-gradient(to right, #b9f377, #9ddd54)',
  168. }, {
  169. title: '配送中',
  170. icon: 'icon-delivery',
  171. colorBg: '#4bc7fc',
  172. bgColor: 'linear-gradient(to right, #84d4f6, #4bc7fc)',
  173. }, {
  174. title: '已送达',
  175. icon: 'icon-yisongda',
  176. colorBg: '#1cc723',
  177. bgColor: 'linear-gradient(to right, #54ef5a, #1cc723)',
  178. }, {
  179. title: '已拒收',
  180. icon: 'icon-yiquxiao',
  181. colorBg: '#fe880e',
  182. bgColor: 'linear-gradient(to right, #f69f45, #fe880e)',
  183. }],
  184. logoutShow: false,
  185. title: '确定退出?',
  186. content: '退出登录后将无法查看运单,重新登录后即可查看',
  187. height: '',
  188. // 是否释冷
  189. iceColdFlag: true,
  190. // 是否只展示冰排管理
  191. iceRaftManage: false,
  192. }
  193. },
  194. onShow() {
  195. const arr = uni.getSystemInfoSync().statusBarHeight
  196. this.height = arr
  197. var token = this.$cache.getToken()
  198. this.token = token
  199. var userInfo = this.$cache.getCache('userInfo')
  200. if (token) {
  201. if (userInfo) {
  202. this.iceRaftManage = userInfo.dept.iceRaftManage
  203. if(this.iceRaftManage){
  204. this.content = '退出登录后将无法查看冰排、保温箱,重新登录后即可查看'
  205. }
  206. this.userInfo = userInfo
  207. } else {
  208. this.getUserInfo()
  209. this.userInfo = {}
  210. }
  211. } else {
  212. uni.redirectTo({
  213. url: '/pages/login'
  214. })
  215. this.userInfo = {}
  216. }
  217. },
  218. mounted() {},
  219. methods: {
  220. getUserInfo() {
  221. this.$api.get('/api/user/profile').then(res => {
  222. if (res.code == 200) {
  223. if (this.token) {
  224. this.userInfo = res.data.user
  225. this.iceRaftManage = res.data.user.dept.iceRaftManage
  226. this.$cache.setCache('userInfo', this.userInfo)
  227. }
  228. } else {
  229. this.$cache.removeToken()
  230. this.$cache.removeCache('userInfo')
  231. uni.showToast({
  232. title: '当前用户不存在',
  233. icon: 'none'
  234. });
  235. }
  236. })
  237. },
  238. rightClick() {
  239. this.personalShow = true
  240. },
  241. // 登录注册
  242. login() {
  243. uni.navigateTo({
  244. url: '/pages/login'
  245. });
  246. },
  247. getOperate(type, value) {
  248. if (this.token) {
  249. if (type == 'book') {
  250. uni.navigateTo({
  251. url: '/pages/order/addressBook'
  252. });
  253. } else if (type == 'add') {
  254. uni.navigateTo({
  255. url: '/pages/order/addWaybill?title=添加运单&type=1'
  256. });
  257. } else if (type == 'password') {
  258. uni.navigateTo({
  259. url: '/pages/mine/password'
  260. });
  261. } else if (['truck', 'unload', 'signfor', 'enter', 'out'].includes(type)) {
  262. uni.navigateTo({
  263. url: '/pages/order/delivery?id=' + type + '&title=' + value
  264. });
  265. } else if (type == 'manage') {
  266. uni.navigateTo({
  267. url: '/pages/home/IceManagement'
  268. });
  269. } else if (type == 'order') {
  270. uni.navigateTo({
  271. url: '/pages/order/index?current=' + value
  272. });
  273. } else if (type == 'incubator') {
  274. uni.navigateTo({
  275. url: '/pages/order/Incubator?detailsFlag=true'
  276. });
  277. } else if (type == 'iceRaft') {
  278. uni.navigateTo({
  279. url: '/pages/order/iceRaft'
  280. });
  281. } else if (type == 'iceCold') {
  282. uni.navigateTo({
  283. url: '/pages/order/iceCold?detailsFlag=true'
  284. });
  285. } else if (type == 'wait') {
  286. uni.$u.toast('敬请期待!')
  287. }
  288. } else {
  289. uni.$u.toast('请先登录')
  290. }
  291. },
  292. // 退出登录
  293. logOut() {
  294. if (this.token) {
  295. this.logoutShow = true
  296. } else {
  297. uni.$u.toast('请先登录')
  298. }
  299. },
  300. // 确定退出登录
  301. confirm() {
  302. this.$cache.removeToken()
  303. this.$cache.removeCache('userInfo')
  304. uni.redirectTo({
  305. url: '/pages/login'
  306. })
  307. },
  308. // 取消
  309. cancel() {
  310. this.logoutShow = false
  311. },
  312. close() {
  313. this.personalShow = false
  314. }
  315. }
  316. }
  317. </script>
  318. <style lang="scss">
  319. .home_app_bgc {
  320. background-image: linear-gradient(#a9e3f1, #a9e3f1, #f3f4f6);
  321. }
  322. // page {
  323. // background-image: linear-gradient(#a9e3f1, #a9e3f1, #f3f4f6);
  324. // }
  325. .column_center_card {
  326. display: flex;
  327. flex-direction: column;
  328. align-items: center;
  329. }
  330. .mine_bg_card {
  331. width: 95%;
  332. border-radius: 10rpx;
  333. background-image: url(../static/task/mine.jpg);
  334. background-repeat: no-repeat;
  335. background-position: center top;
  336. background-size: cover;
  337. background-attachment: scroll;
  338. // background-color: #fff;
  339. // background-image: linear-gradient(#7edfe4, #ffffff);
  340. }
  341. .card_mine {
  342. padding: 0rpx 20rpx;
  343. border-bottom: 1rpx solid #f4f4f5;
  344. }
  345. .mine_image {
  346. width: 100rpx;
  347. height: 100rpx;
  348. border-radius: 50%;
  349. }
  350. .mine_phone {
  351. margin-left: 20rpx;
  352. font-size: 35rpx;
  353. color: #fff;
  354. }
  355. .mine_phone1 {
  356. margin-left: 20rpx;
  357. font-size: 30rpx;
  358. color: #f4f4f5;
  359. }
  360. .mine_title {
  361. margin-left: 20rpx;
  362. font-size: 40rpx;
  363. font-weight: bold;
  364. }
  365. .card_avatar {
  366. display: flex;
  367. align-items: center;
  368. padding-top: 30rpx;
  369. padding-bottom: 30rpx;
  370. }
  371. .order_title_head {
  372. display: flex;
  373. align-items: center;
  374. span {
  375. color: #000;
  376. font-weight: bold;
  377. font-size: 30rpx;
  378. padding: 15rpx 0rpx 8rpx 20rpx;
  379. }
  380. }
  381. .order_card_home {
  382. margin: 20rpx;
  383. padding-bottom: 20rpx;
  384. border-radius: 10rpx;
  385. background-color: rgba(255, 255, 255, 0.5);
  386. }
  387. .card_order {
  388. position: relative;
  389. margin-top: 20rpx;
  390. display: flex;
  391. justify-content: space-around;
  392. }
  393. .item_order {
  394. display: flex;
  395. flex-direction: column;
  396. align-items: center;
  397. }
  398. .card_tab_image {
  399. width: 80rpx;
  400. height: 80rpx;
  401. border-radius: 50%;
  402. }
  403. .order_title {
  404. color: #000;
  405. margin-top: 6rpx;
  406. font-size: 25rpx;
  407. }
  408. .icon_image {
  409. color: #fff;
  410. font-size: 37rpx;
  411. }
  412. .bp_Card_width {
  413. display: flex;
  414. width: calc(100% - 40rpx);
  415. margin: 20rpx;
  416. }
  417. .bpzs_card {
  418. display: flex;
  419. align-items: center;
  420. flex-direction: column;
  421. justify-content: center;
  422. width: 45%;
  423. height: 300rpx;
  424. // background-color: #fff;
  425. border-radius: 10rpx;
  426. background-image: linear-gradient(-225deg, #7edfe4 0%, #ffffff 48%, #7edfe4 100%);
  427. }
  428. .bpzs_cardil {
  429. display: flex;
  430. align-items: center;
  431. flex-direction: column;
  432. justify-content: center;
  433. width: 45%;
  434. height: 300rpx;
  435. border-radius: 10rpx;
  436. background-image: linear-gradient(-225deg, rgba(126, 223, 228, .6) 0%, rgba(255, 255, 255, .6) 48%, rgba(126, 223, 228, .6) 100%);
  437. }
  438. .image_bp {
  439. font-size: 70px;
  440. color: #19be6b;
  441. margin-bottom: 10rpx;
  442. }
  443. .title_bpzs {
  444. font-size: 36rpx;
  445. color: #19be6b;
  446. }
  447. .title_bpzsil {
  448. font-size: 36rpx;
  449. color: #019d48;
  450. }
  451. .right_bpzs_card {
  452. display: flex;
  453. width: 55%;
  454. flex-direction: column;
  455. justify-content: space-between;
  456. align-items: flex-end;
  457. }
  458. .bpcrk_card {
  459. display: flex;
  460. align-items: center;
  461. justify-content: center;
  462. width: 97%;
  463. height: 145rpx;
  464. border-radius: 10rpx;
  465. background-image: linear-gradient(-225deg, #7edfe4 0%, #ffffff 48%, #7edfe4 100%);
  466. }
  467. .bpcrk_cardil {
  468. display: flex;
  469. align-items: center;
  470. justify-content: center;
  471. width: 97%;
  472. height: 145rpx;
  473. border-radius: 10rpx;
  474. background-image: linear-gradient(-225deg, rgba(126, 223, 228, .6) 0%, rgba(255, 255, 255, .6) 48%, rgba(126, 223, 228, .6) 100%);
  475. }
  476. .image_cr {
  477. margin-right: 20rpx;
  478. font-size: 30px;
  479. color: #19be6b;
  480. }
  481. .card_bottom_add {
  482. display: flex;
  483. justify-content: space-between;
  484. align-items: center;
  485. width: calc(100% - 80rpx);
  486. margin: 10rpx 20rpx;
  487. padding: 30rpx 20rpx;
  488. border-radius: 10rpx;
  489. background-color: rgba(255, 255, 255, 0.5);
  490. }
  491. .icon_bottom {
  492. font-size: 40rpx;
  493. margin-right: 10rpx;
  494. }
  495. .head_mine {
  496. position: relative;
  497. height: 378rpx;
  498. margin-bottom: 10rpx;
  499. }
  500. .card_mine_image {
  501. position: absolute;
  502. width: 125rpx;
  503. height: 125rpx;
  504. border-radius: 50%;
  505. top: 68rpx;
  506. left: calc(50% - 59rpx);
  507. }
  508. .card_mine_message {
  509. position: absolute;
  510. top: 0;
  511. left: 0;
  512. right: 0;
  513. bottom: 0;
  514. overflow: hidden;
  515. margin-top: 130rpx;
  516. border-bottom: 1rpx solid #f4f4f5;
  517. padding: 0rpx 50rpx 30rpx 50rpx;
  518. }
  519. .card_rectangle {
  520. position: relative;
  521. width: 100%;
  522. height: 200rpx;
  523. border: 2rpx solid #5ac725;
  524. }
  525. .card_circle {
  526. position: absolute;
  527. top: -73rpx;
  528. left: calc(50% - 70rpx);
  529. width: 140rpx;
  530. height: 140rpx;
  531. border-radius: 50%;
  532. background-color: #fff;
  533. border: 2rpx solid #5ac725;
  534. }
  535. .left_order_head {
  536. position: absolute;
  537. top: 10rpx;
  538. left: 10rpx;
  539. }
  540. .icon_fast {
  541. font-size: 45rpx;
  542. color: #5ac725;
  543. }
  544. .right_exit_head {
  545. position: absolute;
  546. top: 12rpx;
  547. right: 10rpx;
  548. }
  549. .card_content_area {
  550. position: absolute;
  551. top: 80rpx;
  552. left: 20rpx;
  553. right: 0;
  554. bottom: 0;
  555. display: flex;
  556. flex-direction: column;
  557. }
  558. .card_name {
  559. margin-top: 10rpx;
  560. font-size: 30rpx;
  561. span {
  562. margin-left: 10rpx;
  563. }
  564. }
  565. .classify_card {
  566. display: flex;
  567. align-items: center;
  568. justify-content: space-between;
  569. padding: 20rpx;
  570. }
  571. .btn_exit {
  572. position: absolute;
  573. bottom: 30rpx;
  574. left: 30rpx;
  575. right: 30rpx;
  576. padding-bottom: env(safe-area-inset-bottom);
  577. }
  578. </style>