<wxs module="filters" src="../../../../utils/filter.wxs"></wxs>
<wxs module="filter" src="../cart2/c_filter.wxs"></wxs>
<wxs src="../cart2/filter.wxs" module="util"></wxs>
	
  <!-- 先选择配送方式，2021.7修改 -->
  <block wx:if="{{show_submit}}">
  <view class="tab-container" wx:if="{{kt_type!=3 || is_normal==1}}">
			<view class="tab-wrapper">			
					<view hidden="{{distr_type==2}}" bindtap='set_wuliu' data-type='1' class="tab {{exp_type == 1? 'active':''}}"  
					data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view>
					
					<view hidden="{{distr_type==1}}" bindtap='set_wuliu' data-type='0' class="tab {{exp_type== 0 ? 'active':''}}" 
					data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view>

                    <!-- 同城配送 -->
                    <block wx:if="{{show_same_city}}">
                        <view hidden="{{bn_t_exp_t==3}}" bindtap='set_wuliu' data-type='2' class="tab {{exp_type== 2 ? 'active':''}}" data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}">同城配送</view>
                    </block>
				
			</view>
	</view>
    </block>
		

<!----要进行判断地址是否显示---->
<view bindtap="enterAddressPage" class="user-mes mgt20"
      hidden='{{exp_type==1 }}'>
  <!-----默认地址显示---->
  <block wx:if="{{user_addr!=null}}">
    <view class="user-contact">收货人：{{user_addr.consignee}}{{'　　'}}{{user_addr.mobile}}</view>
    <view class="location">
      <view class="address">{{user_addr.more_address}}{{'  '}}{{user_addr.address}}</view>
      <view class="pos-icon">
        <image class="wh100 bdr14" src="{{imgUrl}}/miniapp/images/goodscategory/new_position.png"></image>
      </view>
    </view>
    <view class="update-logistics">
      <image class="arrow-rigth" src="{{imgUrl}}/miniapp/images/icon-arrowdown.png"></image>
    </view>
  </block>
  <!-----先增地址------>
  <block wx:else>
    <view class="add_new">
      <image class="addr_jia" src="{{imgUrl}}/miniapp/images/jia.png"></image>添加地址
    </view>
  </block>
  <!-- <view class="border-img"><image class="wh100 bdr14" src="{{imgUrl}}/miniapp/images/tt.png"></image></view> -->
</view>

<!--头部门店显示-->
<view class='top bdr_t-14 flex'>
	<image class="t_img" src='{{imgUrl}}/miniapp/images/goodscategory/new_store.png'></image>
  <view class='t_wz'>{{pickup.pickup_name}}</view>
</view>

<!--商品图片显示-->
<view class='center'>
  <view class='cen_img'>
    <image src="{{order.show_img}}" binderror="bind_bnerr" data-errorimg="order.show_img"></image>
  </view>

	<view class="details-container">
		<view class='cen_name ellipsis-3'>{{order.order_goods.goods_name}}</view>
		<view class="flex jc_sb">
			<view class='cen_jg'>￥{{order.order_goods.goods_price}}</view>
			<view class='cen_sl'>x{{order.order_goods.goods_num}}</view>
		</view>
	</view>
  
</view>


<view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{bn_pick}}" hidden="{{(selected_quan_list?selected_quan_list.length:0)+ (get_by_quan_list && exp_type==0?get_by_quan_list.length:0)<=0}}" wx:if="{{(selected_quan_list && selected_quan_list.length>0) || (get_by_quan_list!=null && exp_type==0 )}}">
    <view class="work-frame flex-space-between">
        <view class="work">
            优惠券 <text class="quan_num_show">{{(selected_quan_list?selected_quan_list.length:0)+ (get_by_quan_list && exp_type==0?get_by_quan_list.length:0)}}张可用</text>
        </view>
        <view class="xc-right-frame">
            <text wx:if="{{using_quan[bn_pick].is_nouse}}">不使用</text>
            <block wx:else>
                <text wx:if="{{using_quan[bn_pick].money}}">￥{{using_quan[bn_pick].money}}元优惠券</text>
                <text wx:if="{{using_quan[bn_pick].isby}}">包邮券</text>
            </block>
            <view class="xc-right"></view>
        </view>
    </view>
