陶杰
2024-11-20 7530519aecf3d1b5e663cf89cb80c3b772b5d703
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<template>
  <div class="foot-select flex">
    <div class="desc" @click="show = !show">区域选择</div>
    <div class="img-triangle" @click="show = !show"></div>
    <div class="select-areas" v-if="show">
      <div class="select-area" :class="[item.areaCode == activecode ? 'active' : '']" v-for="(item, index) in areas" :key="index"
        @click="selectArea(item.areaCode)">
        {{ item.areaCode }}区
      </div>
      <div class="img-area-select-close" @click="show = !show"></div>
    </div>
  </div>
</template>
 
<script>
import { getAreaList } from "@/api/area";
 
export default {
  methods: {
    selectArea(code) {
      this.show = false;
      this.$router.push({ path: '/area', query: { code: code } })
 
    },
  },
  async mounted() {
    const data = await getAreaList();
    console.log("data", data);
    this.areas = (data && data.switchAreaInfo) || [];
  },
  computed: {
    activecode() {
      // console.log('activecode',this.$route)
      return this.$route.query.code || ''
    }
  },
  data() {
    return {
      show: false,
      areas: [],
      // areas:[
      //     {name:'1'},
      //     {name:'1'},
      //     {name:'1'},
      //     {name:'1'},
      //     {name:'1'},
      //     {name:'1'},
      //     {name:'1'},
      //     {name:'1'},
      //     {name:'1'},
      // ]
    };
  },
};
</script>
<style lang="scss" scoped>
.foot-select {
  background-image: url("../assets/area/area_select.png");
  background-size: 100% 100%;
  width: 104.1rem;
  height: 6.6rem;
  position: fixed;
  bottom: 1rem;
  /* bottom: -2.5rem; */
  /* position: absolute; */
  left: 50%;
  transform: translate(-50%, 0%);
 
  .desc {
    font-size: 2.8rem;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    color: #012b5e;
    line-height: 6.6rem;
    margin-left: auto;
    margin-right: 1rem;
    cursor: pointer;
  }
 
  .img-triangle {
    margin-right: auto;
    margin-left: 1rem;
    background-image: url("../assets/area/area_select_triangle.png");
    height: 1.8rem;
    width: 1.8rem;
    background-size: 100% 100%;
    margin-top: calc((6.6rem - 1.8rem) / 2);
    cursor: pointer;
  }
 
  .select-areas {
    position: absolute;
    width: 70.7rem;
    height: 15rem;
    background: rgba(190, 223, 255, 0.93);
    padding: 1rem;
    padding-left: 2rem;
    padding-right: 2rem;
    display: flex;
    flex-wrap: wrap;
    top: -18rem;
    left: 50%;
    transform: translate(-50%, 0%);
 
    .select-area {
      width: 7.7rem;
      height: 2.8rem;
      box-shadow: 0rem 0.3rem 1.9rem 0rem #61a8fc;
      border-radius: 0.4rem;
      border: 0.14rem solid #278afa;
      line-height: 2.8rem;
      margin: 1rem;
      font-size: 1.6rem;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #278afa;
      cursor: pointer;
    }
 
    .select-area.hight,
    .select-area:hover,
    .select-area.active {
      background: #278afa;
      box-shadow: 0rem 0.3rem 1.9rem 0rem #61a8fc;
      border-radius: 0.4rem;
      font-size: 1.6rem;
      font-weight: 600;
      color: #ffffff;
    }
 
    .img-area-select-close {
      position: absolute;
      background-image: url("../assets/area/area_select_close.png");
      height: 1.6rem;
      width: 1.6rem;
      right: 1rem;
      background-size: 100% 100%;
      z-index: 2;
      cursor: pointer;
    }
  }
}
</style>