Authored by weiqingting

商品池添加字段

var $ = require('jquery'),
common = require('../common/common'),
util = require('../common/util');
//exports.domain = require('../config/common.js').domain;
// exports.domain = "http://192.168.102.201:8082/platform";
exports.domain = "http://172.16.6.210:8083/platform";
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){
if(res.code == 200) {
util.__tip(res.message, 'success');
$("#sknVal").val(JSON.stringify(res.data.productSkn));
$("#path").val($("#productSkn").val());
} else {
util.__tip(res.message);
}
}
});
//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);
});
\ No newline at end of file
exports.res = [
{
//商品池管理 -> 页面渲染
route: '/market/productPool/index',
method: 'GET',
view: 'pages/market/productPool',
src: '/market/productPool'
}, {
//商品池管理 ->查询商品池分页
route: '/market/productPool/queryProductPoolPage',
method: 'POST',
url: '/pool/queryProductPoolPage',
params: [
{name: 'page', type: 'number'},
{name: 'size', type: 'number',def:10},
{name: 'id', type: 'number'},
{name: 'poolName', type: 'string'}
]
}, {
//添加商品池
route: '/market/productPool/addProductPoolBo',
method: 'POST',
url: '/pool/addProductPoolBo',
params: [
{name: 'activityid', type: 'number'},
{name: 'poolName', type: 'string'},
{name: 'comment', type: 'string'},
{name: 'producttype', type: 'string'},
{name: 'productSkns', type: 'string'}
]
}, {
//商品池详细列表分页
route: '/market/productPool/queryProductPoolDetailPage',
method: 'POST',
url: '/pool/queryProductPoolDetailPage',
params: [
{name: 'page', type: 'number'},
{name: 'size', type: 'number',def:10},
{name: 'id', type: 'number'}
]
}, {
//商品池详细列表删除
route: '/market/productPool/deleteProductPoolDetailBo',
method: 'POST',
url: '/pool/deleteProductPoolDetailBo',
params: [
{name: 'id', type: 'number'}
]
}, {
//商品池详细列表添加
route: '/market/productPool/addProductPoolDetailBo',
method: 'POST',
url: '/pool/addProductPoolDetailBo',
params: [
{name: 'activityid', type: 'number'},
{name: 'poolId', type: 'number'},
{name: 'productskn', type: 'number'},
{name: 'producttype', type: 'number'}
]
}];
\ No newline at end of file
... ...
... ... @@ -67,6 +67,7 @@
<option value="2">SKU</option>
<option value="3">SKC</option>
</select>
<font color="red">要导入的数据类型必须和所选类型相同</font>
</div>
</div>
<div class="form-group">
... ...