index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view class="container">
  3. <!-- 地图区域 -->
  4. <view class="map">
  5. <qiun-data-charts type="map" :opts="opts" :chartData="chartData" @getIndex="getMapIndex" />
  6. </view>
  7. <!-- 乡镇列表区域 -->
  8. <view class="body" v-if="list.length">
  9. <!-- 每一个乡镇区域 -->
  10. <view class="body_item" v-for="(item, index) in list" :key="index">
  11. <view class="item_town">{{ item.name }}</view>
  12. <view class="item_platina">白金级({{ item.cSum }})</view>
  13. <view class="item_gold">金宿级({{ item.bSum }})</view>
  14. <view class="item_silver">银宿级({{ item.aSum }})</view>
  15. <view class="item_btn" @click="() => handleGoHome(item)">订</view>
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. // 靖安县地图数据
  22. import { mapData } from '@/util/mapData.js'
  23. export default {
  24. data() {
  25. return {
  26. // 城镇列表数据
  27. list: [],
  28. // 图表数据
  29. chartData: {
  30. series: {}
  31. },
  32. // 图表配置
  33. opts: {
  34. color: ['#096562', '#096562', '#096562', '#096562', '#096562', '#096562', '#096562', '#096562', '#096562', '#096562', '#096562'],
  35. padding: [0, 0, 0, 0],
  36. fontColor: '#fff',
  37. fontSize: 10,
  38. dataPointShape: false,
  39. extra: {
  40. map: {
  41. border: true,
  42. borderWidth: 1,
  43. borderColor: 'rgba(255,255,255,0.2)',
  44. fillOpacity: 0.6,
  45. activeBorderColor: 'rgba(255,255,255,0.2)',
  46. activeFillColor: '#0BBA92',
  47. activeFillOpacity: 1,
  48. fillOpacity: 1
  49. }
  50. }
  51. }
  52. }
  53. },
  54. onReady() {
  55. this.getServerData()
  56. },
  57. onLoad() {
  58. this.getTownList()
  59. },
  60. methods: {
  61. getMapIndex(e) {
  62. let town
  63. if (e.currentIndex === 0) {
  64. town = '双溪镇'
  65. } else if (e.currentIndex === 1) {
  66. town = '仁首镇'
  67. } else if (e.currentIndex === 2) {
  68. town = '罗湾乡'
  69. } else if (e.currentIndex === 3) {
  70. town = '水口乡'
  71. } else if (e.currentIndex === 4) {
  72. town = '香田乡'
  73. } else if (e.currentIndex === 5) {
  74. town = '躁都镇'
  75. } else if (e.currentIndex === 6) {
  76. town = '三爪仑乡'
  77. } else if (e.currentIndex === 7) {
  78. town = '中源乡'
  79. } else if (e.currentIndex === 8) {
  80. town = '高湖镇'
  81. } else if (e.currentIndex === 9) {
  82. town = '雷公尖乡'
  83. } else if (e.currentIndex === 10) {
  84. town = '宝峰镇'
  85. }
  86. uni.setStorageSync('town', town)
  87. uni.switchTab({
  88. url: `/pages/home/home`
  89. })
  90. },
  91. // 获取城镇列表数据
  92. async getTownList() {
  93. const res = await this.$myRequest({
  94. url: '/mhotel/ahpgetTownshipCount.action',
  95. method: 'post'
  96. })
  97. // console.log(res)
  98. if (res.code === 200) {
  99. this.list = res.data
  100. }
  101. },
  102. handleGoHome(item) {
  103. uni.setStorageSync('town', item.name)
  104. uni.switchTab({
  105. url: `/pages/home/home`
  106. })
  107. },
  108. // 获取地图数据
  109. getServerData() {
  110. this.chartData.series = mapData.features
  111. }
  112. }
  113. }
  114. </script>
  115. <style lang="scss" scoped>
  116. .container {
  117. box-sizing: border-box;
  118. padding: 0 30rpx 10rpx;
  119. height: 100vh;
  120. background-color: #f7f7f7;
  121. .map {
  122. width: 100%;
  123. height: 463rpx;
  124. }
  125. .body {
  126. height: calc(100vh - 463rpx);
  127. overflow-y: auto;
  128. .body_item {
  129. display: flex;
  130. align-items: center;
  131. margin-bottom: 20rpx;
  132. height: 92rpx;
  133. border-radius: 12rpx;
  134. background-color: #e6e6e6;
  135. .item_town {
  136. margin-left: 30rpx;
  137. font-size: 32rpx;
  138. font-weight: bold;
  139. }
  140. .item_silver {
  141. margin-left: 24rpx;
  142. font-size: 20rpx;
  143. color: #660909;
  144. }
  145. .item_gold {
  146. margin-left: 18rpx;
  147. font-size: 20rpx;
  148. color: #096562;
  149. }
  150. .item_platina {
  151. margin-left: 24rpx;
  152. font-size: 20rpx;
  153. color: #ff5733;
  154. }
  155. .item_btn {
  156. margin-left: auto;
  157. margin-right: 10rpx;
  158. display: flex;
  159. justify-content: center;
  160. align-items: center;
  161. width: 100rpx;
  162. height: 66rpx;
  163. color: #fff;
  164. font-size: 36rpx;
  165. border-radius: 11rpx;
  166. background-color: #096562;
  167. }
  168. }
  169. }
  170. }
  171. </style>