This commit is contained in:
cun-nan 2024-08-29 11:19:48 +08:00
parent 4e72ab17bf
commit b568508e0c
10 changed files with 186 additions and 29 deletions

View File

@ -76,3 +76,20 @@ export function getInfoActiveNewlyweds() {
method: 'get' 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
})
}

View File

@ -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',
})
}

View File

@ -544,7 +544,7 @@
<el-form-item label="活动名称" prop="name"> <el-form-item label="活动名称" prop="name">
<el-input v-model="ruleForm.name"></el-input> <el-input v-model="ruleForm.name"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="活动时间" prop="activityTimeType"> <el-form-item label="活动时间" prop="activeTimeType">
<div class="d-s"> <div class="d-s">
<div class="icon-type" v-for="(item,index) in activityTimeTypeList" :key="index" <div class="icon-type" v-for="(item,index) in activityTimeTypeList" :key="index"
:class="{ 'acvtive' : index === tindex1 }" @click="Typeindex1(index)"> :class="{ 'acvtive' : index === tindex1 }" @click="Typeindex1(index)">
@ -556,6 +556,7 @@
v-model="ruleForm.activeStartTime" v-model="ruleForm.activeStartTime"
style="width: 160px" style="width: 160px"
type="date" type="date"
value-format="yyyy-MM-dd"
placeholder="开始日期"> placeholder="开始日期">
</el-date-picker> </el-date-picker>
<span style="margin: 0 5px"></span> <span style="margin: 0 5px"></span>
@ -563,21 +564,22 @@
v-model="ruleForm.activeEndTime" v-model="ruleForm.activeEndTime"
style="width: 160px" style="width: 160px"
type="date" type="date"
value-format="yyyy-MM-dd"
placeholder="结束日期"> placeholder="结束日期">
</el-date-picker> </el-date-picker>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="通知内容" prop="name"> <el-form-item label="通知内容" prop="noticeContent">
<div> <div>
<el-button type="text" @click="ifWrite = !ifWrite">编辑</el-button> <el-button type="text" @click="ifWrite = !ifWrite">编辑</el-button>
</div> </div>
<el-input type="textarea" :disabled="ifWrite" v-model="ruleForm.noticeContent" <el-input type="textarea" :disabled="ifWrite" v-model="ruleForm.noticeContent"
placeholder="请输入通知内容"></el-input> placeholder="请输入通知内容"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="活动详情" prop="name"> <el-form-item label="活动详情" prop="activityDetails">
<el-input type="textarea" v-model="ruleForm.activityDetails" placeholder="请输入活动详情"></el-input> <el-input type="textarea" v-model="ruleForm.activityDetails" placeholder="请输入活动详情"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="活动奖品" prop="type"> <el-form-item label="活动奖品" prop="courtesyReward">
<div style="display: flex"> <div style="display: flex">
<div style="width: 17%"> <div style="width: 17%">
<el-checkbox-group v-model="ruleForm.courtesyReward"> <el-checkbox-group v-model="ruleForm.courtesyReward">
@ -629,7 +631,7 @@
</div> </div>
</el-form-item> </el-form-item>
<el-form-item style="text-align: center"> <el-form-item style="text-align: center">
<el-button @click="resetForm('ruleForm')">重置</el-button> <el-button @click="resetForm('ruleForm')">取消</el-button>
<el-button type="primary" @click="submitRuleForm('ruleForm')">保存</el-button> <el-button type="primary" @click="submitRuleForm('ruleForm')">保存</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -646,7 +648,7 @@ import {
addActiveNewlyweds, addActiveNewlyweds,
updateActiveNewlyweds, updateActiveNewlyweds,
huiActiveNewlyweds, huiActiveNewlyweds,
editActiveNewlyweds, getInfoActiveNewlyweds editActiveNewlyweds, getInfoActiveNewlyweds, insertActiveNewlyweds, editActiveNewlyweds1
} from "@/api/EventMarketing/activeNewlyweds"; } from "@/api/EventMarketing/activeNewlyweds";
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption"; import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
import QRCode from "qrcodejs2"; import QRCode from "qrcodejs2";
@ -656,6 +658,7 @@ import {
getActiveFullminus, getActiveFullminus,
updateActiveFullminus updateActiveFullminus
} from "@/api/EventMarketing/activeFullminus"; } from "@/api/EventMarketing/activeFullminus";
import {listCardCoupon} from "@/api/EventMarketing/cardCoupon";
export default { export default {
name: "ActiveNewlyweds", name: "ActiveNewlyweds",
@ -749,28 +752,24 @@ export default {
"永久有效", "自定义" "永久有效", "自定义"
], ],
couponList: [], couponList: [],
//
cardCouponList:[],
// //
rules: { rules: {
name: [ name: [
{required: true, message: '必填项不能为空', trigger: 'blur'}, {required: true, message: '活动名称不能为空', trigger: 'blur'},
], ],
activeStartTime: [ activeTimeType: [
{required: true, message: '必填项不能为空', trigger: 'blur'}, {required: true, message: '活动时间不能为空', trigger: 'blur'},
], ],
activeEndTime: [ noticeContent: [
{required: true, message: '必填项不能为空', trigger: 'blur'}, {required: true, message: '通知内容不能为空', trigger: 'blur'},
],
activityDetails: [
{required: true, message: '活动详情不能为空', trigger: 'blur'},
], ],
courtesyReward: [ courtesyReward: [
{required: true, message: '必填项不能为空', trigger: 'blur'}, {required: true, message: '活动奖品不能为空', trigger: 'blur'},
],
points: [
{required: true, message: '必填项不能为空', trigger: 'blur'},
],
growthValue: [
{required: true, message: '必填项不能为空', trigger: 'blur'},
],
remark: [
{required: true, message: '必填项不能为空', trigger: 'blur'},
], ],
} }
}; };
@ -778,9 +777,14 @@ export default {
created() { created() {
// this.getList() // this.getList()
this.getInfo() this.getInfo()
this.getCardCoupon()
}, },
methods: { methods: {
getCardCoupon(){
listCardCoupon({status:1,putType:1}).then(res => {
this.cardCouponList = res.data.records
})
},
getInfo(){ getInfo(){
getInfoActiveNewlyweds().then(res => { getInfoActiveNewlyweds().then(res => {
if (res.data) { if (res.data) {
@ -790,6 +794,7 @@ export default {
if (res.data.couponList) this.couponList = res.data.couponList if (res.data.couponList) this.couponList = res.data.couponList
}else { }else {
this.ruleForm = { this.ruleForm = {
activeTimeType:0,
courtesyReward:[] courtesyReward:[]
} }
} }
@ -811,17 +816,23 @@ export default {
this.ruleForm.activeTimeType = index this.ruleForm.activeTimeType = index
}, },
submitRuleForm(formName) { submitRuleForm(formName) {
if (this.tindex1 == 1){
if (!this.ruleForm.activeStartTime || !this.ruleForm.activeEndTime){
this.$message.error("请选择活动开始时间")
return
}
}
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
if (this.ruleForm.courtesyReward) this.ruleForm.courtesyReward = this.ruleForm.courtesyReward.toString() if (this.ruleForm.courtesyReward) this.ruleForm.courtesyReward = this.ruleForm.courtesyReward.toString()
if (this.couponList) this.ruleForm.couponList = this.couponList if (this.couponList) this.ruleForm.couponList = this.couponList
if (this.ruleForm.id) { if (this.ruleForm.id) {
updateActiveNewlyweds(this.form).then(response => { editActiveNewlyweds1(this.ruleForm).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.getInfo() this.getInfo()
}); });
}else { }else {
addActiveNewlyweds(this.form).then(response => { insertActiveNewlyweds(this.ruleForm).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.getInfo() this.getInfo()
}); });
@ -831,6 +842,7 @@ export default {
}, },
resetForm(formName) { resetForm(formName) {
this.$refs[formName].resetFields(); this.$refs[formName].resetFields();
this.ifWrite = true
this.getInfo() this.getInfo()
}, },
/** 查询新人有礼活动列表 */ /** 查询新人有礼活动列表 */

View File

@ -199,5 +199,15 @@ public class ActiveNewlywedsController extends BaseController {
public ResponseObject selectByStoreId(){ public ResponseObject selectByStoreId(){
return getSuccessResult(activeNewlywedsService.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));
}
} }

View File

@ -20,10 +20,10 @@ public class ActiveNewlywedsDTO implements Serializable {
//活动名称 //活动名称
private String name; 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; 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; private Date activeEndTime;
//有礼奖励 0优惠券 1兑换券 2成长值 3积分 //有礼奖励 0优惠券 1兑换券 2成长值 3积分
private String[] courtesyReward; private String[] courtesyReward;

View File

@ -35,10 +35,10 @@ public class ActiveNewlyweds extends Model<ActiveNewlyweds> {
//活动时间类型0永久有效1自定义 //活动时间类型0永久有效1自定义
private String activeTimeType; 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; 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; private Date activeEndTime;
//有礼奖励 0优惠券 1兑换券 2成长值 3积分 //有礼奖励 0优惠券 1兑换券 2成长值 3积分
private String courtesyReward; private String courtesyReward;

View File

@ -18,5 +18,12 @@ public interface ActiveNewlywedsChildService extends IService<ActiveNewlywedsChi
* @return * @return
*/ */
List<ActiveNewlywedsChild> selectByActiveId(Integer activeNewlywedsId); List<ActiveNewlywedsChild> selectByActiveId(Integer activeNewlywedsId);
/**
* 根据新人有礼id删除子表信息
* @param activeNewlywedsId
* @return
*/
int deleteByActiveId(Integer activeNewlywedsId);
} }

View File

@ -70,5 +70,19 @@ public interface ActiveNewlywedsService extends IService<ActiveNewlyweds> {
* @return * @return
*/ */
ActiveNewlyweds selectByStoreId(); ActiveNewlyweds selectByStoreId();
/**
* 添加开卡有礼活动信息
* @param activeNewlyweds
* @return
*/
int insertActiveNewlyweds(ActiveNewlyweds activeNewlyweds);
/**
* 修改开卡有礼活动信息
* @param activeNewlyweds
* @return
*/
int updateActiveNewlyweds(ActiveNewlyweds activeNewlyweds);
} }

View File

@ -25,5 +25,12 @@ public class ActiveNewlywedsChildServiceImpl extends ServiceImpl<ActiveNewlyweds
queryWrapper.eq("active_newlyweds_id",activeNewlywedsId); queryWrapper.eq("active_newlyweds_id",activeNewlywedsId);
return baseMapper.selectList(queryWrapper); return baseMapper.selectList(queryWrapper);
} }
@Override
public int deleteByActiveId(Integer activeNewlywedsId) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("active_newlyweds_id",activeNewlywedsId);
return baseMapper.delete(queryWrapper);
}
} }

View File

@ -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.mapper.CardFavorableMapper;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService; import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
import com.fuint.business.store.service.StoreService; import com.fuint.business.store.service.StoreService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.service.AccountService; import com.fuint.common.service.AccountService;
import com.fuint.common.util.TokenUtil; import com.fuint.common.util.TokenUtil;
import com.fuint.repository.model.TAccount; import com.fuint.repository.model.TAccount;
@ -44,6 +45,7 @@ import javax.annotation.Resource;
import java.io.Serializable; import java.io.Serializable;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -649,7 +651,20 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe
public ActiveNewlyweds selectByStoreId() { public ActiveNewlyweds selectByStoreId() {
QueryWrapper queryWrapper = new QueryWrapper<>(); QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("store_id",TokenUtil.getNowAccountInfo().getStoreId()); queryWrapper.eq("store_id",TokenUtil.getNowAccountInfo().getStoreId());
ActiveNewlyweds activeNewlyweds = baseMapper.selectOne(queryWrapper); List<ActiveNewlyweds> 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)) { if (ObjectUtil.isNotEmpty(activeNewlyweds)) {
List<ActiveNewlywedsChild> activeNewlywedsChildren = activeNewlywedsChildService.selectByActiveId(activeNewlyweds.getId()); List<ActiveNewlywedsChild> activeNewlywedsChildren = activeNewlywedsChildService.selectByActiveId(activeNewlyweds.getId());
activeNewlyweds.setCouponList(activeNewlywedsChildren); activeNewlyweds.setCouponList(activeNewlywedsChildren);
@ -657,6 +672,37 @@ public class ActiveNewlywedsServiceImpl extends ServiceImpl<ActiveNewlywedsMappe
return activeNewlyweds; return activeNewlyweds;
} }
@Override
public int insertActiveNewlyweds(ActiveNewlyweds activeNewlyweds) {
// 查看是否存在活动存在则返回
ActiveNewlyweds activeNewlyweds1 = selectByStoreId();
if (ObjectUtil.isNotEmpty(activeNewlyweds1)) return 0;
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
activeNewlyweds.setChainStoreId(nowAccountInfo.getChainStoreId());
activeNewlyweds.setStoreId(nowAccountInfo.getStoreId());
int row = baseMapper.insert(activeNewlyweds);
if (ObjectUtil.isNotEmpty(activeNewlyweds.getCouponList())){
for (ActiveNewlywedsChild activeNewlywedsChild : activeNewlyweds.getCouponList()) {
activeNewlywedsChildService.save(activeNewlywedsChild);
}
}
return row;
}
@Override
public int updateActiveNewlyweds(ActiveNewlyweds activeNewlyweds) {
int row = baseMapper.updateById(activeNewlyweds);
activeNewlywedsChildService.deleteByActiveId(activeNewlyweds.getId());
if (ObjectUtil.isNotEmpty(activeNewlyweds.getCouponList())){
for (ActiveNewlywedsChild activeNewlywedsChild : activeNewlyweds.getCouponList()) {
activeNewlywedsChildService.save(activeNewlywedsChild);
}
}
return row;
}
/** /**
* 数组转字符串 * 数组转字符串
* @param array * @param array