diff --git a/fuintAdmin/src/api/EventMarketing/activeNewlyweds.js b/fuintAdmin/src/api/EventMarketing/activeNewlyweds.js index 21e384389..a9541573b 100644 --- a/fuintAdmin/src/api/EventMarketing/activeNewlyweds.js +++ b/fuintAdmin/src/api/EventMarketing/activeNewlyweds.js @@ -76,3 +76,20 @@ export function getInfoActiveNewlyweds() { method: 'get' }) } + +// 删除新人有礼活动 +export function insertActiveNewlyweds(data) { + return request({ + url: '/business/marketingActivity/activeNewlyweds/add', + method: 'post', + data:data + }) +} +// 删除新人有礼活动 +export function editActiveNewlyweds1(data) { + return request({ + url: '/business/marketingActivity/activeNewlyweds/update', + method: 'put', + data:data + }) +} diff --git a/fuintAdmin/src/api/EventMarketing/cardCoupon.js b/fuintAdmin/src/api/EventMarketing/cardCoupon.js new file mode 100644 index 000000000..df7cc94fc --- /dev/null +++ b/fuintAdmin/src/api/EventMarketing/cardCoupon.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询优惠券活动列表 +export function listCardCoupon(query) { + return request({ + url: 'cardCoupon', + method: 'get', + params: query + }) +} + +// 查询优惠券活动列表 +export function getCardCoupon(id) { + return request({ + url: 'cardCoupon/'+id, + method: 'get', + }) +} + +// 查询优惠券活动列表 +export function addCardCoupon(data) { + return request({ + url: 'cardCoupon', + method: 'post', + data: data + }) +} + +// 查询优惠券活动列表 +export function editCardCoupon(data) { + return request({ + url: 'cardCoupon', + method: 'put', + data: data + }) +} + +// 查询优惠券活动列表 +export function deleteCardCoupon(id) { + return request({ + url: 'cardCoupon/'+id, + method: 'delete', + }) +} diff --git a/fuintAdmin/src/views/EventMarketing/activeNewlyweds/index.vue b/fuintAdmin/src/views/EventMarketing/activeNewlyweds/index.vue index 394a6956b..27dd27198 100644 --- a/fuintAdmin/src/views/EventMarketing/activeNewlyweds/index.vue +++ b/fuintAdmin/src/views/EventMarketing/activeNewlyweds/index.vue @@ -544,7 +544,7 @@ - +
@@ -556,6 +556,7 @@ v-model="ruleForm.activeStartTime" style="width: 160px" type="date" + value-format="yyyy-MM-dd" placeholder="开始日期"> @@ -563,21 +564,22 @@ v-model="ruleForm.activeEndTime" style="width: 160px" type="date" + value-format="yyyy-MM-dd" placeholder="结束日期">
- +
编辑
- + - +
@@ -629,7 +631,7 @@
- 重置 + 取消 保存 @@ -646,7 +648,7 @@ import { addActiveNewlyweds, updateActiveNewlyweds, huiActiveNewlyweds, - editActiveNewlyweds, getInfoActiveNewlyweds + editActiveNewlyweds, getInfoActiveNewlyweds, insertActiveNewlyweds, editActiveNewlyweds1 } from "@/api/EventMarketing/activeNewlyweds"; import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption"; import QRCode from "qrcodejs2"; @@ -656,6 +658,7 @@ import { getActiveFullminus, updateActiveFullminus } from "@/api/EventMarketing/activeFullminus"; +import {listCardCoupon} from "@/api/EventMarketing/cardCoupon"; export default { name: "ActiveNewlyweds", @@ -749,28 +752,24 @@ export default { "永久有效", "自定义" ], couponList: [], + // 优惠券列表信息 + cardCouponList:[], // 表单校验 rules: { name: [ - {required: true, message: '必填项不能为空', trigger: 'blur'}, + {required: true, message: '活动名称不能为空', trigger: 'blur'}, ], - activeStartTime: [ - {required: true, message: '必填项不能为空', trigger: 'blur'}, + activeTimeType: [ + {required: true, message: '活动时间不能为空', trigger: 'blur'}, ], - activeEndTime: [ - {required: true, message: '必填项不能为空', trigger: 'blur'}, + noticeContent: [ + {required: true, message: '通知内容不能为空', trigger: 'blur'}, + ], + activityDetails: [ + {required: true, message: '活动详情不能为空', trigger: 'blur'}, ], courtesyReward: [ - {required: true, message: '必填项不能为空', trigger: 'blur'}, - ], - points: [ - {required: true, message: '必填项不能为空', trigger: 'blur'}, - ], - growthValue: [ - {required: true, message: '必填项不能为空', trigger: 'blur'}, - ], - remark: [ - {required: true, message: '必填项不能为空', trigger: 'blur'}, + {required: true, message: '活动奖品不能为空', trigger: 'blur'}, ], } }; @@ -778,9 +777,14 @@ export default { created() { // this.getList() this.getInfo() - + this.getCardCoupon() }, methods: { + getCardCoupon(){ + listCardCoupon({status:1,putType:1}).then(res => { + this.cardCouponList = res.data.records + }) + }, getInfo(){ getInfoActiveNewlyweds().then(res => { if (res.data) { @@ -790,6 +794,7 @@ export default { if (res.data.couponList) this.couponList = res.data.couponList }else { this.ruleForm = { + activeTimeType:0, courtesyReward:[] } } @@ -811,17 +816,23 @@ export default { this.ruleForm.activeTimeType = 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) { if (this.ruleForm.courtesyReward) this.ruleForm.courtesyReward = this.ruleForm.courtesyReward.toString() if (this.couponList) this.ruleForm.couponList = this.couponList if (this.ruleForm.id) { - updateActiveNewlyweds(this.form).then(response => { + editActiveNewlyweds1(this.ruleForm).then(response => { this.$modal.msgSuccess("修改成功"); this.getInfo() }); }else { - addActiveNewlyweds(this.form).then(response => { + insertActiveNewlyweds(this.ruleForm).then(response => { this.$modal.msgSuccess("新增成功"); this.getInfo() }); @@ -831,6 +842,7 @@ export default { }, resetForm(formName) { this.$refs[formName].resetFields(); + this.ifWrite = true this.getInfo() }, /** 查询新人有礼活动列表 */ diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/controller/ActiveNewlywedsController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/controller/ActiveNewlywedsController.java index de2ac2323..489038ea7 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/controller/ActiveNewlywedsController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/controller/ActiveNewlywedsController.java @@ -199,5 +199,15 @@ public class ActiveNewlywedsController extends BaseController { public ResponseObject selectByStoreId(){ return getSuccessResult(activeNewlywedsService.selectByStoreId()); } + + @PostMapping("add") + public ResponseObject add(@RequestBody ActiveNewlyweds activeNewlyweds){ + return getSuccessResult(activeNewlywedsService.insertActiveNewlyweds(activeNewlyweds)); + } + + @PutMapping("update") + public ResponseObject edit(@RequestBody ActiveNewlyweds activeNewlyweds){ + return getSuccessResult(activeNewlywedsService.updateActiveNewlyweds(activeNewlyweds)); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/dto/ActiveNewlywedsDTO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/dto/ActiveNewlywedsDTO.java index 7ec9b8e82..368386959 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/dto/ActiveNewlywedsDTO.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/dto/ActiveNewlywedsDTO.java @@ -20,10 +20,10 @@ public class ActiveNewlywedsDTO implements Serializable { //活动名称 private String name; //活动开始时间 - @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:优惠券 1:兑换券 2:成长值 3:积分 private String[] courtesyReward; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/entity/ActiveNewlyweds.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/entity/ActiveNewlyweds.java index b1aafcb19..465a7da13 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/entity/ActiveNewlyweds.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/entity/ActiveNewlyweds.java @@ -35,10 +35,10 @@ public class ActiveNewlyweds extends Model { //活动时间类型:0永久有效;1自定义 private String activeTimeType; //活动开始时间 - @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:优惠券 1:兑换券 2:成长值 3:积分 private String courtesyReward; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsChildService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsChildService.java index ac5111770..faf6343c9 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsChildService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsChildService.java @@ -18,5 +18,12 @@ public interface ActiveNewlywedsChildService extends IService selectByActiveId(Integer activeNewlywedsId); + + /** + * 根据新人有礼id删除子表信息 + * @param activeNewlywedsId + * @return + */ + int deleteByActiveId(Integer activeNewlywedsId); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsService.java index a5094e2c2..a477601bc 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsService.java @@ -70,5 +70,19 @@ public interface ActiveNewlywedsService extends IService { * @return */ ActiveNewlyweds selectByStoreId(); + + /** + * 添加开卡有礼活动信息 + * @param activeNewlyweds + * @return + */ + int insertActiveNewlyweds(ActiveNewlyweds activeNewlyweds); + + /** + * 修改开卡有礼活动信息 + * @param activeNewlyweds + * @return + */ + int updateActiveNewlyweds(ActiveNewlyweds activeNewlyweds); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsChildServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsChildServiceImpl.java index cb9f16c72..40ab6da93 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsChildServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsChildServiceImpl.java @@ -25,5 +25,12 @@ public class ActiveNewlywedsChildServiceImpl extends ServiceImpl(); + queryWrapper.eq("active_newlyweds_id",activeNewlywedsId); + return baseMapper.delete(queryWrapper); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java index d54c128a0..bdced4ff5 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsServiceImpl.java @@ -32,6 +32,7 @@ import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRe import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableMapper; import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService; import com.fuint.business.store.service.StoreService; +import com.fuint.common.dto.AccountInfo; import com.fuint.common.service.AccountService; import com.fuint.common.util.TokenUtil; import com.fuint.repository.model.TAccount; @@ -44,6 +45,7 @@ import javax.annotation.Resource; import java.io.Serializable; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -649,7 +651,20 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl(); queryWrapper.eq("store_id",TokenUtil.getNowAccountInfo().getStoreId()); - ActiveNewlyweds activeNewlyweds = baseMapper.selectOne(queryWrapper); + List list = baseMapper.selectList(queryWrapper); + ActiveNewlyweds activeNewlyweds = null; +// 查看活动是否在进行中 + for (ActiveNewlyweds newlyweds : list) { + if (newlyweds.getActiveTimeType().equals("0")){ + activeNewlyweds = newlyweds; + }else { + Date date = new Date(); + if (newlyweds.getActiveStartTime().before(date) && newlyweds.getActiveEndTime().after(date)){ + activeNewlyweds = newlyweds; + } + } + } + if (ObjectUtil.isNotEmpty(activeNewlyweds)) { List activeNewlywedsChildren = activeNewlywedsChildService.selectByActiveId(activeNewlyweds.getId()); activeNewlyweds.setCouponList(activeNewlywedsChildren); @@ -657,6 +672,37 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl