<!-- packageE/stores/stores.wxml -->
<wxs module="util">
  var inOf = function(val, str) { if (val) {return val.indexOf(str) }};
  module.exports.inOf = inOf;
</wxs>
<view class="component-wrapper {{'component-'+component_id}}}">
  <!-- 门店静态 -->
  <view>
    <view id="store" wx:if="{{datas.get_number}}" >
      <view wx:if="{{datas.tab_list && datas.tab_list.length > 0 && !U_tabcontrol}}" style="background:{{datas.tab_bg_color}}">
        <van-tabs active="{{active}}" sticky="{{btnFlag}}" bind:change="onClick" color="{{datas.tab_active_color}}"
          tab-class="tag" custom-class="{{datas.sort_style && datas.sort_style == '2'?'bg-color2':''}}">
          <block wx:for="{{datas.tab_list}}" wx:key='index'>
            <van-tab wx:if='{{item == "1"}}' name="0" title="商家"
              title-style="background:{{datas.tab_bg_color}};overflow: visible;white-space: nowrap;text-overflow: clip;color:{{active==0?datas.tab_active_color:datas.tab_color}};">
              <view class="store-box">
                <storeItem02 datas="{{datas}}" showMun="{{showMun}}" storeList="{{shopList0}}" wx:if="{{datas.sort_style && datas.sort_style == '2'}}"></storeItem02>
                <storeItem datas="{{datas}}" showMun="{{showMun}}" storeList="{{shopList0}}" wx:else></storeItem>
                <view wx:if="{{shopList0.length <= 0}}" class="loading-box">
                  暂无数据
                </view>
                <view class="loading-box" wx:if="{{isLoadMore0}}" catchtap="getMoreList" >
                  加载更多
                </view>
                <view class="loading-box" wx:if="{{bottomShowBolIndex == index && !isLoadMore0}}">
                  没有更多了~
                </view>
              </view>
            </van-tab>
            <van-tab wx:if='{{item == "2"}}' title="折扣" name="1"
              title-style="background:{{datas.tab_bg_color}};overflow: visible;white-space: nowrap;text-overflow: clip;color:{{active==1?datas.tab_active_color:datas.tab_color}};">
              <view class="rebate_box" style="background-color:{{datas.preview_color}}">
                <view class="content_b_a">
                  <view class="tab_b" style="background-color:{{datas.preview_color}}">
                    <view class="tab_b_box ul">
                      <view class="{{index == pd_index?'current':''}} li" wx:for="{{pd_classfy_arr}}"
                        wx:for-item="classfy" wx:key='index' catchtap='pdClassfySearch' data-index='{{index}}'
                        data-id="{{classfy.id}}">
                        {{ classfy.name }}
                      </view>
                    </view>
                  </view>
                  <view class="tab_c" style="background-color:{{datas.preview_color}}">
                    <view class="tab_c_box ul">
                      <view class="{{index == pd_date_index?'current':''}} li" wx:for="{{pd_date_arr}}"
                        wx:for-item="date" wx:key='index' catchtap='pdDateSearch' data-index='{{index}}'
                        data-date="{{date}}">
                        <view class='span'>{{ date.week }}</view>
                        <view class='span'>{{ date.ye }}</view>
                      </view>
                    </view>
                  </view>
                  <view class="goods_list">
                    <view class="goods" catchtap="gotoShop" wx:for="{{shopList1}}" wx:for-item="item" wx:key='i'
                      data-id="{{item.id}}">
                      <view class="img">
                        <yz-image src="{{item.thumb}}" custom-style="width:100%;height:100%" />
                      </view>
                      <view class="info ul">
                        <view class="info_a li">
                          <view class='span'>{{ item.store_name }}</view>
                          <view class='span'>距离{{ item.distance }}km</view>
                        </view>
                        <view class="info_b li">
                          <view class='span'>
                            <text style="background-color: #f5f5f5;padding: 0 10rpx;">{{ item.has_many_privilege[0].title }}</text>
                          </view>
                        </view>
                        <view class="info_c li">
                          <view class='span'>{{ item.has_many_privilege[0].discount_value }}折</view>
                          <view class="button" catchtap="gotoShop" data-id="{{item.id}}">
                            立即使用
                          </view>
                        </view>
                      </view>
                    </view>
                  </view>
                </view>
                <view wx:if="{{shopList1.length <= 0}}" class="loading-box">
                  暂无数据~
                </view>
                <view class="loading-box" wx:if="{{isLoadMore1}}" catchtap="getMorePdData">
                  加载更多
                </view>
              </view>

            </van-tab>
            <van-tab wx:if='{{item == "3"}}' title="优惠券" name="2"
              title-style="background:{{datas.tab_bg_color}};overflow: visible;white-space: nowrap;text-overflow: clip;color:{{active==2?datas.tab_active_color:datas.tab_color}};">
              <view class="coupon_list" style="background-color:{{datas.preview_color}}">
                <view class="content_b_c">
                  <view class="coupon_box">
                    <view class="coupon" wx:for="{{shopList2}}" wx:key="i">
                      <view class="left">
                        <view class="img">
                          <yz-image src="{{item.store && item.store.thumb? item.store.thumb:'https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/photo-mr.jpg'}}" custom-style="width:100%;height:100%;" />
                        </view>
                        <view>{{item.store && item.store.store_name? item.store.store_name: " " }}</view>
                      </view>
                      <view class="right">
                        <view class="right_a ul">
                          <view class='li'>{{ item.name }}</view>
                          <view class='li' wx:if="{{item.coupon_method == 1}}">
                            满{{ item.enough }}立减{{ item.deduct }}元
                          </view>
                          <view class='li' wx:if="{{item.coupon_method == 0}}">
                            {{ item.discount }}折优惠
                          </view>
                        </view>
                        <view class="right_b ul">
                          <view class='li' wx:if="{{item.coupon_method == 1}}">
                            <view class="span"><text style="font-size:14px;">{{language['money']}}</text>{{ item.deduct }}</view>
                          </view>
                          <view class='li' wx:if="{{item.coupon_method == 0}}">
                            <view class="span">{{ item.discount }}</view>折
                          </view>
                          <view class='li'>
                            <view class="button" catchtap='getCoupon' data-id="{{item.id}}">
                              立即领取
                            </view>
                          </view>
                        </view>
                      </view>
                    </view>
                  </view>
                </view>
                <view class="loading-box" wx:if="{{isLoadMore2}}" catchtap="getMoreList">
                  加载更多
                </view>
              </view>

            </van-tab>
            <van-tab wx:if='{{item == "4"}}' title="礼包" name="3"
              title-style="background:{{datas.tab_bg_color}};overflow: visible;white-space: nowrap;text-overflow: clip;color:{{active==3?datas.tab_active_color:datas.tab_color}};">
              <view class="gift_box" style="background-color:{{datas.preview_color}}">
                <store_gift datas="{{datas}}" list="{{shopList3}}"></store_gift>
                  <view
                    class="loading-box"
                    wx:if="{{isLoadMore3}}"
                    catchtap="getMoreList"
                  >
                    加载更多
                  </view>
                </view>
            </van-tab>
          </block>
        </van-tabs>
      </view>

      <block wx:if="{{U_tabcontrol}}">
        <view class="store-box" >
          <storeItem02 datas="{{plugin_active?datas_style02:datas}}"  showMun="{{showMun}}" plugin_active="{{plugin_active}}" storeList="{{shopList0}}" wx:if="{{(datas.sort_style && datas.sort_style == '2')||openTemplate == 1}}"></storeItem02>
          <storeItem datas="{{datas}}" showMun="{{showMun}}" plugin_active="{{plugin_active}}" storeList="{{shopList0}}" wx:else></storeItem>

          <view wx:if="{{shopList0.length <= 0}}" class="loading-box">
            暂无数据
          </view>
          <view class="loading-box" wx:if="{{isLoadMore0}}" catchtap="getMoreList" >
            加载更多
          </view>
          <view class="loading-box" wx:if="{{bottomShowBolIndex == index && !isLoadMore0}}">
            没有更多了~
          </view>
        </view>
      </block>

    </view>
  </view>
</view>
