This commit is contained in:
cun-nan 2024-03-07 09:31:51 +08:00
parent e175eeda8a
commit 09fd7d1e04
2 changed files with 19 additions and 9 deletions

View File

@ -217,7 +217,7 @@
<div class="box-bt"> <div >赠送卡券</div> <el-button type="primary" icon="el-icon-plus" @click="getlistFavorable()" >新增</el-button> </div> <div class="box-bt"> <div >赠送卡券</div> <el-button type="primary" icon="el-icon-plus" @click="getlistFavorable()" >新增</el-button> </div>
<div style="margin: 10px 0px"> <div style="margin: 10px 0px">
<el-table <el-table
:data="form.tableDatas" :data="tableData1"
border border
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
@ -660,6 +660,7 @@ export default {
tableDatadh:[],// tableDatadh:[],//
tableDatasw:[],// tableDatasw:[],//
tableDatas:[],// tableDatas:[],//
tableData1:[],//
// //
youhuiquan:{ youhuiquan:{
name:'', name:'',
@ -979,7 +980,8 @@ export default {
giftCardTotal: 1// giftCardTotal: 1//
} }
this.form.tableDatas.push(data) // this.form.tableDatas.push(data)
this.tableData1.push(data)
this.$message.success("新增成功") this.$message.success("新增成功")
@ -1110,16 +1112,17 @@ export default {
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
this.tableData1 = []
const id = row.id || this.ids const id = row.id || this.ids
getActiveConsumption(id).then(response => { getActiveConsumption(id).then(response => {
this.form = response.data; this.form = response.data;
if(response.data.activeConsumptionChildList&&response.data.activeConsumptionChildList.length >1){ if(response.data.activeConsumptionChildList&&response.data.activeConsumptionChildList.length >1){
this.form.tableDatas = response.data.activeConsumptionChildList.filter(item => item.activeGift == '1') this.form.tableDatas = response.data.activeConsumptionChildList.filter(item => item.activeGift == '1')
this.tableData1 = response.data.activeConsumptionChildList.filter(item => item.activeGift == '1')
this.tableDatas = response.data.activeConsumptionChildList.filter(item => item.activeGift == '2') this.tableDatas = response.data.activeConsumptionChildList.filter(item => item.activeGift == '2')
this.form.shiwudata = response.data.activeConsumptionChildList.filter(item => item.activeGift == '4') this.form.shiwudata = response.data.activeConsumptionChildList.filter(item => item.activeGift == '4')
} }
this.open = true; this.open = true;
this.title = "修改消费有礼活动"; this.title = "修改消费有礼活动";
}); });
@ -1173,10 +1176,14 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
if (!this.form.tableDatas || this.form.tableDatas.length==0){ // if (!this.form.tableDatas || this.form.tableDatas.length==0){
this.form.tableDatas = [] // this.form.tableDatas = []
} // }
this.form.activeConsumptionChildList = this.form.tableDatas.concat(this.tableDatas, this.form.shiwudata); // if (this.tableDatas && this.tableDatas.length>0 || this.form.shiwudata && this.form.shiwudata.length>0 )
// this.form.activeConsumptionChildList = this.form.tableDatas.concat(this.tableDatas, this.form.shiwudata);
// if (this.tableDatas && this.tableDatas.length>0 || this.form.shiwudata && this.form.shiwudata.length>0 )
this.form.activeConsumptionChildList = this.tableData1.concat(this.tableDatas);
console.log(this.form.activeConsumptionChildList) console.log(this.form.activeConsumptionChildList)
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {

View File

@ -125,6 +125,7 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
activeConsumption.setGasolineUserLevel(arrayToString(activeConsumptionDTO.getGasolineUserLevel())); activeConsumption.setGasolineUserLevel(arrayToString(activeConsumptionDTO.getGasolineUserLevel()));
//天然气会员等级 //天然气会员等级
activeConsumption.setNaturalUserLevel(arrayToString(activeConsumptionDTO.getNaturalUserLevel())); activeConsumption.setNaturalUserLevel(arrayToString(activeConsumptionDTO.getNaturalUserLevel()));
activeConsumption.setMoneyType(activeConsumptionDTO.getMoneyType());
save = save(activeConsumption); save = save(activeConsumption);
} }
//新增兑换物品 //新增兑换物品
@ -313,6 +314,7 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
String participationConditionMoney = activeConsumptionDTO.getParticipationConditionMoney(); String participationConditionMoney = activeConsumptionDTO.getParticipationConditionMoney();
double participationConditionMoneys = Double.parseDouble(participationConditionMoney); double participationConditionMoneys = Double.parseDouble(participationConditionMoney);
BeanUtils.copyProperties(activeConsumptionDTO,activeConsumption); BeanUtils.copyProperties(activeConsumptionDTO,activeConsumption);
activeConsumption.setMoneyType(activeConsumptionDTO.getMoneyType());
activeConsumption.setParticipationConditionMoney(participationConditionMoneys); activeConsumption.setParticipationConditionMoney(participationConditionMoneys);
activeConsumption.setAdaptOil(arrayToString(activeConsumptionDTO.getAdaptOil())); activeConsumption.setAdaptOil(arrayToString(activeConsumptionDTO.getAdaptOil()));
activeConsumption.setActiveGift(arrayToString(activeConsumptionDTO.getActiveGift())); activeConsumption.setActiveGift(arrayToString(activeConsumptionDTO.getActiveGift()));
@ -335,9 +337,10 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
List<ActiveConsumptionChild> activeConsumptionChildList1 = activeConsumptionDTO.getActiveConsumptionChildList(); List<ActiveConsumptionChild> activeConsumptionChildList1 = activeConsumptionDTO.getActiveConsumptionChildList();
if (CollectionUtils.isNotEmpty(activeConsumptionChildList1)){ if (CollectionUtils.isNotEmpty(activeConsumptionChildList1)){
activeConsumptionChildList1.stream().map(s ->{ activeConsumptionChildList1.stream().map(s ->{
s.setActiveConsumptionId(activeConsumption.getId()); if (ObjectUtil.isNotEmpty(s)) s.setActiveConsumptionId(activeConsumption.getId());
return s; return s;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
if (ObjectUtil.isNotEmpty(activeConsumptionChildList1))
update = activeConsumptionChildService.saveBatch(activeConsumptionChildList1); update = activeConsumptionChildService.saveBatch(activeConsumptionChildList1);
} }
return update; return update;