Authored by 姜敏

修复发券管理bug

... ... @@ -57,23 +57,30 @@ var Bll = {
button: [{
value: "保存",
callback: function () {
var couponIds=Bll.module.couponsIds||[];
var ids=[];
for(var i=0;i<couponIds.length;i++){
var couponIds = Bll.module.couponsIds || [];
var flag = true;
var ids = [];
for (var i = 0; i < couponIds.length; i++) {
ids.push(couponIds[i].id);
}
Bll.module.couponsIds=ids.join(",");
if (edit.validate()) {
if (ids.join(",").indexOf("-1") > -1) {
flag = false;
common.util.__tip("请正确选择优惠券ID", "warning");
} else {
Bll.module.couponsIds = ids.join(",");
}
//console.log("最终上传数据Bll.module",Bll.module);
if (edit.validate() && flag) {
common.util.__ajax({
url: "/couponSendManager/addOrUpdate",
data: Bll.module
data: Bll.module
}, function (res) {
if(res.code=='200'){
if (res.code == '200') {
g.reload();
d.close();
}
else{
common.util.__tip(res.message,"warning");
else {
common.util.__tip(res.message, "warning");
}
});
}
... ... @@ -99,7 +106,7 @@ var Bll = {
/*监听输入框变化*/
$(document).on("change", ".observe", function () {
var $this = $(this);
var name = $this.data("field")?$this.data("field"):$this.data("name");
var name = $this.data("field") ? $this.data("field") : $this.data("name");
Bll.module = common.util.__buildobj(name, '.', Bll.module, function (obj, name) {
obj[name] = $this.val();
});
... ...
... ... @@ -58,11 +58,11 @@
</select>
</div>
<div class="col-sm-2">
<a class="col-sm-4 btn btn-primary addBtn">+</a>
<a class="col-sm-4 btn btn-primary addBtn" data-index="[[index]]">+</a>
[[if index==0]]
<a class="col-sm-4 col-sm-offset-2 btn btn-danger delBtn" disabled="true">-</a>
<a class="col-sm-4 col-sm-offset-2 btn btn-danger delBtn" disabled="true" data-index="[[index]]">-</a>
[[else]]
<a class="col-sm-4 col-sm-offset-2 btn btn-danger delBtn" >-</a>
<a class="col-sm-4 col-sm-offset-2 btn btn-danger delBtn" data-index="[[index]]">-</a>
[[/if]]
</div>
... ...