修改bug

This commit is contained in:
zhaohengkun 2024-10-12 18:10:56 +08:00
parent 4ed8126d60
commit 217fdd006e
2 changed files with 161 additions and 185 deletions

View File

@ -121,22 +121,22 @@
<el-form :model="ruleForm" :rules="rules" :label-position="labelPosition" ref="ruleForm" label-width="120px"
class="demo-ruleForm">
<div class="d-s" style="justify-content: space-between">
<el-form-item label="优惠券编号" required style="width: 45%;">
<el-form-item label="优惠券编号" required prop="number" style="width: 45%;">
<el-input v-model="ruleForm.number" :disabled="ruleForm.id" placeholder="请输入优惠券编号"></el-input>
</el-form-item>
<el-form-item label="优惠券名称" required style="width: 50%;">
<el-form-item label="优惠券名称" required prop="name" style="width: 50%;">
<el-input v-model="ruleForm.name" :disabled="ruleForm.id" placeholder="请输入优惠券名称"></el-input>
</el-form-item>
</div>
<div class="d-s" style="justify-content: space-between">
<el-form-item label="投放类型" required style="width: 45%;">
<el-form-item label="投放类型" required prop="putType" style="width: 45%;">
<el-select v-model="ruleForm.putType" placeholder="请选择投放类型" style="width: 100%">
<el-option v-for="dict in dict.type.putType_type" :key="dict.value" :label="dict.label"
:value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item label="优惠券类型" required style="width: 50%;">
<el-form-item label="优惠券类型" prop="type" required style="width: 50%;">
<el-select v-model="ruleForm.type" placeholder="请选择优惠券类型" style="width: 100%" :disabled="ruleForm.id">
<el-option v-for="dict in dict.type.CardCoupon_type" :key="dict.value" :label="dict.label"
:value="dict.value"/>
@ -147,6 +147,7 @@
<el-form-item label="消费条件" required style="width: 45%;"
prop="meetCondition"
v-if="ruleForm.type=='1' || ruleForm.type=='5'">
<div class="d-s">
<el-select v-model="ruleForm.useType" :disabled="ruleForm.id" placeholder="请选择金额">
@ -164,11 +165,11 @@
</div>
</el-form-item>
<el-form-item label="兑换内容" required style="width: 45%;" v-if="ruleForm.type=='2'">
<el-form-item label="兑换内容" required style="width: 45%;" v-if="ruleForm.type=='2'" prop="exchangeContent">
<el-input placeholder="" v-model="ruleForm.exchangeContent" :disabled="ruleForm.id"></el-input>
</el-form-item>
<el-form-item label="优惠条件" required style="width: 45%;" v-if="ruleForm.type=='3'">
<el-form-item label="优惠条件" required style="width: 45%;" v-if="ruleForm.type=='3'" prop="meetCondition">
<div class="d-s">
<el-select v-model="ruleForm.useType" placeholder="请选择" style="width: 110px" :disabled="ruleForm.id">
<el-option label="订单金额" value="1"/>
@ -189,7 +190,7 @@
</div>
</el-form-item>
<el-form-item label="消费条件" required style="width: 45%;" v-if="ruleForm.type=='4'">
<el-form-item label="消费条件" required style="width: 45%;" v-if="ruleForm.type=='4'" prop="meetCondition">
<div class="d-s">
<el-select v-model="ruleForm.useType" :disabled="ruleForm.id" placeholder="请选择金额">
<el-option label="订单金额" value="1"/>
@ -211,7 +212,7 @@
</el-form-item>
<!-- 适用油品油号 oilNumber -->
<el-form-item label="适用油品油号" required style="width: 50%;">
<el-form-item label="适用油品油号" required style="width: 50%;" prop="oilLimit">
<div class="d-s">
<el-radio-group v-model="ruleForm.oilLimit">
<el-radio :label="'1'">不限</el-radio>
@ -226,7 +227,7 @@
</div>
<div class="d-s" style="justify-content: space-between" v-if="ruleForm.type=='3'">
<el-form-item label="最大优惠金额" required style="width: 45%;">
<el-form-item label="最大优惠金额" required style="width: 45%;" prop="zkMaxAmount">
<el-input placeholder="" v-model="ruleForm.zkMaxAmount">
<template slot="append"></template>
</el-input>
@ -234,9 +235,8 @@
</div>
<div class="d-s" style="justify-content: space-between">
<el-form-item label="适用会员等级" required style="width: 45%;">
<el-form-item label="适用会员等级" required style="width: 45%;" prop="membershipLevel">
<el-select v-model="ruleForm.membershipLevel" multiple placeholder="请选择" style="width: 100%">
<el-option
v-for="(item,index) in membership"
:label="item.name"
@ -244,7 +244,7 @@
:key="index"></el-option>
</el-select>
</el-form-item>
<el-form-item label="是否允许收银台送券" label-width="160px" required style="width: 50%;">
<el-form-item label="是否允许收银台送券" label-width="160px" required style="width: 50%;" prop="sySend">
<el-radio-group v-model="ruleForm.sySend">
<el-radio :label="'0'"></el-radio>
@ -257,7 +257,7 @@
<div class="d-s" style="justify-content: space-between">
<!-- 生效日期设置 timeType 字段 -->
<el-form-item label="生效日期设置" required style="width: 45%;">
<el-form-item label="生效日期设置" required style="width: 45%;" prop="timeType">
<div class="d-s">
<el-radio-group v-model="ruleForm.timeType">
<el-radio :label="'1'">领取
@ -274,20 +274,21 @@
<el-form-item v-if="ruleForm.type == '5'" label="适用商品" prop="productLimit" style="width: 50%;">
<el-radio v-model="ruleForm.productLimit" label="1">不限</el-radio>
<el-radio v-model="ruleForm.productLimit" label="2">自定义</el-radio>
<el-select multiple v-if="ruleForm.productLimit == 2" v-model="ruleForm.productIdList" placeholder="请选择商品名称(可多选)" style="margin-left: 10px;width:300px">
<el-option
v-for="item in goodsList"
:key="item.id+''"
:label="item.name"
:value="item.id+''"></el-option>
</el-select>
<!-- </div>-->
<!-- </div>-->
<el-select multiple v-if="ruleForm.productLimit == 2" v-model="ruleForm.productIdList"
placeholder="请选择商品名称(可多选)" style="margin-left: 10px;width:300px">
<el-option
v-for="item in goodsList"
:key="item.id+''"
:label="item.name"
:value="item.id+''"></el-option>
</el-select>
<!-- </div>-->
<!-- </div>-->
</el-form-item>
<!-- 生效日期 effectiveDateStart 字段 -->
<el-form-item label="生效日期" required style="width: 50%;" v-if="ruleForm.timeType=='2'">
<el-form-item label="生效日期" required style="width: 50%;" v-if="ruleForm.timeType=='2'" prop="effectiveDateStart">
<el-date-picker
v-model="ruleForm.effectiveDateStart"
style="width: 160px"
@ -307,7 +308,7 @@
</div>
<!-- 是否与其他优惠同时使用 useWithOther -->
<div class="d-s" style="justify-content: space-between">
<el-form-item label="是否与其他优惠同时使用" label-width="180px" required style="width: 45%;">
<el-form-item label="是否与其他优惠同时使用" label-width="180px" required style="width: 45%;" prop="useWithOther">
<el-radio-group v-model="ruleForm.useWithOther">
<el-radio :label="'0'">不可以</el-radio>
@ -316,7 +317,7 @@
</el-radio-group>
</el-form-item>
<el-form-item label="使用次数限制" required style="width: 50%;">
<el-form-item label="使用次数限制" required style="width: 50%;" prop="limitTotalDay">
<div class="d-s">
<div style="margin: 0px 5px;"></div>
<el-input placeholder="" v-model="ruleForm.limitTotalDay" style="width: 140px">
@ -343,13 +344,15 @@
<el-radio-group v-model="ruleForm.availableType">
<div style="display: flex; width: 500px;margin-bottom: 15px;">
<el-radio :label="'1'">每周</el-radio>
<el-checkbox-group v-model="weekDay" style="margin-left: 20px" :disabled="ruleForm.availableType!='1'">
<el-checkbox-group v-model="weekDay" style="margin-left: 20px"
:disabled="ruleForm.availableType!='1'">
<el-checkbox v-for="(item,index) in weekList" :key="index" :label="item"></el-checkbox>
</el-checkbox-group>
</div>
<el-radio :label="'2'">每月
<el-select :disabled="ruleForm.availableType!='2'" v-model="monthDay" placeholder="请选择每月固定日期" multiple style="margin-left: 20px">
<el-select :disabled="ruleForm.availableType!='2'" v-model="monthDay" placeholder="请选择每月固定日期" multiple
style="margin-left: 20px">
<el-option
v-for="item in 31"
:key="item+''"
@ -361,7 +364,7 @@
</el-radio-group>
</div>
<div style="margin-top: 20px">
<el-form-item label="时间段" label-width="70px">
<el-form-item label="时间段" label-width="70px" prop="suitTimeSlot">
<el-time-picker
v-model="ruleForm.availablePeriodStart"
format="HH:mm"
@ -382,12 +385,14 @@
<div>
<el-radio-group v-model="ruleForm.unAvailableType">
<el-radio :label="'1'">每周
<el-checkbox-group v-model="weekDay1" style="margin-left: 20px" :disabled="ruleForm.unAvailableType!='1'">
<el-checkbox-group v-model="weekDay1" style="margin-left: 20px"
:disabled="ruleForm.unAvailableType!='1'">
<el-checkbox v-for="(item,index) in weekList" :key="index" :label="item"></el-checkbox>
</el-checkbox-group>
</el-radio>
<el-radio :label="'2'">每月
<el-select :disabled="ruleForm.unAvailableType!='2'" v-model="monthDay1" placeholder="请选择每月固定日期" multiple style="margin-left: 20px">
<el-select :disabled="ruleForm.unAvailableType!='2'" v-model="monthDay1" placeholder="请选择每月固定日期"
multiple style="margin-left: 20px">
<el-option
v-for="item in 31"
:key="item+''"
@ -416,99 +421,12 @@
</el-form-item>
</div>
</el-form-item>
<!-- <el-form-item label="适用时间段" style="width: 45%;">-->
<!-- <el-radio-group v-model="ruleForm.availableType">-->
<!-- <el-radio :label="'1'" style="margin-bottom: 15px">每周-->
<!-- <el-select v-model="ruleForm.availableWeek" multiple placeholder="请选择周日期">-->
<!-- <el-option v-for="item in weekList" :key="item.value" :label="item.label" :value="item.value">-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-radio>-->
<!-- <el-radio :label="'2'" style="margin-bottom: 15px">每月-->
<!-- <el-select v-model="ruleForm.availableDay" multiple placeholder="请选择每月固定日期">-->
<!-- <el-option v-for="item in monthList" :key="item.value" :label="item.label" :value="item.value">-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-radio>-->
<!-- </el-radio-group>-->
<!-- <div class="d-s">-->
<!-- <div class="malou">时间段</div>-->
<!-- <el-time-select-->
<!-- style="margin-right: 10px"-->
<!-- placeholder="起始时间"-->
<!-- v-model="ruleForm.availablePeriodStart"-->
<!-- :picker-options="{-->
<!-- start: '00:00',-->
<!-- step: '00:15',-->
<!-- end: '24:00'-->
<!-- }">-->
<!-- </el-time-select>-->
<!-- <el-time-select-->
<!-- placeholder="结束时间"-->
<!-- v-model="ruleForm.availablePeriodEnd"-->
<!-- :picker-options="{-->
<!-- start: '00:00',-->
<!-- step: '00:15',-->
<!-- end: '24:00',-->
<!-- minTime: ruleForm.availablePeriodStart-->
<!-- }">-->
<!-- </el-time-select>-->
<!-- </div>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="不适用时间段" style="width: 50%;">-->
<!-- <el-radio-group v-model="ruleForm.unAvailableType">-->
<!-- <div>-->
<!-- <el-radio label="1" style="margin-bottom: 15px">每周-->
<!-- <el-select v-model="ruleForm.unAvailableWeek" multiple placeholder="请选择周日期">-->
<!-- <el-option v-for="item in weekList" :key="item.value" :label="item.label" :value="item.value">-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-radio>-->
<!-- </div>-->
<!-- <div>-->
<!-- <el-radio label="2" style="margin-bottom: 15px">每月-->
<!-- <el-select v-model="ruleForm.unAvailableDay" multiple placeholder="请选择每月固定日期">-->
<!-- <el-option v-for="item in monthList" :key="item.value" :label="item.label" :value="item.value">-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-radio>-->
<!-- </div>-->
<!-- </el-radio-group>-->
<!-- <div class="d-s">-->
<!-- <div class="malou">时间段</div>-->
<!-- <el-time-select-->
<!-- style="margin-right: 10px"-->
<!-- placeholder="起始时间"-->
<!-- v-model="ruleForm.unAvailablePeriodStart"-->
<!-- :picker-options="{-->
<!-- start: '00:00',-->
<!-- step: '00:15',-->
<!-- end: '24:00'-->
<!-- }">-->
<!-- </el-time-select>-->
<!-- <el-time-select-->
<!-- placeholder="结束时间"-->
<!-- v-model="ruleForm.unAvailablePeriodEnd"-->
<!-- :picker-options="{-->
<!-- start: '00:00',-->
<!-- step: '00:15',-->
<!-- end: '24:00',-->
<!-- minTime: ruleForm.availablePeriodStart-->
<!-- }">-->
<!-- </el-time-select>-->
<!-- </div>-->
<!-- </el-form-item>-->
</div>
<div class="d-s" style="justify-content: space-between">
<el-form-item label="每人领券限制" required style="width: 45%;">
<el-form-item label="每人领券限制" required style="width: 45%;" prop="getNumLimit">
<el-input v-model="ruleForm.getNumLimit" placeholder="请输入内容"></el-input>
</el-form-item>
<el-form-item label="每日领券限制" required style="width: 50%;">
<el-form-item label="每日领券限制" required style="width: 50%;" prop="dayGetLimit">
<el-input v-model="ruleForm.dayGetLimit" placeholder="请输入内容"></el-input>
</el-form-item>
</div>
@ -517,7 +435,7 @@
<!-- 每日领卷限制 dayGetLimit -->
<el-form-item label="投放总数" required style="width: 45%;">
<el-form-item label="投放总数" required style="width: 45%;" prop="tfTotal">
<el-input v-model="ruleForm.tfTotal" placeholder="请输入内容"></el-input>
</el-form-item>
<el-form-item label="使用条件" style="width: 50%;">
@ -528,10 +446,10 @@
<div class="d-s" style="justify-content: space-between">
</div>
<div class="d-s" style="justify-content: space-between">
<el-form-item label="背景图" required style="width: 45%;">
<el-form-item label="背景图" style="width: 45%;">
<imgUpload :limit="1" v-model="ruleForm.backgroundImage"></imgUpload>
</el-form-item>
<el-form-item label="备注" style="width: 50%;">
<el-form-item label="备注" style="width: 50%;">
<el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="ruleForm.remark">
</el-input>
</el-form-item>
@ -781,10 +699,10 @@ export default {
weekDay1: [],
monthDay1: [],
ruleForm: {
availableOrUn:'0',
productIdList:[],
productIds:'',
productLimit:1,
availableOrUn: '0',
productIdList: [],
productIds: '',
productLimit: 1,
oilLimit: '',
sySend: '',
timeType: '',
@ -809,15 +727,31 @@ export default {
dayGetLimit: 0,
getNumLimit: 0,
useCondition: "",
validityDay: 30
validityDay: 30,
effectiveDateEnd:'',
effectiveDateStart:'',
},
membership: [],
rules: {
name: [
{required: true, message: '此为必填项', trigger: 'blur'},
],
name: [{required: true, message: '请输入名称' }],
number: [{required: true, message: '请输入编号'}],
putType: [{required: true, message: '请选择投放类型'}],
type: [{required: true, message: '请选择优惠券类型'}],
//
oilLimit: [{required: true, validator: this.validateOilLimit, trigger: 'change'}],
membershipLevel: [{required: true, message: '请选择会员等级', trigger: 'blur'}],
sySend: [{required: true, message: '请选择收银台是否可送', trigger: 'blur'}],
timeType: [{required: true, message: '请选择时间类型', trigger: 'change'}],
//
effectiveDateStart: [{ validator: this.validateEffectiveDate}],
useWithOther: [{required: true, message: '请选择是否可与其他优惠券同享', trigger: 'blur'}],
//
limitTotalDay: [{validator: this.validateLimitTotalDay}],
getNumLimit: [{required: true, message: '请输入每人领券限制' }],
tfTotal: [{required: true, message: '请输入投放总数'}],
dayGetLimit: [{required: true, message: '请输入每日领券限制'}],
}
@ -836,8 +770,46 @@ export default {
imgUpload,
},
methods: {
getGoodsList(){
listLJGoods({page:1,pageSize:10000,status:'qy',isRecovery:0}).then(response => {
validateLimitTotalDay(rule, value, callback){
console.log(this.ruleForm.limitTotalDay)
console.log(this.ruleForm.limitTotalNum)
if (this.ruleForm.limitTotalDay == ''){
callback(new Error('请输入天数'));
}
else if (this.ruleForm.limitTotalNum === undefined){
callback(new Error('请输入次数'));
}
else {
callback();
}
},
validateOilLimit(rule, value, callback) {
if (value == '') {
callback(new Error('请选择油品油号'));
}
else if (value == '2' && this.ruleForm.oilNumber == ''){
callback(new Error('请选择自定义'));
}
else {
callback();
}
},
validateEffectiveDate(rule, value, callback){
//
if (this.ruleForm.effectiveDateStart === undefined || this.ruleForm.effectiveDateStart === null) {
callback(new Error('请选择开始时间'));
}
//
else if (this.ruleForm.effectiveDateEnd === undefined || this.ruleForm.effectiveDateEnd === null) {
callback(new Error('请选择结束时间'));
}
else {
callback();
}
},
getGoodsList() {
listLJGoods({page: 1, pageSize: 10000, status: 'qy', isRecovery: 0}).then(response => {
this.goodsList = response.data.records;
});
},
@ -905,7 +877,7 @@ export default {
this.centerDialogVisible = !this.centerDialogVisible
getCardCoupon(id).then(res => {
this.ruleForm = res.data
if (this.ruleForm.availableOrUn == null || this.ruleForm.availableOrUn == ''){
if (this.ruleForm.availableOrUn == null || this.ruleForm.availableOrUn == '') {
this.ruleForm.availableOrUn = '0'
}
if (res.data.unAvailableWeek) {
@ -930,7 +902,10 @@ export default {
})
},
addCertificate() {
this.ruleForm = {
//
oilLimit: '',
sySend: '',
timeType: '',
@ -958,6 +933,12 @@ export default {
this.centerDialogVisible = !this.centerDialogVisible
//
this.listUserGrade()
//
this.$nextTick(() => {
this.$refs['ruleForm'].clearValidate();
});
},
getwysk(row) {
if (row.sailStatus == 1) {
@ -1136,58 +1117,53 @@ export default {
},
addBlock() {
// if (this.ruleForm.unAvailableWeek) {
// this.ruleForm.unAvailableWeek = this.ruleForm.unAvailableWeek.toString()
// }
// if (this.ruleForm.unAvailableDay) {
// this.ruleForm.unAvailableDay = this.ruleForm.unAvailableDay.toString()
// }
// if (this.ruleForm.availableWeek) {
// this.ruleForm.availableWeek = this.ruleForm.availableWeek.toString()
// }
// if (this.ruleForm.availableDay) {
// this.ruleForm.availableDay = this.ruleForm.availableDay.toString()
// }
if (this.ruleForm.membershipLevel) {
this.ruleForm.membershipLevel = this.ruleForm.membershipLevel.toString()
}
if (this.ruleForm.oilNumber) {
this.ruleForm.oilNumber = this.ruleForm.oilNumber.toString()
}
let productIds = this.ruleForm.productIdList + ''
this.ruleForm.availableWeek = this.weekDay + ''
this.ruleForm.availableDay = this.monthDay + ''
this.ruleForm.unAvailableWeek = this.weekDay1 + ''
this.ruleForm.unAvailableDay = this.monthDay1 + ''
this.ruleForm.productIds = productIds
if (!this.ruleForm.id) {
console.log("啊啊啊啊啊伟大")
//
this.$refs['ruleForm'].validate(valid => {
if (valid) {
if (this.ruleForm.membershipLevel) {
this.ruleForm.membershipLevel = this.ruleForm.membershipLevel.toString()
}
if (this.ruleForm.oilNumber) {
this.ruleForm.oilNumber = this.ruleForm.oilNumber.toString()
}
let productIds = this.ruleForm.productIdList + ''
this.ruleForm.availableWeek = this.weekDay + ''
this.ruleForm.availableDay = this.monthDay + ''
this.ruleForm.unAvailableWeek = this.weekDay1 + ''
this.ruleForm.unAvailableDay = this.monthDay1 + ''
this.ruleForm.productIds = productIds
if (!this.ruleForm.id) {
addCardCoupon(this.ruleForm).then(res => {
if (res.code == 200) {
this.$message.success('添加成功');
this.gettj()
this.getlist()
this.centerDialogVisible = false
addCardCoupon(this.ruleForm).then(res => {
if (res.code == 200) {
this.$message.success('添加成功');
this.gettj()
this.getlist()
this.centerDialogVisible = false
} else {
this.$message.error('操作失败请稍后再试');
}
}).catch().catch(error => {
this.$message.error('操作失败请稍后再试');
});
} else {
this.$message.error('操作失败请稍后再试');
editCardCoupon(this.ruleForm).then(res => {
if (res.code == 200) {
this.$message.success('修改成功');
this.gettj()
this.getlist()
this.centerDialogVisible = false
} else {
this.$message.error('操作失败请稍后再试');
}
}).catch().catch(error => {
this.$message.error('操作失败请稍后再试');
});
}
}).catch().catch(error => {
this.$message.error('操作失败请稍后再试');
});
} else {
editCardCoupon(this.ruleForm).then(res => {
if (res.code == 200) {
this.$message.success('修改成功');
this.gettj()
this.getlist()
this.centerDialogVisible = false
} else {
this.$message.error('操作失败请稍后再试');
}
}).catch().catch(error => {
this.$message.error('操作失败请稍后再试');
});
}
}
});
}

View File

@ -368,7 +368,7 @@
</el-select>
</el-col>
<el-col :span="7">
<el-form-item prop="moneyMin">
<el-form-item prop="literMin">
<el-input v-model="ruleForm1.literMin">
<template slot="append">L</template>
</el-input>
@ -378,7 +378,7 @@
<div style="margin-left: 10px"></div>
</el-col>
<el-col :span="7">
<el-form-item prop="moneyMax">
<el-form-item prop="literMax">
<el-input v-model="ruleForm1.literMax">
<template slot="append">L</template>
</el-input>