...
|
...
|
@@ -24,12 +24,38 @@ var Bll = { |
|
|
$('#shopName b').text(rs.data);
|
|
|
$('#select2-shop-select-container').text(rs.data);
|
|
|
},true);
|
|
|
Bll.showList(1);
|
|
|
Bll.showList(0);
|
|
|
}
|
|
|
},
|
|
|
//新增,编辑销售类目名称
|
|
|
toast: function (type, url, name, id) {
|
|
|
var self = this;
|
|
|
common.dialog.confirm(
|
|
|
type == 0 ? "新增销售类目" : "编辑销售类目",
|
|
|
common.util.__template2($("#addTemplate").html(),{data:name}),
|
|
|
function () {
|
|
|
var categoryName = $('#categoryName').val();
|
|
|
if($.trim(categoryName) != ''){
|
|
|
common.util.__ajax({
|
|
|
url:url,
|
|
|
data: {
|
|
|
shopId:currentShopId,
|
|
|
categoryId: id,
|
|
|
categoryName: categoryName
|
|
|
}
|
|
|
},function (rs) {
|
|
|
self.showList(0);
|
|
|
});
|
|
|
}else{
|
|
|
common.util.__tip('店铺销售类目名称不能为空!');
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
)
|
|
|
},
|
|
|
//展示销售类目列表
|
|
|
showList: function (isLoading) {
|
|
|
//if(isLoading==1) loadModal = common.dialog.load();
|
|
|
if(isLoading==1) loadModal = common.dialog.load();
|
|
|
|
|
|
common.util.__ajax({
|
|
|
url:'/shops/shopCategory/list',
|
...
|
...
|
@@ -88,7 +114,7 @@ $(document).on('change', '#shop-select', function () { |
|
|
var shopName = this.options[this.selectedIndex].text;
|
|
|
$('#shopId b').text(shopId);
|
|
|
$('#shopName b').text(shopName);
|
|
|
Bll.showList(1);
|
|
|
Bll.showList(0);
|
|
|
}else{
|
|
|
Bll.destoryCategory();
|
|
|
}
|
...
|
...
|
@@ -97,12 +123,20 @@ $(document).on('change', '#shop-select', function () { |
|
|
//新增类目
|
|
|
$(document).on('click', '.addBtn', function () {
|
|
|
if(currentShopCategoryNum < 20){
|
|
|
location.href = '/shop/shopCategory/add/' + currentShopId + '/';
|
|
|
Bll.toast(0, '/shops/shopCategory/add', '', null);
|
|
|
}else {
|
|
|
common.util.__tip('店铺最多添加只能添加20个销售类目!');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//编辑类目名称
|
|
|
$(document).on('click', '.editCategory', function () {
|
|
|
var categoryName = $(this).parent().parent().find('td').eq(1).text();
|
|
|
var categoryId = $(this).data('categoryid');
|
|
|
console.log(categoryId)
|
|
|
Bll.toast(1, '/shops/shopCategory/update', categoryName, categoryId);
|
|
|
});
|
|
|
|
|
|
//删除类目
|
|
|
$(document).on('click', '.deleteBtn', function () {
|
|
|
var categoryName = $(this).parent().parent().find('td').eq(1).text();
|
...
|
...
|
|