<!--pages/ticketQuery/ticketQuery.wxml-->
<view class="tabBar shadow">
	<view bindtap="switchTab" data-index="{{0}}" class="tabItem {{tabIndex===0?'active':''}}">发票申领
	</view>
	<view bindtap="switchTab" data-index="{{1}}" class="tabItem {{tabIndex===1?'active':''}}">发票分发
	</view>
</view>
<block wx:if="{{tabIndex===0}}">
	<view class="formTitle" style="margin-top: 88rpx">申领发票信息</view>
	<view class="formArea noMargin">
		<picker bindchange="setStart" mode="date" class="lineGroup">
			<view class="lineInner">
				<view class="label">开始时间</view>
				<view class="content">
					<view class="diyInput hasArrow">
						<text wx:if="{{invoiceDateBegin!==''}}">{{invoiceDateBegin}}</text>
						<text wx:if="{{invoiceDateBegin===''}}" class="placeholderStyle">请选择</text>
					</view>
					<i class="iconfont icon-arrowr arrow" />
				</view>
			</view>
		</picker>
		<picker bindchange="setEnd" mode="date" class="lineGroup">
			<view class="lineInner">
				<view class="label">结束时间</view>
				<view class="content">
					<view class="diyInput hasArrow">
						<text wx:if="{{invoiceDateEnd!==''}}">{{invoiceDateEnd}}</text>
						<text wx:if="{{invoiceDateEnd===''}}" class="placeholderStyle">请选择</text>
					</view>
					<i class="iconfont icon-arrowr arrow" />
				</view>
			</view>
		</picker>
		<picker
		 bindchange="setInvoiceType"
		 value="{{invoiceTypeIndex}}"
		 range="{{invoiceType}}"
		 class="lineGroup"
		>
			<view class="lineInner">
				<view class="label">发票类型</view>
				<view class="content">
					<view class="diyInput hasArrow">
						<text wx:if="{{invoiceTypeIndex!==''}}">{{invoiceType[invoiceTypeIndex]}}</text>
						<text wx:if="{{invoiceTypeIndex===''}}" class="placeholderStyle">请选择</text>
					</view>
					<i class="iconfont icon-arrowr arrow" />
				</view>
			</view>
		</picker>
		<picker
		 bindchange="setInvoiceHandType"
		 value="{{handleStatusTypeIndex}}"
		 range="{{handleStatusType}}"
		 class="lineGroup"
		>
			<view class="lineInner">
				<view class="label">申领状态</view>
				<view class="content">
					<view class="diyInput hasArrow">
						<text wx:if="{{handleStatusTypeIndex!==''}}">{{handleStatusType[handleStatusTypeIndex]}}</text>
						<text wx:if="{{handleStatusTypeIndex===''}}" class="placeholderStyle">请选择</text>
					</view>
					<i class="iconfont icon-arrowr arrow" />
				</view>
			</view>
		</picker>
	</view>
	<view class="topPlaceholder" />
	<view class="list">
		<view
		 bindtap="toDetail"
		 data-index="{{index}}"
		 data-hongchong="{{item.hongchongFlag}}"
		 wx:for="{{list}}"
		 wx:key="recordId"
		 class="item shadow"
		>
			<view class="name">发票类别：{{item.invoiceCateName}}</view>
			<view class="line">申领份数：{{item.applyNum}}</view>
			<view class="line">申领时间：{{item.applyDate}}</view>
			<view class="line">处理时间：{{item.handleDate}}</view>
			<view wx:if="{{item.handleStatus==='0'}}" class="line">处理状态：申领中</view>
			<view wx:if="{{item.handleStatus==='1'}}" class="line">处理状态：成功</view>
			<view wx:if="{{item.handleStatus==='2'}}" class="line">处理状态：失败</view>
			<view class="line">处理信息：{{item.handleInformation}}</view>
			<view class="btnGroup">
				<button
				 wx:if="{{item.handleStatus === '1' && item.resultEnterFlag === 'N'}}"
				 catchtap="refresh"
				 data-invoiceno="{{item.invoiceReqFlowNo}}"
				 data-index="{{index}}"
				 class="btn ticket"
				>申领确认
				</button>
				<button
				 wx:if="{{item.handleStatus === '0'}}"
				 catchtap="showRetry"
				 data-invoiceno="{{item.invoiceReqFlowNo}}"
				 data-index="{{index}}"
				 class="btn ticket"
				>申领撤销
				</button>
			</view>
		</view>
	</view>
	<loadmore loadmore="{{pages>0&&finish===false}}" finish="{{pages>0&&finish===true}}" nodata="{{pages===0}}" />
	<view class="paddingBottom" />
	<ipx-placeholder/>
	<customer-bottom>
		<view class="btnGroup shadow">
			<button bindtap="applyInvoice" class="btn get">申领</button>
		</view>
	</customer-bottom>
</block>
<block wx:if="{{tabIndex===1}}">
	<view class="formArea noMargin" style="margin-top: 88rpx">
		<picker
		 bindchange="setDistributeInvoiceType"
		 value="{{distributeInvoiceTypeIndex}}"
		 range="{{invoiceType}}"
		 class="lineGroup"
		>
			<view class="lineInner">
				<view class="label">发票类型</view>
				<view class="content">
					<view class="diyInput hasArrow">
						<text wx:if="{{distributeInvoiceTypeIndex!==''}}">{{invoiceType[distributeInvoiceTypeIndex]}}</text>
						<text wx:if="{{distributeInvoiceTypeIndex===''}}" class="placeholderStyle">请选择</text>
					</view>
					<i class="iconfont icon-arrowr arrow" />
				</view>
			</view>
		</picker>
		<picker
		 bindchange="setDistribute"
		 value="{{distributeIndex}}"
		 range="{{distribute}}"
		 class="lineGroup"
		>
			<view class="lineInner">
				<view class="label">分发状态</view>
				<view class="content">
					<view class="diyInput hasArrow">
						<text wx:if="{{distributeIndex!==''}}">{{distribute[distributeIndex]}}</text>
						<text wx:if="{{distributeIndex===''}}" class="placeholderStyle">请选择</text>
					</view>
					<i class="iconfont icon-arrowr arrow" />
				</view>
			</view>
		</picker>
	</view>
	<view class="list" style="margin-top: 10rpx">
		<view class="list">
			<view
			 bindtap="toDetail"
			 data-index="{{index}}"
			 wx:for="{{distributeList}}"
			 wx:key="recordId"
			 class="item shadow"
			>
				<view class="name">发票类别：{{item.invoiceCateName}}</view>
				<view class="line">发票类别：{{item.invoiceCateCode}}</view>
				<view class="line">发票代码：{{item.invoiceCode}}</view>
				<view class="line">起始号码：{{item.invoiceBeginNo}}</view>
				<view class="line">终止号码：{{item.invoiceEndNo}}</view>
				<view class="line">份数：{{item.surplusNum}}</view>
				<view class="line">领购日期：{{item.invoicePurchaseDate}}</view>
				<view class="btnGroup">
					<button catchtap="setDistribute" class="btn ticket">发票分发
					</button>
				</view>
			</view>
		</view>
	</view>
	<loadmore loadmore="{{pagesTotal>0&&distributeFinish===false}}" finish="{{pagesTotal>0&&distributeFinish===true}}" nodata="{{pagesTotal===0}}" />
</block>

