优惠券相关修改
This commit is contained in:
parent
cfe0171e60
commit
86b9c1997d
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="app-containers">
|
||||
<!-- 礼品卡-->
|
||||
<!-- 优惠券 -->
|
||||
|
||||
<div class="card-box" style="margin-bottom: 20px">
|
||||
|
||||
@ -70,7 +70,7 @@
|
||||
<span v-if="scope.row.status != 1" style="color: #F44522">下架</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createBy" label="创建人"></el-table-column>
|
||||
<el-table-column prop="createByName" label="创建人"></el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间"></el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
@ -125,8 +125,12 @@
|
||||
<el-form-item label="优惠券编号" required prop="number" style="width: 45%;">
|
||||
<el-input v-model="ruleForm.number" placeholder="请输入优惠券编号"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-button type="primary" icon="el-icon-refresh" circle @click="refreshNumber()"
|
||||
v-if="!this.disabledBol"></el-button>
|
||||
|
||||
<el-form-item label="优惠券名称" required prop="name" style="width: 50%;">
|
||||
<el-input v-model="ruleForm.name" placeholder="请输入优惠券名称"></el-input>
|
||||
<el-input v-model="ruleForm.name" placeholder="请输入优惠券名称" :disabled="disabledBol"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
</div>
|
||||
@ -138,7 +142,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠券类型" prop="type" required style="width: 50%;">
|
||||
<el-select v-model="ruleForm.type" placeholder="请选择优惠券类型" style="width: 100%">
|
||||
<el-select v-model="ruleForm.type" placeholder="请选择优惠券类型" style="width: 100%" :disabled="disabledBol">
|
||||
<el-option v-for="dict in dict.type.CardCoupon_type" :key="dict.value" :label="dict.label"
|
||||
:value="dict.value"/>
|
||||
</el-select>
|
||||
@ -151,16 +155,16 @@
|
||||
v-if="ruleForm.type=='1'"
|
||||
prop="useType">
|
||||
<div class="d-s">
|
||||
<el-select v-model="ruleForm.useType" placeholder="请选择金额">
|
||||
<el-select v-model="ruleForm.useType" placeholder="请选择金额" :disabled="disabledBol">
|
||||
<el-option label="订单金额" value="1"/>
|
||||
<el-option label="加油升数" value="2"/>
|
||||
</el-select>
|
||||
<div style="margin: 0px 5px;">满</div>
|
||||
<el-input placeholder="" v-model="ruleForm.reachAmount" style="width: 140px">
|
||||
<template slot="append">{{ruleForm.useType == '1' ? '元' : '升' }}</template>
|
||||
<el-input placeholder="" v-model="ruleForm.reachAmount" style="width: 140px" :disabled="disabledBol">
|
||||
<template slot="append">{{ ruleForm.useType == '1' ? '元' : '升' }}</template>
|
||||
</el-input>
|
||||
<div style="width: 60px;text-align: center">优惠</div>
|
||||
<el-input placeholder="" v-model="ruleForm.reduceAmount" style="width: 140px">
|
||||
<el-input placeholder="" v-model="ruleForm.reduceAmount" style="width: 140px" :disabled="disabledBol">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</div>
|
||||
@ -170,40 +174,41 @@
|
||||
v-if="ruleForm.type=='5'"
|
||||
prop="useType">
|
||||
<div class="d-s">
|
||||
<el-select v-model="ruleForm.useType" placeholder="请选择金额">
|
||||
<el-select v-model="ruleForm.useType" placeholder="请选择金额" :disabled="disabledBol">
|
||||
<el-option label="订单金额" value="1"/>
|
||||
</el-select>
|
||||
<div style="margin: 0px 5px;">满</div>
|
||||
<el-input placeholder="" v-model="ruleForm.reachAmount" style="width: 140px">
|
||||
<el-input placeholder="" v-model="ruleForm.reachAmount" style="width: 140px" :disabled="disabledBol">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
<div style="width: 60px;text-align: center">优惠</div>
|
||||
<el-input placeholder="" v-model="ruleForm.reduceAmount" style="width: 140px">
|
||||
<el-input placeholder="" v-model="ruleForm.reduceAmount" style="width: 140px" :disabled="disabledBol">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="兑换内容" required style="width: 45%;" v-if="ruleForm.type=='2'" prop="exchangeContent">
|
||||
<el-form-item label="兑换内容" required style="width: 45%;" v-if="ruleForm.type=='2'" prop="exchangeContent"
|
||||
:disabled="disabledBol">
|
||||
<el-input placeholder="" v-model="ruleForm.exchangeContent"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="优惠条件" required style="width: 45%;" v-if="ruleForm.type=='3'" prop="useType">
|
||||
<div class="d-s">
|
||||
<el-select v-model="ruleForm.useType" placeholder="请选择" style="width: 110px">
|
||||
<el-select v-model="ruleForm.useType" placeholder="请选择" style="width: 110px" :disabled="disabledBol">
|
||||
<el-option label="订单金额" value="1"/>
|
||||
<el-option label="加油升数" value="2"/>
|
||||
</el-select>
|
||||
<div style="width: 50px;text-align: center">范围</div>
|
||||
<el-input placeholder="" v-model="ruleForm.zkStartAmount" style="width: 130px">
|
||||
<template slot="append">{{ruleForm.useType == '1' ? '元' : '升'}}</template>
|
||||
<el-input placeholder="" v-model="ruleForm.zkStartAmount" style="width: 130px" :disabled="disabledBol">
|
||||
<template slot="append">{{ ruleForm.useType == '1' ? '元' : '升' }}</template>
|
||||
</el-input>
|
||||
<div style="margin: 0px 5px;">~</div>
|
||||
<el-input placeholder="" v-model="ruleForm.zkEndAmount" style="width: 130px">
|
||||
<template slot="append">{{ruleForm.useType == '1' ? '元' : '升'}}</template>
|
||||
<el-input placeholder="" v-model="ruleForm.zkEndAmount" style="width: 130px" :disabled="disabledBol">
|
||||
<template slot="append">{{ ruleForm.useType == '1' ? '元' : '升' }}</template>
|
||||
</el-input>
|
||||
<div style="width: 50px;text-align: center">优惠</div>
|
||||
<el-input placeholder="" v-model="ruleForm.zkData" style="width: 130px">
|
||||
<el-input placeholder="" v-model="ruleForm.zkData" style="width: 130px" :disabled="disabledBol">
|
||||
<template slot="append">折</template>
|
||||
</el-input>
|
||||
</div>
|
||||
@ -211,27 +216,28 @@
|
||||
|
||||
<el-form-item label="消费条件" required style="width: 45%;" v-if="ruleForm.type=='4'" prop="useType">
|
||||
<div class="d-s">
|
||||
<el-select v-model="ruleForm.useType" placeholder="请选择金额">
|
||||
<el-select v-model="ruleForm.useType" placeholder="请选择金额" :disabled="disabledBol">
|
||||
<el-option label="订单金额" value="1"/>
|
||||
<el-option label="加油升数" value="2"/>
|
||||
</el-select>
|
||||
<div style="margin: 0px 5px;">满</div>
|
||||
<el-input placeholder="" v-model="ruleForm.reachAmount" style="width: 160px">
|
||||
<template slot="append">{{ruleForm.useType == '1' ? '元' : '升'}}</template>
|
||||
<el-input placeholder="" v-model="ruleForm.reachAmount" style="width: 160px" :disabled="disabledBol">
|
||||
<template slot="append">{{ ruleForm.useType == '1' ? '元' : '升' }}</template>
|
||||
</el-input>
|
||||
<div style="width: 40px;text-align: center">每</div>
|
||||
<el-input placeholder="" v-model="ruleForm.ljOilNum" style="width: 160px">
|
||||
<el-input placeholder="" v-model="ruleForm.ljOilNum" style="width: 160px" :disabled="disabledBol">
|
||||
<template slot="append">L</template>
|
||||
</el-input>
|
||||
<div style="width: 40px;text-align: center">减</div>
|
||||
<el-input placeholder="" v-model="ruleForm.ljOilAmount" style="width: 160px">
|
||||
<el-input placeholder="" v-model="ruleForm.ljOilAmount" style="width: 160px" :disabled="disabledBol">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 适用油品油号 oilNumber -->
|
||||
<el-form-item label="适用油品油号" required style="width: 50%;" prop="oilLimit">
|
||||
<el-form-item label="适用油品油号" required style="width: 50%;" prop="oilLimit"
|
||||
v-if="ruleForm.type=='1' || ruleForm.type=='3' || ruleForm.type=='4' ">
|
||||
<div class="d-s">
|
||||
<el-radio-group v-model="ruleForm.oilLimit">
|
||||
<el-radio :label="'1'">不限</el-radio>
|
||||
@ -245,9 +251,9 @@
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<div class="d-s" style="justify-content: space-between" v-if="ruleForm.type=='3'">
|
||||
<div class="d-s" style="justify-content: space-between" v-if="ruleForm.type=='3'|| ruleForm.type=='4' ">
|
||||
<el-form-item label="最大优惠金额" required style="width: 45%;" prop="zkMaxAmount">
|
||||
<el-input placeholder="" v-model="ruleForm.zkMaxAmount">
|
||||
<el-input placeholder="" v-model="ruleForm.zkMaxAmount" :disabled="disabledBol">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
@ -353,13 +359,13 @@
|
||||
|
||||
</div>
|
||||
<div class="d-s" style="justify-content: space-between">
|
||||
<el-form-item label="时间段设置" prop="availableOrUn">
|
||||
<el-form-item label="时间段设置" prop="availableOrUn" required>
|
||||
<el-radio-group v-model="ruleForm.availableOrUn">
|
||||
<el-radio :label="'0'">适用时间段</el-radio>
|
||||
<el-radio :label="'1'">不可用时间段</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="ruleForm.availableOrUn == '0'" label="适用时间段" prop="suitTimeSlotType">
|
||||
<el-form-item v-if="ruleForm.availableOrUn == '0'" label="适用时间段" prop="availableType" required>
|
||||
<div style="width: 100px;margin-top: 10px">
|
||||
<el-radio-group v-model="ruleForm.availableType">
|
||||
<div style="display: flex; width: 500px;margin-bottom: 15px;">
|
||||
@ -384,7 +390,7 @@
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<div style="margin-top: 20px">
|
||||
<el-form-item label="时间段" label-width="70px" prop="suitTimeSlot">
|
||||
<el-form-item label="时间段" label-width="70px" prop="availablePeriodStart" required>
|
||||
<el-time-picker
|
||||
v-model="ruleForm.availablePeriodStart"
|
||||
format="HH:mm"
|
||||
@ -401,7 +407,7 @@
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item v-else label="不适用时间段" prop="noUseTimeType">
|
||||
<el-form-item v-else label="不适用时间段" prop="unAvailableType" required>
|
||||
<div>
|
||||
<el-radio-group v-model="ruleForm.unAvailableType">
|
||||
<el-radio :label="'1'">每周
|
||||
@ -424,7 +430,7 @@
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<div style="margin-top: 20px">
|
||||
<el-form-item label="时间段" prop="noUseTimeFront" label-width="70px">
|
||||
<el-form-item label="时间段" prop="unAvailablePeriodStart" label-width="70px" required>
|
||||
<el-time-picker
|
||||
v-model="ruleForm.unAvailablePeriodStart"
|
||||
format="HH:mm"
|
||||
@ -466,7 +472,7 @@
|
||||
<div class="d-s" style="justify-content: space-between">
|
||||
</div>
|
||||
<div class="d-s" style="justify-content: space-between">
|
||||
<el-form-item label="背景图" style="width: 45%;">
|
||||
<el-form-item label="背景图" style="width: 45%;" required prop="backgroundImage">
|
||||
<imgUpload :limit="1" v-model="ruleForm.backgroundImage"></imgUpload>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" style="width: 50%;">
|
||||
@ -518,6 +524,7 @@ export default {
|
||||
dicts: ['CardCoupon_type', 'putType_type', 'oilNumber_type'],
|
||||
data() {
|
||||
return {
|
||||
disabledBol: false,
|
||||
oilTypelist: [
|
||||
"不限",
|
||||
"自定义"
|
||||
@ -755,6 +762,10 @@ export default {
|
||||
},
|
||||
membership: [],
|
||||
rules: {
|
||||
backgroundImage: [{required: true, message: '请上传背景图'}],
|
||||
unAvailableType: [{required: true, message: '请选择不可使用日期类型'}],
|
||||
availableType: [{required: true, message: '请选择适用日期类型'}],
|
||||
availableOrUn: [{required: true, message: '请选择时间段'}],
|
||||
name: [{required: true, message: '请输入名称'}],
|
||||
number: [{required: true, message: '请输入编号'}],
|
||||
putType: [{required: true, message: '请选择投放类型'}],
|
||||
@ -777,7 +788,7 @@ export default {
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
|
||||
console.log('优惠券类型',this.dict.type.CardCoupon_type)
|
||||
console.log('优惠券类型', this.dict.type.CardCoupon_type)
|
||||
|
||||
if (this.ruleForm.type == '1' || this.ruleForm.type == '5') {
|
||||
if (!this.ruleForm.useType) {
|
||||
@ -821,6 +832,37 @@ export default {
|
||||
trigger: ['change', 'blur']
|
||||
}
|
||||
],
|
||||
//自定义校验
|
||||
unAvailablePeriodStart: [
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
if (this.ruleForm.unAvailablePeriodStart === undefined) {
|
||||
callback(new Error("请选择开始时间段"));
|
||||
} else if (this.ruleForm.unAvailablePeriodEnd === undefined) {
|
||||
callback(new Error("请选择结束时间段"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
|
||||
},
|
||||
trigger: ['change', 'blur']
|
||||
}
|
||||
],
|
||||
//自定义校验
|
||||
availablePeriodStart: [
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
if (this.ruleForm.availablePeriodStart === undefined) {
|
||||
callback(new Error("请选择开始时间段"));
|
||||
} else if (this.ruleForm.availablePeriodEnd === undefined) {
|
||||
callback(new Error("请选择结束时间段"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
trigger: ['change', 'blur']
|
||||
}
|
||||
],
|
||||
exchangeContent: [{required: true, message: '请输入兑换内容'}],
|
||||
}
|
||||
|
||||
@ -839,7 +881,11 @@ export default {
|
||||
imgUpload,
|
||||
},
|
||||
methods: {
|
||||
|
||||
//刷新生成的编号
|
||||
refreshNumber() {
|
||||
console.log("触发了", this.ruleForm)
|
||||
this.ruleForm.number = this.generateCouponNumber()
|
||||
},
|
||||
getExpirationDate(row) {
|
||||
if (row.timeType == '1') {
|
||||
|
||||
@ -862,7 +908,7 @@ export default {
|
||||
return '订单金额 满' + row.reachAmount + '元 优惠' + row.reduceAmount + '元'
|
||||
}
|
||||
if (row.useType == 2) {
|
||||
return '实收 满' + row.reachAmount + '元 优惠' + row.reduceAmount + '元'
|
||||
return '加油升数 满' + row.reachAmount + 'L 优惠' + row.reduceAmount + '元'
|
||||
}
|
||||
|
||||
}
|
||||
@ -876,7 +922,7 @@ export default {
|
||||
return '订单金额 范围' + row.zkStartAmount + '元 ~ ' + row.zkEndAmount + '元 优惠' + row.zkData + '折'
|
||||
}
|
||||
if (row.useType == 2) {
|
||||
return '加油升数 范围' + row.zkStartAmount + '元 ~ ' + row.zkEndAmount + '元 优惠' + row.zkData + '折'
|
||||
return '加油升数 范围' + row.zkStartAmount + 'L ~ ' + row.zkEndAmount + 'L 优惠' + row.zkData + '折'
|
||||
}
|
||||
|
||||
}
|
||||
@ -885,7 +931,7 @@ export default {
|
||||
return '订单金额 满' + row.reachAmount + '元 每' + row.ljOilNum + 'L 减' + row.ljOilAmount + '元'
|
||||
}
|
||||
if (row.useType == 2) {
|
||||
return '加油升数 满' + row.reachAmount + '元 每' + row.ljOilNum + 'L 减' + row.ljOilAmount + '元'
|
||||
return '加油升数 满' + row.reachAmount + 'L 每' + row.ljOilNum + 'L 减' + row.ljOilAmount + '元'
|
||||
}
|
||||
}
|
||||
|
||||
@ -989,11 +1035,13 @@ export default {
|
||||
},
|
||||
|
||||
updetenCardCoupon(id) {
|
||||
//锁定表单某些输入框
|
||||
this.disabledBol = true
|
||||
this.listUserGrade()
|
||||
console.log("什么值啊", this.centerDialogVisible)
|
||||
this.centerDialogVisible = !this.centerDialogVisible
|
||||
getCardCoupon(id).then(res => {
|
||||
this.ruleForm = res.data
|
||||
console.log("类型", typeof this.ruleForm.unAvailablePeriodStart)
|
||||
if (this.ruleForm.availableOrUn == null || this.ruleForm.availableOrUn == '') {
|
||||
this.ruleForm.availableOrUn = '0'
|
||||
}
|
||||
@ -1018,9 +1066,21 @@ export default {
|
||||
|
||||
})
|
||||
},
|
||||
//生成时间
|
||||
generateCouponNumber() {
|
||||
const now = new Date();
|
||||
var dateStr = now.getFullYear().toString() + // 年份取后两位
|
||||
(now.getMonth() + 1).toString().padStart(2, '0') + // 月份
|
||||
now.getDate().toString().padStart(2, '0') + // 日期
|
||||
now.getHours().toString().padStart(2, '0') + // 小时
|
||||
now.getMinutes().toString().padStart(2, '0') + // 分钟
|
||||
now.getSeconds().toString().padStart(2, '0'); // 秒
|
||||
|
||||
return dateStr
|
||||
},
|
||||
addCertificate() {
|
||||
|
||||
|
||||
this.disabledBol = false
|
||||
this.ruleForm = {
|
||||
useType: '1',
|
||||
//单选框都要有默认值 否则会提示表单约束必填项
|
||||
@ -1031,7 +1091,7 @@ export default {
|
||||
availableType: '',
|
||||
unAvailableType: '',
|
||||
name: '',
|
||||
number: '',
|
||||
number: this.generateCouponNumber(),
|
||||
quantity: '',
|
||||
cardAmount: '',
|
||||
remark: '',
|
||||
@ -1234,8 +1294,6 @@ export default {
|
||||
}
|
||||
},
|
||||
addBlock() {
|
||||
|
||||
console.log("啊啊啊啊啊伟大")
|
||||
//表单校验
|
||||
this.$refs['ruleForm'].validate(valid => {
|
||||
if (valid) {
|
||||
@ -1262,8 +1320,6 @@ export default {
|
||||
} else {
|
||||
this.$message.error('操作失败请稍后再试');
|
||||
}
|
||||
}).catch().catch(error => {
|
||||
this.$message.error('操作失败请稍后再试');
|
||||
});
|
||||
} else {
|
||||
editCardCoupon(this.ruleForm).then(res => {
|
||||
|
@ -142,13 +142,13 @@ public class CardCouponController extends BaseController {
|
||||
@PostMapping
|
||||
public ResponseObject insert(@RequestBody CardCoupon cardCoupon) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
//判断活动编号是否存在
|
||||
//判断优惠券编号
|
||||
LambdaQueryWrapper<CardCoupon> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CardCoupon::getNumber, cardCoupon.getNumber())
|
||||
.eq(CardCoupon::getStoreId, nowAccountInfo.getStoreId());
|
||||
int count = cardCouponService.count(queryWrapper);
|
||||
if (count > 0) {
|
||||
return getFailureResult("编号已存在");
|
||||
return getFailureResult(500, "编号已存在 请点击页面刷新按钮生成新的编号");
|
||||
}
|
||||
cardCoupon.setStoreId(nowAccountInfo.getStoreId());
|
||||
cardCoupon.setChainStorId(nowAccountInfo.getChainStoreId());
|
||||
@ -163,16 +163,6 @@ public class CardCouponController extends BaseController {
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseObject update(@RequestBody CardCoupon cardCoupon) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
//判断活动编号是否存在
|
||||
LambdaQueryWrapper<CardCoupon> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CardCoupon::getNumber, cardCoupon.getNumber())
|
||||
.ne(CardCoupon::getId, cardCoupon.getId())
|
||||
.eq(CardCoupon::getStoreId, nowAccountInfo.getStoreId());
|
||||
int count = cardCouponService.count(queryWrapper);
|
||||
if (count > 0) {
|
||||
return getFailureResult("编号已存在");
|
||||
}
|
||||
return getSuccessResult(this.cardCouponService.updateById(cardCoupon));
|
||||
}
|
||||
|
||||
|
@ -5,9 +5,9 @@
|
||||
|
||||
<select id="pageVo" resultType="com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon">
|
||||
SELECT
|
||||
cc.*
|
||||
cc.* , acc.real_name AS createByName
|
||||
FROM
|
||||
card_coupon cc
|
||||
card_coupon cc left join t_account acc on cc.create_by = acc.acct_id
|
||||
<where>
|
||||
<if test="cardCoupon.storeId!=null and cardCoupon.storeId!=''">
|
||||
and cc.store_id = #{cardCoupon.storeId}
|
||||
|
@ -1008,6 +1008,7 @@ import {getLodop} from "@/api/LodopFuncs";
|
||||
|
||||
},
|
||||
getStaffList(){
|
||||
console.log("查询负责人走了")
|
||||
queryStaffs().then(res => {
|
||||
this.staffList = res.data
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user