<template>
<!--最佳销售单品-->
<view>
	<view class="index-categrory" v-for="(items, idx) in categoryData" :key="idx"  :style="'margin-bottom: ' + meta.margin_bottom + 'px'">
	    <view class="best">
	        <view class="title">
	            <span>{{items.meta.name}}</span>
	        </view>
	        <view class="SalesGoods-box">
	            <view class="SalesGoods-item" :data-id="item.id" v-for="(item, index) in items.goodsList" :key="index"  @tap="_jumpToDetail">
	                <view class="item">
	                    <image mode="widthFix" class="slider-image" :src="item.img" :alt="item.image"></image>
	                    <view class="goods-name">{{item.name}}</view>
	                    <view class="money-box">
	                        <view class="money-now">￥{{item.sell_price}}</view>
	                    </view>
	                </view>
	            </view>
	        </view>
	        <view class="button-box" data-src="/pages/store/list/list" @tap="_jumpImg">
	            查看全部商品
	        </view>
	    </view>
	</view>
</view>

</template>
<script>

export default {
  data() {
    return {};
  },

  props: {
	  categoryData: {
	    type: Array,
	    value: ''
	  },
	  meta: {
	    type: Object,
	    value: ""
	  } 
  },

    //组件的方法
    methods: {
      _jumpToDetail(e) {
        var id = e.currentTarget.dataset.id;
        wx.navigateTo({
          url: `/pages/store/detail/detail?id=${id}`
        });
      },

      _jumpImg(e) {
        var src = e.currentTarget.dataset.src;
        if (!src || src == 'uto_miniprogram') return;
        wx.navigateTo({
          url: src
        });
      }

    },
   
};
</script>
<style rel="stylesheet/less" lang="less">
@import "index-category";
</style>