<form action="predeposit.manage.php" method="post" id="form1" name="form1">
<input type="hidden" name="action" id="action" />
<input type="hidden" name="predeposit_r_id" id="predeposit_r_id" value="<tpl> $record_array.predeposit_r_id </tpl>" />

<table width="680" class="from_table2">
  <tr>
	  <th colspan="2"  align="left">　<strong><tpl> $langPreSearchMemberName </tpl>：</strong><tpl> $member_array.login_name </tpl></th>
	  <input type="hidden" name="member_id" id="member_id" value="<tpl> $member_array.member_id </tpl>" />
  </tr>
  <tr>
	  <th colspan="2" align="left">　<strong><tpl> $langPrePayInfo </tpl>：</strong></th>
      <th align="left">&nbsp;</th>
  </tr>
  <tr><th width="100"></th>
	  <td width="30%"><tpl> $langPrePayment </tpl>：
	  		<tpl> if $record_array.payment_type eq '1' </tpl><!-- 线下 -->
		  		<tpl> $langPreCashTypeOffline </tpl>
			  <tpl> else </tpl>
				<tpl> if $record_array.payment eq 'alipay' </tpl>
					<tpl> $langPreCashTypeAlipay </tpl>
				<tpl> /if </tpl>
				<tpl> if $record_array.payment eq 'tenpay' </tpl>
					<tpl> $langPreCashTypeTenpay </tpl>
				<tpl> /if </tpl>
			  <tpl> /if </tpl>	  </td>
	  <td width="30%"><tpl> $langPreCashCreateTime </tpl>：<tpl> $record_array.create_time </tpl></td>
	  <tpl> assign var=one value=$record_array.record_state </tpl>
	  <td width="30%"><tpl> $langPreState </tpl>：<tpl> $predeposit_record_state[$one] </tpl></td>
  </tr>
  <tpl> if $record_array.payment_type eq '1' </tpl><!-- 线下支付 -->
  <tr>
	  <th colspan="2" align="left">　<strong>
      <tpl> $langPreReceptInfo </tpl>：</strong></th>
      <td width="30%" align="left">&nbsp;</td>
  </tr>
  <tr><th width="100"></th>
	  <td width="30%"><tpl> $langPreReceptPayName </tpl>：<tpl> $record_array.pay_name </tpl></td>
	  <td width="30%"><tpl> $langPreReceptPayAccount </tpl>：<tpl> $record_array.pay_account </tpl></td>
	  <td width="30%"><tpl> $langPreReceptPayConsignee </tpl>：<tpl> $record_array.pay_consignee </tpl></td>
  </tr>
  <tr>
	  <th colspan="2" align="left">　<strong>
	    <tpl> $langPreSenderInfo </tpl>
      ：</strong></th>
      <td width="30%" align="left">&nbsp;</td>
  </tr>
  <tr><th width="100"></th>
	  <td width="30%"><tpl> $langPreSenderName </tpl>：<tpl> $record_array.sender_name </tpl></td>
	  <td width="30%"><tpl> $langPreSenderBank </tpl>：<tpl> $record_array.sender_bank </tpl></td>
	  <td width="30%"><tpl> $langPreSenderAmount </tpl>：<tpl> $record_array.sender_amount </tpl></td>
  </tr>
  <tr><th width="100"></th>
	  <td width="30%"><tpl> $langPreSenderDate </tpl>：<tpl> $record_array.sender_date </tpl></td>
	  <td width="30%"><tpl> $langPreSenderRemark </tpl>：<tpl> $record_array.sender_remark </tpl></td>
      <td width="30%"></td>
  </tr>
  <tpl> else </tpl>
  <tr>
	  <th colspan="2" align="left">　<strong>
      <tpl> $langPreSenderInfo </tpl>：</strong></th>
      <td width="30%" align="left">&nbsp;</td>
  </tr>
  <tr><th width="100"></th>
	  <td width="30%"><tpl> $langPrePayAmount </tpl>：<tpl> $record_array.online_amount </tpl></td>
	  <td width="30%"></td>
      <td width="30%"></td>
  </tr>
  <tpl> /if </tpl>
</table>
<tpl> if $record_array.record_state eq '0' </tpl>
<table width="680" class="from_table2">
  <tr>
	  <td colspan="2" align="left">　<strong><tpl> $langPreSystemOperate </tpl>：</strong></td>
    </tr>
  <tr >
  <tpl> if $record_array.payment_type eq '1' </tpl><!-- 线下支付 -->
	  <td align="center">
	  <span class="btn_left"><input type="button" value="<tpl> $langPreOperateMember </tpl>" name="set_member" id="set_member" class="btn_submit" onclick="$('#table_set_member').css('display','');$('#table_close_record').css('display','none');$('#action').val('set_member');" /></span>										
	  </td>
  <tpl> /if </tpl>
	  <td align="center">
	  	<span class="btn_left"><input type="button" name="return"  class="btn_submit"id="return" value="<tpl> $langPreReturn </tpl>" onclick="ShowDiv = 'result_content';getPageContent('predeposit.manage.php?action=pay_record_list');" /></span>	  <span class="btn_left"><input type="button" name="close_record" class="btn_submit" id="close_record" value="<tpl> $langPreCloseRecord </tpl>" onclick="$('#table_set_member').css('display','none');$('#table_close_record').css('display','');$('#action').val('close_record');" /></span></td>
    </tr>
</table>
<tpl> else </tpl>
<table width="680" class="from_table2">
  <tr><th width="83"></th>
	  <td width="585" colspan="3"><span class="btn_left">
      <input type="button" name="return" id="return"  class="btn_submit"value="<tpl> $langPreReturn </tpl>" onclick="ShowDiv = 'result_content';getPageContent('predeposit.manage.php?action=pay_record_list');" /></span></td>
  </tr>
