Authored by weiqingting

资源位

@@ -508,4 +508,135 @@ $(document).on("click", "#sub_btn", function() { @@ -508,4 +508,135 @@ $(document).on("click", "#sub_btn", function() {
508 console.log(res.data); 508 console.log(res.data);
509 window.location.href=window.location.href; 509 window.location.href=window.location.href;
510 }); 510 });
  511 +});
  512 +
  513 +
  514 +/****************************************************************************************************/
  515 +/*商品,商品组*/
  516 +
  517 +/*选择商品表格*/
  518 +var goodsgird = new common.grid({
  519 + el: '#goodsgird',
  520 + parms: function () {
  521 + var beginPrice = 0, endPrice = 1000000;
  522 + if (common.util.__input('beginPrice')) {
  523 + beginPrice = common.util.__input('beginPrice');
  524 + }
  525 + if (common.util.__input('endPrice')) {
  526 + endPrice = common.util.__input('endPrice')
  527 + }
  528 + return {
  529 + query: common.util.__input('skns'),
  530 + price: beginPrice + "," + endPrice
  531 + };
  532 + },
  533 + columns: [
  534 + {
  535 + display: "选择",
  536 + type: "checkbox"
  537 + }, {
  538 + display: "产品图片",
  539 + render: function (item) {
  540 + if (item.images_url) {
  541 + item.images_url = common.util.__joinImg("goodsimg", item.images_url);
  542 + }
  543 + else {
  544 + item.images_url = "";
  545 + }
  546 + return "<img width=120 height=60 src='" + item.images_url + "?imageView/2/w/100/h/100'/>";
  547 + }
  548 + }, {
  549 + display: "产品名称",
  550 + name: "product_name"
  551 + }, {
  552 + display: "品牌",
  553 + name: "brand_name"
  554 + }, {
  555 + display: "现价",
  556 + name: "sales_price"
  557 + }, {
  558 + display: "牌价",
  559 + name: "market_price"
  560 + }, {
  561 + display: "预售",
  562 + name: "stock_number"
  563 + }, {
  564 + display: "库存",
  565 + name: "storage_num"
  566 + }]
  567 +});
  568 +//搜索按钮
  569 +$(document).on("click", "#search", function() {
  570 + goodsgird.reload();
  571 +});
  572 +//点击“选择标签”按钮(添加商品)
  573 +$(document).on("click", "#goodsSelectBtn", function () {
  574 + new common.dialog({
  575 + title: "选择商品",
  576 + content: $("#template_dialog_goodsgird").html(),
  577 + width: '80%',
  578 + button: [{
  579 + value: "确定",
  580 + callback: function () {
  581 + Bll.module.contentData.data = goodsgird.selected.map(function (item, index) {
  582 + return {
  583 + src: item.images_url,
  584 + id: item.product_skn,
  585 + product_skc: item.product_skc
  586 + }
  587 + });
  588 + // Bll.module.data=goodsgird.selected;
  589 + Bll.__render("#goodspic", "template_dialog_goodsimgs", {
  590 + datas: Bll.module.contentData.data
  591 + });
  592 + },
  593 + css: "btn-primary"
  594 + }]
  595 + });
  596 + goodsgird.init('/yohosearch/search');
  597 +});
  598 +//点击“添加组”按钮(添加商品组)
  599 +$(document).on("click", "#goodsaddBtn", function () {
  600 + if(Bll.module.contentData.data[0].list.length){
  601 + Bll.module.contentData.data.push(Button[5].data[0]);
  602 + }
  603 + Bll.__render("#groupsgoods", "template_dialog_remgoodsgroup", Bll.module);
  604 +});
  605 +//点击“选择标签”按钮(添加商品组)
  606 +$(document).on("click", ".goodsSelectBtn", function () {
  607 + var index = $(this).data("index");
  608 + new common.dialog({
  609 + title: "选择商品",
  610 + content: $("#template_dialog_goodsgird").html(),
  611 + width: '80%',
  612 + button: [{
  613 + value: "确定",
  614 + callback: function () {
  615 + goodsgird.selected.forEach(function (item, i) {
  616 + Bll.module.contentData.data[index].list[i] = {
  617 + src: item.images_url,
  618 + id: item.product_skn,
  619 + product_skc: item.product_skc,
  620 + maxSortId: item.max_sort_id
  621 + };
  622 + if (!i) {
  623 + Bll.module.contentData.data[index].cover = {
  624 + cover: item.images_url,
  625 + maxSortId: item.max_sort_id
  626 + };
  627 + }
  628 + });
  629 + Bll.__render("#groupsgoods", "template_dialog_remgoodsgroup", Bll.module);
  630 + },
  631 + css: "btn-primary"
  632 + }]
  633 + });
  634 + goodsgird.init('/yohosearch/search');
  635 +});
  636 +//删除图片按钮
  637 +$(document).on("click", ".removepic", function() {
  638 + Bll.module.contentData.data.splice($(this).data("index"), 1);
  639 + $("#goodspic").html(common.util.__template2($("#template_dialog_goodsimgs").html(), {
  640 + datas: Bll.module.contentData.data
  641 + }));
511 }); 642 });
1 <script type="text/template" id="template_content"> 1 <script type="text/template" id="template_content">
2 <!-- 文本内容 --> 2 <!-- 文本内容 -->
3 [[each modules as module index]] 3 [[each modules as module index]]
4 - <li class="custom-group" data-index="[[index]]"> 4 + <li class="form-group custom-group" data-index="[[index]]" style="width: 100%">
5 [[if module.contentData.template_name=='text']] 5 [[if module.contentData.template_name=='text']]
6 - <div class="con">[[module.contentData.data.text]]</div> 6 + <div class="col-sm-12"><h3>[[module.contentData.data.text]]</h3></div>
7 [[else if module.contentData.template_name=='singleImage']] 7 [[else if module.contentData.template_name=='singleImage']]
8 - <div class="list"> 8 + <div class="col-sm-12">
9 <img src="[[module.contentData.data[0].src]]" title="[[module.contentData.data[0].title]]"> 9 <img src="[[module.contentData.data[0].src]]" title="[[module.contentData.data[0].title]]">
10 </div> 10 </div>
11 [[else if module.contentData.template_name=='smallPic']] 11 [[else if module.contentData.template_name=='smallPic']]
12 - <div class="small-pic">  
13 - <ul class="small-pic-list">  
14 [[each module.contentData.data as item i]] 12 [[each module.contentData.data as item i]]
15 - <img src="[[item.src]]" title="[[item.title]]"> 13 + <div class="col-sm-6">
  14 + <img src="[[item.src]]" title="[[item.title]]">
  15 + </div>
