Authored by shuaiguo

添加&更新兑券

... ... @@ -43,14 +43,13 @@
required="required"/>
</div>
</div>
[[each couponsIds as item index]]
<div class="form-group">
<label class="col-sm-2 control-label">优惠券ID<i class="red">*</i></label>
<div class="col-sm-7">
<select name="couponsIds" class="col-sm-10 observe select2-offscreen couponsIds"
data-field="couponsIds.[[index]].id" data-index="[[index]]">
<option value='[[item.id]]'>[[item.text||item.id||'请选择优惠券ID']]</option>
<select name="sendCouponId" class="col-sm-10 observe select2-offscreen sendCouponId"
data-field="sendCouponId">
<option value='[[sendCouponId]]'>[[sendCouponName||sendCouponId||'请选择优惠券ID']]</option>
</select>
</div>
<!-- <div class="col-sm-2">
... ... @@ -63,7 +62,6 @@
</div> -->
</div>
[[/each]]
<div class="form-group">
<label class="col-sm-2 control-label">兑换有货币数量<i class="red">*</i></label>
... ...
... ... @@ -91,21 +91,15 @@ var Bll = {
{
value: "保存",
callback: function () {
var couponIds = Bll.module.couponsIds || [];
var flag = true;
var ids = [];
for (var i = 0; i < couponIds.length; i++) {
ids.push(couponIds[i].id);
}
if (ids.join(",").indexOf("-1") > -1) {
if (Bll.module.sendCouponId === '-1') {
flag = false;
common.util.__tip("请正确选择优惠券ID", "warning");
} else {
Bll.module.couponsIds = ids.join(",");
}
}
if (edit.validate() && flag) {
const url = Bll.module.id ? '/exchangeCouponManager/update' : '/exchangeCouponManager/add'
common.util.__ajax({
url: "/exchangeCouponManager/addOrUpdate",
url,
data: Bll.module
}, function (res) {
if (res.code == '200') {
... ... @@ -136,7 +130,7 @@ var Bll = {
__editRender: function () {
edit.init();
new common.dropDown({
el: '.couponsIds',
el: '.sendCouponId',
ajax: 'couponID'
});
}
... ... @@ -187,13 +181,9 @@ $('#add-content').on('click', function () {
var item = {
"id": "",
"name": "",
"couponsIds": [
{
"id": "",
"text": ""
}
],
"status": 1
"subName": "",
"sendCouponId": "",
"sendCouponName":""
};
Bll.toast(item, "添加");
});
... ...