<%@ Page CodeFileBaseClass="AliCMS.Lib.SystemPageBase" %>
<%@ Register TagPrefix="alicmsUC" TagName="Ime" Src="../../../ime.dwt.ascx"%>
<%@ Register TagPrefix="alicmsUC" TagName="LanguageMenu" Src="../../../language_menu.dwt.ascx"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- TemplateInfo codeOutsideHTMLIsLocked="true" -->
<ali:Get ID="ThisUser" Object="User" InnerID="Request.QueryString['UserID']" />
<ali:Get ID="Balance" Object="User.Money" Operation="GetAllBalance((Guid)ThisUser[ID])" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>资金</title>
<link rel="stylesheet" type="text/css" href="<%=CommonPath%>jquery/themes/lightness/all.css" />
<ali:Comment><link rel="stylesheet" type="text/css" href="../../../S01/CHS/css/common.css" /></ali:Comment>
<link rel="stylesheet" href="<%=CssPath%>common.css" />
<alicmsUC:Ime Ime="true" Eot="true" runat="server" />
<script language="c#" runat="server">
private decimal _balance = -1;
protected string GetBalance(object amount)
{
	if (_balance == -1)
		_balance = Balance;
	
	decimal result = _balance;
	_balance -= Convert.ToDecimal(amount);
	return result.ToString("0.00");
}
</script>
<script type="text/javascript">
var _page = "user_money";
var _lang = "<%=ContentLang%>";
var _webPath = "<%=WebPath%>";
var _imagePath = "<%=ImagePath%>";
var _userID = "<%=ThisUser[ID]%>";
var _userInnerID = "<%=Request.QueryString["UserID"]%>";
var _creatorName = "<%=User["Name"]%>";
var _lang_working = "正在操作...";
var _lang_operation_success = "操作成功！";
var _lang_operation_fail = "操作失败！";
var _lang_amount_incorrect = "充值金额格式不正确！";
var _lang_time_incorrect = "交易时间格式不正确！";
var _lang_title_plus = "代充值";
var _lang_title_minus = "代扣费";
</script>
</head>
<body>
<div class="WhiteHeader">
	<div class="Left"><img src="<%=ImagePath%>close_frame.gif" /></div>
	<div class="Title"><a href="../../user/list.aspx?Lang=<%=ContentLang%>">用户列表</a> → <span class="<%=ContentLang%>Font"><%=ThisUser[Name]%></span></div>
	<div class="Right">
		<alicmsUC:LanguageMenu runat="server" />
		<img height="15" src="<%=ImagePath%>dropdown.gif" /> 语言：<%=CurrentLanguage%>
	</div>
</div>
<div class="Block">
	<ul class="TabMenu">
		<li class="Left"></li>
		<li class="Middle"><a href="../../user/edit.aspx?Lang=<%=ContentLang%>&amp;ID=<%=Request.QueryString["UserID"]%>">编辑</a></li>
		<li class="Right"></li>
		<li class="Left Selected"></li>
		<li class="Middle Selected">资金</li>
		<li class="Right Selected"></li>
	</ul>
	<ul class="Title">
		<li class="Left"></li>
		<li class="Middle"></li>
		<li class="Right"></li>
	</ul>
	<div class="ToolBar">
		<form>
			充值金额（增/减）：<input name="Amount" maxlength="10" class="Text" />
			支付方式：
			<select name="PaymentID">
				<option value="" data-type="" data-account="">未指定</option>
				<ali:List Mark="System" Object="Payment">
					<ali:Record>
						<option value="<%=ID%>" data-type="<%=Type%>" data-account="<%=Account%>"><%=Name%></option>
					</ali:Record>
				</ali:List>
			</select>
			交易时间：<input type="text" name="Time" value="<%=DateTime.Now.ToString("yyyy-MM-dd")%>" class="Wdate" />
			备注：<input name="Memo" size="25" maxlength="255" class="Text <%=ContentLang%>Font" />
			<input type="submit" value="充值" />
		</form>
	</div>
	<div id="List">
		<table border="0" cellpadding="4" cellspacing="1" class="ListTable">
			<thead>
				<tr>
					<th>交易时间</th>
					<th>业务摘要</th>
					<th>转入金额</th>
					<th>转出金额</th>
					<th>当前余额</th>
					<th>支付方式</th>
					<th>支付账号</th>
					<th>状态</th>
					<th>备 注</th>
				</tr>
			</thead>
			<tbody>
				<ali:List ID="List" Object="User.Money" Condition="UserID=ThisUser[ID]" Sort="CreateTime DESC" Validate="True">
					<ali:Record>
						<tr>
							<td><%=CreateTime%></td>
							<td class="<%=ContentLang%>Font"><%=Title%></td>
							<%If Convert.ToDecimal(Amount) > 0%>
								<td><%=Convert.ToDecimal(Amount).ToString("0.00")%></td>
								<td>--</td>
							<%Else%>
								<td>--</td>
								<td><%=(-1 * Convert.ToDecimal(Amount)).ToString("0.00")%></td>
							<%EndIf%>
							<td>
								<%If Convert.ToBoolean(Frozen)%>
									--
								<%Else%>
									<%=GetBalance(Amount)%>
								<%EndIf%>
							</td>
							<td class="<%=ContentLang%>Font"><%=PaymentName%></td>
							<td><%=PaymentAccount%></td>
							<td>
								<%If Convert.ToString(PaymentType) == "Alipay"%>
									<%If Convert.ToString(TradeStatus) == "TRADE_FINISHED" || Convert.ToString(TradeStatus) == "TRADE_SUCCESS"%>
										交易成功
									<%ElseIf Convert.ToString(TradeStatus) == "TRADE_CLOSED"%>
										交易中途关闭
									<%ElseIf Convert.ToString(TradeStatus) == "WAIT_BUYER_PAY"%>
										等待买家付款
									<%ElseIf Convert.ToString(TradeStatus) == "WAIT_SELLER_SEND_GOODS"%>
										买家已付款，等待卖家发货
									<%ElseIf Convert.ToString(TradeStatus) == "WAIT_BUYER_CONFIRM_GOODS"%>
										卖家已发货，等待买家确认
									<%Else%>
										<%=TradeStatus%>
									<%EndIf%>
								<%ElseIf Convert.ToString(PaymentType) == "ChinaBank"%>
									<%If Convert.ToString(TradeStatus) == "TRADE_SUCCESS"%>
										交易成功
									<%ElseIf Convert.ToString(TradeStatus) == "WAIT_BUYER_PAY"%>
										等待买家付款
									<%Else%>
										<%=TradeStatus%>
									<%EndIf%>
								<%Else%>
									<%If Convert.ToBoolean(Frozen)%>
										冻结
									<%Else%>
										正常
									<%EndIf%>
								<%EndIf%>
							</td>
							<td class="<%=ContentLang%>Font AlignLeft" style="white-space:pre"><%=Memo%></td>
						</tr>
					</ali:Record>
				</ali:List>
			</tbody>
		</table>		
	</div>
	<div class="Footer"></div>
</div>
<script type="text/javascript" src="<%=CommonPath%>jquery/core.js"></script>
<script type="text/javascript" src="<%=CommonPath%>jquery/ui.js"></script>
<script type="text/javascript" src="<%=CommonPath%>date_picker/date_picker.js"></script>
<script type="text/javascript" src="<%=CommonPath%>utility.js"></script>
<script type="text/javascript" src="<%=JsPath%>global.js"></script>
<script type="text/javascript" src="<%=ModuleJsPath%>module.js"></script>
</body>
</html>