goods.yohoCoin.Audit.js
12.3 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
webpackJsonp([56],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
//yoho币
'use strict';
var $ = __webpack_require__(1),
common=__webpack_require__(2);
var ENUM = {
gender: {
1: '男',
2: '女',
3: '通用'
},
status: {
0: '未设置',
1: '<b style="color:#428bca">待审核</b>',
2: '<b style="color:#5cb85c">通过</b>',
3: '<b style="color:#ff0000">驳回</b>'
},
auditor: {
2965: 'Tracy',
10235: 'David Wong'
}
}
var gridParams = function() {
var select = tabTree.getAddress();
return {
auditStatus: $("#yohoCoinNav .active").data('status'),
productSkn: common.util.__input("skn"),
shopId: common.util.__input("shop"),
brandId: common.util.__input("brand"),
supplierId: common.util.__input("supplier"),
gender: common.util.__input("gender"),
auditorId: common.util.__input("auditor"),
maxSortId: select[0] ? select[0].id : "",
middleSortId: select[1] ? select[1].id : "",
smallSortId: select[2] ? select[2].id : "",
sortId: select[3] ? select[3].id : ""
};
}
var COLUMNS = {
c1: [ //待审核列表
{display: '', type: 'checkbox'},
{display: 'SKN', name: 'productSkn'},
{display: '商品信息', name: 'info', render: function(item) {
var html = ""
html += "<p>名称:" + item.productName + "</p>" + "<p>品牌:" + item.brandName + "</p>" + "<div>类目:";
if(item.maxSortName) {html += item.maxSortName;}
if(item.middleSortName) {html += " > " + item.middleSortName;}
if(item.smallSortName) {html += " > " + item.smallSortName;}
html += "</div>";
return html;
}},
{display: '供应商 / 店铺', name: 'supplier_name', render: function(item) {
var html = '';
if (item.supplierName) {html += item.supplierName;}
if (item.shopName) {html += ' / ' + item.shopName;}
return html;
}},
{display: '性别', name: 'gender', render: function(item) {
return ENUM.gender[item.gender];
}},
{display: '吊牌价', name: 'retailPrice'},
{display: '销售价', name: 'salesPrice'},
{display: '执行返币金额', name: 'returnCoin', render: function(item) {
return item.productPrice.returnCoinMoney;
}},
{display: '审核返币金额', name: 'needAuditCoin', render: function(item) {
return item.productPrice.needAuditCoin;
}},
{display: '状态', name: 'status', render: function(item) {
return ENUM.status[item.productPrice.coinStatus];
}},
{display: '操作信息', name: 'operateInfo', render: function(item) {
var html = '';
if (item.productPrice.founderName) {html += '<p>操作人:' + item.productPrice.founderName + '</p>';}
if (item.productPrice.auditDt) {html += '<div style="color: #999; font-size: 12px;">' + getTime(item.productPrice.auditDt) + '</div>';}
return html;
}},
{display: '操作', render: function(item) {
return '<a href="javascript:;" class="btn btn-success btn-xs btn-checkOk" data-skn="' + item.productSkn + '">审核通过</a>' +
'<a href="javascript:;" class="btn btn-danger btn-xs btn-checkNo" data-skn="' + item.productSkn + '">驳回</a>';
}}
],
c2: [ //通过,驳回,全部列表展示
{display: 'SKN', name: 'productSkn'},
{display: '商品信息', name: 'info', render: function(item) {
var html = ""
html += "<p>名称:" + item.productName + "</p>" + "<p>品牌:" + item.brandName + "</p>" + "<div>类目:";
if(item.maxSortName) {html += item.maxSortName;}
if(item.middleSortName) {html += " > " + item.middleSortName;}
if(item.smallSortName) {html += " > " + item.smallSortName;}
html += "</div>";
return html;
}},
{display: '供应商 / 店铺', name: 'supplier_name', render: function(item) {
var html = '';
if (item.supplierName) {html += item.supplierName;}
if (item.shopName) {html += ' / ' + item.shopName;}
return html;
}},
{display: '性别', name: 'gender', render: function(item) {
return ENUM.gender[item.gender];
}},
{display: '吊牌价', name: 'retailPrice'},
{display: '销售价', name: 'salesPrice'},
{display: '执行返币金额', name: 'returnCoin', render: function(item) {
return item.productPrice.returnCoinMoney;
}},
{display: '审核返币金额', name: 'needAuditCoin', render: function(item) {
return item.productPrice.needAuditCoin;
}},
{display: '状态', name: 'status', render: function(item) {
var html = "<div>" + ENUM.status[item.productPrice.coinStatus] + "</div>";
if(item.productPrice.coinStatus == 3){
html += '<a class="noCheckReason" href="javascript:" data-text="'+ item.productPrice.comment +'" style="color: #ec971f;text-decoration: underline;margin:0">驳回理由</a>';
}
return html;
}},
{display: '审批人', name: 'auditor', render: function(item) {
return ENUM.auditor[item.productPrice.auditorId];
}},
{display: '操作信息', name: 'operateInfo', render: function(item) {
var html = '';
if (item.productPrice.founderName) {html += '<p>操作人:' + item.productPrice.founderName + '</p>';}
if (item.productPrice.auditDt) {html += '<div style="color: #999; font-size: 12px;">' + getTime(item.productPrice.auditDt) + '</div>';}
return html;
}}
]
}
new common.dropDown({
el: '#shop',
ajax: 'shopsRest'
});
new common.dropDown({
el: '#brand',
ajax: 'brand'
});
new common.dropDown({
el: '#supplier',
ajax: 'querySupplier'
});
//多级菜单
var tabTree = new common.tabTree("#sortTree", {status: 1, sortLevel: 1});
tabTree.init();
var g1 = new common.grid({
el: "#yohoCoinAudit_table",
parms: gridParams,
columns: COLUMNS.c1
}),
g2 = new common.grid({
el: "#yohoCoinAudit_table",
parms: gridParams,
columns: COLUMNS.c2
}),
g = null;
//审批通过
function ajaxCheckOk(productSkn){
common.util.__ajax({
url:'/good/yohoCoin/pass',
data: {
"productSkn": productSkn
}
},function(rs){
g.reload();
});
}
//批量审核通过
function ajaxCheckOkBatch(productSkns){
common.util.__ajax({
url:'/good/yohoCoin/passBatch',
data: {
"productSkns": JSON.stringify(productSkns)
}
},function(rs){
g.reload();
});
}
//驳回
function ajaxCheckNo(productSkn, comment){
common.util.__ajax({
url:'/good/yohoCoin/reject',
data: {
"productSkn": productSkn,
"comment": comment
}
},function(rs){
g.reload();
});
}
//批量驳回
function ajaxCheckNoBatch(productSkns, comment){
common.util.__ajax({
url:'/good/yohoCoin/rejectBatch',
data: {
"productSkns": JSON.stringify(productSkns),
"comment": comment
}
},function(rs){
g.reload();
});
}
//找到以选中的商品的SKN
function findCheckedSknList(){
var sknList = new Array();
var checkedItems = $("#yohoCoinAudit_table").find(".wqt_checkbox:checked");
$.each(checkedItems, function(index,value){
var skn = $(value).parent().next().text();
sknList.push(skn);
});
return sknList;
}
//时间转换
function getTime(time){
var t = new Date(time);
var formattedTime = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
return formattedTime;
}
//批量审批通过
$(document).on('click', '#all-checkOk', function() {
var checkOkList = findCheckedSknList();
if(checkOkList.length > 0){
common.dialog.confirm(
"批量审核通过确认",
"你确认<strong style='color:#5cb85c'> 批量审核通过 </strong>么?",
function(){
ajaxCheckOkBatch(checkOkList);
},
function(){}
);
}else{
common.util.__tip("没有选择任何商品!");
}
});
//批量驳回
$(document).on('click', '#all-checkNo', function() {
var checkNoList = findCheckedSknList();
if(checkNoList.length > 0){
common.dialog.confirm(
"批量审核驳回确认",
"你确认<strong style='color:#d9534f'> 批量审核驳回 </strong>么?如果确认,<strong style='color: #f0ad4e'>请填写驳回理由!</strong> \
<textarea id='checkComment' class='form-control' rows='3' style='margin: 10px 0'></textarea> \
<div class='checkTip' style='display: none; color: #ff0000; font-weight: bold'><span>提示:请填写驳回理由!</span></div>",
function(){
var comment = $("#checkComment").val();
if(comment){
ajaxCheckNoBatch(checkNoList, comment);
}else{
$("#checkComment").focus();
$(".checkTip").show();
return false;
}
},
function(){}
);
}else{
common.util.__tip("没有选择任何商品!");
}
});
//选择分类
$(document).on('click', '#yohoCoinNav li', function() {
$(this).addClass("active").siblings().removeClass("active");
if($(this).data("status") == "1"){
$("#checkOperation").show();
g1.init("/good/yohoCoin/queryPageList4Audit");
g = g1;
}else{
$("#checkOperation").hide();
g2.init("/good/yohoCoin/queryPageList4Audit");
g = g2;
}
});
//审核通过
$(document).on('click', '.btn-checkOk', function() {
var productSkn = $(this).data("skn");
common.dialog.confirm(
"审核通过确认",
"你确认<strong style='color:#5cb85c'> 审核通过 </strong>么?",
function(){
ajaxCheckOk(productSkn);
},
function(){}
);
});
//驳回
$(document).on('click', '.btn-checkNo', function() {
var productSkn = $(this).data("skn");
common.dialog.confirm(
"审核驳回确认",
"你确认<strong style='color:#d9534f'> 审核驳回 </strong>么?如果确认,<strong style='color: #f0ad4e'>请填写驳回理由!</strong> \
<textarea id='checkComment' class='form-control' rows='3' style='margin: 10px 0'></textarea> \
<div class='checkTip' style='display: none; color: #ff0000; font-weight: bold'><span>提示:请填写驳回理由!</span></div>",
function(){
var comment = $("#checkComment").val();
if(comment){
ajaxCheckNo(productSkn, comment);
}else{
$("#checkComment").focus();
$(".checkTip").show();
return false;
}
},
function(){}
);
});
//查看驳回理由
$(document).on('click', '.noCheckReason', function() {
var reason = $(this).data("text");
common.dialog.confirm("查看驳回理由", reason, function(){}, function(){});
});
//筛选
$(document).on('click', '#filter-btn', function() {
g.reload(1);
});
//全部
$(document).on('click', '#all-btn', function() {
$("#yohoCoinNav li").eq(3).click();
});
//禁页面默认在待审核列表
$("#yohoCoinNav li").eq(0).click();
/***/ }
]);