<{import file="common.html" title="提现申请"}>
<style type="text/css">
body{ background:#f8f8f8; } 
.addCon{ width:100%; background:#fff; margin:0 0 0.2rem 0; float:left; }
table.etable{ margin:0; }
table.etable tr td{ border-bottom:1px solid #efefef; }
table.etable tr td:first-child{ text-align:left; padding-left:10px; font-size:0.3rem; color:#333; }
table.etable tr td em{ font-style:inherit; padding:10px 0 0 10px; color:#FF0000; float:left;}
table.etable tr td input[type=text]{ width:100%; border:none; padding:10px 0; font-size:0.3rem; color:#888; float:left;} 
.remark{ width:100%; padding:0.2rem; box-sizing: border-box; background:#efefef; float:left; }
.remark span{ color:#888; font-size:0.23rem; float:left; }
</style> 
<body>
<div class="cnav">
	<a class="back" href="<{$__WAP__}>account/withdraw">&nbsp;</a>
	编辑地址
	<a href="javascript:;" class="thome">主页</a>
</div> 
<{uqcms m="account" v="row" c="withdraw_one:id=smarty.get.id"}>
<div class="addCon">
	<{if $smarty.get.id}><input type="hidden" name="id" value="<{$smarty.get.id}>"/><{/if}>
	<{if $row.pay_status == '1'}>
		<div class="remark"><span>提现订单已经交易完成</span></div>
	<{elseif $row.pay_status == '2'}>
		<div class="remark"><span>当前申请被驳回,驳回原因：<{$row.refuse_reason}></span></div>
	<{elseif $row.pay_status == '0'}>
		<div class="remark"><span>已经申请提交</span></div>
	<{/if}> 
	<div id="ptype_id"></div>
	<table width="100%" class="etable"> 
		<tr>
			<td style="width:1.5rem;">提现方式</td>
			<td>
				<select name="pay_type" id="pay_type">
					<option value="0">--请选择--</option>
					<{uqcms m="api" v="bank" c="bank"}>
					<{if $bank}>
						<{foreach item=i from=$bank}>
							<option value="<{$i.id}>" data-desc="<{$i.desc}>"<{if $row.pay_type == $i.id}> selected="selected"<{/if}>><{$i.name}></option>
						<{/foreach}>
					<{/if}>
				</select> 
			</td>
		</tr> 
		<tr>
			<td>提现金额</td>
			<td><input type="text" name="price" placeholder="提现的金额" value="<{$row.price}>" id="price"/></td>
		</tr>
		<tr>
			<td>个人账户</td>
			<td><input type="text" name="pay_account" placeholder="收款人的账号" value="<{$row.pay_account}>" id="pay_account"/></td>
		</tr> 
		<tr>
			<td>个人姓名</td>
			<td><input type="text" name="pay_name" placeholder="收款人的姓名" value="<{$row.pay_name}>" id="pay_name"/></td>
		</tr> 
		<tr>
			<td>备注信息</td>
			<td><input type="text" name="pay_remark" placeholder="备注" value="<{$row.pay_remark}>" id="pay_remark"/></td>
		</tr> 
	</table>
</div>
<div class="sbutton"><input type="submit" id="submit"  name="is_default" class="submit" value="申请提现"/></div> 
<{include file="default/footer.html"}> 
<script type="text/javascript">
$(function(){
	$("#pay_type").change(function(){
		pay_type = $(this).val(); 
		pay_type_desc = $(this).find("option:selected").attr('data-desc'); 
		if(pay_type == '0'){
			$("#ptype_id").html('');
		}else{ 
			$("#ptype_id").html('<div class="remark"><span>'+pay_type_desc+'</span></div>');
		} 
	});
	
	$(".submit").click(function(){
		pay_type = $("#pay_type option:selected").val(); 
		pay_name = $("#pay_name").val();
		pay_account = $("#pay_account").val();
		pay_remark = $("#pay_remark").val(); 
		price = $("#price").val();
		$.post(URI+'account/withdraw_apply_save', {<{if $smarty.get.id}>id:<{$smarty.get.id}>, <{/if}>price:price, pay_type:pay_type, pay_name:pay_name, pay_account:pay_account, pay_remark:pay_remark}, function(result){ 
			data = jQuery.parseJSON(result);
			if(data.error == '0'){
				alert('申请成功'); 
				location.href=WAP+"account/withdraw";
			}else{
				alert(data.msg);
			} 
		}); 
	}); 
	
}); 
</script>