unionShareUserBanks.html
9.74 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Yoho!Buy运营平台</title>
<script src="/union/js/include.js"></script>
<script src="/union/js/ajaxfileupload.js"></script>
</head>
<body class="easyui-layout" fit="true">
<div region="north" style="padding-bottom: 35px; height: auto;">
<script>
document.write(addHead('CPS联盟管理', 'CPS银行卡管理'));
</script>
<form id="searchForm" method="post" accept-charset="utf-8">
<div style="margin-left: 10px;margin-top: 10px">
<label>分享人ID:</label>
<input class="easyui-textbox" id="uid" name="uid">
</input>
<label>持卡人姓名:</label>
<input class="easyui-textbox" id="name" name="name">
</input>
<label>身份证号:</label>
<input class="easyui-textbox" id="idCardNo" name="idCardNo" style="width:300px">
</input>
<label>银行卡号:</label>
<input class="easyui-textbox" id="bankCardNo" name="bankCardNo" style="width:300px">
</input>
<label>银行:</label>
<input class="easyui-combobox" id="bankCode" name="bankCode">
</input>
<label>状态:</label>
<input class="easyui-combobox" id="status" name="status"
data-options="valueField: 'value',
textField: 'label',
data: [{
label: '正常',
value: '1'
},{
label: '作废',
value: '0'
}]">
</input>
<a id="searchBtn" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">查询</a>
</div>
</form>
</div>
<div region="center">
<div style="margin-left: 30px;margin-top: 20px; height: 500px;">
<table id="userOrdersTable"></table>
</div>
</div>
<script type="text/javascript">
var checkedItems = [];
$(function () {
var _bankCodeSelector = $("#bankCode");
$.ajax({
type: 'POST',
url: contextPath + "/UnionShareRest/getBankList",
//data: JSON.stringify(formData),
async: true,
dataType: 'json',
contentType: "application/json; charset=utf-8",
success: function(res) {
//$.messager.progress("close");
debugger;
if (res.code == 200) {
if(res.data){
_bankCodeSelector.combobox({valueField: 'bankCode',
textField: 'bankName',
data:res.data});
}
} else {
$.messager.alert("失败", res.message, "error");
}
},
error:function(res){
$.messager.alert("失败", "加载所属业务,请刷新页面重试", "error");
return false;
}
});
$("#userOrdersTable").myDatagrid({
fit: true,
fitColumns: true,
<!-- idField: "id",-->
view: fileview,
nowrap: false,
onCheckAll: addcheckItem,
onCheck: addcheckItem,
onUncheckAll: removeAllItem,
onUncheck: removeSingleItem,
url: contextPath + "/UnionShareRest/queryUnionShareUserBanks",
method: 'POST',
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp=null==temp?[]:temp;
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "ID",
field: "id",
idField:"id",
width: 200,
align: "center",
checkbox: true
}, {
title: "分享人ID",
field: "uid",
width: 200,
align: "center"
}, {
title: "身份证号",
field: "idCardNo",
width: 200,
align: "center"
}, {
title: "持卡人姓名",
field: "name",
width: 200,
align: "center"
}, {
title: "银行卡号",
field: "bankCardNo",
width: 200,
align: "center"
}, {
title: "银行",
field: "bankName",
width: 200,
align: "center"
}, {
title: "状态",
field: "status",
width: 200,
align: "center",
formatter: function (value, rowData, rowIndex) {
if(rowData.status == 1) {
return "正常";
}else if(rowData.status == 0) {
return "作废";
}
}
}, {
title: "创建时间",
field: "createTime",
width: 200,
align: "center"
}, {
title: "修改时间",
field: "updateTime",
width: 200,
align: "center"
}, {
title: "操作",
field: "asdf",
width: 200,
align: "center",
formatter: function (value, rowData, rowIndex) {
if(rowData.status == 1) {
var str = "<a role='cancel' dataId='" + rowData.id + "' style='margin-left:10px'>作废</a>";
return str;
}
}
}
]],
cache: false,
pagination: true,
pageSize: 10,
pageList: [10],
idField: "id",
singleSelect: false,
checkOnSelect: false,
onLoadSuccess: function (data) {
resetSelectedCheckBox(data);
$(this).myDatagrid("getPanel").find("a[role='cancel']").linkbutton({
iconCls: "icon-more",
onClick: function () {
var cancleId=$(this).attr("dataId");
$.post(contextPath + "/UnionShareRest/cancelUserBanks", {id: cancleId}, function (res) {
$.messager.progress("close");
if (res.code == 200) {
if(res.data > 0) {
$.messager.show({
title: "提示",
msg: "操作成功!",
height: 120
});
}else {
$.messager.alert("失败", "操作失败,请重新操作", "error");
}
$("#searchBtn").click();
} else {
$.messager.alert("失败", res.message, "error");
}
}, "json");
}
});
}
});
function resetSelectedCheckBox(data){
$("input[type='checkbox'][name='id']").each(function () {
var cb=$(this);
$.each(checkedItems,function(index,value){
if(value==cb.val()){
cb.attr("checked",true);
return false;
}
});
});
}
$("#searchBtn").linkbutton({
iconCls : "icon-search",
onClick : function() {
checkedItems=[];
var param = {
uid:$("#uid").val(),
name:$("#name").val(),
idCardNo:$("#idCardNo").val(),
bankCardNo:$("#bankCardNo").val(),
status:$("#status").combobox('getValue'),
bankCode:$("#bankCode").combobox('getValue')
};
$("#userOrdersTable").myDatagrid("load", param);
}
});
function addcheckItem() {
$("input[type='checkbox'][name='id']:checked").each(function () {
var k = findCheckedItem($(this).val());
if (k == -1) {
checkedItems.push($(this).val());
}
});
}
var fileview = $.extend({}, $.fn.datagrid.defaults.view, { onAfterRender: function (target) { isCheckItem(); } });
function isCheckItem() {
for (var i = 0; i < checkedItems.length; i++) {
$("input[type='checkbox'][name='id'][value='"+checkedItems[i]+"']").attr("checked", "checked");
}
}
function findCheckedItem(ID) {
for (var i = 0; i < checkedItems.length; i++) {
if (checkedItems[i] == ID) return i;
}
return -1;
}
function removeAllItem(rows) {
$("input[type='checkbox'][name='id']").each(function () {
if (!this.checked) {
var k = findCheckedItem($(this).val());
if (k != -1) {
checkedItems.splice(k, 1);
}
}
});
}
function removeSingleItem(rowIndex, rowData) {
var k = findCheckedItem(rowData.id);
if (k != -1) {
checkedItems.splice(k, 1);
}
}
});
</script>
</body>
</html>