This commit is contained in:
cun-nan 2024-09-05 09:46:48 +08:00
parent d6dbf9aec7
commit 7991218e3e
5 changed files with 254 additions and 132 deletions

View File

@ -535,6 +535,8 @@ export default {
Typeindex3(index) {
this.tindex3 = index
this.ruleForm.timeType = index
this.weekDay = []
this.monthDay = []
},
Typeindex4(index) {
this.tindex4 = index

View File

@ -48,3 +48,46 @@ export function deleteList(id) {
})
}
// 分页查询活动规则
export function getPriceRuleList(query) {
return request({
url: '/business/activePriceRule/page',
method: 'get',
params:query
})
}
// 添加活动规则
export function addPriceRule(data) {
return request({
url: '/business/activePriceRule/add',
method: 'post',
data:data
})
}
// 修改活动规则
export function editPriceRule(data) {
return request({
url: '/business/activePriceRule/update',
method: 'put',
data:data
})
}
// 删除活动规则
export function deletePriceRule(id) {
return request({
url: '/business/activePriceRule/del'+id,
method: 'delete',
})
}
// 根据id查询活动规则
export function getPriceRule(id) {
return request({
url: '/business/activePriceRule/'+id,
method: 'get',
})
}

View File

@ -104,7 +104,7 @@
<el-button type="primary" @click="showDialogVisible =! showDialogVisible">新增活动规则</el-button>
</div>
<el-table
:data="tableData"
:data="ruleList"
border
style="width: 100%">
<el-table-column
@ -115,53 +115,53 @@
</el-table-column>
<el-table-column
align="center"
prop="name"
prop="activeId"
label="分时优惠名称"
>
</el-table-column>
<el-table-column
align="center"
prop="name"
prop="ruleName"
label="活动规则名称"
>
</el-table-column>
<el-table-column
align="center"
prop="name"
prop="levelId"
label="会员等级"
>
</el-table-column>
<el-table-column
align="center"
prop="name"
prop="paymentType"
label="支付方式"
>
</el-table-column>
<el-table-column
align="center"
prop="name"
prop="babelIds"
label="会员标签"
>
</el-table-column>
<el-table-column
align="date"
prop="address"
prop="activeStartTime"
label="生效时间">
</el-table-column>
<el-table-column
align="date"
prop="address"
prop="timeSlots"
label="适用时间段">
</el-table-column>
<el-table-column
align="center"
prop="name"
prop="dayLimitNum"
label="每人每天参与限制"
>
</el-table-column>
<el-table-column
align="center"
prop="name"
prop="limitNum"
label="每人累计参与限制"
>
</el-table-column>
@ -170,16 +170,21 @@
prop="name"
label="状态"
>
<template slot-scope="scope">
<span v-if="scope.row.status==0" style="color:#FF9655;">未生效</span>
<span v-if="scope.row.status==1" style="color:#409EFF;">使用中</span>
<span v-if="scope.row.status==2" style="color:#F44522;">已生效</span>
</template>
</el-table-column>
<el-table-column
align="center"
prop="name"
prop="createBy"
label="创建人"
>
</el-table-column>
<el-table-column
align="center"
prop="name"
prop="createTime"
label="创建时间"
>
</el-table-column>
@ -241,7 +246,7 @@
label="油品油号"
>
<template slot-scope="scope">
<span>{{scope.row.oilType}}{{scope.row.oilName}}</span>
<span>{{ scope.row.oilType }}{{ scope.row.oilName }}</span>
</template>
</el-table-column>
<el-table-column
@ -290,117 +295,148 @@
<el-dialog
title="新增/修改活动规则"
:visible.sync="showDialogVisible"
width="30%"
width="60%"
center>
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
<el-form-item label="活动规则名称" prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
<el-form-item label="分时优惠名称" prop="region">
<el-select v-model="ruleForm.region" placeholder="请选择优惠名称">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
</el-select>
</el-form-item>
<el-form-item label="适用会员等级" prop="region">
<el-select v-model="ruleForm.region" placeholder="请选择会员等级">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
</el-select>
</el-form-item>
<el-form-item label=" 会员标签" prop="region">
<el-select v-model="ruleForm.region" placeholder="请选择会员标签">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
</el-select>
</el-form-item>
<el-form-item label="可使用支付方式" prop="type">
<el-checkbox-group v-model="ruleForm.type">
<el-checkbox label="美食/餐厅线上活动" name="type"></el-checkbox>
<el-checkbox label="地推活动" name="type"></el-checkbox>
<el-checkbox label="线下主题活动" name="type"></el-checkbox>
<el-checkbox label="单纯品牌曝光" name="type"></el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="生效时间" required>
<el-form-item prop="date1">
<el-date-picker type="date" placeholder="选择日期" v-model="ruleForm.date1"
style="width: 100%;"></el-date-picker>
</el-form-item>
</el-form-item>
<el-form-item label="适用实收金额" required>
<el-col :span="11">
<el-form-item prop="name">
<div style="display: flex;width: 100%">
<div style="width: 40%">
<el-form-item label="分时优惠名称" prop="region">
<el-select v-model="ruleForm.region" placeholder="请选择优惠名称">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
</el-select>
</el-form-item>
<el-form-item label="可使用支付方式" prop="type">
<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="region">
<el-select v-model="ruleForm.region" placeholder="请选择会员标签">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
</el-select>
</el-form-item>
<el-form-item label="适用实收金额" required>
<el-col :span="11">
<el-form-item prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
</el-col>
<el-col :span="2">
<div style="margin-left: 5px"></div>
</el-col>
<el-col :span="11">
<el-form-item prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
</el-col>
</el-form-item>
<el-form-item label="适用加油升数" required>
<el-col :span="11">
<el-form-item prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
</el-col>
<el-col :span="2">
<div style="margin-left: 5px"></div>
</el-col>
<el-col :span="11">
<el-form-item prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
</el-col>
</el-form-item>
<el-form-item label="最大优惠金额" prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
</el-col>
<el-col :span="2">
<div style="margin-left: 5px"></div>
</el-col>
<el-col :span="11">
<el-form-item prop="name">
<el-form-item label="每人每日参与限制" label-width="140px" prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
</el-col>
</el-form-item>
<el-form-item label="适用加油升数" required>
<el-col :span="11">
<el-form-item prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
</el-col>
<el-col :span="2">
<div style="margin-left: 5px"></div>
</el-col>
<el-col :span="11">
<el-form-item prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
</el-col>
</el-form-item>
<el-form-item label="最大优惠金额" prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
<el-form-item label="每人每日参与限制" label-width="140px" prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
<el-form-item label="每人累计参与限制" label-width="140px" prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
<el-form-item label="适用时间段" prop="name">
<div class="d-s" style="margin-bottom: 5px">
每周
<el-select v-model="ruleForm.region" placeholder="请选择适用时间">
<el-option label="周一" value="shanghai"></el-option>
<el-option label="周二" value="beijing"></el-option>
</el-select>
</div>
<div class="d-s" style="margin-bottom: 5px">
每月
<el-select v-model="ruleForm.region" placeholder="请选择适用时间">
<el-option label="周一" value="shanghai"></el-option>
<el-option label="周二" value="beijing"></el-option>
</el-select>
</div>
<div class="d-s">
时间段
<el-date-picker type="date" placeholder="选择日期" v-model="ruleForm.date1"></el-date-picker>
</div>
</el-form-item>
<div style="width: 60%">
<el-form-item label="活动规则名称" prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
<el-form-item label="适用会员等级" prop="region">
<el-select v-model="ruleForm.region" placeholder="请选择会员等级">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
</el-select>
</el-form-item>
<el-form-item label="生效时间" required>
<el-form-item prop="date1">
<el-date-picker type="date" placeholder="选择日期" v-model="ruleForm.date1"
style="width: 100%;"></el-date-picker>
</el-form-item>
</el-form-item>
<el-form-item label="适用时间段" prop="timeType">
<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-select v-model="weekDay" v-if="item=='每周'" placeholder="请选择每月固定日期" multiple
:disabled="tindex3!=0"
style="margin-left: 20px;margin-bottom: 20px">
<el-option
v-for="(item,index) in weekList"
:key="index"
:label="item"
:value="item">
</el-option>
</el-select>
<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="timeApplyStart">
<el-time-picker
v-model="ruleForm.timeApplyStart"
format="HH:mm"
value-format="HH:mm"
placeholder="请选择开始时间点">
</el-time-picker>
<el-time-picker
v-model="ruleForm.timeApplyEnd"
format="HH:mm"
value-format="HH:mm"
placeholder="请选择结束时间点">
</el-time-picker>
</el-form-item>
</div>
</el-form-item>
<el-form-item label="每人累计参与限制" label-width="140px" prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
</div>
</div>
<!-- -->
<el-form-item>
<el-button type="primary">立即创建</el-button>
<el-button>重置</el-button>
<el-button>取消</el-button>
<el-button type="primary">保存</el-button>
</el-form-item>
</el-form>
@ -408,15 +444,24 @@
</div>
</template>
<script>
import {getoilList, getRequestList, postaddList, getID, updateActivePrice, deleteList} from "./api/separate";
import {
getoilList,
getRequestList,
postaddList,
getID,
updateActivePrice,
deleteList,
getPriceRuleList
} from "./api/separate";
import {oilNumberList1} from "@/api/order/oilnumgun";
export default {
dicts: ['payment_type'],
data() {
return {
//
queryParams: {
pageNum: 1,
pageNo: 1,
pageSize: 5,
activeType: 1
},
@ -446,7 +491,16 @@ export default {
//
oilList: [],
//
ruleList:[],
queryParams1: {
pageNo: 1,
pageSize: 5,
},
ruleList: [],
weekMonthTypeList: ["每周", "每月"],
tindex3: 0,
weekList: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"],
weekDay: [],
monthDay: [],
}
},
created() {
@ -454,15 +508,23 @@ export default {
this.getRuleList()
},
methods: {
Typeindex3(index) {
this.tindex3 = index
this.ruleForm.timeType = index
this.weekDay = []
this.monthDay = []
},
//
getRuleList(){
getRuleList() {
getPriceRuleList(this.queryParams1).then(res => {
this.ruleList = res.data.records
})
},
//
deleteOil(id){
deleteList(id).then(res=>{
deleteOil(id) {
deleteList(id).then(res => {
console.log(res)
if(res.code == 200){
if (res.code == 200) {
this.$message({
message: '删除成功',
type: 'success'
@ -473,8 +535,8 @@ export default {
})
},
//
Blank(){
this.ruleForm ={
Blank() {
this.ruleForm = {
activeType: 1,
title: '',
name: '',
@ -499,9 +561,8 @@ export default {
addSeparateList() {
this.centerDialogVisible = false
if(this.ruleForm.id){
if (this.ruleForm.id) {
updateActivePrice(this.ruleForm).then(res => {
console.log(res)
if (res.code == 200) {
this.$message({
message: '添加成功',
@ -510,9 +571,8 @@ export default {
this.getList()
}
})
}else{
} else {
postaddList(this.ruleForm).then(res => {
console.log(res)
if (res.code == 200) {
this.$message({
message: '添加成功',
@ -528,7 +588,6 @@ export default {
//
getList() {
getRequestList(this.queryParams).then(res => {
console.log(res)
this.tableData = res.data.records
})
},
@ -547,7 +606,6 @@ export default {
data.type = '1'
this.$forceUpdate()
console.log('1', this.ruleForm.oilList)
let tempList = JSON.stringify(this.ruleForm.oilList)
this.ruleForm.oilList = []
this.ruleForm.oilList = JSON.parse(tempList)
@ -555,7 +613,6 @@ export default {
addType(data) {
data.type = '0'
this.$forceUpdate()
console.log('0', this.ruleForm.oilList)
let tempList = JSON.stringify(this.ruleForm.oilList)
this.ruleForm.oilList = []
this.ruleForm.oilList = JSON.parse(tempList)
@ -646,4 +703,22 @@ export default {
font-size: 14px;
color: #333333;
}
.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

@ -97,8 +97,8 @@ public class ActivePriceRuleController extends BaseController {
* @param id 活动规则id
* @return com.fuint.framework.web.ResponseObject
**/
@DeleteMapping("del")
public ResponseObject del(@RequestParam("id") Integer id) {
@DeleteMapping("del/{id}")
public ResponseObject del(@PathVariable Integer id) {
activePriceRuleService.removeById(id);
return getSuccessResult("删除成功", null);
}

View File

@ -62,6 +62,8 @@ public class ActivePriceRule extends Model<ActivePriceRule> {
private Integer dayLimitNum ;
/** 每人累计参与限制次数 */
private Integer limitNum ;
/** 状态0未生效1使用中2已生效 */
private String status ;
/** 创建人 */
private String createBy ;
/** 创建时间 */