</view>

<view class="use-item bdr_b-14 jc_sb" wx:if='{{exp_type==0 && !is_default_logistics}}'>
    <view>选择物流：</view>
    <view class="flex-vertical"  bindtap="show_wu_arr"  data-txt='index' style="margin-right: 8rpx;">
				<view class="logistics-name">{{wu_arr[index].name}}</view><view class="xc-right"></view>
		</view>	
</view>

<!--成团人数-->
<view class='chentuan bdr14'>
  <view class='ct_one jc_sb'>
    <view class='ct_one_left'>成团人数</view>
    <view class='ct_one_right'>
         <text wx:if="{{teamgroup.is_xuni_ct}}" class='redwz'>{{teamgroup.jt_ct_num}}</text>
         <text wx:else class='redwz'>{{teamgroup.jt_ct_num}}</text>
         人
    </view>
  </view>
  <view class='ct_one jc_sb'>
    <view class='ct_one_left'>成团金额</view>
    <view class='ct_one_right'><text class='redwz'>￥{{filters.toFix(order.order_amount+order.user_money+order.tail_money+order.pre_cut,2)}}</text></view>
  </view>
  <view class='ct_one jc_sb'>
    <view class='ct_one_left'>支付定金</view>
    <view class='ct_one_right'><text class='redwz'>￥{{filters.toFix(order.order_amount+order.user_money+order.pre_cut,2)}}</text>
    </view>
  </view>
</view>

<!--尾款-->
<view class='chentuan bdr14'>
    <view class='ct_one jc_sb'>
        <view class='ct_one_left'>尾款金额</view>
        <view class='ct_one_right'>
            <text class='redwz'>￥{{order.tail_money}}</text>
        </view>
    </view>

    <view class='ct_one jc_sb' wx:if="{{formData.coupon_price>0}}">
        <view class='ct_one_left'>使用优惠券</view>
        <view class='ct_one_right'>
            <text class='redwz'>- ￥ {{formData.coupon_price}}元</text>
        </view>
    </view>

    <view class='ct_one jc_sb' wx:if="{{exp_price>0}}">
        <view class='ct_one_left'>配送费用</view>
        <view class='ct_one_right'>
            <text class='redwz'>￥{{exp_price}}</text>
        </view>
    </view>
    <!-- 订单优惠优惠金额 -->
    <view class="ct_one jc_sb" wx:if="{{formData.order_prom_amount>0}}">
        <view>订单优惠</view>
        <view class="co-red">- ￥ {{filters.toFix(formData.order_prom_amount, 2)}}</view>
    </view>
</view>


<!-----使用佣金抵扣,只有佣金小于尾款金额的时候------>
<view class="set-mes mgt20" wx:if="{{goods.use_commission>0 && can_commission && goods.use_commission<order.tail_money+exp_price}}">
    <view class="use-item" bindtap='set_bn_commission'>
        <icon  color="{{bn_use_commission?'red':'gray'}}" size="16" type="success"></icon>
        <view class="yu_er">使用佣金 :￥{{goods.use_commission}} </view>
    </view>
</view>

<view style="height:100rpx"></view>


<!--支付-->
<view class='zf shadow'>
  <!-- <view class='zf_left'>
    <text class='zf_left_wz'>支付合计：</text>
    <text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price,2)}}</text>
  </view> -->
	<view class='zf_left'>支付合计：<text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price-formData.coupon_price-(bn_use_commission?goods.use_commission:0)-(formData.order_prom_amount?formData.order_prom_amount:0) ,2)}}</text></view>
  <view class="zf_btn {{(submit || !same_ok)?'gray':''}}" bindtap="to_pay">支付尾款</view>
</view>




