diff --git a/fuintAdmin/src/api/EventMarketing/activeConsumption.js b/fuintAdmin/src/api/EventMarketing/activeConsumption.js index d3a17a9e0..45bec0b69 100644 --- a/fuintAdmin/src/api/EventMarketing/activeConsumption.js +++ b/fuintAdmin/src/api/EventMarketing/activeConsumption.js @@ -122,3 +122,11 @@ export function addActivity(data) { data:data }) } + +export function editActivity(data) { + return request({ + url: 'business/marketingActivity/activeConsumption/updateActiveConsumption', + method: 'put', + data:data + }) +} diff --git a/fuintAdmin/src/views/EventMarketing/activeConsumption/index.vue b/fuintAdmin/src/views/EventMarketing/activeConsumption/index.vue index d7af3c31f..a5a531854 100644 --- a/fuintAdmin/src/views/EventMarketing/activeConsumption/index.vue +++ b/fuintAdmin/src/views/EventMarketing/activeConsumption/index.vue @@ -679,6 +679,7 @@ v-model="ruleForm.activeStartTime" style="width: 160px" type="date" + value-format="yyyy-MM-dd" placeholder="开始日期"> @@ -686,6 +687,7 @@ v-model="ruleForm.activeEndTime" style="width: 160px" type="date" + value-format="yyyy-MM-dd" placeholder="结束日期"> @@ -732,7 +734,7 @@ - + - - - + + @@ -897,11 +902,12 @@ import { listFavorable, looklook, looklooklook, - editActiveConsumption, getInfoActivity + editActiveConsumption, getInfoActivity, addActivity, editActivity } from "@/api/EventMarketing/activeConsumption"; import {listUserGrade} from "@/api/staff/user/usergrade"; import {getOilNameList} from "@/api/order/oilnumgun"; import {listCardCoupon} from "@/api/EventMarketing/cardCoupon"; +import {listUserLabel} from "@/api/staff/user/userlabel"; export default { name: "ActiveConsumption", @@ -917,6 +923,7 @@ export default { ], labelPosition: 'left', userGradeList: [], + userLabelList:[], // 油号列表 oilNameList: [], pdidlist: [],//判断优惠券id @@ -1019,7 +1026,9 @@ export default { ruleForm: { paymentType:[], - activeGift:[] + activeGift:[], + activityTimeType:0, + suitTimeSlotType:0, }, ifWrite: true, tindex1: 0, @@ -1077,20 +1086,54 @@ export default { created() { // this.getList(); // this.getoiltypeliet() - this.getoilName() + // this.getoilName() this.listUserGrade() this.getInfo() this.getCardCoupon() + this.getUserLabelList() }, methods: { + getUserLabelList(){ + listUserLabel({page:1,pageSize:10000}).then(res => { + this.userLabelList = res.data.records + }) + }, getInfo(){ getInfoActivity().then(res => { if (res.data) { this.ruleForm = res.data + if (res.data.activityTimeType) this.tindex1 = res.data.activityTimeType + if (res.data.suitTimeSlotType) this.tindex3 = res.data.suitTimeSlotType + if (res.data.paymentType) this.ruleForm.paymentType = res.data.paymentType.split(",") + if (res.data.dieselUserLevel) this.ruleForm.dieselUserLevel = res.data.dieselUserLevel.split(",") + if (res.data.userLabelIds) this.ruleForm.userLabelIds = res.data.userLabelIds.split(",") + if (res.data.activeGift) this.ruleForm.activeGift = res.data.activeGift.split(",") + if (res.data.suitDate){ + if (res.data.suitTimeSlotType == 0){ + this.weekDay = res.data.suitDate.split(",") + }else { + this.monthDay = res.data.suitDate.split(",") + } + }else { + this.weekDay = [] + this.monthDay = [] + } + if (res.data.pointList) this.pointList = res.data.pointList + if (res.data.growthValueList) this.growthValueList = res.data.growthValueList if (res.data.couponList) this.couponList = res.data.couponList }else { - + this.ruleForm = { + paymentType:[], + activeGift:[], + activityTimeType:0, + suitTimeSlotType:0, + } + this.tindex1 = 0 + this.tindex3 = 0 + this.pointList = [] + this.growthValueList = [] + this.couponList = [] } }) }, @@ -1144,17 +1187,46 @@ export default { this.ruleForm.suitTimeSlotType = index }, submitRuleForm(formName) { + if (this.tindex1 == 1){ + if (!this.ruleForm.activeStartTime || !this.ruleForm.activeEndTime){ + this.$message.error("请选择活动开始时间") + return + } + } this.$refs[formName].validate((valid) => { if (valid) { - alert('submit!'); - } else { - console.log('error submit!!'); - return false; + // 使用时间段 + if (this.ruleForm.suitTimeSlotType==0){ + this.ruleForm.suitDate = this.weekDay.toString() + }else if (this.ruleForm.suitTimeSlotType==1){ + this.ruleForm.suitDate = this.monthDay.toString() + } + // 会员等级 + if (this.ruleForm.dieselUserLevel) this.ruleForm.dieselUserLevel = this.ruleForm.dieselUserLevel.toString() + // 会员标签 + if (this.ruleForm.userLabelIds) this.ruleForm.userLabelIds = this.ruleForm.userLabelIds.toString() + // 可使用支付方式 + if (this.ruleForm.paymentType) this.ruleForm.paymentType = this.ruleForm.paymentType.toString() + // 活动奖品 + if (this.ruleForm.activeGift) this.ruleForm.activeGift = this.ruleForm.activeGift.toString() + + if (this.ruleForm.id) { + editActivity(this.ruleForm).then(response => { + this.$modal.msgSuccess("修改成功"); + this.getInfo(); + }); + } else { + addActivity(this.ruleForm).then(response => { + this.$modal.msgSuccess("新增成功"); + this.getInfo(); + }); + } } }); }, resetForm(formName) { this.$refs[formName].resetFields(); + this.getInfo() }, indexMethod(index) { return index * 2; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/controller/ActiveConsumptionController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/controller/ActiveConsumptionController.java index 4b60ef6fe..b2d2ef3d7 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/controller/ActiveConsumptionController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/controller/ActiveConsumptionController.java @@ -129,6 +129,24 @@ public class ActiveConsumptionController extends BaseController { return getSuccessResult(this.activeConsumptionService.insertActiveConsumption(activeConsumption)); } + /** + * 修改数据 + * + * @param activeConsumption 实体对象 + * @return 修改结果 + */ + @PutMapping("updateActiveConsumption") + public ResponseObject updateActiveConsumption(@RequestBody ActiveConsumption activeConsumption) { + try { + SysLog sysLog =new SysLog(); + sysLog.setSystemName("2"); + sysLog.setMoudle("营销中心"); + sysLog.setContent("更新名称为"+activeConsumption.getName()+"消费有礼活动"); + sysLogService.saveVo(sysLog); + }catch (Exception ignored){} + return getSuccessResult(this.activeConsumptionService.updateActiveConsumption(activeConsumption)); + } + /** * 修改数据 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/dto/ActiveConsumptionDTO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/dto/ActiveConsumptionDTO.java index 3f4ba33bc..bbde275b7 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/dto/ActiveConsumptionDTO.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/dto/ActiveConsumptionDTO.java @@ -31,10 +31,10 @@ public class ActiveConsumptionDTO extends Model { //满足金额 private String participationConditionMoney; //活动开始时间 - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") + @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8") private Date activeStartTime; //活动结束时间 - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") + @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8") private Date activeEndTime; //适用油品0:92# 1: 95# 2:98# 3:0# 4:-10# 5: LNG 6;CNG 7:京92# 8:京95# 9:京0# private String[] adaptOil; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/entity/ActiveConsumption.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/entity/ActiveConsumption.java index fb1cf8c71..0bc778e50 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/entity/ActiveConsumption.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/entity/ActiveConsumption.java @@ -41,10 +41,10 @@ public class ActiveConsumption extends Model { */ private String activityTimeType; //活动开始时间 - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date activeStartTime; //活动结束时间 - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date activeEndTime; //适用油品0:92# 1: 95# 2:98# 3:0# 4:-10# 5: LNG 6;CNG 7:京92# 8:京95# 9:京0# private String adaptOil; @@ -134,5 +134,20 @@ public class ActiveConsumption extends Model { */ @TableField(exist = false) private List activityPrize; + /** + * 活动奖品积分子表信息 + */ + @TableField(exist = false) + private List pointList; + /** + * 活动奖品成长值子表信息 + */ + @TableField(exist = false) + private List growthValueList; + /** + * 活动奖品优惠券子表信息 + */ + @TableField(exist = false) + private List couponList; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/ActiveConsumptionChildService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/ActiveConsumptionChildService.java index 78159adb2..397701375 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/ActiveConsumptionChildService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/ActiveConsumptionChildService.java @@ -25,4 +25,6 @@ public interface ActiveConsumptionChildService extends IService selectByActiveId(Integer activeConsumptionId,String activeGift); + + int deleteByActiveId(Integer activeConsumptionId); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/ActiveConsumptionService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/ActiveConsumptionService.java index d2c049180..3ecf6ed19 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/ActiveConsumptionService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/ActiveConsumptionService.java @@ -70,6 +70,18 @@ public interface ActiveConsumptionService extends IService { */ ActiveConsumption selectByStoreId(); + /** + * 添加消费有礼信息 + * @param activeConsumption + * @return + */ int insertActiveConsumption(ActiveConsumption activeConsumption); + + /** + * 修改消费有礼信息 + * @param activeConsumption + * @return + */ + int updateActiveConsumption(ActiveConsumption activeConsumption); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/impl/ActiveConsumptionChildServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/impl/ActiveConsumptionChildServiceImpl.java index 2511515a9..9d0174e20 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/impl/ActiveConsumptionChildServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/impl/ActiveConsumptionChildServiceImpl.java @@ -137,4 +137,11 @@ public class ActiveConsumptionChildServiceImpl extends ServiceImpl(); + queryWrapper.eq("active_consumption_id",activeConsumptionId); + return baseMapper.delete(queryWrapper); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/impl/ActiveConsumptionServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/impl/ActiveConsumptionServiceImpl.java index 38b921c4c..8b188aaa6 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/impl/ActiveConsumptionServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeConsumption/service/impl/ActiveConsumptionServiceImpl.java @@ -53,6 +53,7 @@ import java.io.Serializable; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; +import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -569,9 +570,26 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl(); queryWrapper.eq("store_id",nowAccountInfo.getStoreId()); - ActiveConsumption activeConsumption = baseMapper.selectOne(queryWrapper); - List activeConsumptionChildren = activeConsumptionChildService.selectList(activeConsumption.getId()); - activeConsumption.setActivityPrize(activeConsumptionChildren); + List list = baseMapper.selectList(queryWrapper); + ActiveConsumption activeConsumption = null; + for (ActiveConsumption consumption : list) { + if (consumption.getActivityTimeType().equals("0")){ + activeConsumption = consumption; + }else { + Date date = new Date(); + if (consumption.getActiveStartTime().before(date) && consumption.getActiveEndTime().after(date)){ + activeConsumption = consumption; + } + } + } + if (ObjectUtil.isNotEmpty(activeConsumption)) { + List activeConsumptionChildren = activeConsumptionChildService.selectByActiveId(activeConsumption.getId(), "0"); + activeConsumption.setPointList(activeConsumptionChildren); + List activeConsumptionChildren1 = activeConsumptionChildService.selectByActiveId(activeConsumption.getId(), "3"); + activeConsumption.setGrowthValueList(activeConsumptionChildren1); + List activeConsumptionChildren2 = activeConsumptionChildService.selectByActiveId(activeConsumption.getId(), "1"); + activeConsumption.setCouponList(activeConsumptionChildren2); + } return activeConsumption; } @@ -581,14 +599,54 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl