homePage.vue 13 KB

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