<!--packageI/independenceBalance/mycomponent/order_pay/pay_order.wxml-->
<view class="goodsinfo">
    <view class="cashier">
        <block wx:if="{{show1}}">
            <view class="popup start">
                <view class="text_box">
                    <view class="span">去支付</view>
                    <icon catchtap="show1btn" class="iconfont icon-back"></icon>
                </view>
                <view class="ul popup_pay">
                    <view class="li">待付款金额</view>
                    <view class="li">
                        <text class="span">{{language['money']}}</text>
                        <text class="span">{{ payMuch }}</text>
                    </view>
                </view>
                <view class="tbs" wx:if="{{loadDiscount && order_data[0] && order_data[0].order_deductions}}">
                    <view class="list listflex2">
                        <view class="score" wx:for-item="d" wx:for="{{order_data[0].order_deductions}}" wx:key="index">
                            <view class="left">
                                可用{{ d.coin }}{{ d.name }}抵扣
                                <text class="span">{{ d.amount }}{{language['元']}}</text>
                            </view>
                            <view class="right">
                                <van-switch checked="{{d.checked}}" loading="{{clicktag == 1}}" data-index="{{index}}" data-orderData="{{order_data[0]}}" data-d="{{d}}" bind:change="discountHandle" />
                            </view>
                        </view>
                    </view>
                </view>
                <view class="tbs" wx:if="{{loadDiscount && order_data[0] && order_data[0].order_coin_exchanges}}">
                    <view class="list listflex">
                        <view class="score" wx:for-item="d" wx:for="{{order_data[0].order_coin_exchanges}}" wx:key="index">
                            <view class="left">
                                可用{{ d.coin }}{{ d.name }}抵扣
                                <text class="span">{{ d.amount }}{{language['元']}}</text>
                            </view>
                            <view class="right"></view>
                        </view>
                    </view>
                </view>
                <view class="tbs coupon-list" catchtap="showCoupon" wx:if="{{isShowCoupon}}">
                    <view class="couponss list listflex">
                        <view class="left ">
                            优惠券
                            <text class="span">{{ coupon_size }}张可用</text>
                        </view>
                        <view class="right">
                            <view class="font" color="#E84E40">
                                <view class="span">
                                    {{use_coupon_size == 0? "未使用": "已使用" + use_coupon_size + "张"}}
                                </view>
                            </view>
                        </view>
                    </view>
                </view>
                <!-- <view class="tbs coupon-list" wx:if="{{store_set.is_write_information == 1}}">
                    <view class="coupon list">
                        <van-field value="{{form.realname}}" label="联系人" placeholder="请输入联系人:" type="text" maxlength="{{30}}" bind:blur="realnameinp" />
                        <van-field value="{{form.mobile}}" label="电话" placeholder="请输入电话:" type="number" maxlength="{{11}}" bind:blur="mobileinp" />
                    </view>
                </view> -->
                <view class="tbs">
                    <view class="price list listflex" wx:for="{{allData.amount_items}}" wx:key="{{item.name}}">
                        <view class="left ">{{item.name}}</view>
                        <view class="right">
                            <view class="font">-{{language['money']}}{{ item.amount }}</view>
                        </view>
                    </view>
                    <view class="price list listflex" wx:for="{{allData.discount_amount_items}}" wx:key="{{item.name}}">
                        <view class="left ">{{item.name}}</view>
                        <view class="right">
                            <view class="font">-￥{{ item.amount }}</view>
                        </view>
                    </view>
                    <view class="price list listflex" wx:for="{{allData.fee_items}}" wx:key="{{item.name}}">
                        <view class="left ">{{item.name}}</view>
                        <view class="right">
                            <view class="font">{{language['money']}}{{ item.amount }}</view>
                        </view>
                    </view>
                    <view class="price list listflex">
                        <view class="left ">实付金额</view>
                        <view class="right">
                            <view class="font">{{language['money']}}{{price}}</view>
                        </view>
                    </view>
                </view>
                <view class="agreement" wx:if="{{agreementPayData}}">
                    <view class="right">
                        <van-checkbox value="{{agreementPay}}" checked-color="#f15353" shape="square" bind:change="agreementPayinp"></van-checkbox>
                    </view>
                    <view class="left ">
                        <view class="span" catchtap="showPay">《支付协议》</view>
                    </view>
                </view>

                <yz_pay_buttons money="{{price}}" buttons="{{payType}}" bindisPushHome="fromChild" balance="{{balanceNow}}"></yz_pay_buttons>
            </view>
        </block>
    </view>
</view>

<pay-keyboard show="{{popupSpecs}}" wx:if="{{popupSpecs}}" bindclose="payKeyboardClose" bindcomplete="payKeyboardComplete"></pay-keyboard>

<van-popup custom-style="width:100%;height:100%;" show="{{agreementPayShow}}" position="right" overlay="{{false}}">
    <view class="agreementContent">
        <van-nav-bar title="支付协议" left-text="" right-text="" left-arrow bind:click-left="PayShowbtn" />
        <view class="msgbox">
            <rich-text nodes="{{agreementPayData}}"></rich-text>
            <!-- <template is="wxParse" data="{{wxParseData:article.nodes}}" /> -->
        </view>
    </view>
</van-popup>
<van-popup bind:click-overlay="couponclose" show="{{popupCouponSpecs}}" position="bottom" overlay="{{true}}">
    <view class="add-info">
        <view class="coupon-list-info" wx:for="{{coupons}}" wx:for-item="coupon" wx:for-index="index" wx:key="index">
            <view class="checkList">
                <block wx:if="{{clicktag==0}}">
                    <van-checkbox data-index="{{index}}" disabled="{{!coupon.valid}}" value="{{coupon.checked}}" bind:change="selectCoupon" shape="square"></van-checkbox>
                </block>
                <block wx:if="{{clicktag !=0}}">
                    <van-loading size='20px' />
                </block>
            </view>
            <view class="{{coupon.valid?'coupon_voucher_main':''}} {{!coupon.valid?'coupon_voucher_gray':''}}">
                <view class="coupon_voucher_left">
                    <view wx:if="{{coupon.belongs_to_coupon.coupon_method==1}}">
                        <view class="p coupon_voucher_amount type_large">
                            {{coupon.belongs_to_coupon.deduct}}
                        </view>
                        <view class="p coupon_voucher_limit">满{{coupon.belongs_to_coupon.enough}}立减</view>
                    </view>
                    <view wx:else>
                        <view class="p coupon_voucher_amount type_large">
                            {{coupon.belongs_to_coupon.discount}}折
                        </view>
                        <view class="p coupon_voucher_limit">满{{coupon.belongs_to_coupon.enough}}立享</view>
                    </view>
                </view>
                <view class="coupon_voucher_hr"></view>
                <view class="coupon_voucher_right">
                    <view class="p coupon_voucher_range">{{coupon.belongs_to_coupon.name}}</view>
                    <view class="p coupon_voucher_period">{{coupon.time_start}}-{{coupon.time_end}}</view>
                </view>
            </view>
        </view>
    </view>
    <view class="coubtngroup">
        <view class="btn sure" bindtap="couponclose">确认</view>
        <view class="btn close" bindtap="couponclose">取消</view>
    </view>
</van-popup>

<!--消费红包-->
<van-popup show="{{ showPacket }}" bind:close="onClickHide">
    <view class="wrapper">
        <view class="block">
            <image catchtap="toPacket" src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/consume_packet.png" />
        </view>
    </view>
</van-popup>