select-site.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view class="select-site-box iPhone-bottom flex-common-css box-border-box">
  3. <Nav title='选择站点'></Nav>
  4. <scroll-view class="scroll-view-css box-border-box p-24" scroll-y="true" @scrolltolower="scrolltolower">
  5. <view class="list-item align-items-center" :class="site_id == item.site_id?'s-b':''" v-for="(item,i) in list" :key="i"
  6. @click="selectFun(item)">
  7. <view class="list-item-s">
  8. <image v-if="site_id == item.site_id" src="@/static/img/common/y-select.png" mode=""></image>
  9. <image v-else src="@/static/img/common/n-select.png" mode=""></image>
  10. </view>
  11. <image class="img-1" :src="item.logo" mode="aspectFill"></image>
  12. <view class="w-490">
  13. <view class="fs-32 fw-600 fc-0">{{item.name}}</view>
  14. <view class="fs-26 fw-400 fc-9">{{item.city_name}} {{item.address}}</view>
  15. </view>
  16. </view>
  17. </scroll-view>
  18. </view>
  19. </template>
  20. <script>
  21. import tools from "@/service/tools";
  22. import {
  23. getExpressSite
  24. } from '@/api/express.js';
  25. export default {
  26. data() {
  27. return {
  28. site_id: '',
  29. list: [],
  30. }
  31. },
  32. onLoad(e) {
  33. this.site_id = Number(e.site_id);
  34. this.getExpressSite();
  35. },
  36. methods: {
  37. getExpressSite() {
  38. let school_id = uni.getStorageSync('school_id');
  39. getExpressSite({
  40. school_id: school_id
  41. }).then((res) => {
  42. if (res.code === 1) {
  43. this.list = res.data
  44. }
  45. })
  46. },
  47. selectFun(item) {
  48. this.site_id = item.site_id;
  49. uni.setStorageSync('site_id', item.site_id)
  50. uni.setStorageSync('site_name', item.name)
  51. uni.setStorageSync('site_address', item.city_name + item.address)
  52. uni.setStorageSync('site_logo', item.logo)
  53. uni.reLaunch({
  54. url: '/pages-takeout/replace-take'
  55. })
  56. },
  57. },
  58. }
  59. </script>
  60. <style scoped lang="scss">
  61. .select-site-box {
  62. .list-item {
  63. width: 100%;
  64. min-height: 162rpx;
  65. background: #FFFFFF;
  66. border-radius: 20rpx 20rpx 20rpx 20rpx;
  67. margin-bottom: 20rpx;
  68. box-sizing: border-box;
  69. padding: 24rpx 32rpx 20rpx 80rpx;
  70. position: relative;
  71. .img-1 {
  72. width: 80rpx;
  73. height: 80rpx;
  74. border-radius: 8rpx;
  75. margin-right: 20rpx;
  76. }
  77. .w-490 {
  78. width: 490rpx;
  79. }
  80. .list-item-s {
  81. position: absolute;
  82. left: 24rpx;
  83. top: 45%;
  84. image {
  85. width: 32rpx;
  86. height: 32rpx;
  87. }
  88. }
  89. }
  90. .s-b {
  91. border: 2rpx solid #41ABF5;
  92. }
  93. }
  94. </style>