homecolumn.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view>
  3. <!--components/special/special.wxml-->
  4. <!-- 专栏 -->
  5. <template name="homecolumn">
  6. <view class="column3 ddflex" v-if="homecolumnimg[0][0].length==3">
  7. <view class="li">
  8. <image :src="homecolumnimg[0][0][0].picUrl + '?x-oss-process=style/w375'"></image>
  9. </view>
  10. <view class="fflex">
  11. <view class="li">
  12. <image :src="homecolumnimg[0][0][1].picUrl + '?x-oss-process=style/w375'"></image>
  13. </view>
  14. <view class="li">
  15. <image :src="homecolumnimg[0][0][2].picUrl + '?x-oss-process=style/w375'"></image>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="column ddflex" v-else>
  20. <block v-for="(items,indexs) in homecolumnimg" :key="indexs">
  21. <block v-for="(itemss,indexss) in items" :key="indexss">
  22. <block v-for="(item,index) in itemss" :key="index">
  23. <button open-type="share" hover-class="none" class="li" v-if="item.bannerTitle.indexOf('邀请') > -1">
  24. <image :src="item.picUrl" mode="aspectFill"></image>
  25. </button>
  26. <view class="li" @click="jumpUrlColumn(item)" v-else>
  27. <image :src="item.picUrl" mode="aspectFill"></image>
  28. </view>
  29. </block>
  30. </block>
  31. </block>
  32. </view>
  33. <view v-if="merchantList.length >0">
  34. <view class="mer-tit ddflex" @click="jumpUrl('merchant/nearby/nearby')">推荐门店<view class="mer-more ddflex">查看更多<image src="../../static/pages/images/rico.png"></image></view></view>
  35. <view class="mer-list">
  36. <view class="li ddflex" v-for="(item,index) in merchantList" :key="index" @click="jumpUrl('topic/about/about?id='+item.id)">
  37. <image :src="item.logo" mode="aspectFill" class="mer-logo"></image>
  38. <view class="fflex">
  39. <view class="mer-name ddflex">
  40. <view class="fflex">
  41. {{item.title}}
  42. </view>
  43. <image :src="picUrlss+'blue/m_map.png'" @click.stop="goNavigation(1,index)" :data-index="index" class="mer-map"></image>
  44. </view>
  45. <view class="mer-addr">{{item.address}}</view>
  46. <view class="yue" v-if="item.range > 0">
  47. 距离<text v-if="item.mDistance || item.range">{{item.mDistance < 1000 ? item.mDistance+'m' : item.range+'km'}}</text>
  48. </view>
  49. <view class="mer-label ddflex" v-if="item.label">
  50. <text v-for="(it,idx) in item.label.split(',')" :key="idx" v-if="idx < 3">{{it}}</text>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. </view>
  58. </template>
  59. <script>
  60. // components/special/special.js
  61. // 专区
  62. const app = getApp();
  63. const req = require("../../utils/request.js");
  64. export default {
  65. data() {
  66. return {
  67. picUrlss: req.public.picUrls
  68. };
  69. },
  70. components: {},
  71. props: {
  72. homecolumnimg: Array ,//首页专区图片
  73. merchantList: Array,//门店列表
  74. config: Object
  75. },
  76. watch: {},
  77. mounted() {
  78. // console.log('首页专区==',this.homecolumnimg[0][0])
  79. console.log('首页门店==',this.merchantList)
  80. },
  81. methods: {
  82. jumpUrlColumn(item){
  83. let obj = {
  84. content: item.bannerContent,
  85. type: item.bannerType
  86. }
  87. app.globalData.clickBanner(obj);
  88. },
  89. getRqeDatas() {
  90. let that = this; //首页专区
  91. let homecolumn = this.homeTemplate.filter(it => it.module == this.templateType.module_homecolumn);
  92. if (homecolumn.length > 0 && homecolumn[0].state == 0) {
  93. let homecolumnimg = homecolumn[0].contentId.split(",");
  94. if (homecolumnimg[0] != '' && homecolumnimg[1] != '' && homecolumnimg[2] != '') {
  95. if (homecolumnimg.length == 3) {
  96. // console.log(homecolumnimg);
  97. this.setData({
  98. homecolumnimg: homecolumnimg
  99. });
  100. }
  101. }
  102. }
  103. },
  104. toCoupon() {
  105. req.isLogin().then(success => {
  106. if (success) {
  107. app.globalData.openPage('product/coupon/coupon');
  108. }
  109. });
  110. },
  111. goNavigation(type,index) {
  112. let page ={};
  113. page=this.merchantList[index];
  114. console.log('pageItem===',page);
  115. let plugin = requirePlugin('routePlan');
  116. let key = req.public.mapLBSKEY; //使用在腾讯位置服务申请的key
  117. let referer = this.config.CONFIG_PROJECT_TITLE; //调用插件的app的名称
  118. // console.log("名称====" + referer);
  119. let endPoint = JSON.stringify({
  120. //终点
  121. 'name': page.title,
  122. 'latitude': page.lat,
  123. 'longitude': page.lng
  124. });
  125. var url='plugin://routePlan/index?key=' + key + '&referer=' + referer + '&endPoint=' + endPoint;
  126. console.log('地址=====',url);
  127. uni.navigateTo({
  128. url: url
  129. })
  130. },
  131. jumpUrl(url){
  132. app.globalData.openPage(url)
  133. }
  134. }
  135. };
  136. </script>
  137. <style>
  138. @import "./homecolumn.css";
  139. </style>