map - 副本.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. <template>
  2. <view class="map">
  3. <!-- 查询 -->
  4. <view class="address">
  5. <view style="width: 750rpx; height:1200rpx;">
  6. <map subkey='CQIBZ-P2MR5-PM3IB-QRKTX-SEVJE-GYF34' id="map" class="maps"
  7. @regionchange="onMapRegionChange" @tap="onMapTap" @markertap="onmarkertap" enable3D="true"
  8. enableBuilding="true" enableScroll="true" enableZoom="true" :latitude="latitude"
  9. :layerStyle="mapStyle" :longitude="longitude" :showCompass="false" :showLocation="true"
  10. :showScale="false" :scale="scale" :markers="markers"></map>
  11. </view>
  12. </view>
  13. <tab-bar></tab-bar>
  14. </view>
  15. </template>
  16. <script>
  17. import TabBar from '../../components/TabBar/tabbar.vue'
  18. import HchPosition from '../../components/hch-position/hch-position.vue'
  19. export default {
  20. components: {
  21. TabBar,
  22. HchPosition
  23. },
  24. data() {
  25. return {
  26. latitude: 39.924361, //中心纬度
  27. longitude: 116.518557, //中心经度
  28. mapStyle: 1, //个性化地图
  29. scale: 16,//缩放级别
  30. markers:[],//标记点
  31. }
  32. },
  33. onLoad() {
  34. //获取酒店列表
  35. this.getList()
  36. this.updated()
  37. },
  38. methods: {
  39. //获取用户定位
  40. updated() {
  41. let _this = this
  42. wx.getLocation({
  43. type: "gcj02", //返回可以用于wx.openLocation的经纬度
  44. success: function(res) {
  45. _this.latitude = res.latitude
  46. _this.longitude = res.longitude
  47. },
  48. fail: function(res) {
  49. console.log(res);
  50. }
  51. })
  52. },
  53. //视野发生变化时触发
  54. onMapRegionChange: function(e) {
  55. // var t = e.causedBy, r = e.type, i = e.detail.region;
  56. // if (("drag" == t || "scale" == t) && "end" == r) {
  57. // for (var n = i.northeast, o = i.southwest, l = this.data.markersSource, s = [], c = 0, u = l.length; c < u; c++) {
  58. // var d = l[c], g = d.latitude, p = d.longitude;
  59. // !d.load && g > o.latitude && g < n.latitude & p > o.longitude && p < n.longitude && (d.load = !0,
  60. // s.push(d));
  61. // }
  62. // a.addMarkers({
  63. // markers: s,
  64. // clear: !1
  65. // });
  66. // }
  67. },
  68. //点击地图时触发
  69. onMapTap: function(e) {},
  70. //点击标记点时触发
  71. onmarkertap: function(e) {
  72. var t = e.detail.markerId;
  73. wx.vibrateShort({
  74. type: "light"
  75. });
  76. var a = this.data,
  77. r = a.swiperCurrent;
  78. a.markersSource;
  79. this.updateActiveMarker(r, t), this.setData({
  80. swiperCurrent: t
  81. });
  82. },
  83. getList() {
  84. this.$api.hotel.getHotelList({
  85. page: 1
  86. }).then(res => {
  87. this.hotelList = res.data.data
  88. console.log(this.hotelList);
  89. this.markers = this.hotelList.map(item => {
  90. return {
  91. id: item.id,
  92. latitude: item.latitude,
  93. longitude: item.longitude,
  94. width: '34rpx',
  95. height: '40rpx',
  96. iconPath: '/../../static/navigation.png',
  97. callout: {
  98. content: item.name,
  99. borderRadius: 10,
  100. padding: 10,
  101. display: "ALWAYS",
  102. }
  103. }
  104. })
  105. console.log(this.markers);
  106. })
  107. },
  108. //去预定页面
  109. goBook() {
  110. uni.navigateTo({
  111. url: '/pages/map/hotel-book/index'
  112. })
  113. },
  114. //返回上一级
  115. returnBtn() {
  116. this.isShow = !this.isShow
  117. },
  118. //打开酒店列表
  119. goHotelList() {
  120. console.log(111);
  121. this.isShow = !this.isShow
  122. },
  123. //是否展示加盟品牌
  124. selectJoin() {
  125. this.isJoin = !this.isJoin
  126. },
  127. //是否展示合作伙伴
  128. selectPartner() {
  129. this.isPartner = !this.isPartner
  130. },
  131. //合作伙伴刷选
  132. change(e) {
  133. console.log('e:', e);
  134. },
  135. //菜单index切换
  136. checked(index) {
  137. this.isActive = index
  138. },
  139. //展开地区选择
  140. openArea() {
  141. console.log(111);
  142. this.isSelectArea = !this.isSelectArea
  143. },
  144. //展开品牌选择
  145. openBrand() {
  146. this.isSelectBrand = !this.isSelectBrand
  147. },
  148. //展开筛选选择
  149. openSift() {
  150. this.isSelectSift = !this.isSelectSift
  151. }
  152. }
  153. }
  154. </script>
  155. <style lang="scss" scoped>
  156. page {
  157. height: 100%;
  158. }
  159. .map {
  160. height: 100%;
  161. background-color: #f9f9f9;
  162. display: flex;
  163. flex-direction: column;
  164. }
  165. .maps {
  166. width: 100%;
  167. height: 1200rpx;
  168. }
  169. .return-btn {
  170. position: fixed;
  171. right: 0;
  172. top: 927rpx;
  173. z-index: 99;
  174. }
  175. .home-bottom {
  176. height: 60rpx;
  177. background-color: #f9f9f9;
  178. }
  179. .hotel-list {
  180. width: 100%;
  181. background-color: #f9f9f9;
  182. padding: 32rpx 30rpx;
  183. padding-bottom: 200rpx;
  184. .hotel-list-item {
  185. width: 100%;
  186. margin-bottom: 20rpx;
  187. .wrap {
  188. width: 100%;
  189. height: 318rpx;
  190. position: relative;
  191. box-shadow: 0px 4rpx 8rpx 0px rgba(0, 0, 0, 0.08);
  192. border-radius: 10rpx;
  193. .inner {
  194. width: 100%;
  195. height: 318rpx;
  196. border-radius: 10rpx;
  197. background: rgba(0, 0, 0, 0.4);
  198. position: absolute;
  199. z-index: 2;
  200. top: 0;
  201. left: 0;
  202. .address-detail-main {
  203. position: absolute;
  204. left: 0;
  205. bottom: 30rpx;
  206. width: 100%;
  207. display: flex;
  208. align-items: flex-end;
  209. justify-content: space-between;
  210. .address-detail-main-left {
  211. position: absolute;
  212. left: 20rpx;
  213. .title {
  214. font-size: 32rpx;
  215. font-weight: bold;
  216. color: #FFFFFF;
  217. }
  218. .content {
  219. margin: 12rpx 0 20rpx;
  220. width: 92rpx;
  221. height: 34rpx;
  222. background: rgba(142, 160, 166, .6);
  223. border-radius: 17rpx;
  224. color: #ffffff;
  225. font-size: 22rpx;
  226. display: flex;
  227. align-items: center;
  228. justify-content: center;
  229. }
  230. .bottom {
  231. display: flex;
  232. align-items: center;
  233. justify-content: flex-start;
  234. .bottom-left {
  235. font-size: 24rpx;
  236. font-weight: bold;
  237. color: #ffffff;
  238. margin-right: 6rpx;
  239. }
  240. .bottom-right {
  241. font-size: 32rpx;
  242. font-weight: bold;
  243. color: #ffffff;
  244. }
  245. }
  246. }
  247. .address-detail-main-right {
  248. position: absolute;
  249. right: 24rpx;
  250. width: 120rpx;
  251. height: 44rpx;
  252. background: #FF6300;
  253. box-shadow: 0px 4rpx 8rpx 0px rgba(0, 0, 0, 0.08);
  254. border-radius: 22rpx;
  255. display: flex;
  256. align-items: center;
  257. justify-content: center;
  258. color: #ffffff;
  259. font-size: 28rpx;
  260. }
  261. }
  262. .address-detail-position {
  263. position: absolute;
  264. top: 22rpx;
  265. right: 24rpx;
  266. display: flex;
  267. align-items: center;
  268. justify-content: center;
  269. font-weight: 500;
  270. color: #FFFFFF;
  271. font-size: 20rpx;
  272. }
  273. }
  274. }
  275. }
  276. }
  277. .search-detail {
  278. width: 100%;
  279. position: absolute;
  280. top: 88rpx;
  281. z-index: 999 !important;
  282. background-color: #ffffff;
  283. box-shadow: 0px 12rpx 16rpx 0px rgba(220, 222, 229, 0.4);
  284. padding: 20rpx 30rpx 20rpx;
  285. .partner {
  286. .partner-top {
  287. height: 88rpx;
  288. border-top: 2rpx solid #F0F0F0;
  289. border-bottom: 2rpx solid #F0F0F0;
  290. display: flex;
  291. align-items: center;
  292. justify-content: space-between;
  293. color: #333;
  294. font-size: 28rpx;
  295. }
  296. .partner-main {
  297. margin-top: 32rpx;
  298. ::v-deep .uni-data-checklist .checklist-group .checklist-box {
  299. width: 26%;
  300. }
  301. ::v-deep .uni-data-checklist .checklist-group .checklist-box .checkbox__inner {
  302. width: 48rpx;
  303. height: 48rpx;
  304. }
  305. ::v-deep .uni-data-checklist .checklist-group .checklist-box .checkbox__inner .checkbox__inner-icon {
  306. top: 6rpx !important;
  307. left: 17rpx !important;
  308. height: 24rpx !important;
  309. width: 15rpx !important;
  310. border-right-color: #ff6200;
  311. border-bottom-color: #ff6200;
  312. }
  313. ::v-deep .uni-data-checklist .checklist-group .checklist-box.is--default.is-checked .checklist-text {
  314. color: #666 !important;
  315. font-size: 24rpx !important;
  316. }
  317. ::v-deep .checklist-text {
  318. font-size: 24rpx !important;
  319. }
  320. ::v-deep .uni-data-checklist .checklist-group .checklist-box.is--default.is-checked .checkbox__inner {
  321. border-color: #EDEDED !important;
  322. background-color: #ffffff;
  323. }
  324. }
  325. }
  326. .search-detail-area {
  327. width: 100%;
  328. display: flex;
  329. flex-wrap: wrap;
  330. justify-content: flex-start;
  331. align-items: center;
  332. .areaTitle {
  333. width: 156rpx;
  334. height: 56rpx;
  335. background: #FFFFFF;
  336. border: 2rpx solid #EDEDED;
  337. border-radius: 28rpx;
  338. font-size: 28rpx;
  339. color: #666;
  340. display: flex;
  341. justify-content: center;
  342. align-items: center;
  343. margin-right: 20rpx;
  344. margin-bottom: 18rpx;
  345. &:nth-child(4n) {
  346. margin-right: 0;
  347. }
  348. }
  349. // .areaTitle-item {
  350. // width: 156rpx;
  351. // height: 56rpx;
  352. // background-color: #F1F1F1;
  353. // border-radius: 26rpx;
  354. // font-size: 24rpx;
  355. // color: #999;
  356. // display: flex;
  357. // justify-content: center;
  358. // align-items: center;
  359. // }
  360. .active-area {
  361. width: 156rpx;
  362. height: 56rpx;
  363. border-radius: 28rpx;
  364. background-color: #FF6200;
  365. color: #fff;
  366. display: flex;
  367. justify-content: center;
  368. align-items: center;
  369. }
  370. }
  371. .search-detail-btn {
  372. display: flex;
  373. align-items: center;
  374. justify-content: space-between;
  375. margin: 38rpx 0 20rpx;
  376. .search-detail-btn-left {
  377. flex: 1;
  378. height: 76rpx;
  379. background: rgba(237, 237, 237, .55);
  380. border-radius: 8rpx;
  381. color: #999999;
  382. font-size: 30rpx;
  383. display: flex;
  384. align-items: center;
  385. justify-content: center;
  386. font-weight: bold;
  387. }
  388. .search-detail-btn-right {
  389. flex: 1;
  390. height: 76rpx;
  391. background: linear-gradient(270deg, #FF6200 0%, #FF9342 100%);
  392. border-radius: 8rpx;
  393. color: #FFFFFF;
  394. font-size: 30rpx;
  395. display: flex;
  396. align-items: center;
  397. justify-content: center;
  398. margin-left: 22rpx;
  399. font-weight: bold;
  400. }
  401. }
  402. ::v-deep .u-input {
  403. width: 690rpx !important;
  404. height: 68rpx !important;
  405. background: #F1F1F1;
  406. border-radius: 74rpx;
  407. }
  408. ::v-deep .u-input__content__field-wrapper {
  409. padding-left: 36rpx;
  410. }
  411. }
  412. .search-top {
  413. display: flex;
  414. align-items: center;
  415. justify-content: space-between;
  416. }
  417. .search {
  418. position: relative;
  419. flex: none;
  420. width: 100%;
  421. background: #FFFFFF;
  422. box-shadow: 0px 12rpx 16rpx 0px rgba(220, 222, 229, 0.4);
  423. display: flex;
  424. flex-direction: column;
  425. align-items: inherit;
  426. justify-content: space-between;
  427. .search-loupe {
  428. flex: none;
  429. width: 60rpx;
  430. height: 60rpx;
  431. background: #FFFFFF;
  432. border-radius: 50%;
  433. border: 2rpx solid #EDEDED;
  434. display: flex;
  435. align-items: center;
  436. justify-content: center;
  437. margin-right: 16rpx;
  438. }
  439. .search-area-all {
  440. flex: 1;
  441. display: flex;
  442. align-items: center;
  443. justify-content: flex-start;
  444. .search-areaClick {
  445. padding: 12rpx 22rpx;
  446. height: 52rpx;
  447. background: #FFFFFF;
  448. border-radius: 26rpx;
  449. border: 2rpx solid #FF6200;
  450. font-weight: 500;
  451. color: #FF6200;
  452. font-size: 28rpx;
  453. display: flex;
  454. align-items: center;
  455. justify-content: center;
  456. margin-right: 16rpx;
  457. text {
  458. margin-right: 8rpx;
  459. }
  460. }
  461. .search-area {
  462. padding: 12rpx 22rpx;
  463. height: 52rpx;
  464. background: #FFFFFF;
  465. border-radius: 26rpx;
  466. border: 2rpx solid #EDEDED;
  467. font-weight: 500;
  468. color: #666666;
  469. font-size: 28rpx;
  470. display: flex;
  471. align-items: center;
  472. justify-content: center;
  473. margin-right: 16rpx;
  474. text {
  475. margin-right: 8rpx;
  476. }
  477. }
  478. }
  479. }
  480. .address-nav {
  481. position: absolute;
  482. width: 100%;
  483. bottom: 34rpx;
  484. padding: 0 16rpx;
  485. display: flex;
  486. flex-direction: column;
  487. align-items: center;
  488. justify-content: space-between;
  489. overflow-x: scroll;
  490. .address-nav-btn {
  491. width: 100%;
  492. display: flex;
  493. align-items: center;
  494. justify-content: space-between;
  495. }
  496. }
  497. .address {
  498. flex: 1;
  499. position: relative;
  500. .address-detail {
  501. position: relative;
  502. flex: none;
  503. width: 496rpx;
  504. border-radius: 10rpx;
  505. margin-right: 16rpx;
  506. &:last-child {
  507. margin-right: 0rpx;
  508. }
  509. .inner {
  510. width: 100%;
  511. height: 318rpx;
  512. border-radius: 10rpx;
  513. background: rgba(0, 0, 0, 0.4);
  514. position: absolute;
  515. z-index: 2;
  516. top: 0;
  517. left: 0;
  518. .address-detail-main {
  519. position: absolute;
  520. left: 0;
  521. bottom: 30rpx;
  522. width: 100%;
  523. display: flex;
  524. align-items: flex-end;
  525. justify-content: space-between;
  526. .address-detail-main-left {
  527. position: absolute;
  528. left: 20rpx;
  529. .title {
  530. font-size: 32rpx;
  531. font-weight: bold;
  532. color: #FFFFFF;
  533. }
  534. .content {
  535. margin: 12rpx 0 20rpx;
  536. width: 92rpx;
  537. height: 34rpx;
  538. background: rgba(142, 160, 166, .6);
  539. border-radius: 17rpx;
  540. color: #ffffff;
  541. font-size: 22rpx;
  542. display: flex;
  543. align-items: center;
  544. justify-content: center;
  545. }
  546. .bottom {
  547. display: flex;
  548. align-items: center;
  549. justify-content: flex-start;
  550. .bottom-left {
  551. font-size: 24rpx;
  552. font-weight: bold;
  553. color: #ffffff;
  554. margin-right: 6rpx;
  555. }
  556. .bottom-right {
  557. font-size: 32rpx;
  558. font-weight: bold;
  559. color: #ffffff;
  560. }
  561. }
  562. }
  563. .address-detail-main-right {
  564. position: absolute;
  565. right: 24rpx;
  566. width: 120rpx;
  567. height: 44rpx;
  568. background: #FF6300;
  569. box-shadow: 0px 4rpx 8rpx 0px rgba(0, 0, 0, 0.08);
  570. border-radius: 22rpx;
  571. display: flex;
  572. align-items: center;
  573. justify-content: center;
  574. color: #ffffff;
  575. font-size: 28rpx;
  576. }
  577. }
  578. .address-detail-position {
  579. position: absolute;
  580. top: 22rpx;
  581. right: 24rpx;
  582. display: flex;
  583. align-items: center;
  584. justify-content: center;
  585. font-weight: 500;
  586. color: #FFFFFF;
  587. font-size: 20rpx;
  588. }
  589. }
  590. }
  591. }
  592. </style>