homePage.vue 15 KB

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