<!-- 判断隐私是不是显示 -->
<privacy_pop id="privacy_pop" bind:agree_pri="agree_pri"></privacy_pop>
<!-- 促销弹出框 -->
<pro_pop id="pro_pop" bind:sure_cx_group="sure_cx_group"></pro_pop>

<wxs module="g_filter" src="g_filter.wxs"></wxs>

<block wx:if="{{ad_data}}">
 <swiper class="swiper" circular="true" autoplay="true"
           indicator-dots="true" interval="2500"
          style="height:{{max_sw_height}}rpx" >
    <block wx:for="{{ad_data}}">    
	
        <navigator url="{{item.ad_weapplink}}" class="s1_gk_a1" wx:if="{{g_filter.has_char(item.ad_weapplink,'plugin')>=0}}">
          <swiper-item>
               <image src="{{item.ad_code}}"  bindload="imageLoad"  data-index="{{index}}"   class="slide-image" mode="widthFix" lazy-load="true"/>
          </swiper-item>
        </navigator>

        <view data-url="{{item.ad_weapplink}}" class="s1_gk_a1" bindtap="go_url" wx:else>
          <swiper-item>
              <image src="{{item.ad_code}}"  bindload="imageLoad"  data-index="{{index}}"  class="slide-image" mode="widthFix" lazy-load="true"/>
          </swiper-item>
        </view>     

    </block>
  </swiper>
</block>


