...
|
...
|
@@ -6,6 +6,7 @@ var common = require('../common/common'); |
|
|
var couponBean = require('./partials/couponList-bean');
|
|
|
|
|
|
var e = new common.edit2("#basicForm");
|
|
|
|
|
|
var type = $("#basicForm").attr("role"),//类型 新增或修改
|
|
|
action = $("#basicForm").data("action");//路由
|
|
|
var startTimeObj;
|
...
|
...
|
@@ -98,6 +99,38 @@ var Bll = { |
|
|
} else {
|
|
|
$('.sort-wrap').find('.row:first').find('.add-sort-btn').show().end().find('.del-sort-btn').hide();
|
|
|
}
|
|
|
},
|
|
|
setTabTree:function () {
|
|
|
var data={},NUMN={};
|
|
|
common.util.__ajax({
|
|
|
url:'/product/class/queryAllProductSortList',
|
|
|
data:{}
|
|
|
},function(res){
|
|
|
data=res.data;
|
|
|
},true);
|
|
|
NUMN={
|
|
|
columns: [{
|
|
|
state: "prov",
|
|
|
text: "一级分类",
|
|
|
hide: false,
|
|
|
addclass: ""
|
|
|
}, {
|
|
|
state: "city",
|
|
|
text: "二级分类",
|
|
|
hide: false,
|
|
|
addclass: ""
|
|
|
}],
|
|
|
datas: [{
|
|
|
sortName: data.sortName,
|
|
|
code: "",
|
|
|
id: data.id
|
|
|
}, {
|
|
|
sortName: data.subList,
|
|
|
code: "",
|
|
|
id: data.subList
|
|
|
}]
|
|
|
};
|
|
|
return NUMN;
|
|
|
}
|
|
|
};
|
|
|
/**
|
...
|
...
|
@@ -152,17 +185,18 @@ $(document).on("click", "input[name='customType']", function () { |
|
|
$(document).on("keyup", ".number", function () {
|
|
|
$(this).val($(this).val().replace(/\D/g, ''));
|
|
|
});
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 保存
|
|
|
*/
|
|
|
$(document).on("click", "#save_brand", function () {
|
|
|
// console.log(couponBean);
|
|
|
if (e.validate()) {
|
|
|
delete couponBean.useRange;
|
|
|
common.util.__ajax({
|
|
|
url: action,
|
|
|
data: couponBean
|
|
|
}, function (res) {
|
|
|
}, function () {
|
|
|
location.href = "/market/couponList/index";
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -171,21 +205,24 @@ $(document).on("click", "#save_brand", function () { |
|
|
|
|
|
/********************************************************分类相关****************************************/
|
|
|
var tabTreeArr = [], tabTree;
|
|
|
|
|
|
//选择分类
|
|
|
$(document).on('click', "#addSorts", function () {
|
|
|
var data = {};
|
|
|
var data1 = {};
|
|
|
common.dialog({
|
|
|
title: "选择分类",
|
|
|
width: "60%",
|
|
|
content: common.util.__template2($('#editTemp').html(), data),
|
|
|
content: common.util.__template2($('#editTemp').html(), data1),
|
|
|
button: [{
|
|
|
value: "保存",
|
|
|
callback: function () {
|
|
|
var ids = [];
|
|
|
if (tabTreeArr.length > 0) {
|
|
|
for (var i = 0; i < tabTreeArr.length; i++) {
|
|
|
for (var key in tabTreeArr[i].selected) {
|
|
|
ids.push(tabTreeArr[i].selected[key].id);
|
|
|
for(var j=0;j<tabTreeArr[i].selected.length;j++){
|
|
|
if(j<=1){
|
|
|
ids.push(tabTreeArr[i].selected[j].id);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
couponBean.sortLimit = ids.join(',');
|
...
|
...
|
@@ -197,9 +234,7 @@ $(document).on('click', "#addSorts", function () { |
|
|
}]
|
|
|
});
|
|
|
tabTreeArr = [];
|
|
|
tabTree = new common.tabTree(".sortTree", {
|
|
|
sortLevel: 1
|
|
|
});
|
|
|
tabTree = new common.tabTree(".sortTree",Bll.setTabTree());
|
|
|
tabTree.init();
|
|
|
tabTreeArr.push(tabTree);
|
|
|
Bll.checkSortNum();
|
...
|
...
|
@@ -209,9 +244,7 @@ $(document).on('click', "#addSorts", function () { |
|
|
$(document).on('click', '.add-sort-btn', function () {
|
|
|
var $sortGroup = $($('#sortWrap').html());
|
|
|
$sortGroup.appendTo($('.sort-wrap'));
|
|
|
tabTree = new common.tabTree(".sortTree:last", {
|
|
|
sortLevel: 1
|
|
|
});
|
|
|
tabTree = new common.tabTree(".sortTree:last", Bll.setTabTree());
|
|
|
tabTreeArr.push(tabTree);
|
|
|
tabTree.init();
|
|
|
Bll.checkSortNum();
|
...
|
...
|
|