<!--pages/member/supplier/supplier.wxml-->
<view class="income">
	<view class="supplier">
		<view class="banner">
			<!-- <image src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/supplier.png" mode='widthFix' /> -->
			<image src="{{apply_page_banner}}" mode='widthFix'/>
		</view>
		<view class="main" wx:if="{{supplier_status==1 && !isDiyForm}}">
			<view class="welcome">
				<view class="text">
					<view class="p">请填写申请信息</view>
				</view>
				<view class="info">
					<van-field value="{{applyModel.username}}" placeholder="设置账号" border="{{ false }}"
						bind:blur="usernameinp" />
					<van-field type="password" value="{{applyModel.password}}" placeholder="设置密码" border="{{ false }}"
						bind:input="passwordinp" />
					<view class="tips" wx:if="{{pass_safe == 1 && showtips}}">密码至少8-16个字符，至少1个大写字母，1个小写字母和1个数字，其他可以是任意字符
					</view>
					<van-field value="{{applyModel.realname}}" placeholder="请填写真实姓名" border="{{ false }}"
						bind:blur="realnameinp" />
					<van-field type="number" value="{{applyModel.mobile}}" placeholder="请填写手机号码" border="{{ false }}"
						bind:blur="mobileinp" />
					<van-field value="{{applyModel.product}}" placeholder="请填写产品类型" border="{{ false }}"
						bind:blur="productinp" />
					<van-field value="{{fullAddress}}" placeholder="请选择地区" border="{{ false }}" readonly
						catchtap="showCity1btn" />
					<van-field wx:if="{{isShowStreet}}" value="{{applyModel.street_name}}" placeholder="请选择街道" border="{{ false }}" readonly
					catchtap="streetChoose" />
					<van-field type="textarea" value="{{applyModel.remark}}" placeholder="备注" border="{{ false }}"
						bind:blur="remarkinp" autosize />
					<view class='top'  wx:if="{{ is_open_group === '1'}}">
						<!-- 下拉框 -->
						<view class='top-selected' bindtap='bindGrouping'>
							<text>{{grouping_name}}</text>
							<!-- <image src=''></image> -->
							<van-icon name="arrow" wx:if="{{ !select }}" class="van_icon" />
							<van-icon name="arrow-down" wx:if="{{select}}" class="van_icon" />
						</view>
						<!-- 下拉需要显示的列表 -->
						<view class="select_box" wx:if="{{select}}">
							<view wx:for="{{grouping}}" wx:key="unique">
								<view class="select_one" bindtap="selectGrouping" data-dataList="{{item}}">{{item.title}}</view>
							</view>
						</view>
					</view>
					<view class='top'  wx:if="{{ is_open_category === '1'}}">
						<!-- 下拉框 -->
						<view class='top-selected' bindtap='bindIndustry'>
							<text>{{industry_name}}</text>
							<!-- <image src=''></image> -->
							<van-icon name="arrow" wx:if="{{ !select_ind }}" class="van_icon" />
							<van-icon name="arrow-down" wx:if="{{select_ind}}" class="van_icon" />
						</view>
						<!-- 下拉需要显示的列表 -->
						<view class="select_box" wx:if="{{select_ind}}">
							<view wx:for="{{industry}}" wx:key="unique">
								<view class="select_one" bindtap="selectIndustry" data-dataList="{{item}}">{{item.title}}</view>
							</view>
						</view>
					</view>
					<view class="up_license" wx:if="{{group_list.up_aptitude === 1}}">上传营业执照<view class="start">*</view></view>
					<view class="imgflex" wx:if="{{!comment.worker_level}}" wx:if="{{group_list.up_aptitude === 1}}">
						<view wx:for="{{applyModel.aptitude}}" wx:for-item="val" wx:key="index">
							<view class="photobox">
								<image src="{{val}}" style="width: 100%;height:100%;object-fit: contain;" class="image_licence"></image>
								<van-icon class="icon_del" wx:if="{{true}}" name="cross" bindtap="del" data-index="{{index}}"/>
							</view>
						</view>
						<view bindtap="bindUpImage"
							style="width:200rpx;height:200rpx; border: 1rpx dashed #c0ccda;display:flex;align-items:center;justify-content:center;margin:0 0 20rpx 10rpx">
							<van-icon name="plus" />
						</view>
					</view>

					<block wx:if="{{is_identity}}">
						<view class="inputWrapper fileWrapper">
							<view class="c1">
								<text class="required">*</text>
								<text class="desc">身份证人像面</text>
							</view>
							<view class="staImg" data-index="2" catchtap='upIdCard'>
								<image class="" src="{{imagefile2 ? imagefile2 : 'https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/bg_idcard_up@2x.png'}}"></image>
							</view>
						</view>

						<view class="inputWrapper fileWrapper">
							<view class="c1">
								<text class="required">*</text>
								<text class="desc">身份证国徽面</text>
							</view>
							<view class="staImg" data-index="1" catchtap='upIdCard'>
								<image class="" src="{{imagefile1 ? imagefile1 : 'https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/bg_idcard_down@2x.png'}}"></image>
							</view>
						</view>

					</block>
					
					<view class="button" catchtap="setApplyData">申请</view>
					<view class="agreement">
						<van-checkbox value="{{ agreement }}" checked-color="#f55955" icon-size="55rpx"
							bind:change="changeAgreement">
							<text catchtap="setExplainFlag">阅读并同意《供应商协议》</text>
						</van-checkbox>
					</view>
				</view>
			</view>
			<view class="vip_main" wx:if="{{supplier_info}}">
				<view class="title">供应商说明</view>
				<view class="vip">
					<view class="text">
						<view class="t1">{{supplier_info}}</view>
					</view>
				</view>
			</view>
		</view>
		<view class="main" wx:if="{{supplier_status==2 && isDiyForm}}">
			<view class="h1">请填写申请信息</view>
			<block wx:for="{{diydata}}" wx:for-index="idx" wx:key="{{idx}}">
				<view wx:if="{{item.type == 'diyinput'}}">
					<van-field wx:if="{{item.data.tp_must == 1}}" required value="{{item.value}}"
						label="{{item.data.tp_name}}：" placeholder="{{item.data.placeholder}}" bind:blur="tpnameinp"
						data-idex="{{idx}}" />
					<van-field wx:if="{{item.data.tp_must == 0}}" value="{{item.value}}" label="{{item.data.tp_name}}"
						placeholder="{{item.data.placeholder}}" bind:blur="tpnameinp" data-idex="{{idx}}" />
				</view>
				<view class="image-list" wx:if="{{item.type == 'diyimage'}}">
					<view class="otherphoto section">
						<view class="top">
							<view class="span">{{item.data.tp_name}}</view>
						</view>
						<view class="imgflex">
							<block wx:for-item="val" wx:for-index="index_1" wx:key="{{index_1}}"
								wx:for="{{item.imgUrls}}">
								<view class="photobox">
									<image src="{{val}}" mode='widthFix' data-src="{{val}}"
										data-src-list="{{item.imgUrls}}" bindtap='previewImage' />
									<view class="i" data-index="{{idx}}" data-indexc="{{index_1}}" catchtap="removeImg">
									</view>
								</view>
							</block>
							<view class="photoshow" data-name="{{item.name}}" catchtap="onRead_1">
								<image src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/up_icon.png" mode='widthFix' />
							</view>
						</view>
					</view>
				</view>
				<block wx:if="{{item.type == 'diytextarea'}}">
					<view class="cell_box">
						<view class="title">
							{{item.data.tp_name}}
						</view>
						<van-cell-group>
							<van-field type="textarea" value="{{item.value}}" placeholder="{{item.data.placeholder}}"
								border="{{false}}" maxlength="{{100}}" data-idex="{{idx}}" bind:blur="diytextareainp" />
						</van-cell-group>
					</view>
				</block>
				<block wx:if="{{item.type == 'diycheckbox'}}">
					<view class="cell_box">
						<view class="title">
							{{item.data.tp_name}}
						</view>
						<van-cell-group>
							<van-checkbox-group wx:for="{{item.data.tp_text}}" wx:key="index" wx:for-item="ck"
								value="{{item.value}}" data-idex="{{idx}}" bind:change="checkboxinp">
								<van-checkbox name="{{ck}}">{{ck}}</van-checkbox>
							</van-checkbox-group>
						</van-cell-group>
					</view>
				</block>
				<block wx:if="{{item.type == 'diyselect'}}">
					<van-cell-group>
						<van-cell title="请选择{{item.data.tp_name}}" data-index="{{index}}" is-link
							bind:click="diyselectBtn" data-idex="{{idx}}" value="{{diydata[idx].value}}"/>
					</van-cell-group>
				</block>
				<block wx:if="{{item.type == 'diyradio'}}">
					<view class="cell_box">
						<view class="title">
							{{item.data.tp_name}}
						</view>
						<van-cell-group>
							<van-radio-group wx:for="{{item.data.tp_text}}" wx:for-item="ritem" value="{{item.value}}"
								wx:for-index="index_radio" wx:key="{{index_radio}}" data-idex="{{idx}}"
								bind:change="raidinp">
								<van-radio name="{{ritem}}">{{ritem}}</van-radio>
							</van-radio-group>
						</van-cell-group>
					</view>
				</block>
				<block wx:if="{{item.type == 'diycity'}}">
					<van-cell-group>
						<van-cell title="{{item.data.tp_name}}：" data-idex="{{idx}}" bind:click="showAddBtn"
							value="{{item.value}}" is-link />
					</van-cell-group>
				</block>
				<block wx:if="{{item.type == 'diydate'}}">
					<van-cell-group>
						<van-cell bind:click="openPicker" data-idex="{{idx}}" title="{{item.data.tp_name}}"
							value="{{shoTime?shoTime:item.shoTime}}" is-link />
					</van-cell-group>
				</block>
				<block wx:if="{{item.type == 'diyusername'}}">
					<van-field wx:if="{{item.data.tp_must == 1}}" required value="{{item.value}}"
						label="{{item.data.tp_name}}：" placeholder="{{item.data.placeholder}}" data-idex="{{idx}}"
						bind:blur="tpnameinp" />
					<van-field wx:if="{{item.data.tp_must == 0}}" value="{{item.value}}" label="{{item.data.tp_name}}："
						placeholder="{{item.data.placeholder}}" data-idex="{{idx}}" bind:blur="tpnameinp" />
				</block>
				<block wx:if="{{item.type == 'diypassword'}}">
					<van-field type="password" wx:if="{{item.data.tp_must == 1}}" required value="{{item.value}}"
						label="{{item.data.tp_name}}：" placeholder="{{item.data.placeholder}}" data-idex="{{idx}}"
						bind:blur="tpnameinp" />
					<van-field type="password" wx:if="{{item.data.tp_must == 0}}" value="{{item.value}}"
						label="{{item.data.tp_name}}：" placeholder="{{item.data.placeholder}}" data-idex="{{idx}}"
						bind:blur="tpnameinp" />
				</block>
			</block>
			<view class="btn">
				<view class="button" catchtap="submit">提交申请</view>
			</view>
			<view class="agreement">
				<van-checkbox value="{{ agreement }}" checked-color="#f55955" icon-size="55rpx"
					bind:change="changeAgreement">
					<text catchtap="setExplainFlag">阅读并同意《供应商协议》</text>
				</van-checkbox>
			</view>
			<view class="vip_main" wx:if="{{supplier_info}}">
				<view class="title">供应商说明</view>
				<view class="vip">
					<view class="text">
						<view class="t1">{{supplier_info}}</view>
					</view>
				</view>
			</view>
		</view>
		<view class="success" wx:if="{{supplier_status==0}}">
			<view class="ico">
				<van-icon name="passed" color="#32cd32" size="140rpx" />
			</view>
			<view class="text">您的申请已经提交，请等待审核！</view>
			<view class="gohome" catchtap="goHome">
				<view class="sub">去商城逛逛</view>
			</view>
		</view>
		<view class="success" wx:if="{{supplier_status==-1}}">
			<view class="ico">
				<van-icon name="passed" color="#32cd32" size="140rpx" />
			</view>
			<view class="text">您已通过审核</view>
			<view catchtap="goHome" class="gohome">
				<view class="sub">去商城逛逛</view>
			</view>
		</view>
	</view>
