ChainList.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <!-- List.vue -->
  2. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  3. <home-base :show="false" ><view class="div wrapper" :style="'width:'+getBannerStyle.width+'px;height:'+getBannerStyle.height+'px'">
  4. <view class="div common-header-wrap">
  5. <view :style="'height:'+navHeight+'px'"></view>
  6. <view class="common-header-holder"></view>
  7. <view class="common-header-fixed">
  8. <title-header />
  9. <uni-nav-bar title="自提门店" class="common-header" left-icon="back" @clickLeft="goBack()">
  10. </uni-nav-bar>
  11. </view>
  12. </view>
  13. <map v-if="loaded>=2" class="div common-popup-content" :latitude="latitude" :longitude="longitude" :markers="covers"></map>
  14. </view></home-base>
  15. </template>
  16. <script>
  17. import {getFontSize} from '@/util/common'
  18. import TitleHeader from '../../TitleHeader'
  19. import HomeBase from '../HomeBase'
  20. import { getChainList } from '../../../api/homegoodsdetail'
  21. import { convertPoint } from '../../../util/bmap'
  22. import { env } from '../../../static/config'
  23. export default {
  24. computed:{
  25. fontSize(){
  26. return getFontSize()
  27. },
  28. getBannerStyle: function () {
  29. const res = uni.getSystemInfoSync()
  30. var width = res.windowWidth
  31. var height = res.windowHeight
  32. let itemWidth = width
  33. let itemHeight = height
  34. return {
  35. width: itemWidth,
  36. height: itemHeight
  37. }
  38. },
  39. },
  40. data(){
  41. return {
  42. loaded:0,
  43. navHeight: 0,
  44. goods_id: 0,
  45. latitude:0,
  46. longitude:0,
  47. covers:[]
  48. }
  49. },
  50. components:{
  51. TitleHeader,
  52. HomeBase,
  53. },
  54. props: ['list'],
  55. onLoad: function (option) {
  56. this.goods_id=option.goods_id
  57. },
  58. mounted(){
  59. // #ifdef MP-WEIXIN
  60. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  61. // #endif
  62. uni.getLocation({
  63. type: 'gcj02',
  64. success: (res) => {
  65. this.longitude=res.longitude
  66. this.latitude=res.latitude
  67. this.loaded++
  68. }
  69. })
  70. getChainList({ goods_id: this.goods_id }).then(res => {
  71. let chain_list = res.result.chain_list
  72. for (var i in chain_list) {
  73. this.mapAddMarker(chain_list[i])
  74. }
  75. this.loaded++
  76. })
  77. },
  78. methods:{
  79. goBack(){uni.navigateBack({delta:1})},
  80. mapAddMarker (info) {
  81. var marker = {
  82. id:info.chain_id,
  83. width: 35,
  84. height: 25,
  85. latitude:info.chain_latitude,
  86. longitude:info.chain_longitude,
  87. title:info.chain_addressname,
  88. iconPath: '/static/image/marker_red_sprite.png',
  89. }
  90. this.covers.push(marker) // 将标注添加到地图中
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="scss">
  96. .common-header-wrap .common-header{box-shadow: unset}
  97. .common-popup-content{width:100%}
  98. .wrapper{display: flex;flex-direction: column;}
  99. </style>