productPool.js
3.23 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
var $ = require('jquery'),
common = require('../common/common');
var g = new common.grid({
el: "#product-pool",
parms: function () {
return {
id: common.util.__input('search-id'),
poolName: common.util.__input('search-name')
};
},
columns: [
{display: "商品池编号", name: "id"},
{display: "商品池名称", name: "poolName"},
{display: "说明", name: "comment"},
{display: "SKN个数", name: "total"},
{
display: "操作", name: "", render: function (item) {
return '<a class="btn btn-info detail" data-index="' + item.__index + '">详情</a>';
}
}
]
});
g.init('/market/productPool/queryProductPoolPage');
var Bll = {
toast:function(url) {
var e = new common.edit("#baseform", {bucket: "productPool"});
common.dialog.confirm("添加商品池",
common.util.__template($("#template").html(), {}),
function() {
e.submit(url,function(option){
//option.data;
option.success=function(){
g.reload();
};
option.error=function(){
}
});
});
e.init();
new common.dropDown({el: "#producttype"});
},
detailtoast:function(index) {
common.dialog({
title:"商品池详情",
content:'<div id="faGrid" style="height: 600px;overflow:auto;"></div>',
button:[{value:"添加", callback:function() {
var e = new common.edit("#baseform", {bucket: "productPool"});
common.dialog.confirm("添加商品池",
common.util.__template($("#template1").html(), {}),
function() {
e.submit("/market/productPool/addProductPoolDetailBo",function(option){
//option.data;
option.success=function(){
g.reload();
};
option.error=function(){
}
});
});
e.init();
return false;
}}]
});
var grid = new common.grid({
el:"#faGrid",
parms: function() {
return {id: index};
},
columns:[
{display:"ID", name:"id"},
{display:"SKN",name:"productskn"},
{display:"名称", name:""},
{display:'品牌', name: "brandName"},
{display: '分类',name: "sortName"},
{display: '操作', name: "", render: function(item) {
return '<a class="btn btn-info delbtn" data-index="' + item.__index + '">删除</a>';
}}
]
});
grid.init('/market/productPool/queryProductPoolDetailPage');
$(document).on('click', '.delbtn', function() {
var item = grid.rows[$(this).data("index")];
common.util.__ajax({
url:'/market/productPool/deleteProductPoolDetailBo',
data:{id:item.id}
},function(res) {
grid.reload();
});
});
}
};
$("#add-pool").on('click', function() {
Bll.toast("/market/productPool/addProductPoolBo");
});
$(document).on("click", ".detail", function() {
var item=g.rows[$(this).data("index")];
Bll.detailtoast(item.id);
});
$(document).on("click","#filter-btn",function () {
g.reload(1);
});