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

View File

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