</view>

<van-popup show="{{ explainFlag }}" custom-style="background:transparent;">
	<view class="explainWrapper">
		<view class="explainTextWrapper">
			<view class="explainTextTitle">协议说明</view>
			<view class="explainTextContent">
				<rich-text nodes="{{agreementText}}"></rich-text>
			</view>
		</view>
		<icon bindtap="setExplainFlag" class="close iconfont icon-adsystem_icon_cancle"></icon>
	</view>
</van-popup>

<block wx:for="{{diydata}}" wx:key="index">
	<block wx:if="{{item.type == 'diyselect'}}">
		<van-action-sheet show="{{item.diysishow}}" data-index="{{index}}" actions="{{item.sitem}}"
			bind:close="sitemClose" bind:select="sitemSelectBtn" data-idex="{{index}}" cancel-text="取消"
			bind:cancel="sitemClose" />
	</block>
</block>
<block wx:for="{{diydata}}" wx:key="index">
	<block wx:if="{{item.type == 'diycity'}}">
		<view class="b-mask {{item.showAdd}}" data-idex="{{index}}" bindtap="_closeDateLw"></view>
		<view class="dateBe {{item.showAdd}}">
			<view class="head">
				<view class="ll" data-idex="{{index}}" bindtap="_closeDateLw">取消</view>
				<view class="rr" data-idex="{{index}}" bindtap="resultAdd">确定</view>
			</view>
			<view class="main">
				<picker-view indicator-style="height: 50px;" style="width: 100%; height: 300px;"
					value="{{[pickerValue[0],pickerValue[1],pickerValue[2]]}}" bindchange="bindChange">
					<picker-view-column id="provinceData">
						<view wx:for="{{provinceData}}" wx:for-index="pidx" wx:key="{{pidx}}" style="line-height: 50px">
							{{item.areaname}}</view>
					</picker-view-column>
					<picker-view-column id="cityData">
						<view wx:for="{{cityData}}" wx:for-index="pidx" wx:key="{{pidx}}" style="line-height: 50px">
							{{item.areaname}}</view>
					</picker-view-column>
					<picker-view-column id="districtData">
						<view wx:for="{{districtData}}" wx:for-index="pidx" wx:key="{{pidx}}" style="line-height: 50px">
							{{item.areaname}}</view>
					</picker-view-column>
				</picker-view>
			</view>
		</view>
	</block>
