Authored by weiqingting

资源位

... ... @@ -509,3 +509,134 @@ $(document).on("click", "#sub_btn", function() {
window.location.href=window.location.href;
});
});
/****************************************************************************************************/
/*商品,商品组*/
/*选择商品表格*/
var goodsgird = new common.grid({
el: '#goodsgird',
parms: function () {
var beginPrice = 0, endPrice = 1000000;
if (common.util.__input('beginPrice')) {
beginPrice = common.util.__input('beginPrice');
}
if (common.util.__input('endPrice')) {
endPrice = common.util.__input('endPrice')
}
return {
query: common.util.__input('skns'),
price: beginPrice + "," + endPrice
};
},
columns: [
{
display: "选择",
type: "checkbox"
}, {
display: "产品图片",
render: function (item) {
if (item.images_url) {
item.images_url = common.util.__joinImg("goodsimg", item.images_url);
}
else {
item.images_url = "";
}
return "<img width=120 height=60 src='" + item.images_url + "?imageView/2/w/100/h/100'/>";
}
}, {
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() {
goodsgird.reload();
});
//点击“选择标签”按钮(添加商品)
$(document).on("click", "#goodsSelectBtn", function () {
new common.dialog({
title: "选择商品",
content: $("#template_dialog_goodsgird").html(),
width: '80%',
button: [{
value: "确定",
callback: function () {
Bll.module.contentData.data = goodsgird.selected.map(function (item, index) {
return {
src: item.images_url,
id: item.product_skn,
product_skc: item.product_skc
}
});
// Bll.module.data=goodsgird.selected;
Bll.__render("#goodspic", "template_dialog_goodsimgs", {
datas: Bll.module.contentData.data
});
},
css: "btn-primary"
}]
});
goodsgird.init('/yohosearch/search');
});
//点击“添加组”按钮(添加商品组)
$(document).on("click", "#goodsaddBtn", function () {
if(Bll.module.contentData.data[0].list.length){
Bll.module.contentData.data.push(Button[5].data[0]);
}
Bll.__render("#groupsgoods", "template_dialog_remgoodsgroup", Bll.module);
});
//点击“选择标签”按钮(添加商品组)
$(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.contentData.data[index].list[i] = {
src: item.images_url,
id: item.product_skn,
product_skc: item.product_skc,
maxSortId: item.max_sort_id
};
if (!i) {
Bll.module.contentData.data[index].cover = {
cover: item.images_url,
maxSortId: item.max_sort_id
};
}
});
Bll.__render("#groupsgoods", "template_dialog_remgoodsgroup", Bll.module);
},
css: "btn-primary"
}]
});
goodsgird.init('/yohosearch/search');
});
//删除图片按钮
$(document).on("click", ".removepic", function() {
Bll.module.contentData.data.splice($(this).data("index"), 1);
$("#goodspic").html(common.util.__template2($("#template_dialog_goodsimgs").html(), {
datas: Bll.module.contentData.data
}));
});
\ No newline at end of file
... ...
<script type="text/template" id="template_content">
<!-- 文本内容 -->
[[each modules as module index]]
<li class="custom-group" data-index="[[index]]">
<li class="form-group custom-group" data-index="[[index]]" style="width: 100%">
[[if module.contentData.template_name=='text']]
<div class="con">[[module.contentData.data.text]]</div>
<div class="col-sm-12"><h3>[[module.contentData.data.text]]</h3></div>
[[else if module.contentData.template_name=='singleImage']]
<div class="list">
<div class="col-sm-12">
<img src="[[module.contentData.data[0].src]]" title="[[module.contentData.data[0].title]]">
</div>
[[else if module.contentData.template_name=='smallPic']]
<div class="small-pic">
<ul class="small-pic-list">
[[each module.contentData.data as item i]]
<div class="col-sm-6">
<img src="[[item.src]]" title="[[item.title]]">
[[/each]]
</ul>
</div>
[[/each]]
[[else if module.contentData.template_name=='goods']]
<div class="small-pic">
<ul class="small-pic-list">
[[each module.contentData.data as item i]]
<img src="[[item.src]]" title="[[item.id]]">
[[/each]]
</ul>
<div class="col-sm-6">
<img src="[[item.src]]" title="[[item.title]]">
</div>
[[/each]]
[[else if module.contentData.template_name=='link']]
<div class="list">
<div class="col-sm-12">
<h3>添加链接</h3>
</div>
[[else if module.contentData.template_name=='goodsGroup']]
<div class="small-pic">
<div class="small-pic-list2">
<div class="form-group">
[[each module.contentData.data as items i]]
<div class="col-sm-3">
<img src="[[items.cover.cover]]" >
</div>
[[/each]]
</div>
<div class="small-pic-list">
[[each module.contentData.data[0].list as item index]]
<div class="col-sm-6">
<img src="[[item.src]]" title="[[item.id]]">
</div>
[[/each]]
</ul>
</div>
{{> resource/taoyu2}}
[[/if]]
... ...