<van-sticky>
<view class="search-container">
  <view class="search" style="height:{{navHeight}}px;padding-top:{{navTop}}px">
    <view class="search-title" src="../../images/actLogo/ytlogo.png"
      style="height:{{navHeight-navTop-5}}px;line-height:{{navHeight-navTop-5}}px;width:{{132/52*(navHeight-navTop-5)}}px;">
      {{mallName}}
    </view>
    <input placeholder-class="search-placeholder"
      style="width:{{menuButtonObject.left-18-((132/52)*(navHeight-navTop-5))}}px" type="text" placeholder="输入关键词搜索" disabled
      value="{{name}}" bindinput="bindinput" bindtap="goSearch"></input>
  </view>
</view>
</van-sticky>
<navigator wx:if="{{shopInfo}}" url="/pages/shop/select">
  <view class="shops-container">
    <view class="l">
      <image src="/images/order-details/icon-address.png"></image>
      <text>{{shopInfo.name}}</text>
    </view>
    <view class="r">
      <text>切换门店</text>
      <image src="/images/icon/next.png"></image>
    </view>
  </view>
</navigator>
<wxs module="goodsDetailPage">
module.exports = {
  url : function(item) {
    if (item.supplyType == 'cps_jd') {
      return '/packageCps/pages/goods-details/cps-jd?id=' + item.goodsId
    } else if (item.supplyType == 'vop_jd') {
      return '/pages/goods-details/vop?id=' + item.yyId + '&goodsId=' + item.id
    } else if (item.supplyType == 'cps_pdd') {
      return '/packageCps/pages/goods-details/cps-pdd?id=' + item.goodsId
    } else if (item.supplyType == 'cps_taobao') {
      return '/packageCps/pages/goods-details/cps-taobao?id=' + item.goodsId
    } else {
      return '/pages/goods-details/index?id=' + item.goodsId
    }
  }
}
</wxs>
<view class="swiper-container">
  <swiper class="swiper1" indicator-dots="true" indicator-active-color="#fff" autoplay circular>
    <swiper-item wx:for="{{banners}}" wx:key="id">
      <image mode="aspectFill" bindtap="tapBanner" data-url="{{item.linkUrl}}" src="{{item.picUrl}}" />
    </swiper-item>
  </swiper>
  <view wx:if="{{goodsDynamic && show_buy_dynamic == '1' }}" class="goodsDynamic">
    <swiper class="swiper2" autoplay circular vertical>
      <navigator wx:for="{{goodsDynamic}}" wx:key="index" url="{{ goodsDetailPage.url(item) }}">
        <swiper-item>
          <view class="goodsDynamic-item">
            <image mode="aspectFill" src="{{item.avatarUrl}}"></image>
            <text>{{item.nick}} 购买了 {{item.goodsName}}</text>
          </view>
        </swiper-item>
      </navigator>
    </swiper>
  </view>
</view>
<view class="category-container">
  <view class="category-box">
    <view class="category-list" wx:for="{{categories}}" wx:key="id">
      <view class="category-column" bindtap="tabClick"
        data-id="{{item.id}}">
        <image mode="aspectFill" class="category-imgbox" src="{{item.icon}}"></image>
        <view class="category-title">{{item.name}}</view>
      </view>
    </view>
    <view class="category-list" wx:for="{{cmsCategories}}" wx:key="id">
      <view class="category-column" bindtap="tabClickCms"
        data-idx="{{ index }}">
        <image mode="aspectFill" class="category-imgbox" src="{{item.icon}}"></image>
        <view class="category-title">{{item.name}}</view>
      </view>
    </view>
  </view>
</view>
<view class="notice-box" wx:if="{{noticeList}}">
  <swiper class="notice_swiper" vertical autoplay circular interval="8000">
    <swiper-item wx:for="{{noticeList.dataList}}" wx:key="id">
      <van-notice-bar wx:if="{{noticeList}}" mode="link" text="{{ item.title }}" background="#FFFFFF"
        data-id="{{ item.id }}" speed="30" bind:click="goNotice">
        <image slot="left-icon" class="notice-icon" src="../../images/home/notice.png"></image>
      </van-notice-bar>
    </swiper-item>
  </swiper>