<view class="container {{(requestData && requestData.length>0) || (service_data && service_data.length>0)?'margin_b':''}} " wx:if="{{(requestData && requestData.length>0) || (service_data && service_data.length>0) || invalidList && invalidList.length  }}">
  <!-- 购物车商品框架 -->
  <view class="login-in">
    <!-- 编辑 -->
    <view class="padding flex-vertical-between fs30 Storenum store" style="justify-content:space-between">
      <view wx:if="{{freight_free}}" class="fs28 pdr20 pdl20 c-red2 flex jc_sb weight_free">
        <text wx:if="{{weight_free <=0}}">全场满{{freight_free}}元可享包邮</text>
        <text wx:else>全场满{{freight_free}}元可享包邮({{weight_free}}kg内)</text>
      </view>
      <view wx:if="{{is_edit==0}}" bindtap="edit_cart" data-type="1">编辑</view>
      <view wx:else bindtap="edit_cart" data-type="0">完成</view>
    </view>
	
	<!-- 商品的列表 -->
	<block wx:if="{{requestData && requestData.length>0}}">
      <block wx:for="{{requestData}}" wx:key="{{pidx}}" wx:for-item="item" wx:for-index="pidx">
      <!-- 门店底下的商品 -->
      <view class="store">
        <view class="shmd_m">

          <!-- 门店 -->
          <icon wx:if="{{checkAllToggle||item.selected}}" class="order-raido flex-center"  bindtap="check_th_all_item" data-pitems="{{pidx}}"
                  color="red" size="20" type="success"></icon>
          <view  wx:else class="icon_no_sele2" bindtap="check_th_all_item" data-pitems="{{pidx}}"></view>

          <view class="flex-center">
            <image src="{{iurl}}miniapp/images/stores/store.png"></image>
            <view class="shmd fs30">{{item.pname}}</view>
          </view>

        </view>

         <block  wx:for="{{item.goods}}" wx:for-item="items" wx:for-index="idx" wx:key="{{idx}}">
            <view class="order-item" data-item="{{idx}}">
                <block wx:if="{{!items.is_gift}}">
                    <view bindtap="check_th_item" class="order-raido flex-vertical " data-check="{{items.selected}}" data-item="{{idx}}" data-pitems="{{pidx}}">
                        <!--<radio color="red" checked="{{checkAllToggle||items.selected}}"></radio>-->
                        <icon  wx:if="{{checkAllToggle||items.selected}}" color="red"  size="20" type="success"></icon>
                        <text  wx:else class="icon_no_sele"></text>
                    </view>
                </block>
                <block wx:else><view class="order-raido flex-vertical " style="width: 45rpx"></view></block>

                <navigator class="goods-img rel" bindtap="go_gd" data-item="{{items}}"  data-gd="{{items.goods_id}}">
                    <image class="wh100" src="{{items.original_img}}" binderror="bind_bnerr2" data-errorimg="requestData[{{pidx}}].goods[{{idx}}].original_img" data-url="{{items.original_img}}"></image>
                    <block wx:if="{{items.is_gift}}">
                        <view style="background-color:red" class="abs flex-center fs26" wx:if="{{items.is_gift==1}}">赠品</view>
                    </block>
                    <block wx:else>
                        <view class="abs flex-center fs26" wx:if="{{items.distr_type==0}}">自选</view>
                        <view class="abs flex-center fs26" wx:if="{{items.distr_type==1}}">自提</view>
                        <view class="abs flex-center fs26" wx:if="{{items.distr_type==2}}">物流</view>
                    </block>

                    <block wx:if="{{items.prom_type==7}}">
                        <block wx:if="{{items.selected}}">
                            <!-- 主要显示限购 -->
                            <text wx:if="{{items.zhqty>items.goods_num}}" class="abs2">还需购买{{items.zhqty-items.goods_num}}件</text>
                        </block>
                        <block wx:else>
                            <text wx:if="{{items.zhqty}}" class="abs2">需购买{{items.zhqty}}件</text>
                        </block>
                    </block>


                </navigator>
                <view class="goods-cont">
                    <view class="goods-name">
                        <navigator bindtap="go_gd" class="ellipsis-2 fs30" data-item="{{items}}"   data-gd="{{items.goods_id}}">{{items.goods_name}}</navigator>

                        <view class="specifications  ellipsis-1">
                            <view  wx:if="{{items.goods_color || items.goods_spec}}">
                                {{items.goods_color}}{{items.goods_color?"/":''}}{{items.goods_spec}}</view>
                            <view  wx:else>规格1</view>
                        </view>
                        <block wx:if="{{items.is_gift}}">
                            <view>{{items.goods_num}}件</view>
                        </block>
                        <view wx:if="{{items.buyqty>0}}" class="fs22 ml10 c-7b">组合限购{{items.buyqty}}件</view>
                    </view>


                    <block wx:if="{{!items.is_gift}}">
                        <view class="flex alend jc_sb">
                            <view class="goods-price co-red baseline ellipsis-1">
                                <view class="fs20">￥</view>
                                <view class="fs28">{{items.goods_price}}</view>

                                <view wx:if="{{items.is_offline}}" class="quan_color flex ai-center"><text>券后 ￥{{g_filter.toFix(items.offline_price,2)}}</text></view>


                            </view>
                            <view class="count">
                                <view bindtap="{{items.goods_num <= 1 ? '':'subNum'}}" class="sub fs28 {{items.goods_num <= 1 ? 'active':''}}" data-pitems="{{pidx}}" data-item="{{idx}}">一</view>
                                <input class="goodadd" bindblur="valueToNum" data-pitems="{{pidx}}" data-item="{{idx}}"
                                       bindinput="refresh_input" type="number" value="{{items.goods_num}}"></input>
                                <view class="add" bindtap="addNum" data-pitems="{{pidx}}" data-item="{{idx}}">+</view>
                            </view>
                        </view>
                    </block>
                </view>
            </view>


            <!-- 验证活动是不是多个，要不要显示切换 -->
            <!-- 新增促销多活动的排版 -->
            <block  wx:if="{{g_filter.is_more_act(items,item.show_can_cx1) && item.show_can_cx1[items.goods_id] && item.show_can_cx1[items.goods_id].act_arr.length>1}}">
                <view class="bdb16">
                    <view bindtap="switch_cx_group"
                          data-index="{{pidx}}"
                          data-gd_key="{{items.goods_id}}"
                          class="cx-frame flex" style="position: relative">
                        <view class="cx-sizs fs30">可参促销</view>
                        <view class="flex ai_c f1 pdh20">
                            <view class="xc-coupon-fram" wx:for="{{item.show_can_cx1[items.goods_id].act_arr}}" >
                                <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }}">优惠促销</view>
                                <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">搭配促销</view>
                                <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">组合购</view>
                                <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }}">阶梯促销</view>
                            </view>
                        </view>
                        <view class="cx-obtain-coupon wsize">
                            <text class="bg_jj"></text>
                        </view>
                    </view>
                </view>
            </block>


        </block >

          <!-- 判断有没有赠品2024-2-1 -->
          <block wx:if="{{cart_zp[item.pid] && cart_zp[item.pid].goods.length>0 }}">
              <block  wx:for="{{cart_zp[item.pid].goods}}" wx:for-item="itemss" wx:for-index="idxx" wx:key="{{idxx}}">
                  <view class="order-item" data-item="{{idxx}}">
                      <view class="order-raido flex-vertical " style="width: 45rpx"></view>
                      <navigator class="goods-img rel" bindtap="go_gd" data-item="{{itemss}}"  data-gd="{{itemss.goods_id}}">
                          <image class="wh100" src="{{itemss.original_img}}" binderror="bind_bnerr_gift" data-pid="{{item.pid}}" data-idxx="{{idxx}}" data-url="{{itemss.original_img}}"></image>
                          <view style="background-color:red" class="abs flex-center fs26">赠品</view>
                      </navigator>
                      <view class="goods-cont">
                          <view class="goods-name">
                              <navigator bindtap="go_gd" class="ellipsis-2 fs30" data-item="{{itemss}}"   data-gd="{{itemss.goods_id}}">{{itemss.goods_name}}</navigator>

                              <view class="specifications  ellipsis-1">
                                  <view  wx:if="{{itemss.goods_color || itemss.goods_spec}}">
                                      {{itemss.goods_color}}{{itemss.goods_color?"/":''}}{{itemss.goods_spec}}</view>
                                  <view  wx:else>规格1</view>
                              </view>
                              <view>{{itemss.goods_num}}件</view>
                          </view>
                      </view>
                  </view>
              </block>
          </block>

          <!--此时是多个商品参与活动的切换 验证活动是不是多个，要不要显示切换 -->
          <!-- 新增促销多活动的排版 -->
          <block wx:if="{{item.show_can_cx1}}">
              <block  wx:for="{{item.show_can_cx1}}" wx:for-item="pitem">
                  <view class="bdb16" wx:if="{{pitem.is_duo_gd && pitem.act_arr.length>1}}" >
                          <view bindtap="switch_cx_group"
                                data-index="{{pidx}}"
                                data-gd_key="{{index}}"
                                class="cx-frame flex" style="position: relative">
                              <view class="cx-sizs fs30">可参促销</view>
                              <view class="flex ai_c f1 pdh20">
                                  <view class="xc-coupon-fram" wx:for="{{pitem.act_arr}}" >
                                      <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word  {{!item.sele?'gray':'' }} ">优惠促销</view>
                                      <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word  {{!item.sele?'gray':'' }} ">搭配促销</view>
                                      <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word  {{!item.sele?'gray':'' }}">组合购</view>
                                      <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }}">阶梯促销</view>
                                  </view>
                              </view>
                              <view class="cx-obtain-coupon wsize">
                                  <text class="bg_jj"></text>
                              </view>
                          </view>
                  </view>
              </block>
          </block>

      </view>
           <!--- 去凑单 -->
          <block wx:if="{{item.make_up_arr}}">
          <view  style="margin-top: 20rpx; padding: 0 30rpx">
              <view class="flex jc_sb fs28" wx:for="{{item.make_up_arr}}" style="margin-bottom: 20rpx" >
              <view class="ellipsis-1" style="width: 80%">再买<text class="co-red">{{item.diff}}<text wx:if="{{item.diff_type==0}}">元</text>
                          <text wx:if="{{item.diff_type==1}}">件</text>
                   </text>，{{g_filter.map_str(item.content)}}
                  <text></text>
              </view>
                <view class="co-red" data-prom_id="{{item.prom_id}}" bindtap="go_cou_dang">去凑单></view>
              </view>
          </view>
          </block>
          <!-- 还差多少件立即享受组合购 -->
          <block wx:if="{{item.need_list && item.need_list.length>0 && !is_edit}}">
            <view class="fs28 pdr20 pdl20 pdb20 c-red2 flex jc_sb" wx:for="{{item.need_list}}">
			       <text>{{item.title}}</text>
			       <text data-url="/packageB/pages/zuhegou/index/index?id={{item.id}}" bindtap="go_url">去凑单></text>
			      </view>
          </block>

          <!-- 阶梯促销提示多少件的优惠 -->
          <block wx:if="{{item.l_need_list && item.l_need_list.length>0 && !is_edit}}">
              <view class="fs28 pdr20 pdl20 pdb20 c-red2 flex jc_sb" wx:for="{{item.l_need_list}}">
                  <text>{{item.title}}</text>
                  <text data-url="/pages/goods/goodsList/goodsList?ladder_id={{item.id}}" bindtap="go_url">去凑单></text>
              </view>
          </block>

          <!-- 赠品的提示  -->
          <block wx:if="{{item.send_gift_arr}}">
              <view bindtap="show_gift_toast"  wx:for="{{item.send_gift_arr}}"
                    class="fs28 pdr20 pdl20 pdb20 c-red2 flex jc_sb" style="padding: 10rpx 30rpx">
                  <text style="color: #333333">送赠品</text>
                  <text  bindtap="tishi_gift">{{item.prom_name}}></text>
              </view>
          </block>
           

      <!-- 线下取价 -->
      <view style="margin:10rpx 0; padding: 0 30rpx;color: #999" wx:if="{{item.offline_price}}" class="fs28">
        当前<text class="red_c">{{item.offline_num}}</text>件商品，可使用<text class="red_c">{{item.offline_price}}</text>元店铺优惠
      </view>
      </block>
    </block>
  
    <!-- 服务卡项的列表 -->
    <block wx:if="{{service_data && service_data.length>0}}">
      <block wx:for="{{service_data}}" wx:key="{{index}}" wx:for-index="pidx">
      <!-- 门店以及门店底下的服务卡 -->
      <view class="store">
        <view class="shmd_m">
        
          <icon wx:if="{{checkAllToggle||item.selected}}" class="order-raido flex-center"  bindtap="check_th_all_item_ser" data-pitems="{{pidx}}"
                  color="red" size="20" type="success"></icon>
          <view  wx:else class="icon_no_sele2" bindtap="check_th_all_item_ser" data-pitems="{{pidx}}"></view>
    
          <view class="flex-center">
            <image src="{{iurl}}miniapp/images/stores/store.png"></image>
            <view class="shmd fs30">{{item.pname}}</view>
          </view>
    
        </view>
        <view class="order-item" data-item="{{idx}}" wx:for="{{item.goods}}" wx:for-item="items" wx:for-index="idx" wx:key="{{index}}">
          <block>
             <view bindtap="check_th_item_ser" class="order-raido flex-vertical " data-check="{{items.selected}}" data-item="{{idx}}" data-pitems="{{pidx}}">
             <!--<radio color="red" checked="{{checkAllToggle||items.selected}}"></radio>-->
                <icon  wx:if="{{checkAllToggle||items.selected}}" color="red"  size="20" type="success"></icon>
                <text  wx:else class="icon_no_sele"></text>
             </view>
          </block>
          
    
          <navigator class="goods-img rel" bindtap="go_card"  data-gid="{{items.service_id}}">
            <image class="wh100" src="{{items.img_url}}" binderror="bind_bnerr2" data-errorimg="service_data[{{pidx}}].goods[{{idx}}].img_url" data-url="{{items.img_url}}"></image>
     
          </navigator>
          <view class="goods-cont">
            <view class="goods-name">
              <navigator class="ellipsis-2 fs30" bindtap="go_card"  data-gid="{{items.service_id}}">{{items.service_name}}</navigator>
              <block wx:if="{{items.is_gift}}">
                <view>{{items.goods_num}}件</view>
              </block>
            </view>
          
		    <block wx:if="{{!items.is_gift}}">
		       <view class="flex alend jc_sb">
		      <view class="goods-price co-red baseline ellipsis-1">
		        <view class="fs20">￥</view>
		        <view class="fs28">{{items.money}}</view>		    
		      </view>
		      <view class="count">
		        <view bindtap="subNum_ser" class="sub fs28" data-pitems="{{pidx}}" data-item="{{idx}}">一</view>
		        <input class="goodadd" bindblur="valueToNum_ser" data-pitems="{{pidx}}" data-item="{{idx}}"
		    	   bindinput="refresh_input"
		    	   type="number" value="{{items.goods_num}}"></input>
		        <view class="add" bindtap="addNum_ser" data-pitems="{{pidx}}" data-item="{{idx}}">+</view>
		      </view>
		    </view>
		    </block>
		  
		  </view>
        </view>
      </view>
      
     
      </block>
    </block>
    <!-- 失效商品 -->
    <block wx:if="{{invalidList && invalidList.length > 0}}">
      <view class="store" style="border-top: 20rpx solid rgb(245, 245, 245);">
        <view class="shmd_m flex-equality">
          <view class="shmd fs30" >失效宝贝{{invalidList.length}}件</view>
          <view class="flex fs26 ctb">
            <view bindtap="collectGoods">移到收藏夹</view>
            <view class="mgl20" bindtap="delInva_all">清空失效宝贝</view>
          </view>
        </view>
        <view class="order-item" style="border: none;" data-item="{{idx}}" wx:for="{{invalidList}}" wx:for-item="items" wx:for-index="idx" wx:key="{{index}}">
            <block >
              <view bindtap="inCheck_th_item" class="order-raido flex-vertical " data-check="{{items.selected}}" data-item="{{idx}}" data-pitems="{{pidx}}">
                  <icon  wx:if="{{items.selected}}" color="red"  size="20" type="success"></icon>
                  <text  wx:else class="icon_no_sele"></text>
              </view>
            </block>
            <view class="goods-img rel"  data-gd="{{items.goods_id}}">
              <image class="wh100" src="{{imgUrl + items.original_img}}" binderror="bind_bnerr2" data-errorimg="requestData[{{pidx}}].goods[{{idx}}].original_img" data-url="{{items.original_img}}"></image>
            </view>            
              <view class="goods-cont">
                <view class="goods-name">
                  <view  class="ellipsis-2 fs30" data-gd="{{items.goods_id}}" style="color: #a5a5a5;">{{items.goods_name || items.service_name}}</view>
                </view>
                <block>
                  <view class="flex alend jc_sb">
                    <view class="goods-price baseline ellipsis-1">
                      <view class="fs28">{{items.invalid}}</view>
                    </view>
                  </view>
                </block>
              </view>
        </view>
      </view>
    </block>    
  
  </view>
  <view class="pay-for flex-vertical-between"  wx:if="{{(requestData && requestData.length>0) || (service_data && service_data.length>0)}}" >
    <view class="allradio flex-vertical-between">
      <view class="flex-vertical mlr" bindtap="checkAll">
        <!--<radio class="order-raido" color="red" checked="{{checkAllToggle}}"></radio>-->
        <icon  wx:if="{{checkAllToggle}}" color="red"  size="20" type="success"></icon>
        <text  wx:else class="icon_no_sele"></text>
        <view class="all fs30" style="margin-left: 10rpx">全选</view>
      </view>

      <!-- 显示金额的多少 -->
      <view class="consumer" wx:if="{{is_edit==0}}">
        <view class="fs30 baseline">
          <view class="total">合计:</view>
          <text class="co-red">￥{{total_fee}}</text>
        </view>
        <view class="flex-level-right">
          <text class="tips fs20">不含运费</text>
        </view>
      </view>
    </view>
    <view>

      <button wx:if="{{is_edit}}" bindtap="check_del" class="pay-btn">删除</button>
      <button wx:else bindtap="checkout" class="pay-btn">结算({{total_num}})</button>
    </view>
  </view>

