...
|
...
|
@@ -2,9 +2,9 @@ |
|
|
var $ = require('jquery'),
|
|
|
common = require('../../../common/common');
|
|
|
|
|
|
var operate = 0, //操作,0:新增,1:编辑
|
|
|
curShopId = -1,
|
|
|
var curShopId = -1,
|
|
|
curCategoryId = 0,
|
|
|
selectedNum = 0,
|
|
|
curTab = 0;
|
|
|
|
|
|
var g1 = new common.grid({
|
...
|
...
|
@@ -35,7 +35,8 @@ var g1 = new common.grid({ |
|
|
}}
|
|
|
],
|
|
|
complete2: function (res) {
|
|
|
$('.selectedProductsNum').text(res.data.checkedCount);
|
|
|
selectedNum = res.data.checkedCount;
|
|
|
$('.selectedProductsNum').text(selectedNum);
|
|
|
}
|
|
|
});
|
|
|
|
...
|
...
|
@@ -63,7 +64,8 @@ var g2 = new common.grid({ |
|
|
}}
|
|
|
],
|
|
|
complete2: function (res) {
|
|
|
$('.selectedProductsNum').text(res.data.checkedCount);
|
|
|
selectedNum = res.data.list.length;
|
|
|
$('.selectedProductsNum').text(selectedNum);
|
|
|
}
|
|
|
});
|
|
|
|
...
|
...
|
@@ -113,7 +115,8 @@ $(document).on("click", ".nav-tabs li", function () { |
|
|
|
|
|
//选择商品
|
|
|
$(document).on("click", ".selectProduct", function () {
|
|
|
var index = $(this).data("index");
|
|
|
var self = this;
|
|
|
var index = $(self).data("index");
|
|
|
var item = g1.rows[index];
|
|
|
common.util.__ajax({
|
|
|
url:'/shops/shopCategory/link',
|
...
|
...
|
@@ -122,13 +125,16 @@ $(document).on("click", ".selectProduct", function () { |
|
|
productSKN: item.productSKN
|
|
|
}
|
|
|
},function(){
|
|
|
g1.reload();
|
|
|
//g1.reload();
|
|
|
$(self).parent().html('<a href="javascript:" class="btn btn-warning btn-xs cancelProduct" data-index="'+index+'">取消选择</a>');
|
|
|
$('.selectedProductsNum').text(++selectedNum);
|
|
|
}, true);
|
|
|
});
|
|
|
|
|
|
//在全部商品中,取消选择商品
|
|
|
$(document).on("click", ".cancelProduct", function () {
|
|
|
var index = $(this).data("index");
|
|
|
var self = this;
|
|
|
var index = $(self).data("index");
|
|
|
var g = curTab == 0 ? g1 : g2;
|
|
|
var item = g.rows[index];
|
|
|
common.util.__ajax({
|
...
|
...
|
@@ -138,7 +144,13 @@ $(document).on("click", ".cancelProduct", function () { |
|
|
productSKN: item.productSKN
|
|
|
}
|
|
|
},function(){
|
|
|
g.reload();
|
|
|
if(curTab == 0){
|
|
|
$(self).parent().html('<a href="javascript:" class="btn btn-info btn-xs selectProduct" data-index="'+index+'">选择</a>');
|
|
|
$('.selectedProductsNum').text(--selectedNum);
|
|
|
}
|
|
|
if(curTab == 1){
|
|
|
g2.reload();
|
|
|
}
|
|
|
}, true);
|
|
|
});
|
|
|
|
...
|
...
|
@@ -156,16 +168,24 @@ $(document).on("click", ".btn-save", function () { |
|
|
var categoryName = $.trim($('#categoryName').val());
|
|
|
if(categoryName != ''){
|
|
|
common.util.__ajax({
|
|
|
url:'/shops/shopCategory/unlink',
|
|
|
url:'/shops/shopCategory/update',
|
|
|
data:{
|
|
|
shopId: curShopId,
|
|
|
categoryId: curCategoryId,
|
|
|
categoryName: categoryName
|
|
|
}
|
|
|
},function(){
|
|
|
|
|
|
setTimeout(function() {
|
|
|
location.href="/shop/shopCategory/index/" + curShopId;
|
|
|
}, 1000);
|
|
|
});
|
|
|
}else{
|
|
|
common.util.__tip("销售类目名称不能为空!");
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//返回
|
|
|
$(document).on("click", ".btn-return", function () {
|
|
|
location.href="/shop/shopCategory/index/" + curShopId;
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|