<view bindtap="closeSpecModal" class="cover-layer"></view>
  <view class="spec-model">
    <view class="pding">
      <icon bindtap="closeSpecModal" class="modal-close" color="gray" size="22" type="cancel"></icon>

      <!-- 商品名称 -->
      <view class="spec-goods">
        <image class="wh100 spec-img xc-distance-bottom" bindtap="previewImage" src="{{data.original_img}}" binderror="pop_err_img" data-errorimg="data.original_img"></image>
        <view class="spec-goods-info">
          <view class="spec-goods-name ellipsis-1">{{sele_g.goods_name}}</view>
          <view class="flex ai_end xc-val-money {{sele_g[card_field]}}" >
            <view class="spec-goods-price" wx:if="{{is_normal==1}}" >
			                 <!-- 如果是等级会员，且有等级价 -->
			     			  <block wx:if="{{card_field && sele_g[card_field]>0}}">
			     			    ￥ {{sele_g[card_field]}}
			     			  </block> 		 
			     			  <block wx:else>
			     			    ￥ {{sele_g.shop_price}} 
			     			  </block>	 
			</view>
            <view class="spec-goods-price" wx:else>￥ {{prom_price}}</view>
          </view>

          <block wx:if="{{is_normal==1}}">
            <view class="flex">
			  <view class="spec-goods-stock">已售：{{sele_g.sales_sum}}</view>
              <block wx:if="{{sales_rules>=2}}">
                  <block wx:if="{{!filters.is_virtual_gd(sele_g.is_virtual)}}">
                     <view class="spec-goods-stock" wx:if="{{def_pick_store && def_pick_store.CanOutQty}}">可售：{{def_pick_store.CanOutQty}}</view>
                     <view class="spec-goods-stock" wx:else>可售:0</view>
                  </block>
              </block>
              <block wx:else><view class="spec-goods-stock">可售：{{sele_g.store_count}}</view></block>    
            </view>
          </block>
          <block wx:if="{{is_normal==0}}">
            <view class="flex">
              <view class="spec-goods-stock" wx:if="{{prom_st>0}}">已售：{{prom_act.buy_num}}</view>
              <view class="spec-goods-stock" wx:else >已售：{{prom_act.buy_num}}</view>
              <view class="spec-goods-stock">可售：{{prom_act.goods_num-prom_act.buy_num}}</view>
            </view>
          </block>
        </view>

      </view>


      <view style="clear: both"></view>
      <view style="margin-top: 20rpx">
         <view  class="flex-space-between address ai_end xc-width ">

          <view class="flex" wx:if="{{def_pick_store && def_pick_store.pickup_name}}">
            <text class="fs30 xc-black3 shop_name {{def_pick_store.distance!=null?'max':''}} ">{{def_pick_store.pickup_name}}</text>
            <view class="distance fs24 xc-ash" wx:if="{{def_pick_store.distance!=null}}">
              距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}

            </view>
          </view>

          <!-- 没有门店的时候 -->
          <view  class="flex" bindtap="choice_store" wx:else>
            <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image>
            <view class="fs28 xc-ash-9f">选择门店</view>
          </view>

          <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store" >更多门店<text class="right-arrow"></text></view>
        </view>
