...
|
...
|
@@ -4,24 +4,25 @@ var e = new common.edit('#editor-group'); |
|
|
|
|
|
e.on("validate", function () {
|
|
|
|
|
|
if (new Date($("#beginTimeStr").val()).getTime() >= new Date($("#endTimeStr").val()).getTime()) {
|
|
|
return "开始时间必须小于结束时间";
|
|
|
}
|
|
|
|
|
|
var discount = $("#discount").val();
|
|
|
|
|
|
if (!/^1|0\.[0-9][0-9]$/.test(discount) || discount > 1.0) {
|
|
|
if (!/^1|0\.[0-9]{0,2}$/.test(discount) || discount > 1.0 || discount <= 0.0) {
|
|
|
return "折扣格式不正确";
|
|
|
}
|
|
|
|
|
|
|
|
|
var skns = '';
|
|
|
$("input[name='productSkn']").each(function (index) {
|
|
|
var skn = $(this).val();
|
|
|
if (skn && skn.length > 1) {
|
|
|
|
|
|
var iptSkns = $("input[name='productSkn']");
|
|
|
|
|
|
for (var i = 0, l = iptSkns.length; i < l; i++) {
|
|
|
var $thiz = $(iptSkns[i]);
|
|
|
var skn = $.trim($thiz.val());
|
|
|
if (/^[1-9][0-9]{4,10}$/.test(skn)) {
|
|
|
skns = skns + skn + "/";
|
|
|
} else if(skn.length != 0) {
|
|
|
return "第 " + (i + 1) + " 个 SKN 格式错误";
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
var lio = skns.lastIndexOf("/");
|
|
|
|
...
|
...
|
@@ -45,8 +46,6 @@ $('#add-btn').click(function(option) { |
|
|
data.startTime = toSeconds(data.beginTimeStr);
|
|
|
data.endTime = toSeconds(data.endTimeStr);
|
|
|
|
|
|
data.popupPic = $("#popupPic").parent().find("img").attr("src");
|
|
|
|
|
|
option.beforeSend = function() {
|
|
|
$('#add-btn').addClass('disabled');
|
|
|
};
|
...
|
...
|
@@ -54,7 +53,7 @@ $('#add-btn').click(function(option) { |
|
|
option.success = function(res) {
|
|
|
if (res.code == "200") {
|
|
|
e.$tip('提交成功', function() {
|
|
|
location.href = "/activity/yohocoin/index";
|
|
|
location.href = "/product/bundle/index";
|
|
|
}, 'growl-success');
|
|
|
} else {
|
|
|
$('#add-btn').removeClass('disabled');
|
...
|
...
|
@@ -91,7 +90,3 @@ function toSeconds(strDate) { |
|
|
var seconds = new Date(strDate).getTime() / 1000;
|
|
|
return seconds;
|
|
|
} |
|
|
|
|
|
$("#set_default_img").click(function() {
|
|
|
$("#popupPic").parent().find("img").attr("src", default_img);
|
|
|
}); |
...
|
...
|
|