homePage.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  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. {{userInfo.dept.appName}}<span v-if="userInfo.dept.appName">-</span>智慧冰排管理系统
  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. this.userInfo = userInfo
  204. } else {
  205. this.getUserInfo()
  206. this.userInfo = {}
  207. }
  208. } else {
  209. uni.redirectTo({
  210. url: '/pages/login'
  211. })
  212. this.userInfo = {}
  213. }
  214. },
  215. mounted() {},
  216. methods: {
  217. getUserInfo() {
  218. this.$api.get('/api/user/profile').then(res => {
  219. if (res.code == 200) {
  220. if (this.token) {
  221. this.userInfo = res.data.user
  222. this.iceRaftManage = res.data.user.dept.iceRaftManage
  223. this.$cache.setCache('userInfo', this.userInfo)
  224. }
  225. } else {
  226. this.$cache.removeToken()
  227. this.$cache.removeCache('userInfo')
  228. uni.showToast({
  229. title: '当前用户不存在',
  230. icon: 'none'
  231. });
  232. }
  233. })
  234. },
  235. rightClick() {
  236. this.personalShow = true
  237. },
  238. // 登录注册
  239. login() {
  240. uni.navigateTo({
  241. url: '/pages/login'
  242. });
  243. },
  244. getOperate(type, value) {
  245. if (this.token) {
  246. if (type == 'book') {
  247. uni.navigateTo({
  248. url: '/pages/order/addressBook'
  249. });
  250. } else if (type == 'add') {
  251. uni.navigateTo({
  252. url: '/pages/order/addWaybill?title=添加运单&type=1'
  253. });
  254. } else if (type == 'password') {
  255. uni.navigateTo({
  256. url: '/pages/mine/password'
  257. });
  258. } else if (['truck', 'unload', 'signfor', 'enter', 'out'].includes(type)) {
  259. uni.navigateTo({
  260. url: '/pages/order/delivery?id=' + type + '&title=' + value
  261. });
  262. } else if (type == 'manage') {
  263. uni.navigateTo({
  264. url: '/pages/home/IceManagement'
  265. });
  266. } else if (type == 'order') {
  267. uni.navigateTo({
  268. url: '/pages/order/index?current=' + value
  269. });
  270. } else if (type == 'incubator') {
  271. uni.navigateTo({
  272. url: '/pages/order/Incubator?detailsFlag=true'
  273. });
  274. } else if (type == 'iceRaft') {
  275. uni.navigateTo({
  276. url: '/pages/order/iceRaft'
  277. });
  278. } else if (type == 'iceCold') {
  279. uni.navigateTo({
  280. url: '/pages/order/iceCold?detailsFlag=true'
  281. });
  282. } else if (type == 'wait') {
  283. uni.$u.toast('敬请期待!')
  284. }
  285. } else {
  286. uni.$u.toast('请先登录')
  287. }
  288. },
  289. // 退出登录
  290. logOut() {
  291. if (this.token) {
  292. this.logoutShow = true
  293. } else {
  294. uni.$u.toast('请先登录')
  295. }
  296. },
  297. // 确定退出登录
  298. confirm() {
  299. this.$cache.removeToken()
  300. this.$cache.removeCache('userInfo')
  301. uni.redirectTo({
  302. url: '/pages/login'
  303. })
  304. },
  305. // 取消
  306. cancel() {
  307. this.logoutShow = false
  308. },
  309. close() {
  310. this.personalShow = false
  311. }
  312. }
  313. }
  314. </script>
  315. <style lang="scss">
  316. .home_app_bgc {
  317. background-image: linear-gradient(#a9e3f1, #a9e3f1, #f3f4f6);
  318. }
  319. // page {
  320. // background-image: linear-gradient(#a9e3f1, #a9e3f1, #f3f4f6);
  321. // }
  322. .column_center_card {
  323. display: flex;
  324. flex-direction: column;
  325. align-items: center;
  326. }
  327. .mine_bg_card {
  328. width: 95%;
  329. border-radius: 10rpx;
  330. background-image: url(../static/task/mine.jpg);
  331. background-repeat: no-repeat;
  332. background-position: center top;
  333. background-size: cover;
  334. background-attachment: scroll;
  335. // background-color: #fff;
  336. // background-image: linear-gradient(#7edfe4, #ffffff);
  337. }
  338. .card_mine {
  339. padding: 0rpx 20rpx;
  340. border-bottom: 1rpx solid #f4f4f5;
  341. }
  342. .mine_image {
  343. width: 100rpx;
  344. height: 100rpx;
  345. border-radius: 50%;
  346. }
  347. .mine_phone {
  348. margin-left: 20rpx;
  349. font-size: 35rpx;
  350. color: #fff;
  351. }
  352. .mine_phone1 {
  353. margin-left: 20rpx;
  354. font-size: 30rpx;
  355. color: #f4f4f5;
  356. }
  357. .mine_title {
  358. margin-left: 20rpx;
  359. font-size: 40rpx;
  360. font-weight: bold;
  361. }
  362. .card_avatar {
  363. display: flex;
  364. align-items: center;
  365. padding-top: 30rpx;
  366. padding-bottom: 30rpx;
  367. }
  368. .order_title_head {
  369. display: flex;
  370. align-items: center;
  371. span {
  372. color: #000;
  373. font-weight: bold;
  374. font-size: 30rpx;
  375. padding: 15rpx 0rpx 8rpx 20rpx;
  376. }
  377. }
  378. .order_card_home {
  379. margin: 20rpx;
  380. padding-bottom: 20rpx;
  381. border-radius: 10rpx;
  382. background-color: rgba(255, 255, 255, 0.5);
  383. }
  384. .card_order {
  385. position: relative;
  386. margin-top: 20rpx;
  387. display: flex;
  388. justify-content: space-around;
  389. }
  390. .item_order {
  391. display: flex;
  392. flex-direction: column;
  393. align-items: center;
  394. }
  395. .card_tab_image {
  396. width: 80rpx;
  397. height: 80rpx;
  398. border-radius: 50%;
  399. }
  400. .order_title {
  401. color: #000;
  402. margin-top: 6rpx;
  403. font-size: 25rpx;
  404. }
  405. .icon_image {
  406. color: #fff;
  407. font-size: 37rpx;
  408. }
  409. .bp_Card_width {
  410. display: flex;
  411. width: calc(100% - 40rpx);
  412. margin: 20rpx;
  413. }
  414. .bpzs_card {
  415. display: flex;
  416. align-items: center;
  417. flex-direction: column;
  418. justify-content: center;
  419. width: 45%;
  420. height: 300rpx;
  421. // background-color: #fff;
  422. border-radius: 10rpx;
  423. background-image: linear-gradient(-225deg, #7edfe4 0%, #ffffff 48%, #7edfe4 100%);
  424. }
  425. .bpzs_cardil {
  426. display: flex;
  427. align-items: center;
  428. flex-direction: column;
  429. justify-content: center;
  430. width: 45%;
  431. height: 300rpx;
  432. border-radius: 10rpx;
  433. background-image: linear-gradient(-225deg, rgba(126, 223, 228, .6) 0%, rgba(255, 255, 255, .6) 48%, rgba(126, 223, 228, .6) 100%);
  434. }
  435. .image_bp {
  436. font-size: 70px;
  437. color: #19be6b;
  438. margin-bottom: 10rpx;
  439. }
  440. .title_bpzs {
  441. font-size: 36rpx;
  442. color: #19be6b;
  443. }
  444. .title_bpzsil {
  445. font-size: 36rpx;
  446. color: #019d48;
  447. }
  448. .right_bpzs_card {
  449. display: flex;
  450. width: 55%;
  451. flex-direction: column;
  452. justify-content: space-between;
  453. align-items: flex-end;
  454. }
  455. .bpcrk_card {
  456. display: flex;
  457. align-items: center;
  458. justify-content: center;
  459. width: 97%;
  460. height: 145rpx;
  461. border-radius: 10rpx;
  462. background-image: linear-gradient(-225deg, #7edfe4 0%, #ffffff 48%, #7edfe4 100%);
  463. }
  464. .bpcrk_cardil {
  465. display: flex;
  466. align-items: center;
  467. justify-content: center;
  468. width: 97%;
  469. height: 145rpx;
  470. border-radius: 10rpx;
  471. background-image: linear-gradient(-225deg, rgba(126, 223, 228, .6) 0%, rgba(255, 255, 255, .6) 48%, rgba(126, 223, 228, .6) 100%);
  472. }
  473. .image_cr {
  474. margin-right: 20rpx;
  475. font-size: 30px;
  476. color: #19be6b;
  477. }
  478. .card_bottom_add {
  479. display: flex;
  480. justify-content: space-between;
  481. align-items: center;
  482. width: calc(100% - 80rpx);
  483. margin: 10rpx 20rpx;
  484. padding: 30rpx 20rpx;
  485. border-radius: 10rpx;
  486. background-color: rgba(255, 255, 255, 0.5);
  487. }
  488. .icon_bottom {
  489. font-size: 40rpx;
  490. margin-right: 10rpx;
  491. }
  492. .head_mine {
  493. position: relative;
  494. height: 378rpx;
  495. margin-bottom: 10rpx;
  496. }
  497. .card_mine_image {
  498. position: absolute;
  499. width: 125rpx;
  500. height: 125rpx;
  501. border-radius: 50%;
  502. top: 68rpx;
  503. left: calc(50% - 59rpx);
  504. }
  505. .card_mine_message {
  506. position: absolute;
  507. top: 0;
  508. left: 0;
  509. right: 0;
  510. bottom: 0;
  511. overflow: hidden;
  512. margin-top: 130rpx;
  513. border-bottom: 1rpx solid #f4f4f5;
  514. padding: 0rpx 50rpx 30rpx 50rpx;
  515. }
  516. .card_rectangle {
  517. position: relative;
  518. width: 100%;
  519. height: 200rpx;
  520. border: 2rpx solid #5ac725;
  521. }
  522. .card_circle {
  523. position: absolute;
  524. top: -73rpx;
  525. left: calc(50% - 70rpx);
  526. width: 140rpx;
  527. height: 140rpx;
  528. border-radius: 50%;
  529. background-color: #fff;
  530. border: 2rpx solid #5ac725;
  531. }
  532. .left_order_head {
  533. position: absolute;
  534. top: 10rpx;
  535. left: 10rpx;
  536. }
  537. .icon_fast {
  538. font-size: 45rpx;
  539. color: #5ac725;
  540. }
  541. .right_exit_head {
  542. position: absolute;
  543. top: 12rpx;
  544. right: 10rpx;
  545. }
  546. .card_content_area {
  547. position: absolute;
  548. top: 80rpx;
  549. left: 20rpx;
  550. right: 0;
  551. bottom: 0;
  552. display: flex;
  553. flex-direction: column;
  554. }
  555. .card_name {
  556. margin-top: 10rpx;
  557. font-size: 30rpx;
  558. span {
  559. margin-left: 10rpx;
  560. }
  561. }
  562. .classify_card {
  563. display: flex;
  564. align-items: center;
  565. justify-content: space-between;
  566. padding: 20rpx;
  567. }
  568. .btn_exit {
  569. position: absolute;
  570. bottom: 30rpx;
  571. left: 30rpx;
  572. right: 30rpx;
  573. padding-bottom: env(safe-area-inset-bottom);
  574. }
  575. </style>