Authored by 陶雨

修改部分bug

var $ = require('jquery'),
common = require('../common/common');
common = require('../common/common'),
util = require('../common/util');
var g = new common.grid({
el: "#product-pool",
... ... @@ -53,8 +54,9 @@ var $ = require('jquery'),
__type: "batch-import"
},
onComplete:function(res){
util.__tip("上传成功",'success');
$("#sknVal").val(JSON.stringify(res.data.productSkn));
//console.log($("#sknVal").val().replace("[", "").replace("]", ""));
$("#path").val($("#productSkn").val());
}
});
... ...
... ... @@ -81,6 +81,21 @@ var $ = require('jquery'),
return "开始时间和结束时间必须同时存在";
}
});
e.on("validate", function() {
var temp = $("#productPoolId").val();
if(!temp || temp == -1) {
return "请填写商品池";
}
});
e.on("validate", function() {
if(($("#promotion1").is(":checked") && !$("#promotionName1").val())
|| ($("#promotion2").is(":checked") && (!$("#promotionName2").val() || !$("#promotionName3").val()))
|| ($("#promotion4").is(":checked") && !$("#promotionName4").val())
|| ($("#promotion5").is(":checked") && !$("#promotionName5").val())) {
return "请将折扣形式填写完整";
}
});
common.dialog.confirm(hint,
common.util.__template($("#template").html(), item),
... ... @@ -90,22 +105,18 @@ var $ = require('jquery'),
if(typeof option.data.startTime == "string") {
option.data.startTime=new Date(option.data.startTime).getTime() / 1000;
option.data.endTime=new Date(option.data.endTime).getTime() / 1000;
// console.log(option.data.startTime);
}
var arr;
try {
arr=option.data.promotionName.split(":")//"promotionName1:折起";
option.data.promotionName = "";
for(var i = 0; i < arr.length; i++) {
var value = "";
try {
value = $("#" + arr[i]).val();
} catch(e) {
value = arr[i];
}
option.data.promotionName += value ? value : arr[i];
var val=$('input:radio[name="promotionName"]:checked').val();
if(val == 1) {
option.data.promotionName = $("#promotionName1").val() + "折起";
}else if(val == 2) {
option.data.promotionName = $("#promotionName2").val() + "~" + $("#promotionName3").val() + "折";
}else if(val == 4) {
option.data.promotionName = $("#promotionName4").val() + "元起";
}else if(val == 5) {
option.data.promotionName = $("#promotionName5").val() + "%Off";
}
}catch(e){}
option.success=function(){
g.reload();
... ... @@ -134,6 +145,7 @@ var $ = require('jquery'),
$("#promotion5").attr("checked","checked");
}
}
console.log($("#promotion1").val());
e.init();
new common.dropDown({el: "#productPoolId","ajax":"productPool"});
... ... @@ -143,11 +155,8 @@ var $ = require('jquery'),
url:'/runManage/subjectManage/queryBaseProductPoolListById',
data:{id:item.productPoolId}
},function(res) {
// console.log(res);
$("#select2-productPoolId-container").html(res.data[0].text);
},true);
} else {
$("#select2-productPoolId-container").html("选择商品池");
}
}
};
... ...
... ... @@ -27,7 +27,7 @@
<script type="text/template" id="template">
<div class="rows" id="baseform">
<div class="form-group">
<label for="category_name_value" class="col-sm-2 control-label">分类名称</label>
<label for="categoryName" class="col-sm-2 control-label">分类名称</label>
<div class="col-sm-10">
<input type="hidden" value="{id}" id="id" />
... ... @@ -36,7 +36,7 @@
</div>
</div>
<div class="form-group">
<label for="fir_category_value" class="col-sm-2 control-label">一级分类</label>
<label class="col-sm-2 control-label">一级分类</label>
<div class="col-sm-10">
<select id="parentId" style="width: 280px;" value="{parentId}" name="{parentId}">
<option value="{parentId}">请选择</option>
... ...
... ... @@ -71,7 +71,10 @@
</div>
<div class="form-group">
<label class="col-sm-2 control-label">上传</label>
<div class="col-sm-10">
<div class="col-sm-6">
<input id="path" class="form-control" type="text" disabled="disabled" style="cursor:default">
</div>
<div class="col-sm-4">
<input id="productSkn" name="productSkn" class="btn btn-default excel-upload" type="file">
<div class="file-name btn btn-default">请选择文件</div>
<input type="hidden" id="sknVal" />
... ...
... ... @@ -99,18 +99,17 @@
<div class="form-group">
<label class="col-sm-2 control-label">促销形式</label>
<div class="col-sm-10">
<input id="promotion1" name="promotionName" type="radio" value="promotionName1:折起" />
<input id="promotion1" name="promotionName" type="radio" value="1" />
<input class="smalltxt" type="text" id="promotionName1" />折起
<input class="smalltxt" type="text" id="promotionName1" />折起&nbsp;&nbsp;
<input id="promotion2" name="promotionName" type="radio" value="promotionName2:~:promotionName3:折" /><input class="smalltxt" type="text" id="promotionName2" />~<input class="smalltxt" type="text" id="promotionName3" />
<input id="promotion2" name="promotionName" type="radio" value="2" /><input class="smalltxt" type="text" id="promotionName2" />~<input class="smalltxt" type="text" id="promotionName3" />&nbsp;&nbsp;
<input id="promotion4" name="promotionName" type="radio" value="promotionName4:元起" /><input class="smalltxt" type="text" id="promotionName4" />元起
<input id="promotion4" name="promotionName" type="radio" value="4" /><input class="smalltxt" type="text" id="promotionName4" />元起&nbsp;&nbsp;
<input id="promotion5" name="promotionName" type="radio" value="promotionName5:%Off" /><input class="smalltxt" type="text" id="promotionName5" />%Off(大图折扣)
<input id="promotion5" name="promotionName" type="radio" value="5" /><input class="smalltxt" type="text" id="promotionName5" />%Off(大图折扣)
</div>
<input type="hidden" id="promotionName" value="{promotionName}" for="radio"/>
</div>
<div class="form-group col-sm-100">
<label class="col-sm-2 control-label">活动时间</label>
... ... @@ -146,9 +145,11 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="">添加商品</label>
<label class="col-sm-2 control-label" for="">添加商品<font color="#f00">*</font></label>
<div class="col-sm-10">
<select id="productPoolId" style="width: 280px;" value="{productPoolId}"></select>
<select id="productPoolId" style="width: 280px;" value="{productPoolId}">
<option value="{productPoolId}">请选择商品池</option>
</select>
</div>
</div>
</div>
... ...