Authored by chenchao

complete all

... ... @@ -55,7 +55,8 @@ module.exports = {
sknExclude: {type: String},
shopLimit:{type:String},
feeSharingType:{type:Number},
feeSharingRatio:{type:Number}
feeSharingRatio:{type:Number},
productLimit:{type:String}
}
},
reject: {
... ...
... ... @@ -193,13 +193,19 @@
<select id="useRange" class="form-control input-form" value="[[useRange]]">
[[if couponType!=6]]
<option value="0">分类</option>
<option value="1">品牌</option>
[[/if]]
[[if couponType==1||couponType==3]]
<option value="3">商品</option>
[[/if]]
<option value="2">店铺</option>
</select>&emsp;&emsp;
[[if useRange==1]]
<a class="btn btn-primary btn-xs" href="javascript:;" id="addBrands">添加品牌</a>
[[/if]]
[[if useRange==3]]
<a class="btn btn-primary btn-xs" href="javascript:;" id="importPrds">导入商品</a>
[[/if]]
[[if useRange==2||couponType==6]]
<a class="btn btn-primary btn-xs" href="javascript:;" id="addShop">添加店铺</a>
[[/if]]
... ... @@ -244,6 +250,15 @@
</div>
</div>
[[/if]]
[[if useRange==3]]
<div class="form-group">
<label class="col-sm-2 control-label">指定商品</label>
<div class="col-sm-4">
<textarea name="productLimit" class="form-control observe" prompt="SKN除外" data-field="productLimit"
placeholder="skn用英文逗号分隔" style="resize: none">[[productLimit]]</textarea>
</div>
</div>
[[/if]]
</div>
</div>
<div>
... ... @@ -432,5 +447,34 @@
[[/each]]
</select>
</script>
<script type="text/template" id="template_import_prds">
<div class="form-group">
<div class="contentpanel">
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-body">
<table class="table table-bordered">
<tr>
<td rowspan="2">商品</td>
<td>上传EXCEL:</td>
<td style="position: relative;"><input id="[[impoprtKey]]" name="file" data-type="" type="file" style="border:1px solid red; cursor: pointer; height: 37px; top: 8px;">
</td>
</tr>
<tr>
<td>说明:</td>
<td colspan="2">
1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br>
2、第一行标题栏:<span style="color: #67D267;">SKN</span><br>
3<a href="[[dlFile]]">下载样例</a>
</td>
</tr>
</table>
</div>
<div class="panel-body red" id="message">
</div>
</div>
</div>
</div>
</script>
<%include '../../../common/views/__ui/footer'%>
... ...
... ... @@ -202,6 +202,16 @@
</div>
</div>
[[/if]]
[[if productLimit]]
<div class="form-group">
<label class="col-sm-2 control-label">商品限制</label>
<div class="col-sm-10">
<p>[[productLimit]]</p>
</div>
</div>
[[/if]]
<div class="form-group">
<label class="col-sm-2 control-label">互斥配置</label>
<div class="col-sm-8">
... ...
... ... @@ -201,6 +201,7 @@ if (type == 'add') {
data: {couponsId: id}
}, function (res) {
couponBean = res.data;
$.extend(window.ViewModel,res.data);
couponBean.limitStartTime=Bll.getTime(couponBean.limitStartTime);
couponBean.startTime = Bll.getTime(couponBean.startTime);
couponBean.endTime = Bll.getTime(couponBean.endTime);
... ... @@ -235,6 +236,10 @@ if (type == 'add') {
couponBean.shopList = Bll.selectShops.join(";");
couponBean.useRange = 2;
}
//指定商品
if(couponBean.productLimit){
couponBean.useRange = 3;
}
Bll.__render(couponBean, type)
}, true);
}
... ... @@ -319,6 +324,10 @@ $(document).on("click", "#save_brand", function () {
return false;
}
}
var productLimit = $("textarea[name=\"productLimit\"]").val();
if(productLimit){
couponBean.productLimit = productLimit;
}
if (e.validate()) {
delete couponBean.useRange;
common.util.__ajax({
... ... @@ -585,3 +594,5 @@ function shopDropDown(){
}
}
//********************* 店铺end****************************************
require('../partials/import_prds');
\ No newline at end of file
... ...
var $ = require('jquery'),
common = require('../../../common/common');
//var couponBean = require('../CouponList/AddOrUpdate');
var loadModal = null;
var _import = function(el, type) {
return {
params: {
type: type,
id:common.util.__input("id"),
__type: "batch-import"
},
onStart: function(params) {
var _id = window.ViewModel.id;
if(_id && _id>0){
params.args= "{'id':"+ _id +"}" ;
}
console.log("params",params);
loadModal = common.dialog.load();
$("#message").html('');
//$(el).parents('td').find('.file-name').text($(el).val().replace("C:\\fakepath\\", ""));
},
onComplete: function(response) {
console.log("批量接口返回数据",response);
$("#message").html('');
if (response.code == 200) {
//__ajaxExeclById(response.data.taskId);
common.util.__tip(response.message, 'success');
if(response.data.successList){
var import_skns=[];
response.data.successList.forEach(function(o,i){
import_skns.push(o.productSkn);
});
var productLimit = window.ViewModel.productLimit + "," + import_skns.join(",");
$("textarea[name=\"productLimit\"]").val(productLimit);
}
}
if (loadModal) {
loadModal.close();
}
if(response.data && response.data.failFileReason.length){
$("#message").html(response.data.failFileReason.join('<br/>'));
return false;
}
common.util.__tip(response.message, 'warning');
}
};
}
$(document).on("click", "#importPrds", function () {
//var e = new common.edit("#brandForm");
var _g = $(this);
common.dialog.confirm("导入商品", "确认导入商品?",function(){
var _import_input_id = "couponProductLimit";
var _html = common.util.__template2($("#template_import_prds").html(), {
impoprtKey : _import_input_id,
dlFile : "/ajax/link/couponProductLimit"
});
_g.closest(".form-group").after(_html);
$('#'+_import_input_id).after('<div class="file-name btn btn-default">请选择文件</div>');
common.edit.ajaxfileupload('#'+_import_input_id, _import('#sort-file', _import_input_id));
});
_g.attr("disabled",true);
//e.init();
});
\ No newline at end of file
... ...