<!--		  <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view>-->
<!--		  <view class="no_store" wx:elif="{{def_pick_store.is_no_dis_nor && is_normal==1}}">(配送不匹配)</view>-->
          <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view>
          <block wx:else>
              <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
              <block wx:else>
                  <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view>
                  <view class="no_store" wx:elif="{{def_pick_store.is_no_dis_nor && is_normal}}">(该店不可售)</view>
                  <view class="no_store" wx:elif="{{def_pick_store.is_no_dis_act && !is_normal}}">(该店不可售)</view>
                  <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules>=2 && is_normal}}">(库存不足)</view>
              </block>
          </block>

          <view class="fs24 xc-ash-9f xc-distance-top "wx:if="{{def_pick_store && def_pick_store.pickup_name}}">地址:{{def_pick_store.fulladdress}}</view>
      </view>
      <!----商品的属性项目---->
     <view> 
      <view hidden="{{ismend==1}}" class="spec-name">商品规格</view>
      <block wx:if="{{is_normal==0}}">
        <view hidden="{{ismend==1}}" class="flex">
          <view class="spec_bt {{sele_g.goods_id==item.goods_id?'act':''}}" bindtap="sele_spec" data-gid='{{item.goods_id}}' wx:for="{{sku_g}}" wx:key="sku_g">{{item.gg}}
          </view>
        </view>
      </block>

      <block wx:else>
        <view hidden="{{ismend==1}}" class="flex">
          <view class="spec_bt {{sele_g.goods_id==item.goods_id?'act':''}}" 
		     bindtap="sele_spec" data-nor="1" data-gid='{{item.goods_id}}' wx:for="{{sku_g_pt}}" wx:key="sku_g">{{item.gg}}</view>
        </view>
      </block>
      <view class="clear"></view>
     </view>


     <view>

        <view class="b_num" hidden="{{ismend==1}}" style="margin-top: 20rpx">
          <view>购买数量</view>
          <view class="count">
            <view bindtap="{{goodsInputNum <= 1 ? '':'subCartNum'}}" class="sub {{goodsInputNum <= 1 ? 'active':''}}">-</view>
            <input bindblur="inputCartNum" class="xc-val-fream" type="number" value="{{goodsInputNum}}"></input>
            <view bindtap="addCartNum" class="add">+</view>
          </view>
        </view>
		
		
		<!-- 提示再买多少优惠 -->
		<view style="margin-top: 35rpx;color:#333;font-size:28rpx;" wx:if="{{hui_condition && is_normal==1}}">
			再买{{hui_condition.need}}
			<text wx:if="{{hui_condition.money}}">，免{{hui_condition.money}}元</text>
			<text wx:if="{{hui_condition.sale}}">，打{{hui_condition.sale}}折</text>
			<text wx:if="{{hui_condition.past==1}}">，包邮</text>
			<text wx:if="{{hui_condition.intValue>0}}">，送{{hui_condition.intValue}}积分</text>
			<text wx:if="{{hui_condition.couponId>0}}">，送优惠券</text>
			<text wx:if="{{hui_condition.gift_id>0}}">，送赠品</text>
			<text wx:if="{{hui_condition.lb_id>0}}">，送礼包</text>
			<text wx:if="{{hui_condition.zxlb_id>0}}">，送专享礼包</text>
		</view>
		

        <view class="clear"></view>
        <!---当选取门店的时候会显示门店的选项---->
        <view hidden="{{ismend==0}}" class="sto_v">
          <view class="title" hidden="{{is_sec_mend==1}}" bindtap="hidemend">
            <image class="tubiao" src="{{iurl}}/miniapp/images/icon-left.png"></image>选择门店
          </view>
          <!-----第一级显示------>
          <view class="itemlists" hidden="{{is_sec_mend==1}}">
            <block wx:if="{{is_show_sto_cat>0}}">
              <view wx:for="{{all_sto}}" wx:key="all_sto" class="item" bindtap="show_sec" data-index="{{index}}">{{item.name}}</view>
            </block>
            <block wx:else>
              <view wx:for="{{only_pk}}" wx:key="only_pk" class="item" bindtap="hidemend" data-p_id="{{item.pickup_id}}" data-p_name="{{item.pickup_name}}" data-p_dis="{{item.distr_type}}">{{item.pickup_name}}
              </view>
            </block>
          </view>
          <!-----第二级显示------>
          <view class="stitle" hidden="{{is_sec_mend==0}}" bindtap="hide_sec_mend">
            <image class="tubiao" src="{{iurl}}/miniapp/images/icon-left.png"></image>{{sec_sto.name}}</view>
          <view class="itemlists" hidden="{{is_sec_mend==0}}">
            <view wx:for="{{sec_sto.s_arr}}" wx:key="index" class="item" bindtap="hidemend" data-p_id="{{item.pickup_id}}" data-p_name="{{item.pickup_name}}" data-p_dis="{{item.distr_type}}">{{item.pickup_name}}
            </view>
          </view>
        </view>
      </view>
    </view> 
    <view class="pt_qd">
	 <block wx:if="{{is_normal==1}}">
		  <!-- 按钮部分 -->
		  <view class="spec-cart-btns">	
		      <!-- 根本就找不到门店 -->
		      <block wx:if="{{def_pick_store && def_pick_store.is_no_dis}}">
		      	   <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">配送不匹配</view>		   
		      </block>

              <block wx:elif="{{def_pick_store && def_pick_store.is_no_dis_nor}}">
                  <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">该店不可售</view>
              </block>

		      <block wx:else> 	
		  
		  	       <!-- 根本就找不到门店 -->
		  	       <block wx:if="{{!only_pk && !def_pickpu_list}}">
		  			   <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">库存不足</view>		   
		  		   </block>		 
		  		   <block wx:else>
		  		   
		  		 			  
		  			  <block wx:if="{{only_pk && !only_pk.length}}">
		  				   <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">库存不足</view>
		  			  </block>  	  
		  			  <block wx:else>
		  			      <block wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">
		  		  			   <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view>
		  				 </block>
		  				 <block wx:else>
		  					 <block wx:if="{{!def_pick_store}}">
		  						 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">请先选择门店</view>
		  					 </block>

                             <block wx:else>
                                 <!-- 如果是线下库存购买的时候,且是普通商品购买的时候 -->
                                 <block wx:if="{{sales_rules>=2 && !sele_g.whsle_id}}">
                                     <block wx:if="{{!def_pick_store.CanOutQty || def_pick_store.CanOutQty<1}}">
                                         <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">
                                             库存不足
                                         </view>
                                     </block>
                                     <block wx:else>
                                         <view bindtap="addCart_pt" class="spec-cart-btn spec-buy  {{sp_seleing?'gray':''}}" data-action="buy">立即购买</view>
                                     </block>
                                 </block>
                                 <!-- 线上销售 -->
                                 <block wx:else>
                                     <block wx:if="{{sele_g.store_count<1 && is_no_new}}">
                                         <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">
                                             库存不足
                                         </view>
                                     </block>
                                     <block wx:else>
                                         <view bindtap="addCart_pt" class="spec-cart-btn spec-buy  {{sp_seleing?'gray':''}}" data-action="buy">立即购买</view>
                                     </block>
                                 </block>
                             </block>
		  				 </block>
		  		   </block>  			
		  		</block>	
			   </block>				   
		    </view>
		  
	  </block>		  
	  <block wx:else>
		  <!-- 根本就找不到门店 -->
		  <block wx:if="{{def_pick_store && def_pick_store.is_no_dis}}">
		  	  <view class="spec-cart-btn spec-buy w100"  style="background-color: #dcdcdc;color: #999;">配送不匹配</view>		   
		  </block>
          <block wx:elif="{{def_pick_store && def_pick_store.is_no_dis_act}}">
              <view class="spec-cart-btn spec-buy w100" data-action="add" style="background-color: #dcdcdc;color: #999;">该店不可售</view>
          </block>
		  <block wx:else>
		      <view bindtap="addCart_pt" class="spec-cart-btn spec-buy w100  {{sp_seleing?'gray':''}}" data-action="buy">确定</view>
		  </block> 
	  </block>
		
     
    </view>
  </view>
  