...
|
...
|
@@ -95,7 +95,7 @@ var Bll = { |
|
|
return common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
|
|
|
|
|
|
},
|
|
|
__render: function (item) {
|
|
|
__render: function (item,type) {
|
|
|
$("#basicForm").html(common.util.__template2($("#couponListAdd-template").html(), item));
|
|
|
e.init();
|
|
|
startTimeObj = $("#startTime").fdatepicker({
|
...
|
...
|
@@ -108,6 +108,15 @@ var Bll = { |
|
|
}).data("datepicker");
|
|
|
new common.dropDown({el: '#filter-couponType'});
|
|
|
new common.dropDown({el: '#filter-department'});
|
|
|
if(type=='update'){
|
|
|
if(couponBean.customType){
|
|
|
var customType=couponBean.customType.split(',');
|
|
|
for(var i=0;i<customType.length;i++){
|
|
|
custom = "custom-" + customType[i];
|
|
|
$("input ." + custom).attr("checked","checked");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
checkSortNum: function () {
|
|
|
if ($('.sort-wrap').find('.row').size() > 1) {
|
...
|
...
|
@@ -122,7 +131,7 @@ var Bll = { |
|
|
* 根据type判断界面
|
|
|
*/
|
|
|
if (type == 'add') {
|
|
|
Bll.__render(couponBean);
|
|
|
Bll.__render(couponBean,type);
|
|
|
} else {
|
|
|
var id = location.href.substring(location.href.lastIndexOf("/") + 1);
|
|
|
common.util.__ajax({
|
...
|
...
|
@@ -132,21 +141,21 @@ if (type == 'add') { |
|
|
couponBean = res.data.list[0];
|
|
|
couponBean.startTime = Bll.getTime(couponBean.startTime);
|
|
|
couponBean.endTime = Bll.getTime(couponBean.endTime);
|
|
|
Bll.__render(couponBean)
|
|
|
Bll.__render(couponBean,type)
|
|
|
}, true);
|
|
|
}
|
|
|
/**
|
|
|
* 优惠条件
|
|
|
*/
|
|
|
$(document).on("change", "#useLimitType", function () {
|
|
|
Bll.__render(couponBean);
|
|
|
Bll.__render(couponBean,type);
|
|
|
});
|
|
|
/**
|
|
|
* 适用范围
|
|
|
*/
|
|
|
$(document).on("change", "#useRange", function () {
|
|
|
couponBean.useRange = $(this).val();
|
|
|
Bll.__render(couponBean);
|
|
|
Bll.__render(couponBean,type);
|
|
|
});
|
|
|
var tabTreeArr = [];
|
|
|
var tabTree;
|
...
|
...
|
@@ -205,17 +214,19 @@ $(document).on('click', '.del-sort-btn', function () { |
|
|
/**
|
|
|
* 会员身份
|
|
|
*/
|
|
|
var customType = [];
|
|
|
var len = couponBean.customType.length;
|
|
|
if (len > 0) {
|
|
|
customType = couponBean.customType.split(',');
|
|
|
}
|
|
|
//var customType = [];
|
|
|
//customType = couponBean.customType.split(',');
|
|
|
console.log(couponBean.customType);
|
|
|
//if (customType[0] == "") {
|
|
|
// customType=[];
|
|
|
//}
|
|
|
//console.log(customType);
|
|
|
$(document).on("click", "input[name='customType']", function () {
|
|
|
if ($(this).is(':checked')) {
|
|
|
customType.push($(this).val());
|
|
|
} else {
|
|
|
for (var i = 0; i < a.length; i++) {
|
|
|
if ($(this).val() == a[i]) {
|
|
|
for (var i = 0; i < customType.length; i++) {
|
|
|
if ($(this).val() == customType[i]) {
|
|
|
customType.splice(i, 1)
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -231,13 +242,14 @@ $(document).on("keyup", ".number", function () { |
|
|
* 保存
|
|
|
*/
|
|
|
$(document).on("click", "#save_brand", function () {
|
|
|
console.log(couponBean);
|
|
|
if (e.validate()) {
|
|
|
delete couponBean.useRange;
|
|
|
common.util.__ajax({
|
|
|
url: action,
|
|
|
data: couponBean
|
|
|
}, function (res) {
|
|
|
location.href = "/market/couponList/index";
|
|
|
//location.href = "/market/couponList/index";
|
|
|
});
|
|
|
}
|
|
|
return false;
|
...
|
...
|
|