</view>

<!-- 购物车为空 -->
<view class="empty_order" wx:if="{{(!requestData|| requestData.length==0) && (!service_data|| service_data.length==0) &&  (!invalidList || invalidList.length==0)  && is_load}}">
  <view class="flex-level">
    <image src="{{iurl}}miniapp/images/stores/nocart.png"></image>
  </view>
  <view class="flex-level fs32 xc-ash">购物车竟然是空的</view>
  <view class="flex-level">
    <navigator bindtap="go_url" data-url="/pages/index/index/index" bindtap="goto">
      <view class="flex-center fs30 white">去首页逛逛</view>
    </navigator>
  </view>
</view>

<!-- 好物推荐 -->
<view class="title" style="margin-top: 60rpx; margin-bottom:{{isTabBar == true ? '50px' : '0'}}" wx:if="{{(!requestData|| requestData.length==0) && (!service_data|| service_data.length==0) && is_load}}">
  <!-- 标题 -->
  <view>
    <!-- 中文名标题 -->
    <view class="China flex-level">
      <view class="line flex-vertical">
        <view class="one"></view>
        <view class="two"></view>
        <view class="three"></view>
      </view>

      <view class="Recommend flex-level" bindtap="requestList">好物推荐</view>

      <view class="line flex-vertical">
        <view class="three"></view>
        <view class="two"></view>
        <view class="one"></view>
      </view>
    </view>

    <!-- 英文标题 -->
    <view class="english flex-center">
      <view class="silk"></view>
      <view class="esh five-level-word">GOOD HOT THING</view>
      <view class="silk"></view>
    </view>

  </view>
  <!-- 商品列表组件 -->
  <goods_recommend id="goods_list"></goods_recommend>
</view>


<warn id="warn"></warn>
