<template>
<view class="groupon-item-box" :style="{marginBottom: meta.margin_bottom + 'px',background: meta.background_color}">
    <view class="title" data-src="/pages/store/groups/groups" @tap="_jumpImg">
        <span>超值拼团</span>
        <span>更多
             <text class="iconfont icon-gengduo"></text>
        </span>
    </view>
    <view v-for="(item, index) in indexData" :key="index" >
        <view class="item" :data-id="item.associate.goods.id" @tap="_jumpToDetail">
            <view class="left">
                <image mode="widthFix" :src="item.associate.goods.img" alt></image>
                <view :style="'background: ' + config.mainColor + '; color: ' + config.countColor" class="num">
                    {{item.associate.number}}人团
                </view>
            </view>
            <view class="right">
                <view class="name">
                    {{item.associate.goods.name}}
                </view>
                <view class="price-box">
                    <view>
                        <seckill :end="item.associate.ends_at" :starts="item.associate.starts_at" :server="server" typename="拼团"></seckill>
                    </view>
                    <view class="meal-price">
                        <view class="price">
                            ￥{{item.associate.price}} <span class="old-price">￥{{item.associate.goods.sell_price}}</span>
                        </view>
                        <view class="btn" :style="'background: ' + config.mainColor">
                            <span>去拼团 <i class="iconfont icon-Chevron"></i></span>
                        </view>
                    </view>
                </view>
            </view>
        </view>
    </view>
</view>
</template>
<script>
import seckill from "../seckill/seckill";

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

 options: {
      addGlobalClass: true
    },

  components: {
    seckill
  },
  
  props: {
	  
	indexData: {
	    type: Array,
	    value: ''
	  },
	  config: {
	    type: Object,
	    value: ''
	  },
	  server: {
	    type: String,
	    value: ''
	  },
	  meta: {
	    type: Object,
	    value: ""
	  }
	  
  },

    //组件的方法
    methods: {
      _jumpImg(e) {
        var src = e.currentTarget.dataset.src;
        if (!src || src == 'uto_miniprogram') return;
        wx.navigateTo({
          url: src
        });
      },

      _jumpToDetail(e) {
        var id = e.currentTarget.dataset.id;
        wx.navigateTo({
          url: `/pages/store/detail/detail?id=${id}`
        });
      }
	} 
};
</script>

<style rel="stylesheet/less" lang="less">
@import "index-groupon";
</style>