credit.vm
5.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#set($link=${webUtils.getLocalPath("member/list.do")})
#set($url_save = "/customer/save.do")
#set($page_title="会员中心")
#set($crumbs="首页:/home,会员管理:"+$link+"")
<script language="javascript" type="text/javascript" src="$!{webUtils.getCommonAssetsPath("common/date/WdatePicker.js")}"></script>
<style>
<!--
.modify {
cursor: pointer;
}
-->
</style>
<div class="page-content">
<div class="page-header">
##<span class="pull-right"><a href="${webUtils.getLocalPath("member/list.do")}" class="btn btn-white btn-default">返回</a></span>
<span class="pull-right"><a href="javascript:history.back();" class="btn btn-white btn-default">返回</a></span>
<h1>
会员管理
<small>
<i class="icon-double-angle-right"></i>
信用管理
</small>
</h1>
</div>
<!-- /.page-header -->
<div class="row">
<div class="col-xs-12">
<!-- PAGE CONTENT BEGINS -->
<form class="form-horizontal" id="lockForm" role="form" method="post" action="${webUtils.getLocalPath("member/lockUser.do")}">
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right"
for="form-field-1"> 信用额度:
</label>
<div class="col-sm-9">
<div class="input-group col-xs-10 col-sm-5 ">
<input type="text" class="form-control" disabled data-type="show" value="#if(!${info.limitValue})0.00#else$!{money}#end" id="creditInp" >
<span class="input-group-addon">元</span>
<span class="input-group-addon modify" id="modifyBtn">修改</span>
</div>
<small class="help-block" id="errMsg" style="display:none;color:#d16e6c">必须填写!</small>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right"
for="form-field-1"> 可用额度:
</label>
<div class="col-sm-9">
#set($use = $info.limitValue - $info.residue)
<div class="input-group col-xs-10 col-sm-5 ">
<input type="hidden" value="$!{uid}" id="uid" >
<input type="text" class="form-control" disabled value="#if($use == 0)0.00#else$!{moneyUtils.centToYuan($!{use})}#end" >
<span class="input-group-addon">元</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right"
for="form-field-1"> 已用额度:
</label>
<div class="col-sm-9">
<div class="input-group col-xs-10 col-sm-5 ">
<input type="text" class="form-control" disabled id="haveCredit" value="#if(!${info.residue} || ${info.residue} == 0)0.00#else$!{moneyUtils.centToYuan($!{info.residue})}#end" >
<span class="input-group-addon">元</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right"
for="form-field-1"> 信用额度历史:
</label>
<div class="col-xs-10 col-sm-5">
<table class="table">
<thead>
<tr>
<td>额度</td>
<td>操作人</td>
<td>操作时间</td>
</tr>
</thead>
#foreach($l in $log)
<tr>
<td>$!{moneyUtils.centToYuan($!{l.newLimitValue})}</td>
<td>$!{l.operatorName}</td>
<td>$!{dateFormatUtils.format($!{l.created},"yyyy-MM-dd HH:mm")}</td>
</tr>
#end
</table>
</div>
</div>
<div class="clearfix form-actions">
<div class="col-md-offset-3 col-md-9">
<a class="btn btn-info" href="javascript:history.back()">
<i class="icon-reply bigger-110"></i>
返回
</a>
</div>
</div>
</form>
</div>
</div>
</div>
<link rel="stylesheet" href="$!{webUtils.getAssetsPath("/css/validator/bootstrapValidator.min.css")}" />
<script type="text/javascript" src="$!{webUtils.getAssetsPath("/js/validator/bootstrapValidator.min.js")}"></script>
<script>
$(function (){
$("#modifyBtn").click(function (){
var type = $("#creditInp").attr("data-type");
if(type == 'show'){
$("#creditInp").removeAttr("disabled");
$("#creditInp").attr("data-type","modify");
$(this).html("确定");
} else {
if(modify()){
$("#creditInp").attr("disabled","disabled");
$("#creditInp").attr("data-type","show");
$(this).html("修改");
}
}
});
function yuan2Cent(money){
var reg = /^\d+(\.\d{2})?$/;
var flag = reg.test(money);
if(!flag){
return -1;
}
var cent = parseFloat(money) * 100;
return cent;
}
function showErrMsg(msg){
$("#errMsg").html(msg);
$("#errMsg").show();
}
function modify(){
var uid = $("#uid").val();
var credit = $.trim($("#creditInp").val());
if(credit == ''){
showErrMsg("请输入信用额度");
return false;
}
var haveCredit = $.trim($("#haveCredit").val());
var creditCent = yuan2Cent(credit);
var haveCreditCent = yuan2Cent(haveCredit);
if(creditCent < 0 || haveCreditCent < 0){
showErrMsg("输入金额错误!");
return false;
}
if (creditCent < haveCreditCent){
showErrMsg("信用额度不能小于已用额度! ");
return false;
}
$.ajax({
url: "${webUtils.getLocalPath("member/updateCreditLimit.do")}?uid=" + uid + "&credit="+creditCent,
type : "post",
success : function (data) {
location.reload()
}
});
}
})
</script>