<!--pages/ticketMake/ticketMake.wxml-->
<view class="divide"></view>
<!-- 发票种类 -->
<ticket-cate bindselect="selectCate"></ticket-cate>
<!-- 信息 -->
<view class="formArea noMargin">
	<view class="lineGroup gray">
		<view class="lineInner">
			<view class="label small">发票抬头</view>
			<view class="content">
				<view class="diyInput left">{{buyer.customerName}}</view>
			</view>
		</view>
	</view>
	<view class="lineGroup gray">
		<view class="lineInner">
			<view class="label small">税号</view>
			<view class="content">
				<view class="diyInput left">{{buyer.customerEntTaxId}}</view>
			</view>
		</view>
	</view>
	<view class="lineGroup gray">
		<view class="lineInner">
			<view class="label small">地址和电话</view>
			<view class="content">
				<view class="diyInput left">{{buyer.address}} {{buyer.contactPhone}}</view>
			</view>
		</view>
	</view>
	<view class="lineGroup gray">
		<view class="lineInner">
			<view class="label small">开户行及账号</view>
			<view class="content">
				<view class="diyInput left">{{buyer.bankName}} {{buyer.bankAccountNo}}</view>
			</view>
		</view>
	</view>
		<view class="lineGroup">
		<view class="lineInner">
			<view class="label small">备注说明</view>
			<view class="content">
				<input bindtap="getremark" class="input padding" value="{{buyer.remark}}" type="text" placeholder="请填写备注" placeholder-class="placeholderStyle"></input>
			</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>
</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"></i>
				</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"></input>
				<view class="unit">元</view>
				<!-- <view wx:if="{{!item.price}}" class="diyInput">
					<view wx:if="{{!item.price}}" 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}}"></cart>
				</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"></input>
				<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>
							</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"></i>
				<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"></receive>
<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"></input>
			</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"></input>
			</view>
		</view>
	</view>
</view>
<view class="placeholderBtn"></view>
<customer-bottom>
	<view class="fixedBottom">
		<button bindtap="submitData" class="btn">确定</button>
	</view>
</customer-bottom>