<!--pages/ticketHand/ticketHand.wxml-->
<view class="divide" />
<!-- 发票对象 -->
<ticket-type bindselect="selectObj" />
<!-- 发票种类 -->
<ticket-cate bindselect="selectCate" />
<!-- 征税方式 -->
<ticket-zs bindselect="selectZs" />
<!-- 购方信息 -->
<view class="formArea noMargin">
	<view class="lineGroup">
		<view class="lineInner">
			<view class="label middle">
				<text class="star">*</text>
				发票抬头
			</view>
			<view class="content">
				<input
				 bindinput="getcustomerName"
				 value="{{buyer.customerName}}"
				 maxlength="80"
				 class="input"
				 placeholder="请输入购方名称"
				 placeholder-class="placeholderStyle"
				/>
			</view>
			<button bindtap="toSearch" class="searchBtn">查询</button>
		</view>
	</view>
	<view class="lineGroup">
		<view class="lineInner">
			<view class="label middle">
				<text wx:if="{{customerType===2}}" class="star">*</text>
				税号
			</view>
			<view class="content">
				<input
				 bindinput="getentTaxId"
				 value="{{buyer.entTaxId}}"
				 maxlength="20"
				 class="input"
				 placeholder="请输入税号"
				 placeholder-class="placeholderStyle"
				/>
			</view>
		</view>
	</view>
	<picker
	 bindchange="setPayees"
	 value="{{payeesIndex}}"
	 range="{{payees}}"
	 class="lineGroup"
	>
		<view class="lineInner">
			<view class="label middle">
				<text class="star">*</text>
				收款人
			</view>
			<view class="content">
				<view class="diyInput nopadding left">
					<text wx:if="{{payeesIndex!==''}}">{{payees[payeesIndex]}}</text>
					<text wx:else class="placeholderStyle">请选择收款人</text>
				</view>
			</view>
		</view>
	</picker>
	<view wx:if="{{payeesIndex===0}}" class="lineGroup">
		<view class="lineInner">
			<view class="label middle" />
			<view class="content">
				<input
				 bindinput="getPayees"
				 value="{{payeesText}}"
				 class="input"
				 maxlength="8"
				 placeholder="请输入收款人"
				 placeholder-class="placeholderStyle"
				/>
			</view>
		</view>
	</view>
	<picker
	 bindchange="setReviewers"
	 value="{{reviewersIndex}}"
	 range="{{reviewers}}"
	 class="lineGroup"
	>
		<view class="lineInner">
			<view class="label middle">
				<text class="star">*</text>
				复核人
			</view>
			<view class="content">
				<view class="diyInput nopadding left">
					<text wx:if="{{reviewersIndex!==''}}">{{reviewers[reviewersIndex]}}</text>
					<text wx:else class="placeholderStyle">请选择复核人</text>
				</view>
			</view>
		</view>
	</picker>
	<view wx:if="{{reviewersIndex===0}}" class="lineGroup">
		<view class="lineInner">
			<view class="label middle" />
			<view class="content">
				<input
				 bindinput="getReviewers"
				 value="{{reviewersText}}"
				 class="input"
				 maxlength="8"
				 placeholder="请输入复核人"
				 placeholder-class="placeholderStyle"
				/>
			</view>
		</view>
	</view>
	<picker
	 bindchange="setDrawers"
	 value="{{drawersIndex}}"
	 range="{{drawers}}"
	 class="lineGroup"
	>
		<view class="lineInner">
			<view class="label middle">
				<text class="star">*</text>
				开票人
			</view>
			<view class="content">
				<view class="diyInput nopadding left">
					<text wx:if="{{drawersIndex!==''}}">{{drawers[drawersIndex]}}</text>
					<text wx:else class="placeholderStyle">请选择开票人</text>
				</view>
			</view>
		</view>
	</picker>
	<view wx:if="{{drawersIndex===0}}" class="lineGroup">
		<view class="lineInner">
			<view class="label middle" />
			<view class="content">
				<input
				 bindinput="getDrawers"
				 value="{{drawersText}}"
				 class="input"
				 maxlength="8"
				 placeholder="请输入开票人"
				 placeholder-class="placeholderStyle"
				/>
			</view>
		</view>
	</view>
	<block wx:if="{{spreadFlag}}">

		<view class="lineGroup">
			<view class="lineInner">
				<view class="label middle">电话</view>
				<view class="content">
					<input
					 bindinput="getMobile"
					 value="{{buyer.contactPhone}}"
					 class="input"
					 maxlength="20"
					 placeholder="请输入电话号码"
					 placeholder-class="placeholderStyle"
					/>
				</view>
			</view>
		</view>
		<view class="lineGroup">
			<view class="lineInner">
				<view class="label middle">地址</view>
				<view class="content">
					<input
					 bindinput="getAddress"
					 value="{{buyer.address}}"
					 class="input"
					 maxlength="80"
					 placeholder="请输入地址"
					 placeholder-class="placeholderStyle"
					/>
				</view>
			</view>
		</view>
		<view class="lineGroup">
			<view class="lineInner">
				<view class="label middle">开户银行</view>
				<view class="content">
					<input
					 bindinput="getBankName"
					 value="{{bankName}}"
					 class="input"
					 maxlength="75"
					 placeholder="请输入开户银行"
					 placeholder-class="placeholderStyle"
					/>
				</view>
			</view>
		</view>
		<view class="lineGroup">
			<view class="lineInner">
				<view class="label middle">银行账号</view>
				<view class="content">
					<input
					 bindinput="getBankAccount"
					 value="{{buyer.bankAccount}}"
					 class="input"
					 maxlength="25"
					 placeholder="请输入银行账号"
					 placeholder-class="placeholderStyle"
					/>
				</view>
			</view>
		</view>
		<view class="lineGroup">
			<view class="lineInner">
				<view class="label middle">备注说明</view>
				<view class="content">
					<view class="textareaWrap">
						<textarea
						 bindinput="getremark"
						 value="{{remark}}"
						 class="textarea"
						 maxlength="200"
						 placeholder="请输入备注说明"
						 placeholder-class="placeholderStyle"
						/>
					</view>
				</view>
			</view>
		</view>
	</block>
	<view class="lineSpread">
		<button bindtap="spreadBuyer" class="btn">{{spreadFlag?'收起更多填写项':'展开更多填写项'}}</button>
	</view>
