<template>
<!--打call-->
<view class="seckill-box" :style="'margin-bottom: ' + meta.margin_bottom + 'px'">
    <view class="title " data-src="/pages/store/callList/callList" @tap="_jumpImg">
        <span>打Call免费领</span>
        <span>更多
             <text class="iconfont icon-gengduo"></text>
        </span>
    </view>
    <view v-for="(item, index) in callData" :key="index" >
        <view class="seckill-info" :data-goods="item.associate.goods.id" :data-id="item.associate_id" @tap="_jumpCall">
            <view class="left">
                <image :src="item.associate.img"></image>
            </view>
            <view class="right">
                <view class="goods-name">
                    {{item.associate.label}}
                </view>
                <view class="price-box free-money">
                    <view class="money">
                        <text class="new">￥{{item.associate.goods.sell_price}}</text>
                        <text class="old">￥{{item.associate.goods.market_price}}</text>
                    </view>
                    <view class="nun">
                        限量{{item.associate.limit}}件
                    </view>
                </view>
                <view class="seckill-time">
                    <view v-if="item.associate.activity_status == 'NoBegin'">
                        <seckill :end="item.associate.ends_at" typename="集call" :starts="item.associate.starts_at" :server="server" mold="index"></seckill>
                    </view>
                    <view class="free" v-else>
                        集满{{item.associate.per_count}}个Call即可免费领
                    </view>
                    <view :style="'background: ' + config.mainColor" class="buy">
                        去打Call
                    </view>
                </view>
            </view>
        </view>
    </view>
</view>

</template>
<script>
import {pageLogin, getUrl,config} from '../../common/js/utils.js';
import seckill from "../seckill/seckill";

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

  components: {
    seckill
  },
  props: {
	  callData: {
	    type: Array,
	    value: ''
	  },
	  isLogin: {
	    type: Boolean,
	    value: ''
	  },
	  config: {
	    type: Object,
	    value: ''
	  },
	  server: {
	    type: String,
	    value: ''
	  },
	  meta: {
	    type: Object,
	    value: ""
	  }
  },
  options: {
    addGlobalClass: true
  },
    //组件的方法
    methods: {
      _jumpImg(e) {
        var src = e.currentTarget.dataset.src;
        if (!src || src == 'uto_miniprogram') return;
        wx.navigateTo({
          url: src
        });
      },

      _jumpCall(e) {
        if (this.isLogin) {
          var id = e.currentTarget.dataset.id;
          wx.navigateTo({
            url: '/pages/store/call/call?id=' + id
          });
        } else {
          wx.showModal({
            content: '请先登录',
            success: res => {
              if (res.confirm || !res.cancel && !res.confirm) {
                pageLogin(getUrl());
              }
            }
          });
        }
      }
    },
};
</script>
<style rel="stylesheet/less" lang="less">
@import "index-call";
</style>