|
|
var $ = require('jquery'),
|
|
|
common = require('../common/common');
|
|
|
// module;
|
|
|
var ENUM={};
|
|
|
common = require('../common/common');
|
|
|
// module;
|
|
|
var ENUM = {};
|
|
|
// common.util.__ajax({
|
|
|
// url:'/guang/article/getEnumList',
|
|
|
// async:false
|
...
|
...
|
@@ -10,91 +10,110 @@ var ENUM={}; |
|
|
// });
|
|
|
console.log(ENUM);
|
|
|
|
|
|
var edit=new common.edit(".modal-body",{bucket:"goodsimg"});
|
|
|
var edit = new common.edit(".modal-body", {
|
|
|
bucket: "goodsimg"
|
|
|
});
|
|
|
|
|
|
var Bll={
|
|
|
Brands:[],
|
|
|
Brands1:{},
|
|
|
Brdata:[],
|
|
|
getBrands:function(){
|
|
|
var Brand={};
|
|
|
$.get("/ajax/yohosearch",function(res){
|
|
|
res.data.forEach(function(item,index){
|
|
|
var brandAlif=(item.brand_alif||"").toUpperCase();
|
|
|
if(/^[0-9]$/.test(item.brand_alif)){
|
|
|
brandAlif="0-9";
|
|
|
}
|
|
|
if(/^\W$/.test(item.brand_alif)){
|
|
|
brandAlif="#";
|
|
|
var Bll = {
|
|
|
Brands: [],
|
|
|
Brands1: {},
|
|
|
Brdata: [],
|
|
|
getBrands: function() {
|
|
|
var Brand = {};
|
|
|
$.get("/ajax/yohosearch", function(res) {
|
|
|
res.data.forEach(function(item, index) {
|
|
|
var brandAlif = (item.brand_alif || "").toUpperCase();
|
|
|
if (/^[0-9]$/.test(item.brand_alif)) {
|
|
|
brandAlif = "0-9";
|
|
|
}
|
|
|
if (/^\W$/.test(item.brand_alif)) {
|
|
|
brandAlif = "#";
|
|
|
}
|
|
|
Brand[brandAlif] = Brand[brandAlif] || [];
|
|
|
Brand[brandAlif].push(item);
|
|
|
Bll.Brands1[item.id] = item;
|
|
|
});
|
|
|
for (var i in Brand) {
|
|
|
Brand[i].sort(function(a, b) {
|
|
|
var aName = a.brand_name.toLowerCase(),
|
|
|
bName = b.brand_name.toLowerCase();
|
|
|
if (aName < bName) return -1;
|
|
|
if (aName > bName) return 1;
|
|
|
return 0;
|
|
|
});
|
|
|
Bll.Brands.push({
|
|
|
name: i,
|
|
|
items: Brand[i]
|
|
|
});
|
|
|
}
|
|
|
Brand[brandAlif]=Brand[brandAlif]||[];
|
|
|
Brand[brandAlif].push(item);
|
|
|
Bll.Brands1[item.id]=item;
|
|
|
});
|
|
|
for(var i in Brand){
|
|
|
Bll.Brands.push({name:i,items:Brand[i]});
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
renderBrandPic:function(Brdata){
|
|
|
var Brands2=[];
|
|
|
Brdata.forEach(function(item,index){
|
|
|
var a=Bll.Brands1[item.id]
|
|
|
//图片的绝对路径是多少
|
|
|
a.brand_ico=common.util.__joinImg("brandLogo",a.brand_ico)
|
|
|
Brands2.push(a);
|
|
|
});
|
|
|
$("#addBrands").parent("div").parent("li").prevAll().remove();
|
|
|
$("#addPic").prepend(common.util.__template2($("#template3").html(),{Brands:Brands2}));
|
|
|
},
|
|
|
contentDatas:[],
|
|
|
module:null,
|
|
|
toast:function(index,module){
|
|
|
var d=new common.dialog({
|
|
|
title:(!!~index?"修改":"添加")+module.template_intro,
|
|
|
content:common.util.__template2($("#"+module.dialog).html(),module),
|
|
|
width:'70%',
|
|
|
button:[
|
|
|
{
|
|
|
value: "保存",
|
|
|
callback: function(){
|
|
|
if(edit.validate()){
|
|
|
//TODO
|
|
|
!!~index?Bll.contentDatas[index]=module:Bll.contentDatas.push(module);
|
|
|
Bll.rendContent();
|
|
|
console.log(Bll.contentDatas);
|
|
|
|
|
|
d.close();
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
},
|
|
|
css: "btn-primary"
|
|
|
},
|
|
|
renderBrandPic: function(Brdata) {
|
|
|
var Brands2 = [];
|
|
|
Brdata.forEach(function(item, index) {
|
|
|
var a = Bll.Brands1[item.id]
|
|
|
//图片的绝对路径是多少
|
|
|
a.brand_ico = common.util.__joinImg("brandLogo", a.brand_ico)
|
|
|
Brands2.push(a);
|
|
|
});
|
|
|
$("#addBrands").parent("div").parent("li").prevAll().remove();
|
|
|
$("#addPic").prepend(common.util.__template2($("#template3").html(), {
|
|
|
Brands: Brands2
|
|
|
}));
|
|
|
},
|
|
|
contentDatas: [],
|
|
|
module: null,
|
|
|
toast: function(index, module) {
|
|
|
var d = new common.dialog({
|
|
|
title: (!!~index ? "修改" : "添加") + module.template_intro,
|
|
|
content: common.util.__template2($("#" + module.dialog).html(), module),
|
|
|
width: '70%',
|
|
|
button: [{
|
|
|
value: "保存",
|
|
|
callback: function() {
|
|
|
if (edit.validate()) {
|
|
|
//TODO
|
|
|
!!~index ? Bll.contentDatas[index] = module : Bll.contentDatas.push(module);
|
|
|
Bll.rendContent();
|
|
|
console.log(Bll.contentDatas);
|
|
|
|
|
|
d.close();
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
},
|
|
|
css: "btn-primary"
|
|
|
}]
|
|
|
});
|
|
|
edit.init();
|
|
|
edit.on("callback", function(obj) {
|
|
|
if (/^file_onComplete/.test(obj.key)) {
|
|
|
//(!!~index?index:0)
|
|
|
var _field = obj.key.replace(/^file_onComplete_file__/, '').split('-');
|
|
|
Bll.module.data[_field[1]].src = obj.data;
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
edit.init();
|
|
|
edit.on("callback", function(obj) {
|
|
|
if(/^file_onComplete/.test(obj.key)){
|
|
|
//(!!~index?index:0)
|
|
|
var _field=obj.key.replace(/^file_onComplete_file__/,'').split('-');
|
|
|
Bll.module.data[_field[1]].src=obj.data;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
rendContent:function(){
|
|
|
$("#add-content").html(common.util.__template2($("#template_content").html(),{modules:Bll.contentDatas}));
|
|
|
},
|
|
|
__render:function(selecter,templater,data){
|
|
|
$(selecter).html(common.util.__template2($("#"+templater).html(),data) );
|
|
|
},
|
|
|
Tags:[]
|
|
|
}
|
|
|
//获取品牌
|
|
|
});
|
|
|
},
|
|
|
rendContent: function() {
|
|
|
$("#add-content").html(common.util.__template2($("#template_content").html(), {
|
|
|
modules: Bll.contentDatas
|
|
|
}));
|
|
|
},
|
|
|
__render: function(selecter, templater, data) {
|
|
|
$(selecter).html(common.util.__template2($("#" + templater).html(), data));
|
|
|
},
|
|
|
Tags: []
|
|
|
}
|
|
|
//获取品牌
|
|
|
Bll.getBrands();
|
|
|
|
|
|
$(document).on('click', '.brand-index', function() {
|
|
|
var brandIndex = $(this).text();
|
|
|
$('.brand-wrap').find('[name="' + brandIndex + '"]').show().siblings().hide();
|
|
|
});
|
|
|
|
|
|
/*渲染页面*/
|
|
|
$("#panel-body").html(common.util.__template2($("#tempalte1").html(),ENUM));
|
|
|
$("#panel-body").html(common.util.__template2($("#tempalte1").html(), ENUM));
|
|
|
/*渲染品牌*/
|
|
|
// Bll.Brdata=ENUM.brands;
|
|
|
// Bll.renderBrandPic(Bll.Brdata);
|
...
|
...
|
@@ -105,301 +124,340 @@ $("#panel-body").html(common.util.__template2($("#tempalte1").html(),ENUM)); |
|
|
// Bll.contentDatas=ENUM.contentData;
|
|
|
|
|
|
|
|
|
new common.dropDown({el:"#authorId",ajax:"guangGetAuthorList"});
|
|
|
new common.dropDown({el:"#maxSortId",ajax:"guangGetSortList",params:function(){
|
|
|
return {pid:0};
|
|
|
}});
|
|
|
new common.dropDown({el:"#minSortId",ajax:"guangGetSortList",params:function(){
|
|
|
return {pid:$("#maxSortId").val()};
|
|
|
}});
|
|
|
new common.dropDown({
|
|
|
el: "#authorId",
|
|
|
ajax: "guangGetAuthorList"
|
|
|
});
|
|
|
new common.dropDown({
|
|
|
el: "#maxSortId",
|
|
|
ajax: "guangGetSortList",
|
|
|
params: function() {
|
|
|
return {
|
|
|
pid: 0
|
|
|
};
|
|
|
}
|
|
|
});
|
|
|
new common.dropDown({
|
|
|
el: "#minSortId",
|
|
|
ajax: "guangGetSortList",
|
|
|
params: function() {
|
|
|
return {
|
|
|
pid: $("#maxSortId").val()
|
|
|
};
|
|
|
}
|
|
|
});
|
|
|
|
|
|
var g= new common.grid({
|
|
|
el:"#gird",
|
|
|
columns:[
|
|
|
{display:"选择","type":"checkbox"},
|
|
|
{display:"标签名",name:"tagName"}
|
|
|
]
|
|
|
var g = new common.grid({
|
|
|
el: "#gird",
|
|
|
columns: [{
|
|
|
display: "选择",
|
|
|
"type": "checkbox"
|
|
|
}, {
|
|
|
display: "标签名",
|
|
|
name: "tagName"
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
$(document).on("click","#addUrl",function(){
|
|
|
common.dialog.confirm("添加链接",common.util.__template2($("#template2").html(),{}),function(){
|
|
|
$(document).on("click", "#addUrl", function() {
|
|
|
common.dialog.confirm("添加链接", common.util.__template2($("#template2").html(), {}), function() {
|
|
|
$("#url").val(JSON.stringify({
|
|
|
action:'go.'+$("#goTo").val(),
|
|
|
url:$("#goToUrl").val()
|
|
|
action: 'go.' + $("#goTo").val(),
|
|
|
url: $("#goToUrl").val()
|
|
|
}));
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$(document).on("click","#TagsSelectBtn",function(){
|
|
|
common.dialog.confirm("选择标签","<div id='gird'></div>",function(){
|
|
|
Bll.Tags=g.selected;
|
|
|
Bll.__render("#taglist","template4",{tags:Bll.Tags});
|
|
|
$(document).on("click", "#TagsSelectBtn", function() {
|
|
|
common.dialog.confirm("选择标签", "<div id='gird'></div>", function() {
|
|
|
Bll.Tags = g.selected;
|
|
|
Bll.__render("#taglist", "template4", {
|
|
|
tags: Bll.Tags
|
|
|
});
|
|
|
});
|
|
|
g.init('/guang/tags/getList');
|
|
|
});
|
|
|
$(document).on("click",".tag a",function(){
|
|
|
Bll.Tags.splice($(this).data("index"),1);
|
|
|
Bll.__render("#taglist","template4",{tags:Bll.Tags});
|
|
|
$(document).on("click", ".tag a", function() {
|
|
|
Bll.Tags.splice($(this).data("index"), 1);
|
|
|
Bll.__render("#taglist", "template4", {
|
|
|
tags: Bll.Tags
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
$(document).on("click","#addBrands",function(){
|
|
|
$(document).on("click", "#addBrands", function() {
|
|
|
///goods/brands/queryBrandsByStatus
|
|
|
var e=new common.edit("#brandForm");
|
|
|
common.dialog.confirm("选择品牌",common.util.__template2($("#template5").html(),{Brands:Bll.Brands,Brdata:Bll.Brdata.join('|')}),function(){
|
|
|
var e = new common.edit("#brandForm");
|
|
|
common.dialog.confirm("选择品牌", common.util.__template2($("#template5").html(), {
|
|
|
Brands: Bll.Brands,
|
|
|
Brdata: Bll.Brdata.join('|')
|
|
|
}), function() {
|
|
|
//todo
|
|
|
Bll.Brdata=$("#brandCheckBox").val().split('|');
|
|
|
Bll.Brdata=Bll.Brdata.map(function(item,index){
|
|
|
Bll.Brdata = $("#brandCheckBox").val().split('|');
|
|
|
Bll.Brdata = Bll.Brdata.map(function(item, index) {
|
|
|
return {
|
|
|
"brandCategory": "2",
|
|
|
"id": item
|
|
|
"brandCategory": "2",
|
|
|
"id": item
|
|
|
}
|
|
|
});
|
|
|
Bll.renderBrandPic(Bll.Brdata);
|
|
|
});
|
|
|
e.init();
|
|
|
});
|
|
|
$(document).on("click",".remove1",function(){
|
|
|
Bll.Brdata.splice($(this).data("index"),1);
|
|
|
$(document).on("click", ".remove1", function() {
|
|
|
Bll.Brdata.splice($(this).data("index"), 1);
|
|
|
Bll.renderBrandPic(Bll.Brdata);
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
var Button=[
|
|
|
{
|
|
|
template_intro:"文本",
|
|
|
dialog:"template_dialog_text",
|
|
|
data:{text:""},
|
|
|
template_name:"text"
|
|
|
},
|
|
|
{
|
|
|
template_intro:"一张大图",
|
|
|
dialog:"template_dialog_grid",
|
|
|
template_name:"singleImage",
|
|
|
data:[{
|
|
|
"url": "",
|
|
|
"alt": "",
|
|
|
"src": "",
|
|
|
"imgId": ""
|
|
|
}]
|
|
|
},
|
|
|
{
|
|
|
template_intro:"两张小图",
|
|
|
dialog:"template_dialog_grid",
|
|
|
template_name:"smallPic",
|
|
|
data:[{
|
|
|
"url": "",
|
|
|
"alt": "",
|
|
|
"src": "",
|
|
|
"imgId": ""
|
|
|
},{
|
|
|
"url": "",
|
|
|
"alt": "",
|
|
|
"src": "",
|
|
|
"imgId": ""
|
|
|
}]
|
|
|
var Button = [{
|
|
|
template_intro: "文本",
|
|
|
dialog: "template_dialog_text",
|
|
|
data: {
|
|
|
text: ""
|
|
|
},
|
|
|
{
|
|
|
template_intro:"添加商品",
|
|
|
dialog:"template_dialog_goods",
|
|
|
template_name:"goods",
|
|
|
data:[
|
|
|
template_name: "text"
|
|
|
}, {
|
|
|
template_intro: "一张大图",
|
|
|
dialog: "template_dialog_grid",
|
|
|
template_name: "singleImage",
|
|
|
data: [{
|
|
|
"url": "",
|
|
|
"alt": "",
|
|
|
"src": "",
|
|
|
"imgId": ""
|
|
|
}]
|
|
|
}, {
|
|
|
template_intro: "两张小图",
|
|
|
dialog: "template_dialog_grid",
|
|
|
template_name: "smallPic",
|
|
|
data: [{
|
|
|
"url": "",
|
|
|
"alt": "",
|
|
|
"src": "",
|
|
|
"imgId": ""
|
|
|
}, {
|
|
|
"url": "",
|
|
|
"alt": "",
|
|
|
"src": "",
|
|
|
"imgId": ""
|
|
|
}]
|
|
|
}, {
|
|
|
template_intro: "添加商品",
|
|
|
dialog: "template_dialog_goods",
|
|
|
template_name: "goods",
|
|
|
data: [
|
|
|
// {
|
|
|
// src:"",
|
|
|
// id:""
|
|
|
// }
|
|
|
]
|
|
|
}, {
|
|
|
template_intro: "推荐商品组",
|
|
|
dialog: "template_dialog_remgoods",
|
|
|
template_name: "goodsGroup",
|
|
|
data: [{
|
|
|
cover: {
|
|
|
cover: "",
|
|
|
maxSortId: ""
|
|
|
},
|
|
|
list: [
|
|
|
// {
|
|
|
// src:"",
|
|
|
// id:""
|
|
|
// id:"",
|
|
|
// maxSortId:""
|
|
|
// }
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
template_intro:"推荐商品组",
|
|
|
dialog:"template_dialog_remgoods",
|
|
|
template_name:"goodsGroup",
|
|
|
data:[
|
|
|
{
|
|
|
cover:{cover:"",maxSortId:""},
|
|
|
list:[
|
|
|
// {
|
|
|
// src:"",
|
|
|
// id:"",
|
|
|
// maxSortId:""
|
|
|
// }
|
|
|
]
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
template_intro:"一个连接",
|
|
|
dialog:"template_dialog_link",
|
|
|
template_name:"link",
|
|
|
data:[
|
|
|
{"url":{"action":"","url":""}}
|
|
|
]
|
|
|
}
|
|
|
];
|
|
|
}]
|
|
|
}, {
|
|
|
template_intro: "一个连接",
|
|
|
dialog: "template_dialog_link",
|
|
|
template_name: "link",
|
|
|
data: [{
|
|
|
"url": {
|
|
|
"action": "",
|
|
|
"url": ""
|
|
|
}
|
|
|
}]
|
|
|
}];
|
|
|
|
|
|
$("#content_btns").html(common.util.__template2($("#template_content_btns").html(),{btns:Button}));
|
|
|
$("#content_btns").html(common.util.__template2($("#template_content_btns").html(), {
|
|
|
btns: Button
|
|
|
}));
|
|
|
|
|
|
|
|
|
$(document).on("click",".add_btn",function(){
|
|
|
var item=Button[$(this).data("index")];
|
|
|
Bll.module=$.extend(true,{},item);
|
|
|
Bll.toast(-1,Bll.module);
|
|
|
$(document).on("click", ".add_btn", function() {
|
|
|
var item = Button[$(this).data("index")];
|
|
|
Bll.module = $.extend(true, {}, item);
|
|
|
Bll.toast(-1, Bll.module);
|
|
|
});
|
|
|
$(document).on("click",".del",function(){
|
|
|
Bll.contentDatas.splice($(this).data("index"),1);
|
|
|
$(document).on("click", ".del", function() {
|
|
|
Bll.contentDatas.splice($(this).data("index"), 1);
|
|
|
Bll.rendContent();
|
|
|
});
|
|
|
|
|
|
$(document).on("change",".observe",function(){
|
|
|
var $this=$(this);
|
|
|
var name=$this.data("field"),index=$this.data("index");
|
|
|
var module=(index==undefined)?Bll.module.data:Bll.module.data[index];
|
|
|
common.util.__buildobj(name,'.',module,function(obj,name){
|
|
|
obj[name]=$this.val();
|
|
|
$(document).on("change", ".observe", function() {
|
|
|
var $this = $(this);
|
|
|
var name = $this.data("field"),
|
|
|
index = $this.data("index");
|
|
|
var module = (index == undefined) ? Bll.module.data : Bll.module.data[index];
|
|
|
common.util.__buildobj(name, '.', module, function(obj, name) {
|
|
|
obj[name] = $this.val();
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$(document).on("click",".edit",function(){
|
|
|
var index=$(this).data("index");
|
|
|
var item=Bll.contentDatas[index];
|
|
|
$(document).on("click", ".edit", function() {
|
|
|
var index = $(this).data("index");
|
|
|
var item = Bll.contentDatas[index];
|
|
|
console.log(Bll.contentDatas);
|
|
|
Bll.module=$.extend(true,{},item);
|
|
|
Bll.toast(index,Bll.module);
|
|
|
Bll.module = $.extend(true, {}, item);
|
|
|
Bll.toast(index, Bll.module);
|
|
|
});
|
|
|
|
|
|
/*添加商品*/
|
|
|
var goodsgird=new common.grid({
|
|
|
el:'#goodsgird',
|
|
|
parms:function(){
|
|
|
var goodsgird = new common.grid({
|
|
|
el: '#goodsgird',
|
|
|
parms: function() {
|
|
|
return {
|
|
|
xxx:"",
|
|
|
xxx1:"",
|
|
|
xxx: "",
|
|
|
xxx1: "",
|
|
|
};
|
|
|
},
|
|
|
columns:[
|
|
|
{display:"选择",type:"checkbox"},
|
|
|
{display:"产品图片",render:function(item){
|
|
|
item.default_images=common.util.__joinImg("goodsimg",item.default_images)
|
|
|
return "<img width=120 height=60 src='"+item.default_images+"'/>";
|
|
|
}},
|
|
|
{display:"产品名称",name:"product_name"},
|
|
|
{display:"品牌",name:"brand_name"},
|
|
|
{display:"现价",name:"sales_price"},
|
|
|
{display:"牌价",name:"market_price"},
|
|
|
{display:"预售",name:"stock_number"},
|
|
|
{display:"库存",name:"storage_num"}
|
|
|
]
|
|
|
columns: [{
|
|
|
display: "选择",
|
|
|
type: "checkbox"
|
|
|
}, {
|
|
|
display: "产品图片",
|
|
|
render: function(item) {
|
|
|
item.default_images = common.util.__joinImg("goodsimg", item.default_images)
|
|
|
return "<img width=120 height=60 src='" + item.default_images + "'/>";
|
|
|
}
|
|
|
}, {
|
|
|
display: "产品名称",
|
|
|
name: "product_name"
|
|
|
}, {
|
|
|
display: "品牌",
|
|
|
name: "brand_name"
|
|
|
}, {
|
|
|
display: "现价",
|
|
|
name: "sales_price"
|
|
|
}, {
|
|
|
display: "牌价",
|
|
|
name: "market_price"
|
|
|
}, {
|
|
|
display: "预售",
|
|
|
name: "stock_number"
|
|
|
}, {
|
|
|
display: "库存",
|
|
|
name: "storage_num"
|
|
|
}]
|
|
|
});
|
|
|
$(document).on("click","#search",function(){
|
|
|
$(document).on("click", "#search", function() {
|
|
|
goodsgird.reload();
|
|
|
});
|
|
|
$(document).on("click","#goodsSelectBtn",function(){
|
|
|
$(document).on("click", "#goodsSelectBtn", function() {
|
|
|
new common.dialog({
|
|
|
title:"选择商品",
|
|
|
content:$("#template_dialog_goodsgird").html(),
|
|
|
width:'80%',
|
|
|
button:[
|
|
|
{
|
|
|
value: "确定",
|
|
|
callback: function(){
|
|
|
Bll.module.data=goodsgird.selected.map(function(item,index){
|
|
|
return {
|
|
|
src:item.default_images,
|
|
|
id:item.product_id
|
|
|
}
|
|
|
});
|
|
|
// Bll.module.data=goodsgird.selected;
|
|
|
Bll.__render("#goodspic","template_dialog_goodsimgs",{datas:Bll.module.data});
|
|
|
},
|
|
|
css: "btn-primary"
|
|
|
}
|
|
|
]
|
|
|
title: "选择商品",
|
|
|
content: $("#template_dialog_goodsgird").html(),
|
|
|
width: '80%',
|
|
|
button: [{
|
|
|
value: "确定",
|
|
|
callback: function() {
|
|
|
Bll.module.data = goodsgird.selected.map(function(item, index) {
|
|
|
return {
|
|
|
src: item.default_images,
|
|
|
id: item.product_id
|
|
|
}
|
|
|
});
|
|
|
// Bll.module.data=goodsgird.selected;
|
|
|
Bll.__render("#goodspic", "template_dialog_goodsimgs", {
|
|
|
datas: Bll.module.data
|
|
|
});
|
|
|
},
|
|
|
css: "btn-primary"
|
|
|
}]
|
|
|
});
|
|
|
goodsgird.init('/yohosearch/search');
|
|
|
});
|
|
|
$(document).on("click",".removepic",function(){
|
|
|
Bll.module.data.splice($(this).data("index"),1);
|
|
|
$("#goodspic").html(common.util.__template2($("#template_dialog_goodsimgs").html(),{datas:Bll.module.data}) );
|
|
|
$(document).on("click", ".removepic", function() {
|
|
|
Bll.module.data.splice($(this).data("index"), 1);
|
|
|
$("#goodspic").html(common.util.__template2($("#template_dialog_goodsimgs").html(), {
|
|
|
datas: Bll.module.data
|
|
|
}));
|
|
|
});
|
|
|
|
|
|
/*添加商品组*/
|
|
|
$(document).on("click","#goodsaddBtn",function(){
|
|
|
$(document).on("click", "#goodsaddBtn", function() {
|
|
|
Bll.module.data.push(Button[4].data[0]);
|
|
|
console.log(Bll.module.data);
|
|
|
Bll.__render("#groupsgoods","template_dialog_remgoodsgroup",Bll.module);
|
|
|
Bll.__render("#groupsgoods", "template_dialog_remgoodsgroup", Bll.module);
|
|
|
});
|
|
|
|
|
|
$(document).on("click",".goodsSelectBtn",function(){
|
|
|
var index=$(this).data("index");
|
|
|
$(document).on("click", ".goodsSelectBtn", function() {
|
|
|
var index = $(this).data("index");
|
|
|
new common.dialog({
|
|
|
title:"选择商品",
|
|
|
content:$("#template_dialog_goodsgird").html(),
|
|
|
width:'80%',
|
|
|
button:[
|
|
|
{
|
|
|
value: "确定",
|
|
|
callback: function(){
|
|
|
goodsgird.selected.forEach(function(item,i){
|
|
|
Bll.module.data[index].list[i]={
|
|
|
src:item.default_images,
|
|
|
id:item.product_id,
|
|
|
maxSortId:1
|
|
|
}
|
|
|
if(!i){
|
|
|
Bll.module.data[index].cover={
|
|
|
cover:item.default_images,
|
|
|
maxSortId:item.product_id
|
|
|
};
|
|
|
}
|
|
|
});
|
|
|
Bll.__render("#groupsgoods","template_dialog_remgoodsgroup",Bll.module);
|
|
|
},
|
|
|
css: "btn-primary"
|
|
|
}
|
|
|
]
|
|
|
title: "选择商品",
|
|
|
content: $("#template_dialog_goodsgird").html(),
|
|
|
width: '80%',
|
|
|
button: [{
|
|
|
value: "确定",
|
|
|
callback: function() {
|
|
|
goodsgird.selected.forEach(function(item, i) {
|
|
|
Bll.module.data[index].list[i] = {
|
|
|
src: item.default_images,
|
|
|
id: item.product_id,
|
|
|
maxSortId: 1
|
|
|
}
|
|
|
if (!i) {
|
|
|
Bll.module.data[index].cover = {
|
|
|
cover: item.default_images,
|
|
|
maxSortId: item.product_id
|
|
|
};
|
|
|
}
|
|
|
});
|
|
|
Bll.__render("#groupsgoods", "template_dialog_remgoodsgroup", Bll.module);
|
|
|
},
|
|
|
css: "btn-primary"
|
|
|
}]
|
|
|
});
|
|
|
goodsgird.init('/yohosearch/search');
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/********************************/
|
|
|
var e=new common.edit("#panel-body",{bucket:"article"});
|
|
|
var e = new common.edit("#panel-body", {
|
|
|
bucket: "article"
|
|
|
});
|
|
|
e.init();
|
|
|
|
|
|
$(document).on("click","#submit",function(){
|
|
|
e.submit($("#panel-body").attr("action"),function(option){
|
|
|
|
|
|
option.data.contentData=[];
|
|
|
Bll.contentDatas.forEach(function(item,index){
|
|
|
var data=common.util.__ArrayToObj({
|
|
|
data:item.data,
|
|
|
template_name:item.template_name,
|
|
|
template_intro:item.template_intro
|
|
|
$(document).on("click", "#submit", function() {
|
|
|
e.submit($("#panel-body").attr("action"), function(option) {
|
|
|
|
|
|
option.data.contentData = [];
|
|
|
Bll.contentDatas.forEach(function(item, index) {
|
|
|
var data = common.util.__ArrayToObj({
|
|
|
data: item.data,
|
|
|
template_name: item.template_name,
|
|
|
template_intro: item.template_intro
|
|
|
});
|
|
|
|
|
|
|
|
|
option.data.contentData.push({
|
|
|
"templateKey":item.template_name,
|
|
|
"contentData":data
|
|
|
"templateKey": item.template_name,
|
|
|
"contentData": data
|
|
|
});
|
|
|
|
|
|
});
|
|
|
console.log("Bll.contentDatas",Bll.Brdata);
|
|
|
option.data.contentData=JSON.stringify(option.data.contentData);
|
|
|
option.data.brands=JSON.stringify(Bll.Brdata);
|
|
|
var Tags=[];
|
|
|
Bll.Tags.forEach(function(item,index){
|
|
|
console.log("Bll.contentDatas", Bll.Brdata);
|
|
|
option.data.contentData = JSON.stringify(option.data.contentData);
|
|
|
option.data.brands = JSON.stringify(Bll.Brdata);
|
|
|
var Tags = [];
|
|
|
Bll.Tags.forEach(function(item, index) {
|
|
|
Tags.push(item.id);
|
|
|
});
|
|
|
option.data.tag=Tags.join(',');
|
|
|
option.data.tag = Tags.join(',');
|
|
|
|
|
|
console.log("submit",option.data);
|
|
|
console.log("submit", option.data);
|
|
|
});
|
|
|
});
|
|
|
/*交互部分*/
|
|
|
|
|
|
|
|
|
/*交互部分*/ |
|
|
\ No newline at end of file |
...
|
...
|
|