</view>
<!-- 项目明细 -->
<view class="formTitle">
	<text class="label">发票内容</text>
</view>
<view wx:for="{{proList}}" wx:key="productId" class="formArea">
	<view bindtap="toSearchPro" data-index="{{index}}" class="lineGroup">
		<view class="lineInner">
			<view class="label">货物或应税劳务名称</view>
			<view class="content">
				<view class="diyInput hasArrow">
					<view wx:if="{{item.productName}}">{{item.productName}}</view>
					<view wx:if="{{!item.productName}}" class="placeholderStyle">请选择</view>
					<i class="arrow iconfont icon-arrowr" />
				</view>
			</view>
		</view>
	</view>
	<view class="lineGroup">
		<view class="lineInner">
			<view class="label">单价（含税）</view>
			<view class="content ticket {{item.price?'hasUnit':''}}">
				<input
				 bindblur="getPrice"
				 data-index="{{index}}"
				 value="{{item.price}}"
				 class="input right"
				 type="digit"
				 placeholder="请输入单价"
				 placeholder-class="placeholderStyle"
				/>
				<view class="unit">元</view>
				<!-- <view wx:if="{{!item.price}}" class="diyInput">
					<view class="placeholderStyle">根据货物选择自动带入并可修改</view>
				</view> -->
			</view>
		</view>
	</view>
	<view class="lineGroup">
		<view class="lineInner">
			<view class="label">数量</view>
			<view class="content">
				<view class="cart">
					<cart
					 bindadd="add"
					 bindminus="minus"
					 num="{{item.quantity}}"
					 bindsetInput="inputNum"
					 data-index="{{index}}"
					/>
				</view>
			</view>
		</view>
	</view>
	<view class="lineGroup">
		<view class="lineInner">
			<view class="label">金额合计（含税）</view>
			<view class="content ticket hasUnit">
				<input
				 bindblur="getTotalMoney"
				 data-index="{{index}}"
				 value="{{item.totalMoney}}"
				 class="input right"
				 type="digit"
				 placeholder="请输入金额合计（含税）"
				 placeholder-class="placeholderStyle"
				/>
				<view class="unit">元</view>
				<!-- <view class="diyInput">
					<view wx:if="{{item.totalMoney}}">{{item.totalMoney}} 元</view>
					<view wx:if="{{!item.totalMoney}}" class="placeholderStyle">根据货物选择自动计算</view>
				</view> -->
			</view>
		</view>
	</view>
	<block wx:if="{{item.spreadFlag}}">
		<view class="lineGroup">
			<view class="lineInner">
				<view class="label">税率</view>
				<view class="content">
					<view class="diyInput">
						<picker
						 wx:if="{{item.taxRate}}"
						 bindchange="setRate"
						 disabled="{{(!!item.preferentialType||item.zeroRateFlag!==null)?true:false}}"
						 data-index="{{index}}"
						 value="{{item.taxRateArrIndex}}"
						 range="{{item.taxRateArr}}"
						 class="selectRate"
						>
							<view class="lineInner">
								<view class="label" />
							</view>
						</picker>
						<view wx:if="{{item.taxRate}}">{{item.taxRate?item.taxRate*100+'%':0+'%'}}</view>
						<view wx:if="{{!item.taxRate}}" class="placeholderStyle">根据货物选择自动带入可修改</view>
					</view>
				</view>
			</view>
		</view>
		<view class="lineGroup gray">
			<view class="lineInner">
				<view class="label">税额</view>
				<view class="content">
					<view class="diyInput">
						<view wx:if="{{item.totalRate}}">{{item.totalRate}} 元</view>
						<view wx:if="{{!item.totalRate}}" class="placeholderStyle">根据货物选择自动计算</view>
					</view>
				</view>
			</view>
		</view>
	</block>
	<view class="lineSpread">
		<button bindtap="spread" data-index="{{index}}" class="btn">{{item.spreadFlag?'点击收起':'点击展开'}}</button>
		<button
		 wx:if="{{index>0}}"
		 bindtap="delete"
		 data-index="{{index}}"
		 class="btn"
		>删除
		</button>
	</view>