16 [[/each]] 16 [[/each]]
17 - </ul>  
18 - </div>  
19 [[else if module.contentData.template_name=='goods']] 17 [[else if module.contentData.template_name=='goods']]
20 - <div class="small-pic">  
21 - <ul class="small-pic-list">  
22 [[each module.contentData.data as item i]] 18 [[each module.contentData.data as item i]]
23 - <img src="[[item.src]]" title="[[item.id]]"> 19 + <div class="col-sm-6">
  20 + <img src="[[item.src]]" title="[[item.title]]">
  21 + </div>
24 [[/each]] 22 [[/each]]
25 - </ul>  
26 - </div>  
27 [[else if module.contentData.template_name=='link']] 23 [[else if module.contentData.template_name=='link']]
28 - <div class="list">  
29 - <h3>添加链接</h3>  
30 - </div> 24 + <div class="col-sm-12">
  25 + <h3>添加链接</h3>
  26 + </div>
31 [[else if module.contentData.template_name=='goodsGroup']] 27 [[else if module.contentData.template_name=='goodsGroup']]
32 - <div class="small-pic">  
33 -  
34 - <div class="small-pic-list2"> 28 + <div class="form-group">
35 [[each module.contentData.data as items i]] 29 [[each module.contentData.data as items i]]
  30 + <div class="col-sm-3">
36 <img src="[[items.cover.cover]]" > 31 <img src="[[items.cover.cover]]" >
  32 + </div>
37 [[/each]] 33 [[/each]]
38 </div> 34 </div>
39 - <div class="small-pic-list">  
40 -  
41 - [[each module.contentData.data[0].list as item index]]  
42 - <img src="[[item.src]]" title="[[item.id]]">  
43 - [[/each]] 35 +
  36 + [[each module.contentData.data[0].list as item index]]
  37 + <div class="col-sm-6">
  38 + <img src="[[item.src]]" title="[[item.id]]">
  39 + </div>
  40 + [[/each]]
44 41
45 - </ul>  
46 </div> 42 </div>
47 {{> resource/taoyu2}} 43 {{> resource/taoyu2}}
48 [[/if]] 44 [[/if]]