This commit is contained in:
cun-nan 2024-09-02 11:48:31 +08:00
parent eefa84e9d0
commit 5964d51ab8
11 changed files with 2483 additions and 6 deletions

View File

@ -73,3 +73,29 @@ export function delActiveRecommend(id) {
method: 'delete'
})
}
//
export function getActiveRecommendInfo() {
return request({
url: '/business/marketingActivity/activeRecommend/getInfo' ,
method: 'get'
})
}
//
export function insertActiveRecommend(data) {
return request({
url: '/business/marketingActivity/activeRecommend/add',
method: 'post',
data:data
})
}
//
export function updateActiveRecommend1(data) {
return request({
url: '/business/marketingActivity/activeRecommend/update',
method: 'put',
data:data
})
}

View File

@ -8,6 +8,9 @@
<separate v-show="id == 9" ></separate>
<TimeLimited v-show="id == 10"></TimeLimited>
<liJianMarketing v-show="id == 11"></liJianMarketing>
<userRecharge v-show="id == 6"></userRecharge>
<userConsume v-show="id == 7"></userConsume>
<popUp v-show="id == 8"></popUp>
</div>
</template>
@ -26,6 +29,12 @@ import liJianMarketing from "@/views/EventMarketing/liJianMarketing/index.vue";
import invite from "./invite.vue";
//
import birthday from "./birthday.vue"
//
import userRecharge from "@/views/EventMarketing/openCardGift/userRecharge.vue";
//
import userConsume from "@/views/EventMarketing/openCardGift/userConsume.vue";
//
import popUp from "@/views/EventMarketing/openCardGift/popUp.vue";
export default {
data() {
return {
@ -51,7 +60,13 @@ export default {
//
invite,
//
birthday
birthday,
//
userRecharge,
//
userConsume,
//
popUp,
},
methods: {

View File

@ -0,0 +1,785 @@
<template>
<div class="app-container">
<div class="cot-box">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" style="width: 70%;margin: 0 auto">
<el-form-item label="活动名称" prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
<el-form-item label="活动时间" prop="activeTimeType">
<div class="d-s">
<div class="icon-type" v-for="(item,index) in activityTimeTypeList" :key="index"
:class="{ 'acvtive' : index === tindex1 }" @click="Typeindex1(index)">
<img src="@/assets/images/wx.png" style="width: 20px;height: 20px" v-if="index != tindex1">
<img src="@/assets/images/xz.png" style="width: 20px;height: 20px" v-if="index == tindex1">
{{ item }}
</div>
<el-date-picker
v-model="ruleForm.activeStartTime"
style="width: 160px"
type="date"
value-format="yyyy-MM-dd"
placeholder="开始日期">
</el-date-picker>
<span style="margin: 0 5px"></span>
<el-date-picker
v-model="ruleForm.activeEndTime"
style="width: 160px"
type="date"
value-format="yyyy-MM-dd"
placeholder="结束日期">
</el-date-picker>
</div>
</el-form-item>
<el-form-item label="适用时间段" prop="suitTimeSlotType">
<div>
<div class="icon-type" v-for="(item,index) in weekMonthTypeList" :key="index"
:class="{ 'acvtive' : index === tindex3 }" @click="Typeindex3(index)">
<img src="@/assets/images/wx.png" style="width: 20px;height: 20px" v-if="index != tindex3">
<img src="@/assets/images/xz.png" style="width: 20px;height: 20px" v-if="index == tindex3">
{{ item }}
<el-checkbox-group v-model="weekDay" v-if="item=='每周'" style="margin-left: 20px"
:disabled="tindex3!=0">
<el-checkbox v-for="(item,index) in weekList" :key="index" :label="item"></el-checkbox>
</el-checkbox-group>
<el-select v-model="monthDay" placeholder="请选择每月固定日期" multiple v-if="item=='每月'"
:disabled="tindex3!=1"
style="margin-left: 20px">
<el-option
v-for="item in 31"
:key="item.value"
:label="item+'日'"
:value="item">
</el-option>
</el-select>
</div>
</div>
<div style="margin-top: 20px">
<el-form-item label="时间段" prop="suitTimeSlotFront">
<el-time-picker
v-model="ruleForm.suitTimeSlotFront"
format="HH:mm"
value-format="HH:mm"
placeholder="请选择开始时间点">
</el-time-picker>
<el-time-picker
v-model="ruleForm.suitTimeSlotAfter"
format="HH:mm"
value-format="HH:mm"
placeholder="请选择结束时间点">
</el-time-picker>
</el-form-item>
</div>
</el-form-item>
<el-form-item label="适用会员等级" prop="dieselUserLevel">
<el-select v-model="ruleForm.dieselUserLevel" clearable placeholder="请选择会员等级" style="width: 100%">
<el-option
v-for="(item,index) in userGradeList"
:label="item.name"
:value="item.id.toString()"
:key="index"></el-option>
</el-select>
</el-form-item>
<el-form-item label="活动奖品" prop="courtesyReward">
<div style="display: flex">
<div style="width: 17%">
<el-checkbox-group v-model="ruleForm.courtesyReward">
<div style="display: flex;font-size: 14px;margin: 15px 0">
<el-checkbox label="0" name="type">赠送优惠券</el-checkbox>
<img src="@/assets/images/tjb.png"
style="width: 20px;height: 20px;cursor: pointer;margin-top: 7px;margin-left: 10px"
@click="addCoupons()">
</div>
</el-checkbox-group>
</div>
<div style="width: 70%">
<div v-for="(item,index) in couponList" :key="index" style="font-size: 14px;margin: 15px 0">
<span>赠送</span>
<el-select v-model="item.vouchersId" style="margin-left: 10px;width: 30%" placeholder="请选择">
<el-option
v-for="(item1,index1) in cardCouponList"
:key="index1"
:label="item1.name"
:value="item1.id"></el-option>
</el-select>
<el-input style="width: 30%;margin-left: 10px" v-model="item.giftCardTotal">
<template slot="append"></template>
</el-input>
<img src="@/assets/images/ljt.png" style="width: 25px;height: 25px;margin-left: 10px"
@click="deleteCoupons(index)">
</div>
</div>
</div>
</el-form-item>
<el-form-item label="适用模块" prop="everyDayCeiling">
<div class="d-s">
<div class="icon-type" v-for="(item,index) in suitModuleList" :key="index"
:class="{ 'acvtive' : index === tindex2 }" @click="Typeindex2(index)">
<img src="@/assets/images/wx.png" style="width: 20px;height: 20px" v-if="index != tindex2">
<img src="@/assets/images/xz.png" style="width: 20px;height: 20px" v-if="index == tindex2">
{{ item }}
</div>
</div>
</el-form-item>
<el-form-item label="每人每日参与上限" prop="everyDayCeiling">
<el-input v-model="ruleForm.everyDayCeiling"></el-input>
<span style="color: grey;font-size: 12px">每个每日可参与次数默认为1</span>
</el-form-item>
<el-form-item label="总参与次数" prop="everyDayCeiling">
<el-input v-model="ruleForm.everyDayCeiling"></el-input>
<span style="color: grey;font-size: 12px">每个总参与次数默认为0不限制</span>
</el-form-item>
<el-form-item style="text-align: center">
<el-button @click="resetForm('ruleForm')">取消</el-button>
<el-button type="primary" @click="submitRuleForm('ruleForm')">保存</el-button>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
import {
listActiveNewlyweds,
getActiveNewlyweds,
delActiveNewlyweds,
addActiveNewlyweds,
updateActiveNewlyweds,
huiActiveNewlyweds,
editActiveNewlyweds, getInfoActiveNewlyweds, insertActiveNewlyweds, editActiveNewlyweds1
} from "@/api/EventMarketing/activeNewlyweds";
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
import QRCode from "qrcodejs2";
import {
delActiveFullminus,
editActiveFullminus,
getActiveFullminus,
updateActiveFullminus
} from "@/api/EventMarketing/activeFullminus";
import {listCardCoupon} from "@/api/EventMarketing/cardCoupon";
import {listUserGrade} from "@/api/staff/user/usergrade";
export default {
name: "ActiveNewlyweds",
dicts: ['payment_type'],
data() {
return {
opendetails: false,
looklist: [],
statisticsyou: {},
labelPosition: 'left',
loadingdialog: false,
centerDialogVisible: false,
pdidlist: [],//id
pddhidlist: [],//id
tableData: [],//
tableDatadh: [],//
dialogTableVisible: false,//
dialogTableVisibledh: false,//
tableDatas: [],
//
youhuiquan: {
name: '',
pageNum: 1,
pageSize: 10,
},
ytotal: 0,
//
duihuanquan: {
name: '',
pageNum: 1,
pageSize: 10,
total: 0
},
dtotal: 0,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
ztotal: 0,
//
activeNewlywedsList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
chainStoreId: null,
storeId: null,
name: null,
activeStartTime: null,
activeEndTime: null,
courtesyReward: null,
activeCode: null,
isonline: null,
status: null,
remainderTotal: null,
points: null,
growthValue: null,
},
activeFullminusList: [],
//
form: {
id: "",
tableDatas: [],
courtesyReward: [],
activeNewlywedsChildList: [],
},
ruleForm: {
paymentType:[],
courtesyReward:[]
},
ifWrite: true,
tindex1: 0,
activityTimeTypeList: [
"永久有效", "自定义"
],
weekMonthTypeList: ["每周", "每月"],
tindex3: 0,
weekList: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"],
weekDay: [],
monthDay: [],
oilTypeList:['不限','自定义'],
tindex4:0,
suitModuleList:['一键加油','扫码买单'],
tindex2:0,
couponList: [],
//
cardCouponList:[],
userGradeList: [],
//
rules: {
name: [
{required: true, message: '活动名称不能为空', trigger: 'blur'},
],
activeTimeType: [
{required: true, message: '活动时间不能为空', trigger: 'blur'},
],
noticeContent: [
{required: true, message: '通知内容不能为空', trigger: 'blur'},
],
activityDetails: [
{required: true, message: '活动详情不能为空', trigger: 'blur'},
],
courtesyReward: [
{required: true, message: '活动奖品不能为空', trigger: 'blur'},
],
}
};
},
created() {
// this.getList()
// this.getInfo()
this.getCardCoupon()
this.listUserGrade()
},
methods: {
Typeindex3(index) {
this.tindex3 = index
this.ruleForm.suitTimeSlotType = index
},
Typeindex4(index) {
this.tindex4 = index
},
Typeindex2(index) {
this.tindex2 = index
},
listUserGrade() {
listUserGrade({page:1,pageSize:1000}).then(res => {
if (res.code == 200) {
this.userGradeList = res.data.records
}
})
},
getCardCoupon(){
listCardCoupon({status:1,putType:1}).then(res => {
this.cardCouponList = res.data.records
})
},
getInfo(){
getInfoActiveNewlyweds().then(res => {
if (res.data) {
this.ruleForm = res.data
if (res.data.courtesyReward) this.ruleForm.courtesyReward = res.data.courtesyReward.split(",")
if (res.data.activeTimeType) this.tindex1 = res.data.activeTimeType
if (res.data.couponList) this.couponList = res.data.couponList
}else {
this.ruleForm = {
activeTimeType:0,
courtesyReward:[]
}
this.tindex1 = 0
}
})
},
addCoupons() {
let data = {
activeGift: 0,
vouchersId: "",
giftCardTotal: "",
}
this.couponList.push(data)
},
deleteCoupons(index) {
this.couponList.splice(index, 1);
},
Typeindex1(index) {
this.tindex1 = index
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) {
editActiveNewlyweds1(this.ruleForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.getInfo()
});
}else {
insertActiveNewlyweds(this.ruleForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.getInfo()
});
}
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.ifWrite = true
this.getInfo()
},
/** 查询新人有礼活动列表 */
getList() {
this.loading = true;
listActiveNewlyweds(this.queryParams).then(res => {
this.activeFullminusList = res.data.records
this.ztotal = res.data.total;
console.log('wwwwwc', res)
this.loading = false;
})
// this.loading = true;
// listActiveNewlyweds(this.queryParams).then(response => {
// this.activeNewlywedsList = response.data.records;
// this.total = response.data.total;
// this.loading = false;
// });
},
getoilName() {
getoilName().then(res => {
console.log(res)
this.oillist = res.data
})
},
addDatas() {
this.open = true
this.form = {
id: "",
tableDatas: [],
courtesyReward: [],
activeNewlywedsChildList: [],
}
this.form.tableDatas = []
this.tableDatas = []
this.pdidlist = []
this.pddhidlist = []
},
qrcodelook(url) {
this.loadingdialog = true
this.centerDialogVisible = true
setTimeout(() => {
this.creatQrCode(url)
this.loadingdialog = false
}, 1000);
},
creatQrCode(url) {
document.getElementById("qrCode").innerHTML = ""
new QRCode(this.$refs.qrCodeUrl, {
text: url, //
width: 300,
height: 300,
colorDark: '#000',
colorLight: '#fff',
correctLevel: QRCode.CorrectLevel.H
})
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: 1,
chainStoreId: null,
storeId: null,
name: null,
activeStartTime: null,
activeEndTime: null,
courtesyReward: [],
tableDatas: [],
activeNewlywedsChildList: [],
activeCode: null,
isonline: null,
status: null,
remainderTotal: null,
points: null,
growthValue: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.pdidlist = []
this.form.tableDatas = []
this.pddhidlist = []
this.tableDatas = []
this.resetForm("form");
},
//
getlistExchange() {
this.tableDatadh = []
listExchange(this.duihuanquan).then(res => {
if (res.code == 200) {
this.dialogTableVisibledh = true
this.tableDatadh = res.data.records
this.dtotal = res.data.total
}
})
},
//
getlistFavorable() {
this.tableData = []
listFavorable(this.youhuiquan).then(res => {
if (res.code == 200) {
this.dialogTableVisible = true
this.tableData = res.data.records
this.ytotal = res.data.total
}
})
},
//
Favorabledata(row) {
this.dialogTableVisibledh = false
if (this.pddhidlist.indexOf(row.id) > -1) {
this.$message.error("该兑换卡券已存在")
return
}
this.pddhidlist.push(row.id)
console.log(row)
let data = {
activeGift: 2, // 01 2. 3 4.
goodsIds: "", //id
goodsName: "", //
goodsTotal: "", //
vouchersId: row.id, //id
giftCardName: row.name, //
giftCardType: row.type, //
validityZero: null,
validityOne: null,
validityTwo: null,
validity: row.validity,
giftCardDetail: row.cardDetail, //
giftCardTime: row.validity, //
giftCardTotal: 1, //
instruction: row.useInstructions, //使
}
this.tableDatas.push(data)
this.$message.success("新增成功")
},
//
chosedata(row) {
this.dialogTableVisible = false
if (this.pdidlist.indexOf(row.id) > -1) {
this.$message.error("该优惠卡券已存在")
return
}
this.pdidlist.push(row.id)
let data = {
activeGift: 1, // 01 2. 3 4.
goodsIds: "", //id
goodsName: "", //
goodsTotal: "", //
vouchersId: row.id, //id
giftCardName: row.name, //
giftCardType: row.discountType, //
timeType: row.timeType,
validityZero: row.validityZero,
validityOne: row.validityOne,
validityTwo: row.validityTwo,
giftCardDetail: row.cardDetail, //
giftCardTime: "", //
giftCardTotal: 1,//
instruction: row.instruction,//使
}
this.form.tableDatas.push(data)
this.$message.success("新增成功")
},
//
deletedata(row) {
if (this.form.tableDatas && this.form.tableDatas.length > 0) {
let delIdx = -1;
for (let item of this.form.tableDatas) {
delIdx++;
if (item.id === row.id) {
break
}
}
this.pdidlist.splice(delIdx, 1);
this.form.tableDatas.splice(delIdx, 1);
}
},
//
deletedhdata(row) {
if (this.tableDatas && this.tableDatas.length > 0) {
let delIdx = -1;
for (let item of this.tableDatas) {
delIdx++;
if (item.id === row.id) {
break
}
}
this.pddhidlist.splice(delIdx, 1);
this.tableDatas.splice(delIdx, 1);
}
},
lookDetail(row) {
this.opendetails = true
let data = {
id: row.id,
exchangeFrom: "新人有礼"
}
looklook(data).then(res => {
this.looklist = res.data
console.log('详情', res)
})
looklooklook(row.id).then(resp => {
this.statisticsyou = resp.data
console.log('优惠券详情统计', resp)
})
},
Deleteshan(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除此条新人有礼活动的信息?').then(function () {
return delActiveNewlyweds(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加新人有礼活动";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
getActiveNewlyweds(row.id).then(response => {
this.form = response.data;
if (response.data.activeNewlywedsChildList) {
this.form.tableDatas = response.data.activeNewlywedsChildList.filter(item => item.activeGift == '1')
this.tableDatas = response.data.activeNewlywedsChildList.filter(item => item.activeGift == '2')
}
this.open = true;
this.title = "编辑";
});
},
handleDeletexia(row, isonline) {
// getActiveNewlyweds(row.id).then(response => {
//
// let data = response.data
// data.isonline = 1
// updateActiveNewlyweds(data).then(response => {
// this.$modal.msgSuccess("线");
// this.open = false;
// this.getList();
// });
//
// });
this.$modal.confirm('确定上线此条新人有礼活动信息?').then(function () {
return editActiveNewlyweds({id: row.id, isonline: isonline});
}).then(() => {
this.$modal.msgSuccess("上线成功");
this.open = false;
this.getList();
}).catch(() => {
});
},
submitForm() {
// this.form.activeNewlywedsChildList
this.form.activeNewlywedsChildList = this.form.tableDatas.concat(this.tableDatas);
this.$refs["form"].validate(valid => {
if (valid) {
console.log(this.form)
if (this.form.id) {
updateActiveNewlyweds(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addActiveNewlyweds(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 提交按钮 */
// submitForm() {
// // this.form.activeNewlywedsChildList
// this.form.activeNewlywedsChildList = this.form.tableDatas.concat(this.tableDatas);
// this.$refs["form"].validate(valid => {
// if (valid) {
// if (this.form.id != null) {
// updateActiveNewlyweds(this.form).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
// } else {
// addActiveNewlyweds(this.form).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
// }
// }
// });
// },
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除此条新人有礼活动信息?').then(function () {
return delActiveNewlyweds(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('business/marketingActivity/activeNewlyweds/export', {
...this.queryParams
}, `activeNewlyweds_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<style scoped lang="scss">
.box-bt {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 18px;
}
.x-box {
background: #f9f9f9;
border-radius: 6px;
box-sizing: border-box;
padding: 15px;
width: 45%;
}
.cot-box {
width: 100%;
height: 89vh;
border-radius: 8px;
background: #fff;
box-sizing: border-box;
padding: 20px;
margin: 0 auto;
}
.d-s {
display: flex;
align-items: center;
}
.icon-type {
display: flex;
align-items: center;
font-weight: 400;
font-size: 14px;
color: #999999;
margin-right: 20px;
cursor: pointer;
}
.acvtive {
color: #FF770F !important;
}
</style>

View File

@ -0,0 +1,763 @@
<template>
<div class="app-container">
<div class="cot-box">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" style="width: 70%;margin: 0 auto">
<el-form-item label="活动名称" prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
<el-form-item label="活动时间" prop="activeTimeType">
<div class="d-s">
<div class="icon-type" v-for="(item,index) in activityTimeTypeList" :key="index"
:class="{ 'acvtive' : index === tindex1 }" @click="Typeindex1(index)">
<img src="@/assets/images/wx.png" style="width: 20px;height: 20px" v-if="index != tindex1">
<img src="@/assets/images/xz.png" style="width: 20px;height: 20px" v-if="index == tindex1">
{{ item }}
</div>
<el-date-picker
v-model="ruleForm.activeStartTime"
style="width: 160px"
type="date"
value-format="yyyy-MM-dd"
placeholder="开始日期">
</el-date-picker>
<span style="margin: 0 5px"></span>
<el-date-picker
v-model="ruleForm.activeEndTime"
style="width: 160px"
type="date"
value-format="yyyy-MM-dd"
placeholder="结束日期">
</el-date-picker>
</div>
</el-form-item>
<el-form-item label="获赠次数限制" prop="noticeContent">
<el-input v-model="ruleForm.noticeContent"
placeholder="请输入通知内容"></el-input>
<span style="font-size: 12px;color: grey">每个推荐人最多可获赠的次数限制0表示每次都可以赠送不限制次数</span>
</el-form-item>
<el-form-item label="适用油品油号" prop="activityTimeType">
<div class="d-s">
<div class="icon-type" v-for="(item,index) in oilTypeList" :key="index"
:class="{ 'acvtive' : index === tindex4 }" @click="Typeindex4(index)">
<img src="@/assets/images/wx.png" style="width: 20px;height: 20px" v-if="index != tindex4">
<img src="@/assets/images/xz.png" style="width: 20px;height: 20px" v-if="index == tindex4">
{{ item }}
</div>
<el-select v-model="ruleForm.dieselUserLevel" multiple clearable placeholder="请选择油品油号(多选)">
<el-option
v-for="(item,index) in userGradeList"
:label="item.name"
:value="item.id.toString()"
:key="index"></el-option>
</el-select>
</div>
</el-form-item>
<el-form-item label="可使用支付方式" prop="paymentType">
<el-checkbox-group v-model="ruleForm.paymentType">
<el-checkbox
v-for="dict in dict.type.payment_type"
v-if="dict.value!='APPLET_CODE'"
:key="dict.value"
:label="dict.label"
:value="dict.value"></el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="适用会员等级" prop="dieselUserLevel">
<el-select v-model="ruleForm.dieselUserLevel" clearable placeholder="请选择会员等级" style="width: 100%">
<el-option
v-for="(item,index) in userGradeList"
:label="item.name"
:value="item.id.toString()"
:key="index"></el-option>
</el-select>
</el-form-item>
<el-form-item label="活动奖品" prop="courtesyReward">
<div style="display: flex">
<div style="width: 17%">
<el-checkbox-group v-model="ruleForm.courtesyReward">
<div>
<el-checkbox label="3" name="type">赠送积分</el-checkbox>
</div>
<div>
<el-checkbox label="2" name="type">赠送成长值</el-checkbox>
</div>
<div style="display: flex;font-size: 14px;margin: 15px 0">
<el-checkbox label="0" name="type">赠送优惠券</el-checkbox>
<img src="@/assets/images/tjb.png"
style="width: 20px;height: 20px;cursor: pointer;margin-top: 7px;margin-left: 10px"
@click="addCoupons()">
</div>
</el-checkbox-group>
</div>
<div style="width: 70%">
<div style="display: flex;font-size: 14px;">
<div>赠送</div>
<el-input placeholder="请输入赠送的积分数量" style="width: 70%;margin: 0 10px"
v-model="ruleForm.points">
<template slot="append">积分</template>
</el-input>
</div>
<div style="display: flex;font-size: 14px;margin: 15px 0">
<div>赠送</div>
<el-input placeholder="请输入赠送的成长值数量" style="width: 70%;margin: 0 10px"
v-model="ruleForm.growthValue">
<template slot="append">成长值</template>
</el-input>
</div>
<div v-for="(item,index) in couponList" :key="index" style="font-size: 14px;margin: 15px 0">
<span>赠送</span>
<el-select v-model="item.vouchersId" style="margin-left: 10px;width: 30%" placeholder="请选择">
<el-option
v-for="(item1,index1) in cardCouponList"
:key="index1"
:label="item1.name"
:value="item1.id"></el-option>
</el-select>
<el-input style="width: 30%;margin-left: 10px" v-model="item.giftCardTotal">
<template slot="append"></template>
</el-input>
<img src="@/assets/images/ljt.png" style="width: 25px;height: 25px;margin-left: 10px"
@click="deleteCoupons(index)">
</div>
</div>
</div>
</el-form-item>
<el-form-item style="text-align: center">
<el-button @click="resetForm('ruleForm')">取消</el-button>
<el-button type="primary" @click="submitRuleForm('ruleForm')">保存</el-button>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
import {
listActiveNewlyweds,
getActiveNewlyweds,
delActiveNewlyweds,
addActiveNewlyweds,
updateActiveNewlyweds,
huiActiveNewlyweds,
editActiveNewlyweds, getInfoActiveNewlyweds, insertActiveNewlyweds, editActiveNewlyweds1
} from "@/api/EventMarketing/activeNewlyweds";
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
import QRCode from "qrcodejs2";
import {
delActiveFullminus,
editActiveFullminus,
getActiveFullminus,
updateActiveFullminus
} from "@/api/EventMarketing/activeFullminus";
import {listCardCoupon} from "@/api/EventMarketing/cardCoupon";
import {listUserGrade} from "@/api/staff/user/usergrade";
export default {
name: "ActiveNewlyweds",
dicts: ['payment_type'],
data() {
return {
opendetails: false,
looklist: [],
statisticsyou: {},
labelPosition: 'left',
loadingdialog: false,
centerDialogVisible: false,
pdidlist: [],//id
pddhidlist: [],//id
tableData: [],//
tableDatadh: [],//
dialogTableVisible: false,//
dialogTableVisibledh: false,//
tableDatas: [],
//
youhuiquan: {
name: '',
pageNum: 1,
pageSize: 10,
},
ytotal: 0,
//
duihuanquan: {
name: '',
pageNum: 1,
pageSize: 10,
total: 0
},
dtotal: 0,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
ztotal: 0,
//
activeNewlywedsList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
chainStoreId: null,
storeId: null,
name: null,
activeStartTime: null,
activeEndTime: null,
courtesyReward: null,
activeCode: null,
isonline: null,
status: null,
remainderTotal: null,
points: null,
growthValue: null,
},
activeFullminusList: [],
//
form: {
id: "",
tableDatas: [],
courtesyReward: [],
activeNewlywedsChildList: [],
},
ruleForm: {
paymentType:[],
courtesyReward:[]
},
ifWrite: true,
tindex1: 0,
activityTimeTypeList: [
"永久有效", "自定义"
],
oilTypeList:['不限','自定义'],
tindex4:0,
couponList: [],
//
cardCouponList:[],
userGradeList: [],
//
rules: {
name: [
{required: true, message: '活动名称不能为空', trigger: 'blur'},
],
activeTimeType: [
{required: true, message: '活动时间不能为空', trigger: 'blur'},
],
noticeContent: [
{required: true, message: '通知内容不能为空', trigger: 'blur'},
],
activityDetails: [
{required: true, message: '活动详情不能为空', trigger: 'blur'},
],
courtesyReward: [
{required: true, message: '活动奖品不能为空', trigger: 'blur'},
],
}
};
},
created() {
// this.getList()
// this.getInfo()
this.getCardCoupon()
this.listUserGrade()
},
methods: {
Typeindex4(index) {
this.tindex4 = index
},
listUserGrade() {
listUserGrade({page:1,pageSize:1000}).then(res => {
if (res.code == 200) {
this.userGradeList = res.data.records
}
})
},
getCardCoupon(){
listCardCoupon({status:1,putType:1}).then(res => {
this.cardCouponList = res.data.records
})
},
getInfo(){
getInfoActiveNewlyweds().then(res => {
if (res.data) {
this.ruleForm = res.data
if (res.data.courtesyReward) this.ruleForm.courtesyReward = res.data.courtesyReward.split(",")
if (res.data.activeTimeType) this.tindex1 = res.data.activeTimeType
if (res.data.couponList) this.couponList = res.data.couponList
}else {
this.ruleForm = {
activeTimeType:0,
courtesyReward:[]
}
this.tindex1 = 0
}
})
},
addCoupons() {
let data = {
activeGift: 0,
vouchersId: "",
giftCardTotal: "",
}
this.couponList.push(data)
},
deleteCoupons(index) {
this.couponList.splice(index, 1);
},
Typeindex1(index) {
this.tindex1 = index
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) {
editActiveNewlyweds1(this.ruleForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.getInfo()
});
}else {
insertActiveNewlyweds(this.ruleForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.getInfo()
});
}
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.ifWrite = true
this.getInfo()
},
/** 查询新人有礼活动列表 */
getList() {
this.loading = true;
listActiveNewlyweds(this.queryParams).then(res => {
this.activeFullminusList = res.data.records
this.ztotal = res.data.total;
console.log('wwwwwc', res)
this.loading = false;
})
// this.loading = true;
// listActiveNewlyweds(this.queryParams).then(response => {
// this.activeNewlywedsList = response.data.records;
// this.total = response.data.total;
// this.loading = false;
// });
},
getoilName() {
getoilName().then(res => {
console.log(res)
this.oillist = res.data
})
},
addDatas() {
this.open = true
this.form = {
id: "",
tableDatas: [],
courtesyReward: [],
activeNewlywedsChildList: [],
}
this.form.tableDatas = []
this.tableDatas = []
this.pdidlist = []
this.pddhidlist = []
},
qrcodelook(url) {
this.loadingdialog = true
this.centerDialogVisible = true
setTimeout(() => {
this.creatQrCode(url)
this.loadingdialog = false
}, 1000);
},
creatQrCode(url) {
document.getElementById("qrCode").innerHTML = ""
new QRCode(this.$refs.qrCodeUrl, {
text: url, //
width: 300,
height: 300,
colorDark: '#000',
colorLight: '#fff',
correctLevel: QRCode.CorrectLevel.H
})
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: 1,
chainStoreId: null,
storeId: null,
name: null,
activeStartTime: null,
activeEndTime: null,
courtesyReward: [],
tableDatas: [],
activeNewlywedsChildList: [],
activeCode: null,
isonline: null,
status: null,
remainderTotal: null,
points: null,
growthValue: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.pdidlist = []
this.form.tableDatas = []
this.pddhidlist = []
this.tableDatas = []
this.resetForm("form");
},
//
getlistExchange() {
this.tableDatadh = []
listExchange(this.duihuanquan).then(res => {
if (res.code == 200) {
this.dialogTableVisibledh = true
this.tableDatadh = res.data.records
this.dtotal = res.data.total
}
})
},
//
getlistFavorable() {
this.tableData = []
listFavorable(this.youhuiquan).then(res => {
if (res.code == 200) {
this.dialogTableVisible = true
this.tableData = res.data.records
this.ytotal = res.data.total
}
})
},
//
Favorabledata(row) {
this.dialogTableVisibledh = false
if (this.pddhidlist.indexOf(row.id) > -1) {
this.$message.error("该兑换卡券已存在")
return
}
this.pddhidlist.push(row.id)
console.log(row)
let data = {
activeGift: 2, // 01 2. 3 4.
goodsIds: "", //id
goodsName: "", //
goodsTotal: "", //
vouchersId: row.id, //id
giftCardName: row.name, //
giftCardType: row.type, //
validityZero: null,
validityOne: null,
validityTwo: null,
validity: row.validity,
giftCardDetail: row.cardDetail, //
giftCardTime: row.validity, //
giftCardTotal: 1, //
instruction: row.useInstructions, //使
}
this.tableDatas.push(data)
this.$message.success("新增成功")
},
//
chosedata(row) {
this.dialogTableVisible = false
if (this.pdidlist.indexOf(row.id) > -1) {
this.$message.error("该优惠卡券已存在")
return
}
this.pdidlist.push(row.id)
let data = {
activeGift: 1, // 01 2. 3 4.
goodsIds: "", //id
goodsName: "", //
goodsTotal: "", //
vouchersId: row.id, //id
giftCardName: row.name, //
giftCardType: row.discountType, //
timeType: row.timeType,
validityZero: row.validityZero,
validityOne: row.validityOne,
validityTwo: row.validityTwo,
giftCardDetail: row.cardDetail, //
giftCardTime: "", //
giftCardTotal: 1,//
instruction: row.instruction,//使
}
this.form.tableDatas.push(data)
this.$message.success("新增成功")
},
//
deletedata(row) {
if (this.form.tableDatas && this.form.tableDatas.length > 0) {
let delIdx = -1;
for (let item of this.form.tableDatas) {
delIdx++;
if (item.id === row.id) {
break
}
}
this.pdidlist.splice(delIdx, 1);
this.form.tableDatas.splice(delIdx, 1);
}
},
//
deletedhdata(row) {
if (this.tableDatas && this.tableDatas.length > 0) {
let delIdx = -1;
for (let item of this.tableDatas) {
delIdx++;
if (item.id === row.id) {
break
}
}
this.pddhidlist.splice(delIdx, 1);
this.tableDatas.splice(delIdx, 1);
}
},
lookDetail(row) {
this.opendetails = true
let data = {
id: row.id,
exchangeFrom: "新人有礼"
}
looklook(data).then(res => {
this.looklist = res.data
console.log('详情', res)
})
looklooklook(row.id).then(resp => {
this.statisticsyou = resp.data
console.log('优惠券详情统计', resp)
})
},
Deleteshan(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除此条新人有礼活动的信息?').then(function () {
return delActiveNewlyweds(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加新人有礼活动";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
getActiveNewlyweds(row.id).then(response => {
this.form = response.data;
if (response.data.activeNewlywedsChildList) {
this.form.tableDatas = response.data.activeNewlywedsChildList.filter(item => item.activeGift == '1')
this.tableDatas = response.data.activeNewlywedsChildList.filter(item => item.activeGift == '2')
}
this.open = true;
this.title = "编辑";
});
},
handleDeletexia(row, isonline) {
// getActiveNewlyweds(row.id).then(response => {
//
// let data = response.data
// data.isonline = 1
// updateActiveNewlyweds(data).then(response => {
// this.$modal.msgSuccess("线");
// this.open = false;
// this.getList();
// });
//
// });
this.$modal.confirm('确定上线此条新人有礼活动信息?').then(function () {
return editActiveNewlyweds({id: row.id, isonline: isonline});
}).then(() => {
this.$modal.msgSuccess("上线成功");
this.open = false;
this.getList();
}).catch(() => {
});
},
submitForm() {
// this.form.activeNewlywedsChildList
this.form.activeNewlywedsChildList = this.form.tableDatas.concat(this.tableDatas);
this.$refs["form"].validate(valid => {
if (valid) {
console.log(this.form)
if (this.form.id) {
updateActiveNewlyweds(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addActiveNewlyweds(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 提交按钮 */
// submitForm() {
// // this.form.activeNewlywedsChildList
// this.form.activeNewlywedsChildList = this.form.tableDatas.concat(this.tableDatas);
// this.$refs["form"].validate(valid => {
// if (valid) {
// if (this.form.id != null) {
// updateActiveNewlyweds(this.form).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
// } else {
// addActiveNewlyweds(this.form).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
// }
// }
// });
// },
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除此条新人有礼活动信息?').then(function () {
return delActiveNewlyweds(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('business/marketingActivity/activeNewlyweds/export', {
...this.queryParams
}, `activeNewlyweds_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<style scoped lang="scss">
.box-bt {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 18px;
}
.x-box {
background: #f9f9f9;
border-radius: 6px;
box-sizing: border-box;
padding: 15px;
width: 45%;
}
.cot-box {
width: 100%;
height: 89vh;
border-radius: 8px;
background: #fff;
box-sizing: border-box;
padding: 20px;
margin: 0 auto;
}
.d-s {
display: flex;
align-items: center;
}
.icon-type {
display: flex;
align-items: center;
font-weight: 400;
font-size: 14px;
color: #999999;
margin-right: 20px;
cursor: pointer;
}
.acvtive {
color: #FF770F !important;
}
</style>

View File

@ -0,0 +1,741 @@
<template>
<div class="app-container">
<div class="cot-box">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" style="width: 70%;margin: 0 auto">
<el-form-item label="活动名称" prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
<el-form-item label="活动时间" prop="activeTimeType">
<div class="d-s">
<div class="icon-type" v-for="(item,index) in activityTimeTypeList" :key="index"
:class="{ 'acvtive' : index === tindex1 }" @click="Typeindex1(index)">
<img src="@/assets/images/wx.png" style="width: 20px;height: 20px" v-if="index != tindex1">
<img src="@/assets/images/xz.png" style="width: 20px;height: 20px" v-if="index == tindex1">
{{ item }}
</div>
<el-date-picker
v-model="ruleForm.activeStartTime"
style="width: 160px"
type="date"
value-format="yyyy-MM-dd"
placeholder="开始日期">
</el-date-picker>
<span style="margin: 0 5px"></span>
<el-date-picker
v-model="ruleForm.activeEndTime"
style="width: 160px"
type="date"
value-format="yyyy-MM-dd"
placeholder="结束日期">
</el-date-picker>
</div>
</el-form-item>
<el-form-item label="获赠次数限制" prop="noticeContent">
<el-input v-model="ruleForm.noticeContent"
placeholder="请输入通知内容"></el-input>
<span style="font-size: 12px;color: grey">每个推荐人最多可获赠的次数限制0表示每次都可以赠送不限制次数</span>
</el-form-item>
<el-form-item label="可使用支付方式" prop="paymentType">
<el-checkbox-group v-model="ruleForm.paymentType">
<el-checkbox
v-for="dict in dict.type.payment_type"
v-if="dict.value!='APPLET_CODE'"
:key="dict.value"
:label="dict.label"
:value="dict.value"></el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="适用会员等级" prop="dieselUserLevel">
<el-select v-model="ruleForm.dieselUserLevel" clearable placeholder="请选择会员等级" style="width: 100%">
<el-option
v-for="(item,index) in userGradeList"
:label="item.name"
:value="item.id.toString()"
:key="index"></el-option>
</el-select>
</el-form-item>
<el-form-item label="活动奖品" prop="courtesyReward">
<div style="display: flex">
<div style="width: 17%">
<el-checkbox-group v-model="ruleForm.courtesyReward">
<div>
<el-checkbox label="3" name="type">赠送积分</el-checkbox>
</div>
<div>
<el-checkbox label="2" name="type">赠送成长值</el-checkbox>
</div>
<div style="display: flex;font-size: 14px;margin: 15px 0">
<el-checkbox label="0" name="type">赠送优惠券</el-checkbox>
<img src="@/assets/images/tjb.png"
style="width: 20px;height: 20px;cursor: pointer;margin-top: 7px;margin-left: 10px"
@click="addCoupons()">
</div>
</el-checkbox-group>
</div>
<div style="width: 70%">
<div style="display: flex;font-size: 14px;">
<div>赠送</div>
<el-input placeholder="请输入赠送的积分数量" style="width: 70%;margin: 0 10px"
v-model="ruleForm.points">
<template slot="append">积分</template>
</el-input>
</div>
<div style="display: flex;font-size: 14px;margin: 15px 0">
<div>赠送</div>
<el-input placeholder="请输入赠送的成长值数量" style="width: 70%;margin: 0 10px"
v-model="ruleForm.growthValue">
<template slot="append">成长值</template>
</el-input>
</div>
<div v-for="(item,index) in couponList" :key="index" style="font-size: 14px;margin: 15px 0">
<span>赠送</span>
<el-select v-model="item.vouchersId" style="margin-left: 10px;width: 30%" placeholder="请选择">
<el-option
v-for="(item1,index1) in cardCouponList"
:key="index1"
:label="item1.name"
:value="item1.id"></el-option>
</el-select>
<el-input style="width: 30%;margin-left: 10px" v-model="item.giftCardTotal">
<template slot="append"></template>
</el-input>
<img src="@/assets/images/ljt.png" style="width: 25px;height: 25px;margin-left: 10px"
@click="deleteCoupons(index)">
</div>
</div>
</div>
</el-form-item>
<el-form-item style="text-align: center">
<el-button @click="resetForm('ruleForm')">取消</el-button>
<el-button type="primary" @click="submitRuleForm('ruleForm')">保存</el-button>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
import {
listActiveNewlyweds,
getActiveNewlyweds,
delActiveNewlyweds,
addActiveNewlyweds,
updateActiveNewlyweds,
huiActiveNewlyweds,
editActiveNewlyweds, getInfoActiveNewlyweds, insertActiveNewlyweds, editActiveNewlyweds1
} from "@/api/EventMarketing/activeNewlyweds";
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
import QRCode from "qrcodejs2";
import {
delActiveFullminus,
editActiveFullminus,
getActiveFullminus,
updateActiveFullminus
} from "@/api/EventMarketing/activeFullminus";
import {listCardCoupon} from "@/api/EventMarketing/cardCoupon";
import {listUserGrade} from "@/api/staff/user/usergrade";
export default {
name: "ActiveNewlyweds",
dicts: ['payment_type'],
data() {
return {
opendetails: false,
looklist: [],
statisticsyou: {},
labelPosition: 'left',
loadingdialog: false,
centerDialogVisible: false,
pdidlist: [],//id
pddhidlist: [],//id
tableData: [],//
tableDatadh: [],//
dialogTableVisible: false,//
dialogTableVisibledh: false,//
tableDatas: [],
//
youhuiquan: {
name: '',
pageNum: 1,
pageSize: 10,
},
ytotal: 0,
//
duihuanquan: {
name: '',
pageNum: 1,
pageSize: 10,
total: 0
},
dtotal: 0,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
ztotal: 0,
//
activeNewlywedsList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
chainStoreId: null,
storeId: null,
name: null,
activeStartTime: null,
activeEndTime: null,
courtesyReward: null,
activeCode: null,
isonline: null,
status: null,
remainderTotal: null,
points: null,
growthValue: null,
},
activeFullminusList: [],
//
form: {
id: "",
tableDatas: [],
courtesyReward: [],
activeNewlywedsChildList: [],
},
ruleForm: {
paymentType:[],
courtesyReward:[]
},
ifWrite: true,
tindex1: 0,
activityTimeTypeList: [
"永久有效", "自定义"
],
couponList: [],
//
cardCouponList:[],
userGradeList: [],
//
rules: {
name: [
{required: true, message: '活动名称不能为空', trigger: 'blur'},
],
activeTimeType: [
{required: true, message: '活动时间不能为空', trigger: 'blur'},
],
noticeContent: [
{required: true, message: '通知内容不能为空', trigger: 'blur'},
],
activityDetails: [
{required: true, message: '活动详情不能为空', trigger: 'blur'},
],
courtesyReward: [
{required: true, message: '活动奖品不能为空', trigger: 'blur'},
],
}
};
},
created() {
// this.getList()
// this.getInfo()
this.getCardCoupon()
this.listUserGrade()
},
methods: {
listUserGrade() {
listUserGrade({page:1,pageSize:1000}).then(res => {
if (res.code == 200) {
this.userGradeList = res.data.records
}
})
},
getCardCoupon(){
listCardCoupon({status:1,putType:1}).then(res => {
this.cardCouponList = res.data.records
})
},
getInfo(){
getInfoActiveNewlyweds().then(res => {
if (res.data) {
this.ruleForm = res.data
if (res.data.courtesyReward) this.ruleForm.courtesyReward = res.data.courtesyReward.split(",")
if (res.data.activeTimeType) this.tindex1 = res.data.activeTimeType
if (res.data.couponList) this.couponList = res.data.couponList
}else {
this.ruleForm = {
activeTimeType:0,
courtesyReward:[]
}
this.tindex1 = 0
}
})
},
addCoupons() {
let data = {
activeGift: 0,
vouchersId: "",
giftCardTotal: "",
}
this.couponList.push(data)
},
deleteCoupons(index) {
this.couponList.splice(index, 1);
},
Typeindex1(index) {
this.tindex1 = index
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) {
editActiveNewlyweds1(this.ruleForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.getInfo()
});
}else {
insertActiveNewlyweds(this.ruleForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.getInfo()
});
}
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.ifWrite = true
this.getInfo()
},
/** 查询新人有礼活动列表 */
getList() {
this.loading = true;
listActiveNewlyweds(this.queryParams).then(res => {
this.activeFullminusList = res.data.records
this.ztotal = res.data.total;
console.log('wwwwwc', res)
this.loading = false;
})
// this.loading = true;
// listActiveNewlyweds(this.queryParams).then(response => {
// this.activeNewlywedsList = response.data.records;
// this.total = response.data.total;
// this.loading = false;
// });
},
getoilName() {
getoilName().then(res => {
console.log(res)
this.oillist = res.data
})
},
addDatas() {
this.open = true
this.form = {
id: "",
tableDatas: [],
courtesyReward: [],
activeNewlywedsChildList: [],
}
this.form.tableDatas = []
this.tableDatas = []
this.pdidlist = []
this.pddhidlist = []
},
qrcodelook(url) {
this.loadingdialog = true
this.centerDialogVisible = true
setTimeout(() => {
this.creatQrCode(url)
this.loadingdialog = false
}, 1000);
},
creatQrCode(url) {
document.getElementById("qrCode").innerHTML = ""
new QRCode(this.$refs.qrCodeUrl, {
text: url, //
width: 300,
height: 300,
colorDark: '#000',
colorLight: '#fff',
correctLevel: QRCode.CorrectLevel.H
})
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: 1,
chainStoreId: null,
storeId: null,
name: null,
activeStartTime: null,
activeEndTime: null,
courtesyReward: [],
tableDatas: [],
activeNewlywedsChildList: [],
activeCode: null,
isonline: null,
status: null,
remainderTotal: null,
points: null,
growthValue: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.pdidlist = []
this.form.tableDatas = []
this.pddhidlist = []
this.tableDatas = []
this.resetForm("form");
},
//
getlistExchange() {
this.tableDatadh = []
listExchange(this.duihuanquan).then(res => {
if (res.code == 200) {
this.dialogTableVisibledh = true
this.tableDatadh = res.data.records
this.dtotal = res.data.total
}
})
},
//
getlistFavorable() {
this.tableData = []
listFavorable(this.youhuiquan).then(res => {
if (res.code == 200) {
this.dialogTableVisible = true
this.tableData = res.data.records
this.ytotal = res.data.total
}
})
},
//
Favorabledata(row) {
this.dialogTableVisibledh = false
if (this.pddhidlist.indexOf(row.id) > -1) {
this.$message.error("该兑换卡券已存在")
return
}
this.pddhidlist.push(row.id)
console.log(row)
let data = {
activeGift: 2, // 01 2. 3 4.
goodsIds: "", //id
goodsName: "", //
goodsTotal: "", //
vouchersId: row.id, //id
giftCardName: row.name, //
giftCardType: row.type, //
validityZero: null,
validityOne: null,
validityTwo: null,
validity: row.validity,
giftCardDetail: row.cardDetail, //
giftCardTime: row.validity, //
giftCardTotal: 1, //
instruction: row.useInstructions, //使
}
this.tableDatas.push(data)
this.$message.success("新增成功")
},
//
chosedata(row) {
this.dialogTableVisible = false
if (this.pdidlist.indexOf(row.id) > -1) {
this.$message.error("该优惠卡券已存在")
return
}
this.pdidlist.push(row.id)
let data = {
activeGift: 1, // 01 2. 3 4.
goodsIds: "", //id
goodsName: "", //
goodsTotal: "", //
vouchersId: row.id, //id
giftCardName: row.name, //
giftCardType: row.discountType, //
timeType: row.timeType,
validityZero: row.validityZero,
validityOne: row.validityOne,
validityTwo: row.validityTwo,
giftCardDetail: row.cardDetail, //
giftCardTime: "", //
giftCardTotal: 1,//
instruction: row.instruction,//使
}
this.form.tableDatas.push(data)
this.$message.success("新增成功")
},
//
deletedata(row) {
if (this.form.tableDatas && this.form.tableDatas.length > 0) {
let delIdx = -1;
for (let item of this.form.tableDatas) {
delIdx++;
if (item.id === row.id) {
break
}
}
this.pdidlist.splice(delIdx, 1);
this.form.tableDatas.splice(delIdx, 1);
}
},
//
deletedhdata(row) {
if (this.tableDatas && this.tableDatas.length > 0) {
let delIdx = -1;
for (let item of this.tableDatas) {
delIdx++;
if (item.id === row.id) {
break
}
}
this.pddhidlist.splice(delIdx, 1);
this.tableDatas.splice(delIdx, 1);
}
},
lookDetail(row) {
this.opendetails = true
let data = {
id: row.id,
exchangeFrom: "新人有礼"
}
looklook(data).then(res => {
this.looklist = res.data
console.log('详情', res)
})
looklooklook(row.id).then(resp => {
this.statisticsyou = resp.data
console.log('优惠券详情统计', resp)
})
},
Deleteshan(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除此条新人有礼活动的信息?').then(function () {
return delActiveNewlyweds(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加新人有礼活动";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
getActiveNewlyweds(row.id).then(response => {
this.form = response.data;
if (response.data.activeNewlywedsChildList) {
this.form.tableDatas = response.data.activeNewlywedsChildList.filter(item => item.activeGift == '1')
this.tableDatas = response.data.activeNewlywedsChildList.filter(item => item.activeGift == '2')
}
this.open = true;
this.title = "编辑";
});
},
handleDeletexia(row, isonline) {
// getActiveNewlyweds(row.id).then(response => {
//
// let data = response.data
// data.isonline = 1
// updateActiveNewlyweds(data).then(response => {
// this.$modal.msgSuccess("线");
// this.open = false;
// this.getList();
// });
//
// });
this.$modal.confirm('确定上线此条新人有礼活动信息?').then(function () {
return editActiveNewlyweds({id: row.id, isonline: isonline});
}).then(() => {
this.$modal.msgSuccess("上线成功");
this.open = false;
this.getList();
}).catch(() => {
});
},
submitForm() {
// this.form.activeNewlywedsChildList
this.form.activeNewlywedsChildList = this.form.tableDatas.concat(this.tableDatas);
this.$refs["form"].validate(valid => {
if (valid) {
console.log(this.form)
if (this.form.id) {
updateActiveNewlyweds(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addActiveNewlyweds(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 提交按钮 */
// submitForm() {
// // this.form.activeNewlywedsChildList
// this.form.activeNewlywedsChildList = this.form.tableDatas.concat(this.tableDatas);
// this.$refs["form"].validate(valid => {
// if (valid) {
// if (this.form.id != null) {
// updateActiveNewlyweds(this.form).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
// } else {
// addActiveNewlyweds(this.form).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
// }
// }
// });
// },
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除此条新人有礼活动信息?').then(function () {
return delActiveNewlyweds(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('business/marketingActivity/activeNewlyweds/export', {
...this.queryParams
}, `activeNewlyweds_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<style scoped lang="scss">
.box-bt {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 18px;
}
.x-box {
background: #f9f9f9;
border-radius: 6px;
box-sizing: border-box;
padding: 15px;
width: 45%;
}
.cot-box {
width: 100%;
height: 89vh;
border-radius: 8px;
background: #fff;
box-sizing: border-box;
padding: 20px;
margin: 0 auto;
}
.d-s {
display: flex;
align-items: center;
}
.icon-type {
display: flex;
align-items: center;
font-weight: 400;
font-size: 14px;
color: #999999;
margin-right: 20px;
cursor: pointer;
}
.acvtive {
color: #FF770F !important;
}
</style>

View File

@ -196,5 +196,34 @@ public class ActiveRecommendController extends BaseController {
}catch (Exception ignored){}
return getSuccessResult(activeRecommendChildService.removeByIds(idList));
}
/**
* 根据storeId查询邀请有礼信息
* @return
*/
@GetMapping("getInfo")
public ResponseObject getInfo() {
return getSuccessResult(activeRecommendService.selectByStoreId());
}
/**
* 添加邀请有礼信息
* @param activeRecommend
* @return
*/
@PostMapping("add")
public ResponseObject add(@RequestBody ActiveRecommend activeRecommend) {
return getSuccessResult(activeRecommendService.insertActiveRecommend(activeRecommend));
}
/**
* 修改邀请有礼信息
* @param activeRecommend
* @return
*/
@PutMapping("update")
public ResponseObject edit(@RequestBody ActiveRecommend activeRecommend) {
return getSuccessResult(activeRecommendService.updateActiveRecommend(activeRecommend));
}
}

View File

@ -3,12 +3,15 @@ package com.fuint.business.marketingActivity.activeRecommend.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 推荐有礼表(ActiveRecommend)表实体类
@ -18,6 +21,7 @@ import java.io.Serializable;
*/
@SuppressWarnings("serial")
@Data
@TableName("active_recommend")
public class ActiveRecommend extends Model<ActiveRecommend> {
//主键id
@TableId(type = IdType.AUTO)
@ -57,16 +61,30 @@ public class ActiveRecommend extends Model<ActiveRecommend> {
//创建者
private String createBy;
//创建时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
// 活动时间类型0永久有效1自定义
private String activeTimeType;
// 活动开始时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date activeStartTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
// 活动结束时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date activeEndTime;
//更新者
private String updateBy;
//更新时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
}
// 通知内容
private String noticeContent;
// 活动详情
private String activityDetails;
/**
* 优惠券列表
*/
@TableField(exist = false)
private List<ActiveRecommendChild> couponList;
}

View File

@ -3,6 +3,8 @@ package com.fuint.business.marketingActivity.activeRecommend.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendChild;
import java.util.List;
/**
* 推荐有礼子表优惠券兑换券(ActiveRecommendChild)表服务接口
*
@ -10,6 +12,18 @@ import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecomme
* @since 2023-11-13 15:10:17
*/
public interface ActiveRecommendChildService extends IService<ActiveRecommendChild> {
/**
* 根据推荐有礼id查询子表信息
* @param activeRecommendId
* @return
*/
List<ActiveRecommendChild> selectList(Integer activeRecommendId);
/**
* 根据推荐有礼id删除子表信息
* @param activeRecommendId
* @return
*/
int deleteByRecommendId(Integer activeRecommendId);
}

View File

@ -56,5 +56,15 @@ public interface ActiveRecommendService extends IService<ActiveRecommend> {
List<ActiveRecommendAppletVO> selectApplet(ActiveConsumption activeConsumption);
IPage select(Page page, ActiveRecommend activeRecommend);
/**
* 根据店铺id查询邀请有礼信息
* @return
*/
ActiveRecommend selectByStoreId();
int insertActiveRecommend(ActiveRecommend activeRecommend);
int updateActiveRecommend(ActiveRecommend activeRecommend);
}

View File

@ -1,11 +1,15 @@
package com.fuint.business.marketingActivity.activeRecommend.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendChild;
import com.fuint.business.marketingActivity.activeRecommend.mapper.ActiveRecommendChildMapper;
import com.fuint.business.marketingActivity.activeRecommend.service.ActiveRecommendChildService;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
/**
* 推荐有礼子表优惠券兑换券(ActiveRecommendChild)表服务实现类
*
@ -15,5 +19,18 @@ import org.springframework.stereotype.Service;
@Service("activeRecommendChildService")
public class ActiveRecommendChildServiceImpl extends ServiceImpl<ActiveRecommendChildMapper, ActiveRecommendChild> implements ActiveRecommendChildService {
@Override
public List<ActiveRecommendChild> selectList(Integer activeRecommendId) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("active_recommend_id", activeRecommendId);
return baseMapper.selectList(queryWrapper);
}
@Override
public int deleteByRecommendId(Integer activeRecommendId) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("active_recommend_id", activeRecommendId);
return baseMapper.delete(queryWrapper);
}
}

View File

@ -2,6 +2,7 @@ package com.fuint.business.marketingActivity.activeRecommend.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -29,6 +30,7 @@ import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableMa
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
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;
@ -41,6 +43,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;
@ -80,6 +83,11 @@ public class ActiveRecommendServiceImpl extends ServiceImpl<ActiveRecommendMappe
@Override
@Transactional
public Boolean add(ActiveRecommendDTO activeRecommendDTO) {
ActiveRecommend activeRecommend1 = this.selectByStoreId();
if (ObjectUtil.isNotEmpty(activeRecommend1)){
return false;
}
boolean save = false;
ActiveApplet activeApplet = new ActiveApplet();
activeApplet.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
@ -570,6 +578,57 @@ public class ActiveRecommendServiceImpl extends ServiceImpl<ActiveRecommendMappe
return page1;
}
@Override
public ActiveRecommend selectByStoreId() {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("store_id", nowAccountInfo.getStoreId());
List<ActiveRecommend> list = baseMapper.selectList(queryWrapper);
ActiveRecommend activeRecommend = null;
for (ActiveRecommend activeRecommend1 : list) {
if (activeRecommend1.getActiveTimeType().equals("0")){
activeRecommend = activeRecommend1;
}else {
Date date = new Date();
if (activeRecommend1.getActiveStartTime().before(date) && activeRecommend1.getActiveEndTime().after(date)){
activeRecommend = activeRecommend1;
}
}
}
if (ObjectUtil.isNotEmpty(activeRecommend)){
List<ActiveRecommendChild> activeRecommendChildren = activeRecommendChildService.selectList(activeRecommend.getId());
activeRecommend.setCouponList(activeRecommendChildren);
}
return activeRecommend;
}
@Override
public int insertActiveRecommend(ActiveRecommend activeRecommend) {
ActiveRecommend activeRecommend1 = this.selectByStoreId();
if (ObjectUtil.isNotEmpty(activeRecommend1)){
return 0;
}
int row = baseMapper.insert(activeRecommend);
if (ObjectUtil.isNotEmpty(activeRecommend.getCouponList())){
for (ActiveRecommendChild activeRecommendChild : activeRecommend.getCouponList()) {
activeRecommendChildService.save(activeRecommendChild);
}
}
return row;
}
@Override
public int updateActiveRecommend(ActiveRecommend activeRecommend) {
int row = baseMapper.updateById(activeRecommend);
activeRecommendChildService.deleteByRecommendId(activeRecommend.getId());
if (ObjectUtil.isNotEmpty(activeRecommend.getCouponList())){
for (ActiveRecommendChild activeRecommendChild : activeRecommend.getCouponList()) {
activeRecommendChildService.save(activeRecommendChild);
}
}
return row;
}
/**
* 数组转字符串
* @param array