<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('账户信息')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-account-edit">
            <input id="comId" name="comId" th:value="${comWalletAccount.comId}"  type="hidden">
            <div class="form-group">	
                <label class="col-sm-3 control-label is-required">钱包账户名：</label>
                <div class="col-sm-8">
                    <input th:value="${comWalletAccount.comName}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label is-required">钱包账户号：</label>
                <div class="col-sm-8">
                    <input th:value="${comWalletAccount.walletAccountNo}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label is-required">账户状态：</label>
                <div class="col-sm-8">
                    <input th:value="${comWalletAccount.accountStatus}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">账户总额：</label>
                <div class="col-sm-8">
                    <input th:value="${comWalletAccount.totalAmount}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">可用金额：</label>
                <div class="col-sm-8">
                    <input th:value="${comWalletAccount.availableAmount}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">冻结金额：</label>
                <div class="col-sm-8">
                    <input th:value="${comWalletAccount.frozenAmount}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">结算卡银行名称：</label>
                <div class="col-sm-8">
                    <select class="form-control" name="bankCode" th:with="type=${@bank.getBanCode()}">
                        <option th:each="dict : ${type}" th:text="${dict.bankName}" th:value="${dict.bankCode}" th:selected="${dict.bankCode==comWalletAccount.bankCode}"></option>
                    </select>
                    <!--${comWalletAccount.bankName}-->
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">结算卡银行卡号：</label>
                <div class="col-sm-8">
                    <input th:value="${comWalletAccount.bankCardNo}" id="bankCardNo" name="bankCardNo" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">绑定手机号：</label>
                <div class="col-sm-8">
                    <input id="mobilePhone" name="mobilePhone" th:value="${comWalletAccount.mobilePhone}" class="form-control" type="text">
                </div>
            </div>
    	</form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
	    var prefix = ctx + "manage/com-wallet";
        var icon = "<i class='fa fa-times-circle'></i>  ";
	    $("#form-account-edit").validate({
	    	onkeyup: false,
	        rules: {
                bankCardNo: {
                    required: true,
                    minlength: 10
                },
                mobilePhone: {
                    required: true,
                    isPhone: true
                }
	        },
	        messages: {
                bankCardNo: {
                    required: icon + "银行卡号不能为空",
                    minlength: icon + "银行卡号不能小于10位"
                },
                mobilePhone: {
                    required: icon + "手机号码不能为空",
                    isPhone: icon + "请输入正确的手机号码"
                }
	        },
            focusCleanup: true
	    });
	    
	    function submitHandler() {
	        if ($.validate.form()) {
	        	$.operate.save(prefix + "/bind-bank-card", $('#form-account-edit').serialize());
	        }
	    }
    </script>
</body>
</html>