</table>
<tpl> /if </tpl>
<table  width="680" class="from_table2"id="table_set_member" style="display:none">
  <tr>
	  <td><tpl> $langPreMemberChangeReason </tpl>：</td>
	  <td><textarea name="txt_system_remark" id="txt_system_remark" style="height:100px;" cols="60" rows="6"></textarea>
	  <label style="display:none" for="txt_system_remark" class="wrong" metaDone="true" generated="true"></label>
	  </td>
  </tr>
  <tr>
	  <td><tpl> $langPreMemberAvailable </tpl>：</td>
	  <td>
	  	<select name="available_type" id="available_type">
			<option value="0" selected="selected"><tpl> $langPreUp </tpl></option>
			<!--<option value="1"><tpl> $langPreDown </tpl></option>-->
		</select>
		<input type="text" name="txt_available_amount" id="txt_available_amount" value="<tpl> $record_array.sender_amount </tpl>" /><tpl> $langPrePredepositNow </tpl><tpl> $member_array.available_predeposit </tpl>
		<input type="hidden" name="available_amount" id="available_amount" value="<tpl> $member_array.available_predeposit </tpl>" />
		<label style="display:none" for="txt_available_amount" class="wrong" metaDone="true" generated="true"></label>
	  </td>
  </tr>
  <!--<tr>
	  <td><tpl> $langPreMemberFreeze </tpl>：</td>
	  <td>
	  	<select name="freeze_type" id="freeze_type">
			<option value="0" selected="selected"><tpl> $langPreUp </tpl></option>
			<option value="1"><tpl> $langPreDown </tpl></option>
		</select>
		<input type="text" name="txt_freeze_amount" id="txt_freeze_amount" value="0" /><tpl> $langPrePredepositNow </tpl><tpl> $member_array.freeze_predeposit </tpl>
		<input type="hidden" name="freeze_amount" id="freeze_amount" value="<tpl> $member_array.freeze_predeposit </tpl>" />
		<label style="display:none" for="txt_freeze_amount" class="wrong" metaDone="true" generated="true"></label>
	  </td>
  </tr>-->
  <tr>
	  <td colspan="2">
	  	<input type="submit" value="<tpl> $langPreSubmit </tpl>" />
		<input type="reset" value="<tpl> $langPreReset </tpl>" />
	  </td>
  </tr>
</table>
<table  width="680" class="from_table2" id="table_close_record" style="display:none">
  <tr>
	  <td><tpl> $langPreCloseReason </tpl>：</td>
	  <td><textarea name="txt_close_remark" id="txt_close_remark" style="height:100px;" cols="60" rows="6"></textarea>
	  <label style="display:none" for="txt_close_remark" class="wrong" metaDone="true" generated="true"></label>
	  </td>
  </tr>
  <tr>
	  <td colspan="2">
	  	<input type="submit" value="<tpl> $langPreSubmit </tpl>" />
		<input type="reset" value="<tpl> $langPreReset </tpl>" />
	  </td>
  </tr>
</table>
</form>
<div id="question" style="display:none; cursor: default; padding:10px"> 
        <b style=" font-size:14px; margin-top:10px; line-height:50px; height:50px;padding-top:10px; padding-bottom:10px"><tpl> $langPreCloseRemark </tpl></b> <br />
        <input type="button" id="yes" value="<tpl> $langPreYes </tpl>"  style=" border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/> 
        <input type="button" id="no" value="<tpl> $langPreNo </tpl>"  style="border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/>
</div> 
<script>
$(document).ready(function() {
	var question = $('#question')[0];
	$('#yes').click(function() {
		$.unblockUI();
		$('#form1').ajaxSubmit(options);
		return false;
	});
	$('#no').click($.unblockUI);
	
	//验证
	var options = {
		beforeSubmit:  function(){showLoading(showText);},
		success:       function(msg){
							hideLoading();
							showMessage(msg.message,msg.type);
							if(msg.type == '1'){
								ST(0,0);
								ShowDiv = 'result_content';
								getPageContent('predeposit.manage.php?action=pay_record_list');
							}
						},
		type:      'post',
		dataType:  'json'
	};
	
	$("#form1").validate({
		errorClass: "wrong",
		rules: {
			txt_system_remark: {required:function(){if($('#action').val()=='set_member'){return true;}else{return false;}}},
			txt_available_amount: {required:function(){if($('#action').val()=='set_member'){return true;}else{return false;}},number:true},
			txt_freeze_amount: {required:function(){if($('#action').val()=='set_member'){return true;}else{return false;}},number:true},
			txt_close_remark: {required:function(){if($('#action').val()=='close_record'){return true;}else{return false;}}}
		},
		messages: {
			txt_system_remark: {required:"<tpl> $langPreMemberChangeReasonIsEmpty </tpl>"},
			txt_available_amount: {required:"<tpl> $langPreAvailableIsNumber </tpl>",number:"<tpl> $langPreAvailableIsNumber </tpl>"},
			txt_freeze_amount: {required:"<tpl> $langPreFreezeIsNumber </tpl>",number:"<tpl> $langPreFreezeIsNumber </tpl>"},
			txt_close_remark: {required:"<tpl> $langPreCloseIsEmpty </tpl>"}
		},
		submitHandler: function() {
			if($('#action').val()=='close_record'){
				$.blockUI(question, { width: '275px' });
			}else{
				$('#form1').ajaxSubmit(options);
			}
		}
	});
});	
</script>