| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <template>
- <view class="container">
- <!-- 地图区域 -->
- <view class="map">
- <qiun-data-charts type="map" :opts="opts" :chartData="chartData" @getIndex="getMapIndex" />
- </view>
- <!-- 乡镇列表区域 -->
- <view class="body" v-if="list.length">
- <!-- 每一个乡镇区域 -->
- <view class="body_item" v-for="(item, index) in list" :key="index">
- <view class="item_town">{{ item.name }}</view>
- <view class="item_platina">白金级({{ item.cSum }})</view>
- <view class="item_gold">金宿级({{ item.bSum }})</view>
- <view class="item_silver">银宿级({{ item.aSum }})</view>
- <view class="item_btn" @click="() => handleGoHome(item)">订</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- // 靖安县地图数据
- // import { mapData } from '@/util/mapData.js'
- export default {
- data() {
- return {
- // 城镇列表数据
- list: [],
- // 图表数据
- chartData: {
- series: {}
- },
- // 图表配置
- opts: {
- color: ['#096562', '#096562', '#096562', '#096562', '#096562', '#096562', '#096562', '#096562', '#096562', '#096562', '#096562'],
- padding: [0, 0, 0, 0],
- fontColor: '#fff',
- fontSize: 10,
- dataPointShape: false,
- extra: {
- map: {
- border: true,
- borderWidth: 1,
- borderColor: 'rgba(255,255,255,0.2)',
- fillOpacity: 0.6,
- activeBorderColor: 'rgba(255,255,255,0.2)',
- activeFillColor: '#0BBA92',
- activeFillOpacity: 1,
- fillOpacity: 1
- }
- }
- }
- }
- },
- onReady() {
- this.getServerData()
- },
- onLoad() {
- this.getTownList()
- },
- methods: {
- getMapIndex(e) {
- let town
- if (e.currentIndex === 0) {
- town = '双溪镇'
- } else if (e.currentIndex === 1) {
- town = '仁首镇'
- } else if (e.currentIndex === 2) {
- town = '罗湾乡'
- } else if (e.currentIndex === 3) {
- town = '水口乡'
- } else if (e.currentIndex === 4) {
- town = '香田乡'
- } else if (e.currentIndex === 5) {
- town = '躁都镇'
- } else if (e.currentIndex === 6) {
- town = '三爪仑乡'
- } else if (e.currentIndex === 7) {
- town = '中源乡'
- } else if (e.currentIndex === 8) {
- town = '高湖镇'
- } else if (e.currentIndex === 9) {
- town = '雷公尖乡'
- } else if (e.currentIndex === 10) {
- town = '宝峰镇'
- }
- uni.setStorageSync('town', town)
- uni.switchTab({
- url: `/pages/home/home`
- })
- },
- // 获取城镇列表数据
- async getTownList() {
- const res = await this.$myRequest({
- url: '/mhotel/ahpgetTownshipCount.action',
- method: 'post'
- })
- // console.log(res)
- if (res.code === 200) {
- this.list = res.data
- }
- },
- handleGoHome(item) {
- uni.setStorageSync('town', item.name)
- uni.switchTab({
- url: `/pages/home/home`
- })
- },
- // 获取地图数据
- getServerData() {
- this.chartData.series = mapData.features
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- box-sizing: border-box;
- padding: 0 30rpx 10rpx;
- height: 100vh;
- background-color: #f7f7f7;
- .map {
- width: 100%;
- height: 463rpx;
- }
- .body {
- height: calc(100vh - 463rpx);
- overflow-y: auto;
- .body_item {
- display: flex;
- align-items: center;
- margin-bottom: 20rpx;
- height: 92rpx;
- border-radius: 12rpx;
- background-color: #e6e6e6;
- .item_town {
- margin-left: 30rpx;
- font-size: 32rpx;
- font-weight: bold;
- }
- .item_silver {
- margin-left: 24rpx;
- font-size: 20rpx;
- color: #660909;
- }
- .item_gold {
- margin-left: 18rpx;
- font-size: 20rpx;
- color: #096562;
- }
- .item_platina {
- margin-left: 24rpx;
- font-size: 20rpx;
- color: #ff5733;
- }
- .item_btn {
- margin-left: auto;
- margin-right: 10rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- width: 100rpx;
- height: 66rpx;
- color: #fff;
- font-size: 36rpx;
- border-radius: 11rpx;
- background-color: #096562;
- }
- }
- }
- }
- </style>
|