productPool.js
3.98 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
var $ = require('jquery'),
common = require('../common/common'),
util = require('../common/util');
var g = new common.grid({
el: "#product-pool",
hash: false,
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() {
common.util.__ajax({
url:url,
data:{
poolName: $("#poolName").val(),
comment: $("#comment").val(),
producttype:$("#producttype").val(),
productSkns:$("#sknVal").val().replace("[", "").replace("]", "")
}
},function() {
g.reload();
});
});
common.edit.ajaxfileupload("#productSkn",{
params: {
type: "productPool",
__type: "batch-import"
},
onComplete:function(res){
util.__tip("上传成功",'success');
$("#sknVal").val(JSON.stringify(res.data.productSkn));
$("#path").val($("#productSkn").val());
}
});
//e.init();
new common.dropDown({el: "#producttype"});
},
detailtoast:function(obj) {
common.dialog({
title:"商品池详情",
content:'<div id="faGrid" style="height: 600px;overflow:auto;"></div>',
button:[{value:"添加", callback:function() {
var e = new common.edit("#base-form");
common.dialog.confirm("添加商品池记录",
common.util.__template($("#template1").html(),
{
poolId:obj.id,
producttype:obj.producttype
}),
function() {
e.submit("/market/productPool/addProductPoolDetailBo",function(option){
//option.data;
option.success=function(res){
util.__tip(res.data.message, "success");
grid.reload();
};
option.error=function(){
}
});
});
e.init();
return false;
}}]
});
var grid = new common.grid({
el:"#faGrid",
hash: false,
parms: function() {
return {id: obj.id};
},
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.dialog.confirm("警告",
"确认删除?",
function() {
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);
});
$(document).on("click","#filter-btn",function () {
g.reload(1);
});