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

<table class="from_table2_five">
 <tr>
	  <th width="150" align="right"><tpl> $langPreSearchMemberName </tpl>：</th>
	  <td colspan="5">
	  <tpl> $member_array.login_name </tpl>
	  </td>
	  <input type="hidden" name="member_id" id="member_id" value="<tpl> $member_array.member_id </tpl>" />
    </tr>
  <tr>
	  <th width="150" align="right"><tpl> $langPreCashInfo </tpl>：</th>
	  <td colspan="5"></td>
	  
  </tr>
  <tr><th width="150" align="right"><tpl> $langPrePayment </tpl>：</th>
	  <td><tpl> if $cash_array.payment eq 'offline' </tpl><tpl> $langPreCashTypeOffline </tpl><tpl>else</tpl><tpl> $cash_array.payment </tpl><tpl> /if </tpl></td>
	  <th><tpl> $langPreCashCreateTime </tpl>：</th>
	  <td><tpl> $cash_array.create_time </tpl></td>
	  <tpl> assign var=one value=$cash_array.record_state </tpl>
	  <th><tpl> $langPreState </tpl>：</th>
	  <td><tpl> $predeposit_record_state[$one] </tpl></td>
  </tr>
  <tr><th width="150" align="right"><tpl> $langPreCashPaymentTrade </tpl>：</th>
	  <td><tpl> $cash_array.payment_trade|default:$langPreNothing </tpl></td>
	  <th><tpl> $langPreCashAmount </tpl>：</th>
	  <td><tpl> $cash_array.amount </tpl></td>
	  <th><tpl> $langPreCashPayAccount </tpl>：</th>
	  <td><tpl> $cash_array.pay_account </tpl></td>
  </tr>
	<tpl> if $cash_array.payment_type eq '1' </tpl><!-- 线下支付 -->
	<tr><th  width="150" align="right"><tpl> $langPreCashPayBank </tpl>：</th>
	  <td><tpl> $cash_array.pay_bank </tpl></td>
	  <th><tpl> $langPreCashPayConsignee </tpl>：</th>
	  <td colspan="2"><tpl> $cash_array.pay_consignee </tpl></td>
	  <td></td>
	</tr>
	<tpl> /if </tpl>
	<tr>
      <th  width="150" align="right"><tpl> $langPreCashRemark </tpl>：</th>
	  <td colspan="5"><tpl> $cash_array.pay_remark|default:"$langPreNothing" </tpl></td>
	</tr>
	<tr>
	  <th  width="150" align="right"><tpl> $langPreCashSystemRemark </tpl>：</th><td colspan="5"><tpl> $cash_array.system_remark|default:"$langPreNothing" </tpl></td>
	</tr>
<tpl> if $cash_array.record_state eq '0' </tpl>
  <tr>
	  <td>
	  <span class="btn_left"><input type="button" name="set_member" id="set_member" class="btn_submit" value="<tpl> $langPreOperateMember </tpl>" onclick="$('#table_set_member').css('display','');$('#table_close_record').css('display','none');$('#action').val('set_member_cash');" /></span>
	  </td>
	  <td>
	  	<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=predeposit_cash_list');" /></span>
	  </td>
	  <td><span class="btn_left"><input type="button" name="close_record" id="close_record" class="btn_submit" value="<tpl> $langPreCloseCash </tpl>" onclick="$('#table_set_member').css('display','none');$('#table_close_record').css('display','');$('#action').val('close_cash');" /></span></td>
  </tr>
<tpl> else </tpl>
  <tr>
  <td></td>
	  <td colspan="6">
	  <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=predeposit_cash_list');" />
	  </span>
	  </td>
  </tr>
<tpl> /if </tpl>
</table>
<table  width="680" class="from_table2" id="table_set_member" style="display:none">
  <tr>
	  <td><tpl> $langPreTrade </tpl>：</td>
	  <td><input type="text" name="txt_payment_trade" id="txt_payment_trade" />
	  <label style="display:none" for="txt_payment_trade" class="wrong" metaDone="true" generated="true"></label>
	  </td>
  </tr>	
  <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" selected="selected"><tpl> $langPreDown </tpl></option>
		</select>
		<input type="text" name="txt_available_amount" id="txt_available_amount" value="<tpl> $cash_array.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(2,2);
								ShowDiv = 'result_content';
								getPageContent('predeposit.manage.php?action=predeposit_cash_list');
							}
						},
		type:      'post',
		dataType:  'json'
	};
	
	$("#form1").validate({
		errorClass: "wrong",
		rules: {
			txt_payment_trade: {required:function(){if($('#action').val()=='set_member_cash'){return true;}else{return false;}}},
			txt_system_remark: {required:function(){if($('#action').val()=='set_member_cash'){return true;}else{return false;}}},
			txt_available_amount: {required:function(){if($('#action').val()=='set_member_cash'){return true;}else{return false;}},number:true},
			txt_freeze_amount: {required:function(){if($('#action').val()=='set_member_cash'){return true;}else{return false;}},number:true},
			txt_close_remark: {required:function(){if($('#action').val()=='close_record'){return true;}else{return false;}}}
		},
		messages: {
			txt_payment_trade: {required:"<tpl> $langPreTradeIsEmpty </tpl>"},
			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_cash'){
				$.blockUI(question, { width: '275px' });
			}else{
				$('#form1').ajaxSubmit(options);
			}
		}
	});
});	
</script>