index.js
2.14 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
/**
* 商品管理列表
*/
'use strict';
var $ = require('jquery'),
Handlebars = require('yoho.handlebars'),
grid = require('../common/grid'),
dropDown = require('../common/dropDown');
require('../util/jquery.simplePagination');
require('../util/jquery.gritter');
exports.init = function() {
//下拉框
$('.select2-offscreen').select2();
new dropDown({
el:'#brand-id',
ajax:'brand'
});
var btnAuthority = JSON.parse($('#btnAuthority').val());
var g = new grid({
el: '#basicTable',
size: 10,
parms: function() {
return {
skn: $.trim($('#skn').val()) || '',
brandName: $.trim($('#brand-name').val()) || '',
storeName: $.trim($('#store-name').val()) || '',
status: $.trim($('#status').val()) || '',
jit: $.trim($('#jit').val()) || ''
};
},
columns: [
{display: 'SKN', name: 'skn'},
{display: '图片', name: "goodsIcon", render: function(item) {
return '<img src="' + item.goodsIcon + '">';
}},
{display: '商品名称', name: "goodsName"},
{display: '品牌', name: "brandName"},
{display: '吊牌价', name: "price"},
{display: '更新时间', name: "updateTime"},
{display: '操作', name:"status", render: function(items) {
var HtmArr = [];
if (btnAuthority.detail) {
HtmArr.push('<a href="supplier/baseaudit/info?product_skn='+ items.skn+'"" class="btn btn-info btn-xs">详情</a>');
}
if (items.status === 0) {
HtmArr.push('<a data-id="' + items.id + '" href="JavaScript:;" class="btn btn-warning btn-xs open-brand">开启品牌</a>');
}
if (items.status === 1) {
HtmArr.push('<a data-id="' + items.id + '" href="JavaScript:;" class="btn btn-danger btn-xs close-brand">关闭品牌</a>');
}
return HtmArr.join('');
}}
]
})
g.init($("#gridurl").val());
}