Authored by chenchao

bind prd pool v1

@@ -58,7 +58,8 @@ module.exports = { @@ -58,7 +58,8 @@ module.exports = {
58 feeSharingRatio:{type:Number}, 58 feeSharingRatio:{type:Number},
59 productLimit:{type:String}, 59 productLimit:{type:String},
60 isNew : {type:Number}, 60 isNew : {type:Number},
61 - isUseLimitRule:{type:String} 61 + isUseLimitRule:{type:String},
  62 + prdPoolLimit : {type:String}
62 } 63 }
63 }, 64 },
64 reject: { 65 reject: {
@@ -217,7 +217,9 @@ @@ -217,7 +217,9 @@
217 [[if couponType > 0]] 217 [[if couponType > 0]]
218 <option value="3">商品</option> 218 <option value="3">商品</option>
219 [[/if]] 219 [[/if]]
220 - 220 + [[if couponType==1 || couponType==3]]
  221 + <option value="4">商品池</option>
  222 + [[/if]]
221 </select>&emsp;&emsp; 223 </select>&emsp;&emsp;
222 224
223 [[if useRange==1]] 225 [[if useRange==1]]
@@ -232,6 +234,9 @@ @@ -232,6 +234,9 @@
232 [[if useRange==0&&couponType!=6]] 234 [[if useRange==0&&couponType!=6]]
233 <a class="btn btn-primary btn-xs" href="javascript:;" id="addSorts">添加分类</a> 235 <a class="btn btn-primary btn-xs" href="javascript:;" id="addSorts">添加分类</a>
234 [[/if]] 236 [[/if]]
  237 + [[if useRange==4]]
  238 + <a class="btn btn-primary btn-xs" href="javascript:;" id="addPrdPool">添加商品池</a>
  239 + [[/if]]
235 </div> 240 </div>
236 </div> 241 </div>
237 </div> 242 </div>
@@ -282,6 +287,14 @@ @@ -282,6 +287,14 @@
282 </div> 287 </div>
283 </div> 288 </div>
284 [[/if]] 289 [[/if]]
  290 + [[if prdPoolLimit]]
  291 + <div class="form-group">
  292 + <label class="col-sm-2 control-label">商品池限制</label>
  293 + <div class="col-sm-8">
  294 + <p class="form-control" style="border: 0px">[[prdPoolLimitName]]</p>
  295 + </div>
  296 + </div>
  297 + [[/if]]
285 </div> 298 </div>
286 </div> 299 </div>
287 <div> 300 <div>
@@ -499,5 +512,28 @@ @@ -499,5 +512,28 @@
499 </div> 512 </div>
500 </div> 513 </div>
501 </script> 514 </script>
  515 +
  516 +<script type="text/template" id="template_prdPoolLimit">
  517 +
  518 + <div class="panel">
  519 + <div class="panel-body nopadding">
  520 + <form role="form" class="form-horizontal form-bordered">
  521 + <div class="form-group" style="margin-bottom: 40px">
  522 + <label class="col-sm-2 control-label">商品池关联:</label>
  523 + <div class="col-sm-8 prdPoolLimit-wrap">
  524 + <div class="row">
  525 + <div class="col-sm-10">
  526 + <select name="prdPoolLimit" class="prdPoolLimit" value="[[id]]" style="width: 280px;" tabindex="-1" title="" class="form-control">
  527 + <option value="[[id||-1]]">[[text||"选择商品池"]]</option>
  528 + </select>
  529 + </div>
  530 +
  531 + </div>
  532 + </div>
  533 + </div>
  534 + </form>
  535 + </div>
  536 + </div>
  537 +</script>
502 <%include '../../../common/views/__ui/footer'%> 538 <%include '../../../common/views/__ui/footer'%>
503 539
@@ -231,6 +231,16 @@ @@ -231,6 +231,16 @@
231 </div> 231 </div>
232 [[/if]] 232 [[/if]]
233 233
  234 +
  235 + [[if prdPoolLimit]]
  236 + <div class="form-group">
  237 + <label class="col-sm-2 control-label">商品池限制</label>
  238 + <div class="col-sm-10">
  239 + <p>[[prdPoolLimitName]]</p>
  240 + </div>
  241 + </div>
  242 + [[/if]]
  243 +
234 <div class="form-group"> 244 <div class="form-group">
235 <label class="col-sm-2 control-label">互斥配置</label> 245 <label class="col-sm-2 control-label">互斥配置</label>
236 <div class="col-sm-8"> 246 <div class="col-sm-8">
@@ -76,6 +76,7 @@ module.exports={ @@ -76,6 +76,7 @@ module.exports={
76 url: '/pool/queryBaseProductPoolList', 76 url: '/pool/queryBaseProductPoolList',
77 params: [ 77 params: [
78 {name: 'poolName', type: 'string'}, 78 {name: 'poolName', type: 'string'},
  79 + {name: 'diffType', type: 'number'},
79 {name: 'idName', type: 'string'} 80 {name: 'idName', type: 'string'}
80 ] 81 ]
81 } 82 }
@@ -32,6 +32,7 @@ var Bll = { @@ -32,6 +32,7 @@ var Bll = {
32 selectShops:[],//店铺数据 32 selectShops:[],//店铺数据
33 selectShopIds:[], 33 selectShopIds:[],
34 selectBrandsName: [], 34 selectBrandsName: [],
  35 + selectPrdPool:{},
35 getBrands: function () {//获取品牌数据 36 getBrands: function () {//获取品牌数据
36 var Brand = {}; 37 var Brand = {};
37 $.get("/ajax/yohosearch", function (res) { 38 $.get("/ajax/yohosearch", function (res) {
@@ -166,6 +167,7 @@ var Bll = { @@ -166,6 +167,7 @@ var Bll = {
166 167
167 }); 168 });
168 } 169 }
  170 +
169 //isNew 171 //isNew
170 if(couponBean.isNew){ 172 if(couponBean.isNew){
171 isNew = couponBean.isNew; 173 isNew = couponBean.isNew;
@@ -270,6 +272,10 @@ if (type == 'add') { @@ -270,6 +272,10 @@ if (type == 'add') {
270 if(couponBean.productLimit){ 272 if(couponBean.productLimit){
271 couponBean.useRange = 3; 273 couponBean.useRange = 3;
272 } 274 }
  275 + if(couponBean.prdPoolLimit){
  276 + couponBean.useRange = 4;
  277 + Bll.selectPrdPool = {id : couponBean.prdPoolLimit, name : couponBean.prdPoolLimitName}
  278 + }
273 Bll.__render(couponBean, type) 279 Bll.__render(couponBean, type)
274 }, true); 280 }, true);
275 } 281 }
@@ -644,3 +650,77 @@ $(document).on("change", "input[name='isUseLimitRule']", function () { @@ -644,3 +650,77 @@ $(document).on("change", "input[name='isUseLimitRule']", function () {
644 couponBean.isUseLimitRule = ""; 650 couponBean.isUseLimitRule = "";
645 } 651 }
646 }); 652 });
  653 +
  654 +var PrdPoolService = {
  655 + initPrdPool: function () {//初始化商品池弹框
  656 + var data1 = {};
  657 + var __self = this;
  658 + common.dialog({
  659 + title: "选择商品池",
  660 + width: "60%",
  661 + content: common.util.__template2($('#template_prdPoolLimit').html(), data1),
  662 + button: [{
  663 + value: "保存",
  664 + callback: function () {
  665 + //myself
  666 + //myselfEnd
  667 + Bll.selectPrdPool = {};
  668 +
  669 + if ($(".prdPoolLimit").length > 0) {
  670 + $(".prdPoolLimit").each(function(index){
  671 + Bll.selectPrdPool.id = $(this).val();
  672 + Bll.selectPrdPool.name = $(this).text().replace("选择商品池","").trim()
  673 + });
  674 + couponBean.prdPoolLimit = Bll.selectPrdPool.id;
  675 + couponBean.prdPoolLimitName = Bll.selectPrdPool.name;
  676 + Bll.__render(couponBean, type);
  677 + }else{
  678 + couponBean.prdPoolLimit = "";
  679 +
  680 + Bll.__render(couponBean, type);
  681 + }
  682 + },
  683 + css: "btn btn-primary"
  684 + }, {
  685 + value: "返回"
  686 + }]
  687 + });
  688 + __self.buildPrdPoolDropDown();
  689 + },
  690 + //选择商品池
  691 + clickHandle : function(){
  692 + var __self = this;
  693 + if (Bll.selectShops && Bll.selectShops.length > 0) {
  694 + //渲染店铺
  695 + if (Bll.selectPrdPool.id) {
  696 + __self.initPrdPool();
  697 + $('.prdPoolLimit-wrap').empty();
  698 + var _pool_name = Bll.selectPrdPool.name;
  699 + var _pool_id = Bll.selectPrdPool.id;
  700 + var Template = {id: _pool_id, text: _pool_name};
  701 + var $prdPoolGroup = $(common.util.__template2($("#template_prdPoolLimit").html(), Template));
  702 + $prdPoolGroup.appendTo($('.prdPoolLimit-wrap'));
  703 + __self.buildPrdPoolDropDown();
  704 + }
  705 + }
  706 + else {
  707 + __self.initPrdPool();
  708 + }
  709 + __self.buildPrdPoolDropDown();
  710 + },
  711 + buildPrdPoolDropDown : function(){
  712 + return new common.dropDown({
  713 + el: '.prdPoolLimit',
  714 + ajax: 'productPool',
  715 + params : {diffType : 3}
  716 + });
  717 + }
  718 +}
  719 +
  720 +
  721 +
  722 +$(document).on('click', "#addPrdPool", function () {
  723 + PrdPoolService.clickHandle();
  724 +});
  725 +
  726 +