list.html
16.6 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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Yoho!Buy运营平台</title>
<script src="/ufoPlatform/js/include.js?version=6.9.6"></script>
</head>
<body class="easyui-layout" fit="true">
<div region="north" style="height:182px;">
<script>
document.write(addHead('二手库存审核', '列表管理'));
</script>
<div style="margin-left: 30px;margin-top: 10px;height:50px">
<input id="skup" type="text">
<input id="skupType" type="text"/>
<input id="sellerUid" type="text"/>
<input id="sku" type="text"/>
<input id="sizeId" type="text"/>
<input id="productCode" type="text"/>
<a id="searchBtn" class="btn-info">筛选</a>
<a id="allBtn" class="btn-info">全部</a>
</div>
<div id="tt" class="easyui-tabs">
<div id="tab_1" title="全部" style="padding:20px;display:none;">
</div>
<div id="tab_2" title="待审核" style="padding:20px;display:none;">
</div>
<div id="tab_3" title="审核通过" style="padding:20px;display:none;">
</div>
<div id="tab_3" title="审核不通过" style="padding:20px;display:none;">
</div>
</div>
</div>
<div id="skupList" region="center">
<table id="skupListTable"></table>
</div>
<div style="display: none">
<div id="dlg" class="datagrid-toolbar" style="padding:5px;">
<img id="simg" src="" alt="" width="800">
</div>
</div>
<div id="w" class="easyui-window" title="卖家上传图片" data-options="modal:true,closed:true" style="width:500px;height:600px;padding:10px;">
<div align="center">
<img id="showImg" height="500px;" width="400px;" onclick="window.open(this.src)"/>
</div>
<div align="center">
<span id="imageInfo"></span>
</div>
<div align="center">
<input style="float:left" type="button" value="上一张" onclick="lastImg()"/>
<input style="float:right" type="button" value="下一张" onclick="nextImg()"/>
</div>
</div>
<script>
const tab_status_to_be_audited=10;
const tab_status_audit_pass=1;
const tab_status_audit_reject=11;
var index=0;
var images;
$(function() {
$("#skup").textbox({
prompt: "SKUP"
});
$("#skupType").combobox({
prompt: "SKUP类型",
editable : false,
data: [
{"text" : "SKUP类型", "value" : "-1", "selected": true},
{"text" : "全新瑕疵", "value" : 5},
{"text" : "二手", "value" : 6}
]
});
$("#sellerUid").textbox({
prompt: "卖家UID"
});
$("#sku").textbox({
prompt: "SKU"
});
$("#sizeId").myCombobox({
prompt: "尺码",
url: contextPath + "/size/queryAllSize",
width: 200,
valueField: "id",
textField: "text",
loadFilter: function (data) {
return defaultLoadFilter(data);
}
});
$("#productCode").textbox({
prompt: "货号"
});
$("#searchBtn").linkbutton({
iconCls : "icon-search",
onClick: function () {
var param = {};
param.skup = $('#skup').val();
param.skupType = $('#skupType').combobox('getValue');
param.sellerUid = $('#sellerUid').val();
param.sku = $('#sku').val();
param.sizeId = $('#sizeId').combobox('getValue');
$("#skupListTable").myDatagrid("load", param);
//获取状态对应的记录数
getCountByStatus();
var tab = $('#tt').tabs('getSelected');
var index = $('#tt').tabs('getTabIndex',tab);
tabsSelected(index);
}
});
// 搜索全部
$("#allBtn").linkbutton({
iconCls : "icon-search",
onClick: function () {
$('#skup').textbox('setValue', '');
$('#skupType').combobox('setValue', '');
$('#sellerUid').textbox('setValue', '');
$('#sku').textbox('setValue', '');
$('#sizeId').combobox('setValue', '');
var param = {};
$("#skupListTable").myDatagrid("load", param);
//获取状态对应的记录数
getCountByStatus();
}
});
//获取状态对应的记录数
getCountByStatus();
getAllList();
$("#tt").tabs({
onSelect:function(title,index){
tabsSelected(index);
}
});
function tabsSelected(index) {
if(index == 0){
getAllList();
}else if(index == 1){
getToBeAuditedList();
}else if(index == 2){
getAuditPassList();
}else if(index == 3){
getAuditRejectList();
}
}
});
function getAllList() {
getSkupList(null);
}
function getToBeAuditedList() {
getSkupList(tab_status_to_be_audited);
}
function getAuditPassList() {
getSkupList(tab_status_audit_pass);
}
function getAuditRejectList() {
getSkupList(tab_status_audit_reject);
}
function getSkupList(status){
var dynaColumns=getTableColumn();
var table_columns=[dynaColumns];
$("#skupListTable").myDatagrid({
fit: true,
fitColumns: true,
striped: true,
url: contextPath + "/secondhand/querySkupList",
method: 'POST',
queryParams: {
status: status,
skup: $('#skup').val(),
skupType: $('#skupType').combobox('getValue'),
sellerUid: $('#sellerUid').val(),
sku: $('#sku').val(),
sizeId: $('#sizeId').combobox('getValue'),
productCode: $('#productCode').val(),
},
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp=null==temp?[]:temp;
temp.rows = temp.list;
return temp;
},
columns: table_columns,
cache: false,
pagination: true,
pageSize: 10,
idField: "id",
singleSelect: true,
onLoadSuccess: function (data) {
//审核通过
$(this).datagrid("getPanel").find("a[role='auditPass']").linkbutton({
onClick: function () {
var skup = $(this).attr("dataId");
auditPass(skup);
}
});
//审核不通过
$(this).datagrid("getPanel").find("a[role='auditReject']").linkbutton({
onClick: function () {
var skup = $(this).attr("dataId");
addRejectPage(skup);
}
});
}
});
}
//审核通过
function auditPass(skup) {
$.messager.confirm("审核通过提醒", "是否审核通过?", function(flag) {
if (flag) {
$.post(contextPath + "/secondhand/updateAuditInfo", {
skup : skup,
status : tab_status_audit_pass
}, function(data) {
if (data.code == 200) {
reloadTableAndFreshCount();
window.self.$.messager.show({
title : "提示",
msg : "审核通过成功!"
});
}else {
window.self.$.messager.alert("失败", "失败!", "error");
}
});
}
});
}
function addRejectPage(skup) {
var div = $("<div id='rejectDiv'>").appendTo($(document.body));
var url = contextPath + "/html/secondhand/reject.html?time_version=" + new Date().getTime();
$(div).myDialog({
width: "50%",
height: "50%",
title: "审核不通过",
href: url,
modal: true,
collapsible: true,
cache: false,
buttons: [{
text: "取消",
iconCls: "icon-cancel",
handler: function () {
$(div).dialog("close");
}
},{
text: "确定",
id: "rejectBtn",
iconCls: "icon-save",
onClick: function () {
//$('#rejectBtn').linkbutton('disable');
auditReject(skup, div);
}
}]
});
}
//审核不通过
function auditReject(skup, div) {
var rejectReason = $("#rejectReason").textbox("getValue");
if(null == rejectReason || rejectReason == ''){
alert("审核不通过原因必填!");
return;
}
$.post(contextPath + "/secondhand/updateAuditInfo", {
skup : skup,
status : tab_status_audit_reject,
rejectReason: rejectReason
}, function(data) {
if (data.code == 200) {
reloadTableAndFreshCount();
$(div).dialog("close");
window.self.$.messager.show({
title : "提示",
msg : "审核不通过成功!"
});
}else {
window.self.$.messager.alert("失败", "失败!", "error");
}
});
}
function reloadTableAndFreshCount(){
//获取鉴定状态对应的记录数
getCountByStatus();
$("#skupListTable").datagrid("reload");
}
function getTableColumn() {
return [{
title: "SKUP",
field: "skupAndSkupTypeStr",
width: 20,
align: "center",
formatter: function (value, rowData, rowIndex) {
return rowData.skup + "</br>" + "<font color='green' >("+ rowData.skupTypeStr + ")</font>";
}
}, {
title: "SKU",
field: "sku",
width: 30,
align: "center"
}, {
title: "商品图片",
field: "productImage",
width: 30,
align: "center",
formatter: function (value, rowData, rowIndex) {
return "<img height='100px;' width='80px;' src='"+value+"'/>";
}
}, {
title: "货号",
field: "productCode",
width: 50,
align: "center"
}, {
title: "商品信息",
field: "productInfo",
width: 30,
align: "center",
formatter: function (value, rowData, rowIndex) {
return "<p align='left'>商品名称:" + rowData.productName + "</br>" +
"颜色:" + rowData.colorName + "</br>" +
"尺码:" + rowData.sizeName + "</p>";
}
},{
title: "卖家上传图片",
field: "imageList",
width: 80,
align: "center",
formatter: function (value, rowData, rowIndex) {
var imageStr = "<table><tbody><tr>";
if(value != null){
for (var i = 0 ;i < value.length; i++){
imageStr += "<td><a href='javascript:void(0)' onclick='openModal("+i+",\""+value[i].imageUrl+"\", \""+value[i].imageDesc+"\","+rowData.skup+")'><img height='70px;' width='50px;' src='"+value[i].imageUrl+"'/></td></a>";
if((i+1) % 4 == 0 && 0 != i && i != (value.length - 1)) {
imageStr += "</tr><tr>";
}
}
}
imageStr = imageStr + "</tr></tbody></table>";
return imageStr;
}
}, {
title: "卖家描述",
field: "describeInfo",
width: 40,
align: "center",
formatter: function (value, rowData, rowIndex) {
return replacexss(value);
}
},{
title: "卖家UID",
field: "sellerUid",
width: 30,
align: "center"
},{
title: "销售价",
field: "price",
width: 20,
align: "center"
},{
title: "状态",
field: "statusStr",
width: 20,
align: "center",
formatter: function (value, rowData, rowIndex) {
var auditInfo = "待审核";
if(rowData.status == 11){
auditInfo = "审核不通过";
}else if(rowData.status == 1){
auditInfo = "审核通过";
}
if(rowData.status==11){//审核不通过
auditInfo += "(<font color='red' >原因:"+ rowData.rejectReason + "</font>)"
}
return auditInfo;
}
},{
title: "创建时间",
field: "createTimeStr",
width: 30,
align: "center"
},{
title: "操作信息",
field: "auditInfo",
width: 30,
align: "center",
formatter: function (value, rowData, rowIndex) {
return rowData.auditName + "</br>" + rowData.auditTimeStr;
}
},{
title: "操作",
field: "asdf",
width: 50,
align: "center",
formatter: function (value, rowData, rowIndex) {
if (rowData.status == 10) {//待审核
return "<a role='auditPass' dataId='"+ rowData.skup +"' style='margin-left:10px;background-color: #5cb85c !important;'>审核通过</a>"
+ "<a role='auditReject' dataId='"+ rowData.skup +"' style='margin-left:10px;background-color: #d9534f !important;'>审核不通过</a>";
}
}
}]
}
function openModal(indexNo, imageUrl, imageInfo, skup){
$("#showImg").attr("src",imageUrl);
$("#imageInfo").text(imageInfo);
var form = new FormData();
form.append("skup", skup);
//发送请求
$.ajax({
type: "POST",
url: contextPath + '/secondhand/queryImageList',
data: form,
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (result) {
if(result.code == 200) {
images = result.data;
}else{
alert("error!");
}
}
});
index = indexNo;
$("#w").window("open");
}
//建立 上一张 按钮函数
function lastImg(){
//下一张是index++ 上一张是index--
index--;
if(index<0){
//数组中的最小下标为0,不可能有比0还小的下标,所以当index到达0这个下标位置的时候就已经到头,
//如果还要继续向前遍历则 index<0 此时我们使index = images.length-1(数组的最后一个下标) 实现重复展示图片效果
index = images.length-1;
}
$("#showImg").attr("src",images[index].imageUrl);
$("#imageInfo").text(images[index].imageDesc);
}
function jumpPage() {
if (event.keyCode==37)//左
lastImg();
if (event.keyCode==39)//右
nextImg();
}
document.onkeydown=jumpPage;
//建立 下一张 函数
function nextImg(){
index++;
if(index>=images.length){
//因为数组的最大下标为length-1,所以length实际上是已经超出了数组长度,index中文含义为下标,
//所以当下标等于length-1的时候已经到了数组的最后一个元素位置,当index = lengeh的时候使index=0,这样可以循环点击
index = 0;
}
$("#showImg").attr("src",images[index].imageUrl);
$("#imageInfo").text(images[index].imageDesc);
}
function getCountByStatus(){
var form = new FormData();
form.append("skup", $("#skup").textbox("getValue"));
form.append("skupType", $("#skupType").combobox("getValue"));
form.append("sellerUid", $("#sellerUid").textbox("getValue"));
form.append("sku", $("#sku").textbox("getValue"));
form.append("sizeId", $("#sizeId").combobox("getValue"));
form.append("productCode", $("#productCode").textbox("getValue"));
//发送请求
$.ajax({
type: "POST",
url: contextPath + '/secondhand/getCountByStatus',
data: form,
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (result) {
if(result.code == 200) {
var tab_all = $('#tt').tabs('getTab',0); // 取得第一个tab
$('#tt').tabs('update', {
tab: tab_all,
options: {
title: "全部("+ result.data.totalNum + ")"
}
});
var tab_toBeAudited = $('#tt').tabs('getTab',1); // 取得第二个tab
$('#tt').tabs('update', {
tab: tab_toBeAudited,
options: {
title: '待审核('+ result.data.toBeAuditedNum + ")"
}
});
var tab_auditPass = $('#tt').tabs('getTab',2); // 取得第三个tab
$('#tt').tabs('update', {
tab: tab_auditPass,
options: {
title: '审核通过('+ result.data.auditPassNum + ")"
}
});
var tab_auditReject = $('#tt').tabs('getTab',3); // 取得第三个tab
$('#tt').tabs('update', {
tab: tab_auditReject,
options: {
title: '审核不通过('+ result.data.auditRejectNum + ")"
}
});
}
else {
$.messager.alert("失败", result.message, "error");
}
}
});
}
</script>
</body>
</html>