Commit d876a7df by 胡悦

修复bug

1 parent 64c1ff41
...@@ -93,6 +93,7 @@ ...@@ -93,6 +93,7 @@
> >
<el-input <el-input
v-model="ruleForm.timeInpution" v-model="ruleForm.timeInpution"
placeholder="若车主近期无加油记录,系统将触发该规则进行消息推送"
size="middle" size="middle"
style="width: 60%" style="width: 60%"
:disabled="!ruleForm.oilCheckbox" :disabled="!ruleForm.oilCheckbox"
...@@ -136,6 +137,7 @@ ...@@ -136,6 +137,7 @@
<el-input <el-input
v-model="ruleForm.rebateRatio" v-model="ruleForm.rebateRatio"
size="middle" size="middle"
placeholder="如设置10%,代表消费100元返利10嘀币"
style="width: 60%" style="width: 60%"
:disabled="!ruleForm.specialOfferCheckbox" :disabled="!ruleForm.specialOfferCheckbox"
id="rebateRatio" id="rebateRatio"
...@@ -169,7 +171,7 @@ ...@@ -169,7 +171,7 @@
</template> </template>
<script> <script>
import { insertMemberCardDefineRf } from "@/api/test"; import { insertMemberCardDefineRf } from '@/api/test'
export default { export default {
data() { data() {
return { return {
...@@ -181,22 +183,22 @@ export default { ...@@ -181,22 +183,22 @@ export default {
// }, // },
submit: false, submit: false,
ruleForm: { ruleForm: {
name: "", name: '',
explain: "", explain: '',
validity: 0, validity: 0,
date1: "", date1: '',
date2: "", date2: '',
delivery: false, delivery: false,
type: [], type: [],
resource: "", resource: '',
currencyCheckbox: false, currencyCheckbox: false,
currencyInpution: "", currencyInpution: '',
oilCheckbox: false, oilCheckbox: false,
oilInpution: "", oilInpution: '',
timeInpution: "", timeInpution: '',
worryFreeCheckbox: false, worryFreeCheckbox: false,
pushCollision: false, pushCollision: false,
rebateRatio: "", rebateRatio: '',
specialOfferCheckbox: false, specialOfferCheckbox: false,
exchangeStandard: false, exchangeStandard: false,
rescueCheckbox: false, rescueCheckbox: false,
...@@ -204,24 +206,21 @@ export default { ...@@ -204,24 +206,21 @@ export default {
rescueWorryFree: null, rescueWorryFree: null,
creditInstallment: null, creditInstallment: null,
meiTuan: null, meiTuan: null,
meituanCheckbox: false, meituanCheckbox: false
}, },
rules: { rules: {
name: [ name: [
{ {
required: true, required: true,
message: "请输入长度在2-10以内的权益卡名称", message: '请输入长度在2-10以内的权益卡名称',
trigger: "blur", trigger: 'blur'
}, },
{ min: 2, max: 10, message: "长度在 2 到 10 个字符", trigger: "blur" } { min: 2, max: 10, message: '长度在 2 到 10 个字符', trigger: 'blur' }
], ],
validity: [{ required: true, message: "请选择有效期", trigger: "blur" }], validity: [{ required: true, message: '请选择有效期', trigger: 'blur' }],
currencyInpution: [{ required: false, message: "请填写嘀币值", trigger: "blur" }], currencyInpution: [{ required: false, message: '请填写嘀币值', trigger: 'blur' }],
timeInpution: [{ required: false, message: "请填写最长间隔", trigger: "blur" }], timeInpution: [{ required: false, message: '请填写最长间隔', trigger: 'blur' }],
rebateRatio: [{ required: false, message: "嘀币返利比例", trigger: "blur" }] rebateRatio: [{ required: false, message: '嘀币返利比例', trigger: 'blur' }]
// currencyInpution: [ // currencyInpution: [
// { required: true, message: "请填写返回的嘀币数", trigger: "blur" }, // { required: true, message: "请填写返回的嘀币数", trigger: "blur" },
...@@ -229,148 +228,147 @@ export default { ...@@ -229,148 +228,147 @@ export default {
// oilInpution: [{ required: true, message: "请填写推荐半径", trigger: "blur" }], // oilInpution: [{ required: true, message: "请填写推荐半径", trigger: "blur" }],
// timeInpution: [{ required: true, message: "请填写最大天数", trigger: "blur" }], // timeInpution: [{ required: true, message: "请填写最大天数", trigger: "blur" }],
// rebateRatio: [{ required: true, message: "请填写返利比例", trigger: "blur" }], // rebateRatio: [{ required: true, message: "请填写返利比例", trigger: "blur" }],
}, }
}; }
}, },
activated() { activated() {
console.log(1111) console.log(1111)
}, },
methods: { methods: {
//开启input验证 // 开启input验证
startcurrencyInputioncheck() { startcurrencyInputioncheck() {
this.rules.currencyInpution[0].required = !this.rules.currencyInpution[0].required this.rules.currencyInpution[0].required = !this.rules.currencyInpution[0].required
this.$refs.ruleForm.clearValidate(); this.$refs.ruleForm.clearValidate()
}, },
startoilInputioncheck() { startoilInputioncheck() {
this.rules.oilInpution[0].required = !this.rules.oilInpution[0].required this.rules.oilInpution[0].required = !this.rules.oilInpution[0].required
this.rules.timeInpution[0].required = !this.rules.timeInpution[0].required this.rules.timeInpution[0].required = !this.rules.timeInpution[0].required
this.$refs.ruleForm.clearValidate(); this.$refs.ruleForm.clearValidate()
}, },
startpushCollisioncheck() { startpushCollisioncheck() {
this.rules.pushCollision[0].required = !this.rules.pushCollision[0].required this.rules.pushCollision[0].required = !this.rules.pushCollision[0].required
this.$refs.ruleForm.clearValidate(); this.$refs.ruleForm.clearValidate()
}, },
startrebateRatiocheck() { startrebateRatiocheck() {
this.rules.rebateRatio[0].required = !this.rules.rebateRatio[0].required this.rules.rebateRatio[0].required = !this.rules.rebateRatio[0].required
this.$refs.ruleForm.clearValidate(); this.$refs.ruleForm.clearValidate()
}, },
//检验跳转 // 检验跳转
jumpScroll(nameId) { jumpScroll(nameId) {
document.getElementById(nameId).scrollIntoView(); document.getElementById(nameId).scrollIntoView()
}, },
cancel() { cancel() {
window.history.go(-1); window.history.go(-1)
this.ruleForm = {}; this.ruleForm = {}
}, },
jump(formName) { jump(formName) {
var equityItemJson = { var equityItemJson = {
returnDicoins: this.ruleForm.currencyInpution, returnDicoins: this.ruleForm.currencyInpution,
oilWorry: { oilWorry: {
oilRadius: +this.ruleForm.oilInpution, oilRadius: +this.ruleForm.oilInpution,
oioilInterval: +this.ruleForm.timeInpution, oioilInterval: +this.ruleForm.timeInpution
}, },
collisionPush: this.ruleForm.pushCollision, collisionPush: this.ruleForm.pushCollision,
dicoinRatio: this.ruleForm.rebateRatio, dicoinRatio: this.ruleForm.rebateRatio,
rescueWorryFree: this.ruleForm.rescueWorryFree, rescueWorryFree: this.ruleForm.rescueWorryFree,
creditInstallment: this.ruleForm.creditInstallment, creditInstallment: this.ruleForm.creditInstallment,
meiTuan: this.ruleForm.meiTuan, meiTuan: this.ruleForm.meiTuan
}; }
var params = { var params = {
memberDescription: this.ruleForm.explain, memberDescription: this.ruleForm.explain,
memberName: this.ruleForm.name, memberName: this.ruleForm.name,
validitVaule: this.ruleForm.validity, validitVaule: this.ruleForm.validity,
rightsList: [], rightsList: []
}; }
if (this.ruleForm.currencyCheckbox) { if (this.ruleForm.currencyCheckbox) {
params.rightsList.push({ params.rightsList.push({
rightsId: 20, rightsId: 20,
equityItemJson: JSON.stringify(equityItemJson), equityItemJson: JSON.stringify(equityItemJson)
}); })
this.submit = true; this.submit = true
} }
if (this.ruleForm.oilCheckbox) { if (this.ruleForm.oilCheckbox) {
params.rightsList.push({ params.rightsList.push({
rightsId: 21, rightsId: 21,
equityItemJson: JSON.stringify(equityItemJson), equityItemJson: JSON.stringify(equityItemJson)
}); })
this.submit = true; this.submit = true
} }
if (this.ruleForm.worryFreeCheckbox) { if (this.ruleForm.worryFreeCheckbox) {
params.rightsList.push({ params.rightsList.push({
rightsId: 22, rightsId: 22,
equityItemJson: JSON.stringify(equityItemJson), equityItemJson: JSON.stringify(equityItemJson)
}); })
this.submit = true; this.submit = true
} }
if (this.ruleForm.specialOfferCheckbox) { if (this.ruleForm.specialOfferCheckbox) {
params.rightsList.push({ params.rightsList.push({
rightsId: 23, rightsId: 23,
equityItemJson: JSON.stringify(equityItemJson), equityItemJson: JSON.stringify(equityItemJson)
}); })
this.submit = true; this.submit = true
} }
if (this.ruleForm.rescueCheckbox) { if (this.ruleForm.rescueCheckbox) {
params.rightsList.push({ params.rightsList.push({
rightsId: 24, rightsId: 24,
equityItemJson: JSON.stringify(equityItemJson), equityItemJson: JSON.stringify(equityItemJson)
}); })
this.submit = true; this.submit = true
} }
if (this.ruleForm.creditCheckbox) { if (this.ruleForm.creditCheckbox) {
params.rightsList.push({ params.rightsList.push({
rightsId: 25, rightsId: 25,
equityItemJson: JSON.stringify(equityItemJson), equityItemJson: JSON.stringify(equityItemJson)
}); })
this.submit = true; this.submit = true
} }
if (this.ruleForm.meituanCheckbox) { if (this.ruleForm.meituanCheckbox) {
params.rightsList.push({ params.rightsList.push({
rightsId: 26, rightsId: 26,
equityItemJson: JSON.stringify(equityItemJson), equityItemJson: JSON.stringify(equityItemJson)
}); })
this.submit = true; this.submit = true
} }
this.$refs[formName].validate((valid, options) => { this.$refs[formName].validate((valid, options) => {
if (valid) { if (valid) {
if (this.submit == true) { if (this.submit == true) {
insertMemberCardDefineRf(params).then((res) => { insertMemberCardDefineRf(params).then((res) => {
if (res > 0) { if (res > 0) {
window.history.go(-1); window.history.go(-1)
this.ruleForm = {}; this.ruleForm = {}
this.$message({ this.$message({
message: "增加成功!", message: '增加成功!',
type: "success", type: 'success'
}); })
} else { } else {
this.$message({ this.$message({
message: "增加失败!", message: '增加失败!',
type: "error", type: 'error'
}); })
} }
}); })
} else { } else {
this.$message({ this.$message({
message: "请至少选择一项服务!", message: '请至少选择一项服务!',
type: "error", type: 'error'
}); })
} }
} else { } else {
this.$message({ this.$message({
message: "增加失败!", message: '增加失败!',
type: "error", type: 'error'
}); })
console.log(Object.keys(options)) console.log(Object.keys(options))
//转换成prop对应的id,需要分别转,最好id取唯一的prop值 // 转换成prop对应的id,需要分别转,最好id取唯一的prop值
// var temp = { // var temp = {
// "name": 'nameId' // "name": 'nameId'
// } // }
// this.jumpScroll(temp[Object.keys(options)[0]]) // this.jumpScroll(temp[Object.keys(options)[0]])
// this.jumpScroll(Object.keys(options)[0]) // this.jumpScroll(Object.keys(options)[0])
console.log('----------------'); console.log('----------------')
return false; return false
} }
}); })
// if (this.ruleForm.name) { // if (this.ruleForm.name) {
// if (this.submit == true) { // if (this.submit == true) {
// insertMemberCardDefineRf(params).then((res) => { // insertMemberCardDefineRf(params).then((res) => {
...@@ -397,7 +395,7 @@ export default { ...@@ -397,7 +395,7 @@ export default {
// type: "error", // type: "error",
// }); // });
// } // }
}, }
// inableInpution(checkStatus, inputStatus) { // inableInpution(checkStatus, inputStatus) {
// this[inputStatus] = !this[checkStatus] // this[inputStatus] = !this[checkStatus]
...@@ -407,8 +405,8 @@ export default { ...@@ -407,8 +405,8 @@ export default {
// // this. stopdrivingInpution=true // // this. stopdrivingInpution=true
// // } // // }
// } // }
}, }
}; }
</script> </script>
<style> <style>
* { * {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!