</block>
<block wx:for="{{diydata}}" wx:key="index">
	<block wx:if="{{item.type == 'diydate'}}">
		<van-popup position="bottom" show="{{item.timeShow}}" data-idex="{{index}}" bind:close="dateClose">
			<van-datetime-picker type="date" value="{{currentDate}}" data-idex="{{index}}" bind:cancel="dateClose"
				bind:confirm="birthdayconfirm" min-date="{{startDate}}" />
		</van-popup>
	</block>
</block>
<view class="b-mask {{showCity1}}" bindtap="_closeDateLw_1"></view>
<view class="dateBe {{showCity1}}">
	<view class="head">
		<view class="ll" bindtap="_closeDateLw_1">取消</view>
		<view class="rr" bindtap="resultAdd_1">确定</view>
	</view>
	<view class="main">
		<picker-view indicator-style="height: 50px;" style="width: 100%; height: 300px;"
			value="{{[pickerValue[0],pickerValue[1],pickerValue[2]]}}" bindchange="bindChange">
			<picker-view-column id="provinceData">
				<view wx:for="{{provinceData}}" wx:for-index="pidx" wx:key="{{pidx}}" style="line-height: 50px">
					{{item.areaname}}</view>
			</picker-view-column>
			<picker-view-column id="cityData">
				<view wx:for="{{cityData}}" wx:for-index="pidx" wx:key="{{pidx}}" style="line-height: 50px">
					{{item.areaname}}</view>
			</picker-view-column>
			<picker-view-column id="districtData">
				<view wx:for="{{districtData}}" wx:for-index="pidx" wx:key="{{pidx}}" style="line-height: 50px">
					{{item.areaname}}</view>
			</picker-view-column>
		</picker-view>
	</view>
</view>

<!-- 街道选择 -->
<van-popup custom-style="width:100%;height:100%;overflow:auto" show="{{streetShow}}" position="right" overlay="{{false}}">
	<view class="streetContent">
		<van-nav-bar title="选择街道" left-text="" right-text="" left-arrow bind:click-left="streetClose" />
		<van-cell-group>
			<van-cell wx:for="{{districtVal}}" wx:key="index" title="{{item.areaname}}" data-strname="{{item.areaname}}" is-link bindtap="streetConfirm" />
		</van-cell-group>
	</view>
</van-popup>