营销
This commit is contained in:
parent
ab7bcfd8a3
commit
e4d735eda5
@ -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
|
||||
})
|
||||
}
|
||||
|
@ -679,6 +679,7 @@
|
||||
v-model="ruleForm.activeStartTime"
|
||||
style="width: 160px"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="开始日期">
|
||||
</el-date-picker>
|
||||
<span style="margin: 0 5px">至</span>
|
||||
@ -686,6 +687,7 @@
|
||||
v-model="ruleForm.activeEndTime"
|
||||
style="width: 160px"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="结束日期">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
@ -732,7 +734,7 @@
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="适用会员等级" prop="dieselUserLevel">
|
||||
<el-select v-model="ruleForm.dieselUserLevel" placeholder="请选择活动区域">
|
||||
<el-select v-model="ruleForm.dieselUserLevel" multiple clearable placeholder="请选择会员等级(多选)">
|
||||
<el-option
|
||||
v-for="(item,index) in userGradeList"
|
||||
:label="item.name"
|
||||
@ -741,9 +743,12 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员标签" prop="userLabelIds">
|
||||
<el-select v-model="ruleForm.userLabelIds" placeholder="请选择活动区域">
|
||||
<el-option label="区域一" value="shanghai"></el-option>
|
||||
<el-option label="区域二" value="beijing"></el-option>
|
||||
<el-select v-model="ruleForm.userLabelIds" multiple clearable placeholder="请选择会员标签(多选)">
|
||||
<el-option
|
||||
v-for="item in userLabelList"
|
||||
:key="item.id+''"
|
||||
:label="item.labelName"
|
||||
:value="item.id+''"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="可使用支付方式" prop="paymentType">
|
||||
@ -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!');
|
||||
// 使用时间段
|
||||
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 {
|
||||
console.log('error submit!!');
|
||||
return false;
|
||||
addActivity(this.ruleForm).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.getInfo();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
resetForm(formName) {
|
||||
this.$refs[formName].resetFields();
|
||||
this.getInfo()
|
||||
},
|
||||
indexMethod(index) {
|
||||
return index * 2;
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
|
@ -31,10 +31,10 @@ public class ActiveConsumptionDTO extends Model<ActiveConsumptionDTO> {
|
||||
//满足金额
|
||||
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;
|
||||
|
@ -41,10 +41,10 @@ public class ActiveConsumption extends Model<ActiveConsumption> {
|
||||
*/
|
||||
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<ActiveConsumption> {
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<ActiveConsumptionChild> activityPrize;
|
||||
/**
|
||||
* 活动奖品积分子表信息
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<ActiveConsumptionChild> pointList;
|
||||
/**
|
||||
* 活动奖品成长值子表信息
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<ActiveConsumptionChild> growthValueList;
|
||||
/**
|
||||
* 活动奖品优惠券子表信息
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<ActiveConsumptionChild> couponList;
|
||||
}
|
||||
|
||||
|
@ -25,4 +25,6 @@ public interface ActiveConsumptionChildService extends IService<ActiveConsumptio
|
||||
CardFavorableCountVO detailCount(Serializable id);
|
||||
|
||||
List<ActiveConsumptionChild> selectByActiveId(Integer activeConsumptionId,String activeGift);
|
||||
|
||||
int deleteByActiveId(Integer activeConsumptionId);
|
||||
}
|
||||
|
@ -70,6 +70,18 @@ public interface ActiveConsumptionService extends IService<ActiveConsumption> {
|
||||
*/
|
||||
ActiveConsumption selectByStoreId();
|
||||
|
||||
/**
|
||||
* 添加消费有礼信息
|
||||
* @param activeConsumption
|
||||
* @return
|
||||
*/
|
||||
int insertActiveConsumption(ActiveConsumption activeConsumption);
|
||||
|
||||
/**
|
||||
* 修改消费有礼信息
|
||||
* @param activeConsumption
|
||||
* @return
|
||||
*/
|
||||
int updateActiveConsumption(ActiveConsumption activeConsumption);
|
||||
}
|
||||
|
||||
|
@ -137,4 +137,11 @@ public class ActiveConsumptionChildServiceImpl extends ServiceImpl<ActiveConsump
|
||||
}
|
||||
return baseMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByActiveId(Integer activeConsumptionId) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("active_consumption_id",activeConsumptionId);
|
||||
return baseMapper.delete(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
@ -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<ActiveConsumptionM
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("store_id",nowAccountInfo.getStoreId());
|
||||
ActiveConsumption activeConsumption = baseMapper.selectOne(queryWrapper);
|
||||
List<ActiveConsumptionChild> activeConsumptionChildren = activeConsumptionChildService.selectList(activeConsumption.getId());
|
||||
activeConsumption.setActivityPrize(activeConsumptionChildren);
|
||||
List<ActiveConsumption> 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<ActiveConsumptionChild> activeConsumptionChildren = activeConsumptionChildService.selectByActiveId(activeConsumption.getId(), "0");
|
||||
activeConsumption.setPointList(activeConsumptionChildren);
|
||||
List<ActiveConsumptionChild> activeConsumptionChildren1 = activeConsumptionChildService.selectByActiveId(activeConsumption.getId(), "3");
|
||||
activeConsumption.setGrowthValueList(activeConsumptionChildren1);
|
||||
List<ActiveConsumptionChild> activeConsumptionChildren2 = activeConsumptionChildService.selectByActiveId(activeConsumption.getId(), "1");
|
||||
activeConsumption.setCouponList(activeConsumptionChildren2);
|
||||
}
|
||||
return activeConsumption;
|
||||
}
|
||||
|
||||
@ -581,14 +599,54 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
|
||||
if (ObjectUtil.isNotEmpty(activeConsumption1)){
|
||||
return 0;
|
||||
}
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
activeConsumption.setChainStorId(nowAccountInfo.getChainStoreId());
|
||||
activeConsumption.setStoreId(nowAccountInfo.getStoreId());
|
||||
int row = baseMapper.insert(activeConsumption);
|
||||
activeConsumption1 = selectByStoreId();
|
||||
if (ObjectUtil.isNotEmpty(activeConsumption.getActivityPrize())){
|
||||
for (ActiveConsumptionChild activeConsumptionChild : activeConsumption.getActivityPrize()) {
|
||||
if (ObjectUtil.isNotEmpty(activeConsumption.getPointList())){
|
||||
for (ActiveConsumptionChild activeConsumptionChild : activeConsumption.getPointList()) {
|
||||
activeConsumptionChild.setActiveConsumptionId(activeConsumption1.getId());
|
||||
activeConsumptionChildService.save(activeConsumptionChild);
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(activeConsumption.getGrowthValueList())){
|
||||
for (ActiveConsumptionChild activeConsumptionChild : activeConsumption.getGrowthValueList()) {
|
||||
activeConsumptionChild.setActiveConsumptionId(activeConsumption1.getId());
|
||||
activeConsumptionChildService.save(activeConsumptionChild);
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(activeConsumption.getCouponList())){
|
||||
for (ActiveConsumptionChild activeConsumptionChild : activeConsumption.getCouponList()) {
|
||||
activeConsumptionChild.setActiveConsumptionId(activeConsumption1.getId());
|
||||
activeConsumptionChildService.save(activeConsumptionChild);
|
||||
}
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateActiveConsumption(ActiveConsumption activeConsumption) {
|
||||
int row = baseMapper.updateById(activeConsumption);
|
||||
activeConsumptionChildService.deleteByActiveId(activeConsumption.getId());
|
||||
if (ObjectUtil.isNotEmpty(activeConsumption.getPointList())){
|
||||
for (ActiveConsumptionChild activeConsumptionChild : activeConsumption.getPointList()) {
|
||||
activeConsumptionChild.setActiveConsumptionId(activeConsumption.getId());
|
||||
activeConsumptionChildService.save(activeConsumptionChild);
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(activeConsumption.getGrowthValueList())){
|
||||
for (ActiveConsumptionChild activeConsumptionChild : activeConsumption.getGrowthValueList()) {
|
||||
activeConsumptionChild.setActiveConsumptionId(activeConsumption.getId());
|
||||
activeConsumptionChildService.save(activeConsumptionChild);
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(activeConsumption.getCouponList())){
|
||||
for (ActiveConsumptionChild activeConsumptionChild : activeConsumption.getCouponList()) {
|
||||
activeConsumptionChild.setActiveConsumptionId(activeConsumption.getId());
|
||||
activeConsumptionChildService.save(activeConsumptionChild);
|
||||
}
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user