</view>
<view class="container">
  <image wx:if="{{ adPositionIndexLivePic }}" class="live-banner" src="{{ adPositionIndexLivePic.val }}" mode="widthFix" bindtap="clickAdPositionIndexLive"></image>
  <!-- 秒杀开始 -->
  <block wx:if="{{miaoshaGoods && miaoshaGoods.length > 0}}">
    <van-divider custom-class="table-text" contentPosition="center">
      <image class="table-icon-miaosha" src="../../images/home/miaosha.png"></image> 限时秒杀
    </van-divider>
    <view class="miaosha-container">
      <view class="miaosha-goods-list" wx:for="{{miaoshaGoods}}" wx:key="id" bindtap="toDetailsTap"
        data-id="{{item.id}}" data-supplytype="{{item.supplyType}}" data-yyid="{{item.yyId}}">
        <image src="{{item.pic}}" class="image" mode="aspectFill" lazy-load="true" />
        <view class="r">
          <view class="goods-title">{{item.name}}</view>
          <view class="count-down">
            <van-count-down wx:if="{{item.dateStartInt > 0}}" time="{{ item.dateStartInt }}"
              format="距离开始: HH 时 mm 分 ss 秒" />
            <van-count-down wx:if="{{item.dateStartInt <= 0 && item.dateEndInt > 0}}" time="{{ item.dateEndInt }}"
              format="剩余: HH 时 mm 分 ss 秒" />
          </view>
          <view class="miaosha-price-btn">
            <view class="price">￥{{item.minPrice}} <text>￥{{item.originalPrice}}</text></view>
            <van-button custom-class="msbtn" wx:if="{{item.dateStartInt > 0}}" type="danger" size="small" round plain
              disabled>未开始</van-button>
            <van-button custom-class="msbtn" wx:if="{{item.dateEndInt <= 0}}" type="danger" size="small" round>已结束
            </van-button>
            <van-button custom-class="msbtn" wx:if="{{item.stores <= 0}}" type="danger" size="small" round>已抢完
            </van-button>
            <van-button custom-class="msbtn"
              wx:if="{{item.dateStartInt <= 0 && item.dateEndInt > 0 && item.stores > 0}}" type="danger" size="small"
              round>立即抢购</van-button>
          </view>
        </view>
      </view>
    </view>
  </block>
  <!-- 秒杀结束 -->

  <view class="space"></view>
  <van-divider custom-class="table-text" wx:if="{{goodsRecommend.length > 0}}"
    contentPosition="center">
    <image class="table-icon-tuijian" src="../../images/home/recommend.png"></image> 爆品推荐
  </van-divider>
  <view class="goods-container" wx:if="{{goodsRecommend.length > 0}}">
    <view class="goods-box" wx:for="{{goodsRecommend}}" wx:key="id" bindtap="toDetailsTap" data-id="{{item.id}}" data-supplytype="{{item.supplyType}}" data-yyid="{{item.yyId}}">
      <view class="img-box">
        <image src="{{item.pic}}" class="image" mode="aspectFill" lazy-load="true" />
      </view>
      <view class="goods-title van-multi-ellipsis--l2">{{item.name}}</view>
      <view wx:if="{{item.characteristic}}" class="characteristic van-multi-ellipsis--l2" style="-webkit-line-clamp: 1;">{{item.characteristic}}</view>
      <view style='display:flex;'>
        <view class="goods-price">¥ {{item.minPrice}}</view>
        <view wx:if="{{item.originalPrice && item.originalPrice > 0}}" class="goods-price"
          style='color:#aaa;text-decoration:line-through'>¥ {{item.originalPrice}}</view>
      </view>
    </view>
  </view>
  <view class="space"></view>
  <view wx-if="{{kanjiaList.length > 0}}"
    class="kanjia-container">
    <van-divider custom-class="table-text" contentPosition="center">
      <image class="table-icon-kanjia" src="../../images/home/kanjia.png"></image> 疯狂砍价
    </van-divider>
    <van-card custom-class="kanjia-vcard" wx:for="{{kanjiaList}}" wx:key="id" price="{{item.kanjiaPrice}}"
      origin-price="{{item.originalPrice}}" desc="{{item.characteristic}}" title="{{item.name}}" thumb="{{item.pic}}">
      <view slot="footer">
        <van-button custom-class="kjbtn" type="danger" size="small" data-id="{{item.id}}" data-supplytype="{{item.supplyType}}" data-yyid="{{item.yyId}}" bind:click="toDetailsTap">砍价
        </van-button>
      </view>
      <view slot="price-top">
        <van-progress custom-class="vprogress" percentage="{{item.process}}" color="#FDEDED;" />
      </view>
    </van-card>
  </view>
  <block wx:if="{{pingtuanList.length > 0}}">
    <view class='space'></view>
    <van-divider custom-class="table-text" contentPosition="center">
      <image class="table-icon-pingtuan" src="../../images/home/pingtuan.png"></image> 全民拼团
    </van-divider>
    <view class='tuan'>
      <view class='tuan-item' wx:for="{{pingtuanList}}" wx:key="id">
        <view class='tuan-goods-pic'>
          <image src="{{item.pic}}" mode="aspectFill" lazy-load='{{true}}' />
        </view>
        <view class='tuan-title'>{{item.name}}</view>
        <view class='tuan-profile'>{{item.characteristic}}</view>
        <van-tag custom-class="pingtuantag" wx:if="{{item.tags}}" type="danger">{{item.tags}}</van-tag>
        <view class='tuan-price'>
          <text class='now'>￥ {{item.pingtuanPrice}}</text>
          <text class='original'>￥ {{item.originalPrice}}</text>
        </view>
        <view class="tuan-btn">
          <button class="ptbtn" type="warn" size="mini" bindtap="toDetailsTap" data-id="{{item.id}}" data-supplytype="{{item.supplyType}}" data-yyid="{{item.yyId}}">拼团</button>
        </view>
      </view>
    </view>
  </block>

  <view class='space'></view>
  <van-divider custom-class="table-text" contentPosition="center">
    <image class="table-icon-goodslist" src="../../images/home/goodslist.png"></image> 商品列表
  </van-divider>
  <view class="goods-container">
    <view class="goods-box" wx:for="{{goods}}" wx:key="id" bindtap="toDetailsTap" data-id="{{item.id}}" data-supplytype="{{item.supplyType}}" data-yyid="{{item.yyId}}">
      <view class="img-box">
        <image src="{{item.pic}}" class="image" mode="aspectFill" lazy-load="true" />
      </view>
      <view class="goods-title van-multi-ellipsis--l2">{{item.name}}</view>
      <view wx:if="{{item.characteristic}}" class="characteristic van-multi-ellipsis--l2" style="-webkit-line-clamp: 1;">{{item.characteristic}}</view>
      <view class="goods-price-container">
        <view class="goods-price">¥ {{item.minPrice}}</view>
        <view wx:if="{{item.originalPrice && item.originalPrice > 0}}" class="goods-price2">¥ {{item.originalPrice}}
        </view>
      </view>
    </view>
  </view>
  <van-divider wx:if="{{ !loadingMoreHidden }}" contentPosition="center">没有更多啦</van-divider>
</view>
<view class='coupons-float' bindtap="goCoupons">
  <image src="/images/gift.png"></image>
</view>

<van-overlay show="{{ adPositionIndexPop }}">
  <view class="adPositionIndexPop">
    <image src="{{ adPositionIndexPop.val }}" mode="widthFix" bindtap="clickAdPositionIndexPop"></image>
    <van-icon custom-class="close" name="close" size="64rpx" color="#fff" bind:click="closeAdPositionIndexPop" />
  </view>
</van-overlay>