</view>
<view bindtap="addTicket" class="formArea">
	<view class="lineGroup">
		<view class="lineInner">
			<view class="label center">
				<i class="iconfont icon-add1" />
				<text>添加商品</text>
			</view>
		</view>
	</view>
</view>
<view class="formArea noMargin">
	<view class="lineGroup">
		<view class="lineInner">
			<view class="label">发票总金额</view>
			<view class="content">
				<view class="diyInput">{{moneyTotal?'￥'+moneyTotal:0}}</view>
			</view>
		</view>
	</view>
	<view class="lineGroup">
		<view class="lineInner">
			<view class="label">发票总税额</view>
			<view class="content">
				<view class="diyInput">{{rateTotal?'￥'+rateTotal:0}}</view>
			</view>
		</view>
	</view>
</view>
<!-- 接收方式 -->
<view class="formTitle">
	<text class="label">接收方式</text>
</view>
<receive bindselect="selectType" />
<view class="formArea">
	<view wx:if="{{curValue===1}}" class="lineGroup">
		<view class="lineInner">
			<view class="label mr">
				<text class="star">*</text>
				邮箱
			</view>
			<view class="content">
				<input
				 bindinput="getDetail"
				 value="{{interactTypeDetail}}"
				 class="input"
				 maxlength="-1"
				 placeholder="请填写邮箱"
				 placeholder-class="placeholderStyle"
				/>
			</view>
		</view>
	</view>
	<view wx:if="{{curValue===2}}" class="lineGroup">
		<view class="lineInner">
			<view class="label mr">
				<text class="star">*</text>
				手机号码
			</view>
			<view class="content">
				<input
				 bindinput="getDetail"
				 value="{{interactTypeDetail}}"
				 class="input"
				 maxlength="-1"
				 placeholder="请填写手机号码"
				 placeholder-class="placeholderStyle"
				/>
			</view>
		</view>
	</view>
</view>
<view class="placeholderBtn" />
<customer-bottom>
	<view class="fixedBottom">
		<button bindtap="submitData" class="btn">确定</button>
	</view>
</customer-bottom>

