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

创建积分活动修改

parent 78d336c4
...@@ -167,7 +167,7 @@ ...@@ -167,7 +167,7 @@
let showIndex = null; let showIndex = null;
// 初始化数据, 可以由后台传过来 // 初始化数据, 可以由后台传过来
let data = []; // 表格内数据集合 var data = []; // 表格内数据集合
let activityName = ''; // 活动名称 let activityName = ''; // 活动名称
let activityType = ''; // 活动类型 let activityType = ''; // 活动类型
let timeType = '1'; // 活动时间类型 let timeType = '1'; // 活动时间类型
...@@ -270,7 +270,11 @@ ...@@ -270,7 +270,11 @@
title: '奖励积分数量', title: '奖励积分数量',
formatter: function(value, row, index) { formatter: function(value, row, index) {
let str = ''; let str = '';
str = `<input id='prizeTypeNum${index}' class='form-control' type='text' name='' value='${data[index].prizeTypeNum}'>` if (data[index].prizeType === 1) {
str = `<input id='prizeTypeNum${index}' class='form-control' type='text' name='' value='${data[index].prizeTypeNum}' style="display: block">`
} else {
str = `<input id='prizeTypeNum${index}' class='form-control' type='text' name='' value='${data[index].prizeTypeNum}' style="display: none">`
}
var html = $.common.sprintf(str, index, value); var html = $.common.sprintf(str, index, value);
return html; return html;
} }
...@@ -296,13 +300,12 @@ ...@@ -296,13 +300,12 @@
title: '奖品库存', title: '奖品库存',
formatter: function(value, row, index) { formatter: function(value, row, index) {
let str = ''; let str = '';
if (data[index].isInfinite !== '') { if (data[index].isInfinite === 1) {
str = `<div class="radio-box"><input type="radio" name="isInfinite${index}" value="1" checked="${data[index].isInfinite} === 1" onclick="changeInfinite(this, ${index})"/>有限库存</div> str = `<div class="radio-box"><input type="radio" name="isInfinite${index}" value="1" checked onclick="changeInfinite(this, ${index})"/>有限库存</div>
<div class="radio-box"><input type="radio" name="isInfinite${index}" value="2" checked="${data[index].isInfinite} === 2" onclick="changeInfinite(this, ${index})"/>无限库存</div>` <div class="radio-box"><input type="radio" name="isInfinite${index}" value="2" onclick="changeInfinite(this, ${index})"/>无限库存</div>`
} else { } else {
str = `<div class="radio-box"><input type="radio" name="isInfinite${index}" value="1" onclick="changeInfinite(this, ${index})"/>有限库存</div>
str = `<div class="radio-box"><input type="radio" name="isInfinite${index}" value="1" checked="${data[index].isInfinite} === 1" onclick="changeInfinite(this, ${index})"/>有限库存</div> <div class="radio-box"><input type="radio" name="isInfinite${index}" value="2" checked onclick="changeInfinite(this, ${index})"/>无限库存</div>`
<div class="radio-box"><input type="radio" name="isInfinite${index}" value="2" checked="${data[index].isInfinite} === 2" onclick="changeInfinite(this, ${index})"/>无限库存</div>`
} }
var html = $.common.sprintf(str, index, value); var html = $.common.sprintf(str, index, value);
return html; return html;
...@@ -315,9 +318,11 @@ ...@@ -315,9 +318,11 @@
formatter: function(value, row, index) { formatter: function(value, row, index) {
let str = ''; let str = '';
if (data[index].prizeNum !== '') { if (data[index].prizeNum !== '') {
str = `<input id='prizeNum${index}' class='form-control' type='text' name='' value='${data[index].prizeNum}'>` if (data[index].isInfinite === 1) {
} else { str = `<input id='prizeNum${index}' class='form-control' type='text' name='' value='${data[index].prizeNum}'>`
str = `<input id='prizeNum${index}' class='form-control' type='text' name='' value=''>` } else {
str = `<input id='prizeNum${index}' class='form-control' type='text' name='' value='${data[index].prizeNum}' style="display: none">`
}
} }
var html = $.common.sprintf(str, index, value); var html = $.common.sprintf(str, index, value);
return html; return html;
...@@ -485,7 +490,6 @@ ...@@ -485,7 +490,6 @@
} }
data = [...res.prizeList] data = [...res.prizeList]
options.data = data; options.data = data;
console.log('data==', data);
setTimeout(()=>{ setTimeout(()=>{
$.table.init(options); $.table.init(options);
}, 500) }, 500)
...@@ -494,6 +498,7 @@ ...@@ -494,6 +498,7 @@
}) })
} else { } else {
let obj = { let obj = {
prizeId: "",
prizeTitle: "", prizeTitle: "",
prizeImgInit: "", prizeImgInit: "",
prizeImgSelect: "", prizeImgSelect: "",
...@@ -506,7 +511,7 @@ ...@@ -506,7 +511,7 @@
prizeDescribe: "", prizeDescribe: "",
residue: "" residue: ""
}; };
for( var i = 0; i < 20; i++) { for( var i = 0; i < 2; i++) {
data.push(obj) data.push(obj)
} }
$.table.init(options); $.table.init(options);
...@@ -630,7 +635,7 @@ ...@@ -630,7 +635,7 @@
|| !$("#estimatedNum").val() || !$("#estimatedNum").val()
|| !$("#probabilityPublicity").val() || !$("#probabilityPublicity").val()
) { ) {
return layer.msg('请将必填信息填写完整!') return layer.msg('请将活动必填信息填写完整!')
} }
if (timeType == 2) { if (timeType == 2) {
if (!$("#startTime").val() || !$("#endTime").val()) { if (!$("#startTime").val() || !$("#endTime").val()) {
...@@ -646,7 +651,7 @@ ...@@ -646,7 +651,7 @@
} }
let flag = false; let flag = false;
let prizeListArr = [] let prizeListArr = []
data = data.map((item,index)=>{ data.forEach((item, index) => {
let temp = {}; let temp = {};
if (!$("#prizeTitle"+index).val() if (!$("#prizeTitle"+index).val()
|| !$("#showPic"+index).attr('src') || !$("#showPic"+index).attr('src')
...@@ -655,7 +660,6 @@ ...@@ -655,7 +660,6 @@
|| !$("#winningProbability"+index).val() || !$("#winningProbability"+index).val()
|| !$("input[name=isInfinite"+index+"]:checked").val() || !$("input[name=isInfinite"+index+"]:checked").val()
|| !$("#prizeNum"+index).val() || !$("#prizeNum"+index).val()
|| !$("#prizeDescribe"+index).val()
) { ) {
flag = true flag = true
} else { } else {
...@@ -666,19 +670,14 @@ ...@@ -666,19 +670,14 @@
temp.prizeType = $("#prizeType"+index).val(); temp.prizeType = $("#prizeType"+index).val();
temp.prizeTypeNum = temp.prizeType == '1' ? $("#prizeTypeNum"+index).val() : 0; temp.prizeTypeNum = temp.prizeType == '1' ? $("#prizeTypeNum"+index).val() : 0;
temp.isInfinite = $("input[name=isInfinite"+index+"]:checked").val(); temp.isInfinite = $("input[name=isInfinite"+index+"]:checked").val();
if (temp.isInfinite === '1') { temp.prizeNum = temp.isInfinite === '1' ? $("#prizeNum"+index).val() : 0;
temp.prizeNum = $("#prizeNum"+index).val();
} else {
temp.prizeNum = 0;
}
temp.winningProbability = $("#winningProbability"+index).val(); temp.winningProbability = $("#winningProbability"+index).val();
temp.prizeDescribe = $("#prizeDescribe"+index).val(); temp.prizeDescribe = $("#prizeDescribe"+index).val();
} }
prizeListArr.push(temp); prizeListArr.push(temp);
// return {...item}; });
})
if (flag) { if (flag) {
return layer.msg('请将表格内容填写完整!') return layer.msg('请将奖品表格内容填写完整!')
} }
let datas = { let datas = {
activityImg: showPicture, activityImg: showPicture,
...@@ -711,7 +710,7 @@ ...@@ -711,7 +710,7 @@
layer.msg('' + res); layer.msg('' + res);
if (res.code != undefined && res.code != web_status.SUCCESS) { if (res.code != undefined && res.code != web_status.SUCCESS) {
$.modal.alertWarning(res.msg); $.modal.alertWarning(res.msg);
return []; return;
} else if (res.code == web_status.SUCCESS) { } else if (res.code == web_status.SUCCESS) {
$.operate.successTabCallback(res); $.operate.successTabCallback(res);
closeItem(); closeItem();
...@@ -816,7 +815,6 @@ ...@@ -816,7 +815,6 @@
pageNum: 1, pageNum: 1,
bindType: 2 bindType: 2
} }
console.log(data);
let str = ''; let str = '';
promiseMethods(candyfix + "/list",'post',data,'application/x-www-form-urlencoded').then(res=>{ promiseMethods(candyfix + "/list",'post',data,'application/x-www-form-urlencoded').then(res=>{
if (res.rows.length>0) { if (res.rows.length>0) {
......
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