<!--支付的方式选择，0微信支付  1余额支付-->
<block wx:if="{{show_pay_type}}">
   <view class="cover-layer" bindtap="close_show_pay"></view>
	 <view class="pay_type_view">
		  <view class="title">请选择支付方式</view>
			<view class="anniu_view">
				   <view bindtap="set_pay_type" data-type="0" >微信支付</view>
					 <view bindtap="set_pay_type" data-type="1" >余额支付</view>
			</view>
	 </view>
</block>

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

<!----弹起选择物流名的列表---->
<view wx:if='{{open_express==1}}' >
    <view class="cover-layer flex-center "  bindtap='close_express'>
    </view>

    <view class="cx-popup radius {{open_express==1?'up' : 'down'}}" >
        <view class="tops flex">
            <view class="top-content fs32">
                <view>
                    选择物流名字
                </view>
            </view>
            <view class="close-frame"  bindtap='close_express' >
                <view class="xc-close-express">×</view>
            </view>
        </view>
        <view class="express_list">
            <view  wx:for="{{wu_arr}}" wx:for-item="express_list" wx:for-index="idx">
                <view class="express_list_frame" bindtap="click_express_name"
                      data-shippingcode="{{express_list.shipping_code}}"
                      data-name="{{express_list.name}}" data-idxe="{{idx}}">

                    <block wx:if="{{is_express==idx}}">
                        <view class="circle white xc-hook fs20 red-b"><text>Γ</text></view>
                    </block>
                    <block wx:else>
                        <view class="circle  xc-hooks"></view>
                    </block>
                    <view class="fs30">{{express_list.name}}</view>

                </view>
            </view>
        </view>
        <view class="flex click-buttem" >
            <view class="xc-determine flex-center" bindtap="determine_expres">
                <view class="flex-vertical  t-c">确定</view>
            </view>
            <view class="xc-confirms flex-center" bindtap="select_default_logistics">
                <view class="flex-vertical  t-c">设为默认</view>
            </view>
        </view>

    </view >
</view>
<view style="height: 50rpx"></view>

