From c9ab6b7f3f2297aa964d5489d82dfa3d13311e49 Mon Sep 17 00:00:00 2001 From: cun-nan <19819293608@163.com> Date: Thu, 5 Sep 2024 14:37:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=90=A5=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../openCardGift/api/separate.js | 2 +- .../EventMarketing/openCardGift/separate.vue | 234 +++++++++++++----- .../controller/ActivePriceRuleController.java | 4 +- .../activePrice/entity/ActivePriceRule.java | 4 +- .../mapper/xml/ActivePriceRuleMapper.xml | 12 +- .../impl/ActivePriceRuleServiceImpl.java | 88 +++++-- .../activePrice/vo/ActivePriceRuleRespVO.java | 8 +- 7 files changed, 259 insertions(+), 93 deletions(-) diff --git a/fuintAdmin/src/views/EventMarketing/openCardGift/api/separate.js b/fuintAdmin/src/views/EventMarketing/openCardGift/api/separate.js index c1ed01385..067358135 100644 --- a/fuintAdmin/src/views/EventMarketing/openCardGift/api/separate.js +++ b/fuintAdmin/src/views/EventMarketing/openCardGift/api/separate.js @@ -79,7 +79,7 @@ export function editPriceRule(data) { // 删除活动规则 export function deletePriceRule(id) { return request({ - url: '/business/activePriceRule/del'+id, + url: '/business/activePriceRule/del/'+id, method: 'delete', }) } diff --git a/fuintAdmin/src/views/EventMarketing/openCardGift/separate.vue b/fuintAdmin/src/views/EventMarketing/openCardGift/separate.vue index 345c2ac29..6364cc64d 100644 --- a/fuintAdmin/src/views/EventMarketing/openCardGift/separate.vue +++ b/fuintAdmin/src/views/EventMarketing/openCardGift/separate.vue @@ -101,7 +101,7 @@
活动规则
- 新增活动规则 + 新增活动规则 @@ -127,7 +127,7 @@ @@ -139,7 +139,7 @@ @@ -173,12 +173,12 @@ @@ -194,13 +194,14 @@ 修改 删除 @@ -210,8 +211,7 @@ + width="48%"> @@ -295,19 +295,21 @@ - -
-
- - - - + width="60%"> + +
+
+ + + - - + + - - + + - - + +
- - + +
- - + +
- - + +
- - + + - - + +
-
- - +
+ + - - - - + + + + - - - - - + + + + + + +
+
+ + + + +
@@ -418,31 +431,33 @@
- - + +
- - 取消 - 保存 + + 取消 + 保存 @@ -457,7 +472,7 @@ import { getID, updateActivePrice, deleteList, - getPriceRuleList + getPriceRuleList, addPriceRule, editPriceRule, getPriceRule, deletePriceRule } from "./api/separate"; import {oilNumberList1} from "@/api/order/oilnumgun"; import {listUserGrade} from "@/api/staff/user/usergrade"; @@ -509,23 +524,111 @@ export default { weekList: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"], weekDay: [], monthDay: [], - userLabelList:[], - userGradeList:[] + userLabelList: [], + userGradeList: [], + timeShareList: [], + ruleForm1: { + activeType: 1, + timeType: 0, + paymentType: [] + } } }, created() { this.getList() this.getRuleList() - this.listUserGrade() - this.getUserLabelList() }, methods: { + // 重置活动规则 + resetRule(){ + this.ruleForm1 = { + activeType: 1, + timeType: 0, + paymentType: [] + } + this.tindex3 = 0 + this.weekDay = [] + this.monthDay = [] + }, + // 删除活动规则 + deleteRule(data){ + deletePriceRule(data.id).then(res => { + this.$message.success("删除成功") + this.getRuleList() + }) + }, + // 修改活动规则 + editRule(data) { + this.resetRule() + getPriceRule(data.id).then(res => { + + this.getTimeShareList() + this.listUserGrade() + this.getUserLabelList() + this.showDialogVisible = true + + if (res.data){ + this.ruleForm1 = res.data + if (res.data.paymentType) this.ruleForm1.paymentType = res.data.paymentType.split(",") + if (res.data.babelIds) this.ruleForm1.babelIds = res.data.babelIds.split(",") + + if (res.data.timeSlots){ + if (res.data.timeType == "0") { + this.weekDay = this.ruleForm1.timeSlots.split(",") + } else if (this.ruleForm1.timeType == "1") { + this.monthDay = this.ruleForm1.timeSlots.split(",") + } + } + } + }) + }, + // 提交活动规则 + submitRuleForm() { + this.$refs["ruleForm1"].validate((valid) => { + if (valid) { + if (this.ruleForm1.paymentType) this.ruleForm1.paymentType = this.ruleForm1.paymentType.toString() + if (this.ruleForm1.babelIds) this.ruleForm1.babelIds = this.ruleForm1.babelIds.toString() + if (this.ruleForm1.timeType == "0") { + this.ruleForm1.timeSlots = this.weekDay.toString() + } else if (this.ruleForm1.timeType == "1") { + this.ruleForm1.timeSlots = this.monthDay.toString() + } + + if (this.ruleForm1.id) { + editPriceRule(this.ruleForm1).then(res => { + this.$message.success("修改成功") + this.getRuleList() + this.showDialogVisible = false + }) + } else { + addPriceRule(this.ruleForm1).then(res => { + this.$message.success("添加成功") + this.getRuleList() + this.showDialogVisible = false + }) + } + } + }) + }, + // 添加活动规则 + addActiveRule() { + this.resetRule() + this.getTimeShareList() + this.listUserGrade() + this.getUserLabelList() + this.showDialogVisible = true + }, + // 查询分时优惠列表信息 + getTimeShareList() { + getRequestList({pageNo: 1, pageSize: 10000}).then(res => { + this.timeShareList = res.data.records + }) + }, // 会员等级 listUserGrade() { listUserGrade({page: 1, pageSize: 1000}).then(res => { if (res.code == 200) { this.userGradeList = res.data.records - console.log(this.userGradeList) } }) }, @@ -537,7 +640,7 @@ export default { }, Typeindex3(index) { this.tindex3 = index - this.ruleForm.timeType = index + this.ruleForm1.timeType = index this.weekDay = [] this.monthDay = [] }, @@ -730,6 +833,7 @@ export default { font-size: 14px; color: #333333; } + .d-s { display: flex; align-items: center; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/controller/ActivePriceRuleController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/controller/ActivePriceRuleController.java index 61bf8040b..b5624feba 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/controller/ActivePriceRuleController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/controller/ActivePriceRuleController.java @@ -80,10 +80,10 @@ public class ActivePriceRuleController extends BaseController { * @param saveVO ActivePriceRuleSaveVO实体 * @return com.fuint.framework.web.ResponseObject **/ - @PostMapping("/update") + @PutMapping("/update") public ResponseObject update(@RequestBody ActivePriceRuleSaveVO saveVO) { try { - activePriceRuleService.saveActivePriceRule(true, saveVO); + activePriceRuleService.saveActivePriceRule(false, saveVO); } catch (BusinessCheckException businessCheckException) { return getFailureResult(businessCheckException.getMessage()); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/entity/ActivePriceRule.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/entity/ActivePriceRule.java index 8f79b52ef..99046cb5d 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/entity/ActivePriceRule.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/entity/ActivePriceRule.java @@ -37,8 +37,10 @@ public class ActivePriceRule extends Model { /** 会员标签ids,多个以英文逗号隔开 */ private String babelIds ; /** 生效起始时间 */ + @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8") private Date activeStartTime ; /** 生效截止时间 */ + @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8") private Date activeEndTime ; /** 适用实收金额下限 */ private Double moneyMin ; @@ -62,7 +64,7 @@ public class ActivePriceRule extends Model { private Integer dayLimitNum ; /** 每人累计参与限制次数 */ private Integer limitNum ; - /** 状态:0未生效;1使用中;2已生效 */ + /** 状态:0未生效;1使用中;2已失效 */ private String status ; /** 创建人 */ private String createBy ; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/mapper/xml/ActivePriceRuleMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/mapper/xml/ActivePriceRuleMapper.xml index edf6c1396..88145e329 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/mapper/xml/ActivePriceRuleMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/mapper/xml/ActivePriceRuleMapper.xml @@ -14,13 +14,15 @@ ofType="com.fuint.business.userManager.entity.UserLabel"/> - SELECT main.*, - ap.title AS activeTitle + ap.title AS activeTitle, + ta.real_name createName FROM active_price_rule main LEFT JOIN active_price ap ON main.active_id = ap.id + LEFT JOIN t_account ta on main.create_by = ta.acct_id AND main.chain_stor_id = #{entity.chainStorId} @@ -48,13 +50,13 @@ \ No newline at end of file diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/service/impl/ActivePriceRuleServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/service/impl/ActivePriceRuleServiceImpl.java index 3369b9459..4ad1c73d1 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/service/impl/ActivePriceRuleServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activePrice/service/impl/ActivePriceRuleServiceImpl.java @@ -1,5 +1,6 @@ package com.fuint.business.marketingActivity.activePrice.service.impl; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -11,7 +12,10 @@ import com.fuint.business.marketingActivity.activePrice.util.ActPriceUtil; import com.fuint.business.marketingActivity.activePrice.vo.ActivePriceRuleReqVO; import com.fuint.business.marketingActivity.activePrice.vo.ActivePriceRuleRespVO; import com.fuint.business.marketingActivity.activePrice.vo.ActivePriceRuleSaveVO; +import com.fuint.business.userManager.entity.LJUserGrade; import com.fuint.business.userManager.entity.UserLabel; +import com.fuint.business.userManager.service.LJUserGradeService; +import com.fuint.business.userManager.service.UserLabelService; import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.StringUtils; import com.fuint.common.util.TokenUtil; @@ -19,10 +23,13 @@ import com.fuint.framework.exception.BusinessCheckException; import com.fuint.quartz.util.BeanUtils; import com.fuint.repository.model.MtUserGrade; import com.fuint.utils.StringUtil; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.util.Date; +import java.util.List; import java.util.stream.Collectors; import static com.fuint.business.marketingActivity.activePrice.entity.ActivePrice.*; @@ -43,6 +50,10 @@ public class ActivePriceRuleServiceImpl extends ServiceImpl result = activePriceRuleMapper.pageActivePriceRule(page, actPriceRuleReq); +// 会员等级列表 + List ljUserGrades = userGradeService.selectUserGradeAll(nowAccountInfo.getStoreId()); +// 会员标签列表 + List userLabels = userLabelService.queryList(); /*2、数据处理*/ result.getRecords().forEach(item -> { - item.setPaymentTypeText(replacePayment(item.getPaymentType())); +// item.setPaymentTypeText(replacePayment(item.getPaymentType())); //会员等级集合转文字列表展示 - item.setLevelText(item.getLevelList().stream().map(MtUserGrade::getName).collect(Collectors.joining(","))); +// item.setLevelText(ljUserGrades.stream().map(LJUserGrade::getName).collect(Collectors.joining(","))); //会员标签集合转文字列表展示 - item.setLabelText(item.getLabelList().stream().map(UserLabel::getLabelName).collect(Collectors.joining(","))); +// item.setLabelText(userLabels.stream().map(UserLabel::getLabelName).collect(Collectors.joining(","))); + + String levelText = ""; + for (LJUserGrade ljUserGrade : ljUserGrades) { + if (ObjectUtil.isNotEmpty(item.getLevelId()) && item.getLevelId().equals(ljUserGrade.getId().toString())){ + levelText = ljUserGrade.getName() + ","; + } + } + item.setLevelText(levelText); + + String labelText = ""; + if (ObjectUtil.isNotEmpty(item.getBabelIds())) { + String[] babelIds = item.getBabelIds().split(","); + for (UserLabel userLabel : userLabels) { + for (String babelId : babelIds) { + if (babelId.equals(userLabel.getId().toString())){ + labelText += userLabel.getLabelName() + ","; + } + } + } + } + item.setLabelText(labelText); }); return result; } @@ -84,15 +120,15 @@ public class ActivePriceRuleServiceImpl extends ServiceImpl String.valueOf(item.getId())).collect(Collectors.toList())); - } - //会员等级集合抽取id方便前端展示 - if (!result.getLevelList().isEmpty()){ - //会员等级id集合 - result.setLevelIdList(result.getLevelList().stream().map(item -> String.valueOf(item.getId())).collect(Collectors.toList())); - } +// if (!result.getLabelList().isEmpty()) { +// //会员标签id集合 +// result.setLabelIdList(result.getLabelList().stream().map(item -> String.valueOf(item.getId())).collect(Collectors.toList())); +// } +// //会员等级集合抽取id方便前端展示 +// if (!result.getLevelList().isEmpty()){ +// //会员等级id集合 +// result.setLevelIdList(result.getLevelList().stream().map(item -> String.valueOf(item.getId())).collect(Collectors.toList())); +// } return result; } @@ -116,16 +152,32 @@ public class ActivePriceRuleServiceImpl extends ServiceImpl labelIdList; + /** 活动名称 分时优惠 类型 */ + private String activeType ; + /** + * 创建人 + */ + private String createName; }