goods.cod.Brand.js
8.52 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
webpackJsonp([42],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
/**
* Created by wangqianjun on 16/4/11.
* 货到付款设置
*/
'use strict';
var $ = __webpack_require__(1),
common = __webpack_require__(2);
var ENUM = {
tips: {
"1": 0,
"2": 0,
"all": 0
},
status: {
'1': "开启",
'0': "关闭"
},
tab: {
"1": 100,
"2": 300,
"all": 'all'
}
};
var currentTab = 'all';
/*下拉选择*/
common.dropDown({
el: "#brandId",
ajax: "brand",
params:function(){
return{userLimitFlag:true};
}
});
new common.dropDown({
el: "#isPayDelivery",
ajax: ""
});
var currentBtnType;
var currentSelItem;
var t = new common.tab({
el: "#basicTab",
click: function() {
var columnname = $(this).find('a').attr('columnname');
currentTab = ENUM.tab[columnname];
layoutGridCloum(currentTab);
g.init('/payDelivery/queryTotalBrandPayDelivery');
},
columns: [{
name: "1",
display: "待审核({1})",
value: ''
}, {
name: "2",
display: "驳回({2})",
value: ''
}, {
name: "all",
display: "全部({3})",
value: ''
}]
}).init(ENUM.tips);
var g = new common.grid({
el: '#basicTable',
parms: function() {
return {
brandId: common.util.__input("brandId"),
isPayDelivery: common.util.__input("isPayDelivery"),
checkStatus: (currentTab && currentTab != 'all') ? currentTab : 400//ENUM.tab[t.active] //(t.active && t.active!='all') ? t.active : 400
};
},
columns: [{
display: '品牌',
name: 'brandName'
},
// 审核状态(全部商品是显示) 1
{
display: "状态",
render: function(item) {
var html = [];
html.push("<p>" + ENUM.status[item.isPayDelivery] + "</p>");
return html.join('');
}
},
{ //2
display: "申请人",
hidden: true,
render: function(item) {
var html = [];
html.push("<p>" + common.util.__filterNull(item, 'applicant') + "</p>");
return html.join('');
}
}, { //3
display: "申请时间",
hidden: true,
render: function(item) {
var html = [];
html.push("<p>" + common.util.__filterNull(item, 'createTime') + "</p>");
return html.join('');
}
},{
// 4
display: '驳回理由',
hidden: true,
name: 'status', // 8待上架,2待审核,3驳回,4通过,1已上架,0已下架,5再上架待审核,6再上架驳回,7再上架通过
render: function(item) {
return '<p style="color:red;">' + common.util.__filterNull(item, 'rejectReason') + '</p>' ;
}
}, { // 5
display: "操作",
render: function(item) {
var html = [];
if (item.isPayDelivery == 1) { // 待审核
html.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn operation btn-danger btn-xs edit-class-btn" id="btn-item-close" data-type="close">关闭</a>');
} else {
html.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn operation btn-success btn-xs edit-class-btn" id="btn-item-open" data-type="open">开启</a>');
}
return html.join('');
}
},{ // 6
display: "操作",
hidden: true,
render: function(item) {
var html = [];
html.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn operation btn-danger btn-xs edit-class-btn" id="btn-item-reject" data-type="reject">驳回</a>');
html.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn operation btn-success btn-xs edit-class-btn" id="btn-item-pass" data-type="pass">通过</a>');
return html.join('');
}
}
]
});
g.init('/payDelivery/queryTotalBrandPayDelivery');
function layoutGridCloum(tabname) {
if (tabname == 'all') {
g.options.columns[1].hidden = false;
g.options.columns[2].hidden = true;
g.options.columns[3].hidden = true;
g.options.columns[4].hidden = true;
g.options.columns[5].hidden = false;
g.options.columns[6].hidden = true;
} else if(tabname == 100) {
g.options.columns[1].hidden = true;
g.options.columns[2].hidden = false;
g.options.columns[3].hidden = false;
g.options.columns[4].hidden = true;
g.options.columns[5].hidden = true;
g.options.columns[6].hidden = false;
} else {
g.options.columns[1].hidden = true;
g.options.columns[2].hidden = false;
g.options.columns[3].hidden = false;
g.options.columns[4].hidden = false;
g.options.columns[5].hidden = true;
g.options.columns[6].hidden = true;
}
}
// tab初始化
var loadTab = function() {
t.active = undefined;
setTimeout(function() {
common.util.__ajax({
url: "/payDelivery/queryCountBrandPayDelivery",
data: g.options.parms()
}, function(res) {
var __dt = $.extend({}, ENUM.tips, res.data);
t.init(__dt);
}, true);
}, 800);
};
var reloadTab = function() {
t.active = undefined;
setTimeout(function() {
common.util.__ajax({
url: "/payDelivery/queryCountBrandPayDelivery",
data: g.options.parms()
}, function(res) {
var __dt = $.extend({}, ENUM.tips, res.data);
t.load(__dt);
}, true);
}, 800);
};
loadTab();
// 筛选
$(document).on('click', "#filter-btn", function() {
reloadTab();
//g.options.columns[1].hidden = false;
//g.options.columns[2].hidden = true;
//g.options.columns[3].hidden = true;
//g.options.columns[4].hidden = true;
//g.options.columns[5].hidden = false;
//g.options.columns[6].hidden = true;
layoutGridCloum(currentTab);
g.reload();
});
$(document).on('click', ".edit-class-btn", function() {
currentBtnType = $(this).data('type');
var url = '';
var alertContent;
currentSelItem = g.rows[$(this).data("index")];
var data = function() {
var reason = $('#reason').val();
if (reason === '' || $.trim(reason) === '') {
if(currentBtnType == 'reject') {
return "请填写驳回原因";
}
}
return {
brandName: currentSelItem.brandName,
brandId: currentSelItem.brandId,
rejectReason: reason,
isPayDelivery: currentBtnType=='open'?1:0,
checkStatus: currentBtnType=='pass'?200:300,
id: currentSelItem.id
};
};
switch (currentBtnType) {
case 'open':
{
url = '/payDelivery/addPayDeliveryCheck';
alertContent = '开启货到付款无需组长审核,您确定开启吗?';
}
break;
case 'close':
{
url = '/payDelivery/addPayDeliveryCheck';
alertContent = '关闭货到付款需组长审核,您确定提交此申请吗?';
}
break;
case 'pass':
{
url = '/payDelivery/reviewPayDeliveryCheck';
alertContent = '您确定要通过申请吗?';
}
break;
case 'reject':
{
url = '/payDelivery/reviewPayDeliveryCheck';
alertContent = $("#template").html();
}
break;
default :
{
url = '';
alertContent = '未知弹框~';
}
break;
}
common.dialog.confirm("温馨提示", alertContent, function() {
common.util.__ajax({
url: url,
data: data()
}, function() {
g.reload();
reloadTab();
});
});
});
$('#export-btn').on('click', function() {
window.open("/ajax/down?queryConf=" + JSON.stringify(g.options.parms()) + "&type=brandPayDeliveryExport");
});
/***/ }
]);