<!-- 使用券列表的弹窗 -->
<view wx:if='{{open_quan==1}}'>
    <view class="cover-layer flex-center " bindtap='close_coupon'> </view>
    <view class="cx-popup {{open_quan==true?'up' : 'down'}}">
        <!-- 最上面 -->
        <view class="top flex">
            <view class="xc-top-content  t-c">
                <view class="xc-title">优惠券使用</view>
            </view>
            <view class="xc-close-frame" bindtap='close_coupon'>
                <view class="xc-close">×</view>
            </view>
        </view>
        <!-- 使用优惠券和不使用优惠券层-->
        <view class="may_use_coupon fs28 flex"> 可使用的优惠券
            <view class=" is_use_coupon flex-vertical" bindtap="sele_quan_item" data-no="1">不使用优惠券
                <block wx:if="{{using_quan[selected_quan_pick].is_nouse_red}}">
                    <view class="circle white xc-hooka fs20 red-b  sn"><text>Γ</text></view>
                </block>
                <block wx:else>
                    <view class="circle  xc-hookst ons"></view>
                </block>
            </view>
        </view>

        <!-- 中间券内容显示 -->
        <view class="xc-frame flex-level">
            <view class="list-frame">
                <view wx:for="{{selected_quan_list}}" bindtap="sele_quan_item" wx:if="{{!item.is_using}}" data-ind="{{q_index}}" wx:for-item="item" wx:for-index="q_index">
                    <view class="xc-coupon-frame flex-center" data-ind="{{q_index}}">
                        <view class="coupon-frame flex rel">
                            <!-- 锯齿 -->
                            <include src="../cart2/juchi_part.wxml" />
                            <!-- 左边 -->
                            <view class="coupon-left  rel {{filter.setcolor(item.UseObjectType)}} flex-center">
                                <view class="white xc-money-frames">
                                    <view class="f_text"><text class="xc-rmb-symbol">￥</text><text class="xc-rmb-val">{{item.Sum}}</text></view>
                                    <view class="coupon-explain t-c" wx:if="{{item.BuySum>0}}">满{{item.BuySum}}元可用</view>
                                    <view class="coupon-explain t-c" wx:else>满0元可用</view>
                                </view>
                            </view>
                            <!-- 右边 -->
                            <view class="coupon-right flex-center rel">
                                <view class="coupon-annotation  flex">
                                    <view class="flex  top-frame">
                                        <view class="frame">
                                            <view class="coupon-wode ib flex ellipsis-2 ">
                                                <text class="xc-brand t-c ib white {{filter.setcolor(item.UseObjectType)}}">{{filter.get_type_card(item.UseObjectType)}}</text>
                                                <block>{{item.Sum}}元优惠券</block>
                                            </view>
                                            <view class="coupon-time">{{filters.replace_time2(item.BeginDate)}}至{{item.ValidDate?filters.replace_time2(item.ValidDate):'不限'}}</view>
                                        </view>
                                    </view>
                                    <block wx:if="{{item.show_red}}">
                                        <view class="circle white xc-hook fs20 red-b sn"><text>Γ</text></view>
                                    </block>
                                    <block wx:else>
                                        <view class="circle  xc-hooks on"></view>
                                    </block>
                                </view>
                                <include src="../cart2/remark_click_part.wxml" />
                            </view>
                        </view>
                    </view>
                    <!-- 打开是说明 -->
                    <include src="../cart2/remark_part_qj.wxml" />
                </view>
                <!-- 包邮券的显示，立即购买 -->
                <block wx:if="{{get_by_quan_list && get_by_quan_list.length}}">
                    <view wx:for="{{get_by_quan_list}}" bindtap="sele_quan_item_by" wx:if="{{!item.is_using}}" data-ind="{{byq_index}}" wx:for-item="item" wx:for-index="byq_index">
                        <view class="xc-coupon-frame flex-center" data-ind="{{byq_index}}">
                            <view class="coupon-frame flex rel">
                                <!-- 锯齿 -->
                                <include src="../cart2/juchi_part.wxml" />
                                <!-- 左边 -->
                                <view class="coupon-left  rel {{filter.setcolor(item.UseObjectType)}} flex-center">
                                    <view class="white xc-money-frames">
                                        <view class="f_text"><text class="xc-rmb-val">包邮券</text></view>
                                        <view class="coupon-explain t-c" wx:if="{{item.condition>0}}">满{{item.condition}}元可用</view>
                                        <view class="coupon-explain t-c" wx:else>满0元可用</view>
                                    </view>
                                </view>
                                <!-- 右边 -->
                                <view class="coupon-right flex-center rel">
                                    <view class="coupon-annotation  flex">
                                        <view class="flex  top-frame">
                                            <view class="frame">
                                                <view class="coupon-wode ib flex ellipsis-2 ">
                                                    <text class="xc-brand t-c ib white {{filter.setcolor(item.UseObjectType)}}">{{filter.get_type_card(0)}}</text>
                                                    <block>包邮券</block>
                                                </view>
                                                <view class="coupon-time">{{filters.format_time(item.use_start_time)}}至{{item.use_end_time?filters.format_time(item.use_end_time):'不限'}}</view>
                                            </view>
                                        </view>
                                        <block wx:if="{{item.show_red}}">
                                            <view class="circle white xc-hook fs20 red-b sn"><text>Γ</text></view>
                                        </block>
                                        <block wx:else>
                                            <view class="circle  xc-hooks on"></view>
                                        </block>
                                    </view>
                                    <include src="../cart2/remark_click_part2.wxml" />
                                </view>
                            </view>
                        </view>
                        <!-- 打开是说明 -->
                        <include src="../cart2/remark_part.wxml" />
                    </view>
                </block>

            </view>
        </view>
        <!-- 最底下确定层-->
        <view class="determine-frame">
            <view class="xc-confirm flex-center" bindtap="confirm_quan"> 确定 </view>
        </view>
    </view>
</view>
