<!-- pages/cashier_pay/cashier_pay.wxml -->
<!-- <import src="../../../wxParse/wxParse.wxml" /> -->
<view class="goodsinfo">
	<view class="cashier">
		<view wx:if="{{!show1}}">
			<view class="header">
				<view class="img">
					<image src="{{store.thumb}}" />
				</view>
				<view class="span">{{store.name}}</view>
			</view>
			<view class="pay">
				<view class="span">付款金额</view>
				<view class="span">
					<text class="i">{{language['money']}}</text>
					{{ payMuch }}
				</view>
			</view>
			<view class="btn">
				<view class="ul btn_box">
					<view class="li line_one">
						<view class="button" catchtap="_handleKeyPress" data-num="1">1</view>
						<view class="button" catchtap="_handleKeyPress" data-num="2">2</view>
						<view class="button" catchtap="_handleKeyPress" data-num="3">3</view>
						<view class="button" catchtap="_handleKeyPress" data-num="D">
							<icon class="iconfont icon-seller-del"></icon>
						</view>
					</view>
					<view class="li btn_bottom">
						<view class="ul line_two_1">
							<view class="li line-left">
								<view class="ul line_box">
									<view class="li line_two">
										<view class="button" catchtap="_handleKeyPress" data-num="4">4</view>
										<view class="button" catchtap="_handleKeyPress" data-num="5">5</view>
										<view class="button" catchtap="_handleKeyPress" data-num="6">6</view>
									</view>
									<view class="li line_three">
										<view class="button" catchtap="_handleKeyPress" data-num="7">7</view>
										<view class="button" catchtap="_handleKeyPress" data-num="8">8</view>
										<view class="button" catchtap="_handleKeyPress" data-num="9">9</view>
									</view>
									<view class="li line_four">
										<view class="button"></view>
										<view class="button" catchtap="_handleKeyPress" data-num="0">0</view>
										<view class="button" catchtap="_handleKeyPress" data-num=".">
											<view class="span">.</view>
										</view>
									</view>
								</view>
							</view>
							<view class="li line-right">
								<view class="button" catchtap="_handleKeyPress" data-num="S">
									<view class="top">优惠</view>
									<view class="bottom">买单</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<block wx:if="{{show1}}">
			<view class="popup start">
				<view class="text_box" wx:if="{{cashier_type != 'scanning_payment'}}">
					<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_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_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>
		<!-- <van-popup custom-style="width:100%;" show="{{show1}}" position="right" overlay="{{false}}" dataList='{{true}}'>
			
		</van-popup> -->
	</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>

</view>