记得上下班打卡 | git大法好,push需谨慎

创建积分活动+优惠券选择

parent 40c5beec
......@@ -114,11 +114,11 @@
</div>
</div>
</form>
<div id="detailsFormList" class="details-form-list">
<div id="detailsFormList" class="details-form-list" style="display: none">
<!--奖品详情-->
<div class="details-pop-inner">
<button type="button" class="btn btn-primary" onclick="addCouponShow()">添加</button>
<button type="button" class="btn btn-primary" onclick="closeCoupon()">关闭窗口</button>
<button type="button" class="btn btn-primary" onclick="closeCouponShow()">关闭窗口</button>
<hr>
<div class="coupon-select" style="display: none">
<!--选择优惠券-->
......@@ -364,12 +364,10 @@
]
};
var nowList = []; // 当前编辑的奖品详情列表
var nowPrizeId = ''; // 当前编辑的奖品ID
var integralActivityId = ''; // 当前编辑的活动ID
var nowShowData = {}; // 当前编辑的奖品信息
let searchVal = ''; // 优惠券输入框内数据
let searchData = []; // 优惠券搜索总数据
let nowCouponSelectId = ''; // 当前选择的优惠券ID
let nowCouponSelectTitle = ''; // 当前选择的优惠券title
var nowCouponSelect = {}; // 当前选择的优惠券
var detailsOptions = {
id: "details-table",
data: nowList,
......@@ -393,7 +391,7 @@
align: 'center',
title: "优惠券ID",
formatter: function (value, row, index) {
return data[index].couponId;
return nowList[index].couponId;
}
},
{
......@@ -401,7 +399,7 @@
align: 'center',
title: "优惠券名称",
formatter: function (value, row, index) {
return data[index].couponTitle;
return nowList[index].couponTitle;
}
},
{
......@@ -487,7 +485,6 @@
data.push(obj)
}
$.table.init(options);
console.log($.table);
}
});
......@@ -681,8 +678,6 @@
estimatedNum: $("#estimatedNum").val(),
probabilityPublicity: $("#probabilityPublicity").val()
}
console.log('========', data);
console.log('========', datas);
let url = '/sweet/integralActivity/create';
let type = 'post';
if (itemId) {
......@@ -706,36 +701,40 @@
}
})
}
// 展示已配置的优惠券列表
function showList (index) {
console.log('showList===', data[index]);
nowPrizeId = data[index].prizeId;
integralActivityId = data[index].integralActivityId;
// 拿列表数据
nowShowData = data[index];
nowShowData.index = index;
nowList = [];
detailsOptions.data = [];
$.table.destroy("details-table");
$.ajax({
type: 'get',
url: '/sweet/integralActivityPrizeRelation/list',
data: {prizeId: nowPrizeId},
success: function (e) {
if (e.code == 0) {
let res = e.data;
}
data: { prizeId: nowShowData['prizeId'] },
success: function (res) {
nowList = res;
detailsOptions.data = res;
setTimeout(()=>{
$.table.init(detailsOptions);
}, 500)
$("#detailsFormList").show();
}
});
$.table.init(detailsOptions);
$("#detailsFormList").show();
}
function addCouponShow () {
$(".coupon-select").show();
}
function closeCouponShow () {
$("#detailsFormList").hide();
}
// 添加优惠券
function addCouponFun () {
console.log('添加优惠券===');
let postData = {
"couponId": nowCouponSelectId,
"couponTitle": nowCouponSelectTitle,
"integralActivityId": integralActivityId,
"prizeId": nowPrizeId
"couponId": nowCouponSelect.couponId,
"couponTitle": nowCouponSelect.title,
"integralActivityId": nowShowData['integralActivityId'],
"prizeId": nowShowData['prizeId']
};
$.ajax({
type: 'post',
......@@ -744,16 +743,29 @@
contentType: 'application/json',
success: function (e) {
if (e.code == 0) {
showList(nowShowData.index);
alert('添加成功!');
}
}
});
}
// 删除优惠券
function deleteCoupon(index) {
console.log('删除优惠券===');
}
function closeCoupon () {
$("#detailsFormList").hide();
let postData = {
"integralActivityId": nowShowData['integralActivityId'],
"prizeRelationId": nowList[index]['prizeRelationId']
};
$.ajax({
type: 'put',
url: '/sweet/integralActivityPrizeRelation/delete',
data: postData,
success: function (e) {
if (e.code == 0) {
showList(nowShowData.index);
alert('删除成功!');
}
}
});
}
// 远程搜索券
function getMallList() {
......@@ -790,15 +802,14 @@
})
})
}
// 选择优惠券
function selectOne(id, name) {
searchData.some( item => {
searchData.some( (item, index) => {
if (item[name] == id) {
nowCouponSelectTitle = item.title;
nowCouponSelect = item;
return $("#searchIpt").val(item.title);
}
} )
nowCouponSelectId = id;
console.log('选择===', id, nowCouponSelectTitle);
}
$("#searchIpt").focus(function(){
getMallList()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment