<%@ page language="java" pageEncoding="UTF-8"
         contentType="text/html; charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String basePath = request.getContextPath();
    String resourcePath = basePath + "/resource";
%>
<!doctype html>
<html>
<head>
    <title>我的账户-充值</title>
    <meta charset="utf-8">
    <jsp:include page="../common/head.jsp"></jsp:include>
</head>
<body>
<jsp:include page="../common/body_header.jsp"></jsp:include>
<jsp:include page="../common/user_center_header.jsp"></jsp:include>
<div class="user-mid2">
    <div class="xinxi0">
        <div class="user-mid0">
            <div class="if">
            </div>
            <div>
                <div class="ye1">
                    <img src="img/icon_yue.png" alt="">&nbsp;
                    <span>账户余额：</span>
                    <span class="rmb">${balance}</span>
                </div>

            </div>
            <div class="clearfix"></div>
            <div class="xx-main">
                <div class="cz00">
                    <form id="fromRecharge">
                        <span class="cz-font"><span class="xinghao" >*</span>充值金额：</span>
                        <input type="number" name="orderAmount" id="orderAmount" placeholder="" class="cz">
                        <button type="button"  onclick="toRecharge()" class="cz-but">充值</button>
                    </form>

                </div>
            </div>
        </div>
    </div>
</div>

<div class="clearfix"></div>
<jsp:include page="../common/body_footer.jsp"></jsp:include>

</body>
<script>
function toRecharge() {
    var amount = $("#orderAmount").val();
    if (isNaN(amount) || amount <= 0){
        $("#orderAmount").val(0);
        swal("请输入正确的金额！");
        return
    }
    $.post("<%=basePath%>/open/myAccount/toRecharge.action",$("#fromRecharge").serialize(),function (ret) {
        if(ret.stateCode==200) {
            location.href="<%=basePath%>/open/myAccount/payment.htm?orderNumber="+ret.data.orderNumber+"&orderAmount="+ret.data.orderAmount;
        }else {
            swal("充值失败")
        }
    })
}
</script>
</html>