Authored by chenchao

bind prd pool v1

... ... @@ -58,7 +58,8 @@ module.exports = {
feeSharingRatio:{type:Number},
productLimit:{type:String},
isNew : {type:Number},
isUseLimitRule:{type:String}
isUseLimitRule:{type:String},
prdPoolLimit : {type:String}
}
},
reject: {
... ...
... ... @@ -217,7 +217,9 @@
[[if couponType > 0]]
<option value="3">商品</option>
[[/if]]
[[if couponType==1 || couponType==3]]
<option value="4">商品池</option>
[[/if]]
</select>&emsp;&emsp;
[[if useRange==1]]
... ... @@ -232,6 +234,9 @@
[[if useRange==0&&couponType!=6]]
<a class="btn btn-primary btn-xs" href="javascript:;" id="addSorts">添加分类</a>
[[/if]]
[[if useRange==4]]
<a class="btn btn-primary btn-xs" href="javascript:;" id="addPrdPool">添加商品池</a>
[[/if]]
</div>
</div>
</div>
... ... @@ -282,6 +287,14 @@
</div>
</div>
[[/if]]
[[if prdPoolLimit]]
<div class="form-group">
<label class="col-sm-2 control-label">商品池限制</label>
<div class="col-sm-8">
<p class="form-control" style="border: 0px">[[prdPoolLimitName]]</p>
</div>
</div>
[[/if]]
</div>
</div>
<div>
... ... @@ -499,5 +512,28 @@
</div>
</div>
</script>
<script type="text/template" id="template_prdPoolLimit">
<div class="panel">
<div class="panel-body nopadding">
<form role="form" class="form-horizontal form-bordered">
<div class="form-group" style="margin-bottom: 40px">
<label class="col-sm-2 control-label">商品池关联:</label>
<div class="col-sm-8 prdPoolLimit-wrap">
<div class="row">
<div class="col-sm-10">
<select name="prdPoolLimit" class="prdPoolLimit" value="[[id]]" style="width: 280px;" tabindex="-1" title="" class="form-control">
<option value="[[id||-1]]">[[text||"选择商品池"]]</option>
</select>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</script>
<%include '../../../common/views/__ui/footer'%>
... ...
... ... @@ -231,6 +231,16 @@
</div>
[[/if]]
[[if prdPoolLimit]]
<div class="form-group">
<label class="col-sm-2 control-label">商品池限制</label>
<div class="col-sm-10">
<p>[[prdPoolLimitName]]</p>
</div>
</div>
[[/if]]
<div class="form-group">
<label class="col-sm-2 control-label">互斥配置</label>
<div class="col-sm-8">
... ...
... ... @@ -76,6 +76,7 @@ module.exports={
url: '/pool/queryBaseProductPoolList',
params: [
{name: 'poolName', type: 'string'},
{name: 'diffType', type: 'number'},
{name: 'idName', type: 'string'}
]
}
... ...
... ... @@ -32,6 +32,7 @@ var Bll = {
selectShops:[],//店铺数据
selectShopIds:[],
selectBrandsName: [],
selectPrdPool:{},
getBrands: function () {//获取品牌数据
var Brand = {};
$.get("/ajax/yohosearch", function (res) {
... ... @@ -166,6 +167,7 @@ var Bll = {
});
}
//isNew
if(couponBean.isNew){
isNew = couponBean.isNew;
... ... @@ -270,6 +272,10 @@ if (type == 'add') {
if(couponBean.productLimit){
couponBean.useRange = 3;
}
if(couponBean.prdPoolLimit){
couponBean.useRange = 4;
Bll.selectPrdPool = {id : couponBean.prdPoolLimit, name : couponBean.prdPoolLimitName}
}
Bll.__render(couponBean, type)
}, true);
}
... ... @@ -644,3 +650,77 @@ $(document).on("change", "input[name='isUseLimitRule']", function () {
couponBean.isUseLimitRule = "";
}
});
var PrdPoolService = {
initPrdPool: function () {//初始化商品池弹框
var data1 = {};
var __self = this;
common.dialog({
title: "选择商品池",
width: "60%",
content: common.util.__template2($('#template_prdPoolLimit').html(), data1),
button: [{
value: "保存",
callback: function () {
//myself
//myselfEnd
Bll.selectPrdPool = {};
if ($(".prdPoolLimit").length > 0) {
$(".prdPoolLimit").each(function(index){
Bll.selectPrdPool.id = $(this).val();
Bll.selectPrdPool.name = $(this).text().replace("选择商品池","").trim()
});
couponBean.prdPoolLimit = Bll.selectPrdPool.id;
couponBean.prdPoolLimitName = Bll.selectPrdPool.name;
Bll.__render(couponBean, type);
}else{
couponBean.prdPoolLimit = "";
Bll.__render(couponBean, type);
}
},
css: "btn btn-primary"
}, {
value: "返回"
}]
});
__self.buildPrdPoolDropDown();
},
//选择商品池
clickHandle : function(){
var __self = this;
if (Bll.selectShops && Bll.selectShops.length > 0) {
//渲染店铺
if (Bll.selectPrdPool.id) {
__self.initPrdPool();
$('.prdPoolLimit-wrap').empty();
var _pool_name = Bll.selectPrdPool.name;
var _pool_id = Bll.selectPrdPool.id;
var Template = {id: _pool_id, text: _pool_name};
var $prdPoolGroup = $(common.util.__template2($("#template_prdPoolLimit").html(), Template));
$prdPoolGroup.appendTo($('.prdPoolLimit-wrap'));
__self.buildPrdPoolDropDown();
}
}
else {
__self.initPrdPool();
}
__self.buildPrdPoolDropDown();
},
buildPrdPoolDropDown : function(){
return new common.dropDown({
el: '.prdPoolLimit',
ajax: 'productPool',
params : {diffType : 3}
});
}
}
$(document).on('click', "#addPrdPool", function () {
PrdPoolService.clickHandle();
});
... ...