...
|
...
|
@@ -28,6 +28,7 @@ $(document).on("change", ".observe", function () { |
|
|
*/
|
|
|
var Bll = {
|
|
|
Brands: [],//品牌数据
|
|
|
selectSorts: [],//分类数据
|
|
|
getBrands: function () {//获取品牌数据
|
|
|
var Brand = {};
|
|
|
$.get("/ajax/yohosearch", function (res) {
|
...
|
...
|
@@ -92,6 +93,7 @@ var Bll = { |
|
|
}
|
|
|
}
|
|
|
},
|
|
|
|
|
|
checkSortNum: function () {
|
|
|
if ($('.sort-wrap').find('.row').size() > 1) {
|
|
|
$('.sort-wrap').find('.row').find('.add-sort-btn').hide().end().find('.del-sort-btn').show();
|
...
|
...
|
@@ -100,15 +102,15 @@ var Bll = { |
|
|
$('.sort-wrap').find('.row:first').find('.add-sort-btn').show().end().find('.del-sort-btn').hide();
|
|
|
}
|
|
|
},
|
|
|
setTabTree:function () {
|
|
|
var data={},NUMN={};
|
|
|
setTabTree: function () {//分类数据,设置tabTree
|
|
|
var data = {}, NUMN = {};
|
|
|
common.util.__ajax({
|
|
|
url:'/product/class/queryAllProductSortList',
|
|
|
data:{}
|
|
|
},function(res){
|
|
|
data=res.data;
|
|
|
},true);
|
|
|
NUMN={
|
|
|
url: '/product/class/queryAllProductSortList',
|
|
|
data: {}
|
|
|
}, function (res) {
|
|
|
data = res.data;
|
|
|
}, true);
|
|
|
NUMN = {
|
|
|
columns: [{
|
|
|
state: "prov",
|
|
|
text: "一级分类",
|
...
|
...
|
@@ -141,12 +143,13 @@ if (type == 'add') { |
|
|
} else {
|
|
|
var id = location.href.substring(location.href.lastIndexOf("/") + 1);
|
|
|
common.util.__ajax({
|
|
|
url: "/coupon/queryCouponList",
|
|
|
data: {couponId: id}
|
|
|
url: "/coupon/getCouponDetailById",
|
|
|
data: {couponsId: id}
|
|
|
}, function (res) {
|
|
|
couponBean = res.data.list[0];
|
|
|
couponBean = res.data;
|
|
|
couponBean.startTime = Bll.getTime(couponBean.startTime);
|
|
|
couponBean.endTime = Bll.getTime(couponBean.endTime);
|
|
|
Bll.selectSorts=couponBean.sortList||[];
|
|
|
Bll.__render(couponBean, type)
|
|
|
}, true);
|
|
|
}
|
...
|
...
|
@@ -205,9 +208,7 @@ $(document).on("click", "#save_brand", function () { |
|
|
|
|
|
/********************************************************分类相关****************************************/
|
|
|
var tabTreeArr = [], tabTree;
|
|
|
|
|
|
//选择分类
|
|
|
$(document).on('click', "#addSorts", function () {
|
|
|
var initSort = function () {//初始化分类弹框
|
|
|
var data1 = {};
|
|
|
common.dialog({
|
|
|
title: "选择分类",
|
...
|
...
|
@@ -217,10 +218,12 @@ $(document).on('click', "#addSorts", function () { |
|
|
value: "保存",
|
|
|
callback: function () {
|
|
|
var ids = [];
|
|
|
Bll.selectSorts = [];
|
|
|
if (tabTreeArr.length > 0) {
|
|
|
for (var i = 0; i < tabTreeArr.length; i++) {
|
|
|
for(var j=0;j<tabTreeArr[i].selected.length;j++){
|
|
|
if(j<=1){
|
|
|
Bll.selectSorts.push(tabTreeArr[i].selected);
|
|
|
for (var j = 0; j < tabTreeArr[i].selected.length; j++) {
|
|
|
if (j <= 1) {
|
|
|
ids.push(tabTreeArr[i].selected[j].id);
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -233,11 +236,42 @@ $(document).on('click', "#addSorts", function () { |
|
|
value: "返回"
|
|
|
}]
|
|
|
});
|
|
|
tabTreeArr = [];
|
|
|
tabTree = new common.tabTree(".sortTree",Bll.setTabTree());
|
|
|
tabTree.init();
|
|
|
tabTreeArr.push(tabTree);
|
|
|
Bll.checkSortNum();
|
|
|
};
|
|
|
//选择分类
|
|
|
$(document).on('click', "#addSorts", function () {
|
|
|
if (Bll.selectSorts && Bll.selectSorts.length > 0) {
|
|
|
//渲染物理类目
|
|
|
var selectedArr = [];
|
|
|
for (var i = 0; i < Bll.selectSorts.length; i++) {
|
|
|
var arr = [];
|
|
|
$.each(Bll.selectSorts[i], function (i, item) {
|
|
|
arr.push({id: item.id, sortName: item.sortName});
|
|
|
});
|
|
|
selectedArr.push(arr);
|
|
|
}
|
|
|
if (selectedArr.length > 0) {
|
|
|
initSort();
|
|
|
$('.sort-wrap').empty();
|
|
|
tabTreeArr = [];
|
|
|
$.each(selectedArr, function (i, item) {
|
|
|
var $sortGroup = $($('#sortWrap').html());
|
|
|
$sortGroup.appendTo($('.sort-wrap'));
|
|
|
Bll.checkSortNum();
|
|
|
tabTree = new common.tabTree(".sortTree:last");
|
|
|
tabTreeArr.push(tabTree);
|
|
|
tabTree.init(item);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
initSort();
|
|
|
tabTreeArr = [];
|
|
|
tabTree = new common.tabTree(".sortTree", Bll.setTabTree());
|
|
|
tabTree.init();
|
|
|
tabTreeArr.push(tabTree);
|
|
|
Bll.checkSortNum();
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
//添加一个分类
|
...
|
...
|
@@ -254,6 +288,7 @@ $(document).on('click', '.del-sort-btn', function () { |
|
|
var sortIndex = $(this).parents('.row').index();
|
|
|
$(this).parents('.row').remove();
|
|
|
tabTreeArr.splice(sortIndex, 1);
|
|
|
Bll.selectSorts.splice(sortIndex, 1);
|
|
|
Bll.checkSortNum();
|
|
|
});
|
|
|
|
...
|
...
|
|