Commit 18861b18 by zhouzy

新增界面优化提示

1 parent 39c1ddb4
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<div class="baseinformation">基础信息</div> <div class="baseinformation">基础信息</div>
<div class="itemContainer"> <div class="itemContainer">
<el-form-item label="权益卡名称:" prop="name"> <el-form-item label="权益卡名称:" prop="name">
<el-input v-model="ruleForm.name" style="width: 60%" id="nameId"></el-input> <el-input v-model="ruleForm.name" style="width: 60%" id="name"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="权益卡说明:" prop="explain"> <el-form-item label="权益卡说明:" prop="explain">
<el-input <el-input
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
type="textarea" type="textarea"
v-model="ruleForm.explain" v-model="ruleForm.explain"
style="width: 60%" style="width: 60%"
id="explainId" id="explain"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="套餐有效期:" prop="validity" <el-form-item label="套餐有效期:" prop="validity"
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
controls-position="right" controls-position="right"
:min="1" :min="1"
size="mini" size="mini"
id="validityId" id="validity"
></el-input-number> ></el-input-number>
月内有效 月内有效
</el-form-item> </el-form-item>
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<div>权益配置</div> <div>权益配置</div>
<div class="itemContainer"> <div class="itemContainer">
<el-form-item> <el-form-item>
<el-checkbox v-model="ruleForm.currencyCheckbox">停驶返嘀币</el-checkbox> <el-checkbox v-model="ruleForm.currencyCheckbox" @change="startcurrencyInputioncheck">停驶返嘀币</el-checkbox>
</el-form-item> </el-form-item>
<el-form-item label="返嘀币(每小时):" prop="currencyInpution"> <el-form-item label="返嘀币(每小时):" prop="currencyInpution">
<el-input <el-input
...@@ -46,14 +46,14 @@ ...@@ -46,14 +46,14 @@
size="middle" size="middle"
style="width: 60%" style="width: 60%"
:disabled="!ruleForm.currencyCheckbox" :disabled="!ruleForm.currencyCheckbox"
id="currencyInputionId" id="currencyInpution"
></el-input ></el-input
>个 >个
</el-form-item> </el-form-item>
</div> </div>
<div class="itemContainer"> <div class="itemContainer">
<el-form-item> <el-form-item>
<el-checkbox v-model="ruleForm.oilCheckbox">加油无忧</el-checkbox> <el-checkbox v-model="ruleForm.oilCheckbox" @change="startoilInputioncheck">加油无忧</el-checkbox>
</el-form-item> </el-form-item>
<el-form-item label="油站推荐半径:" prop="oilInpution"> <el-form-item label="油站推荐半径:" prop="oilInpution">
<el-input <el-input
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
size="middle" size="middle"
style="width: 60%" style="width: 60%"
:disabled="!ruleForm.oilCheckbox" :disabled="!ruleForm.oilCheckbox"
id="oilInputionId" id="oilInpution"
></el-input ></el-input
>公里 >公里
</el-form-item> </el-form-item>
...@@ -71,14 +71,14 @@ ...@@ -71,14 +71,14 @@
size="middle" size="middle"
style="width: 60%" style="width: 60%"
:disabled="!ruleForm.oilCheckbox" :disabled="!ruleForm.oilCheckbox"
id="timeInputionId" id="timeInpution"
></el-input ></el-input
>天 >天
</el-form-item> </el-form-item>
</div> </div>
<div class="itemContainer"> <div class="itemContainer">
<el-form-item> <el-form-item>
<el-checkbox v-model="ruleForm.worryFreeCheckbox">出险无忧</el-checkbox> <el-checkbox v-model="ruleForm.worryFreeCheckbox" @change="startpushCollisioncheck">出险无忧</el-checkbox>
</el-form-item> </el-form-item>
<el-form-item label="启用碰撞推送:" prop="pushCollision"> <el-form-item label="启用碰撞推送:" prop="pushCollision">
<el-switch <el-switch
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
</div> </div>
<div class="itemContainer"> <div class="itemContainer">
<el-form-item> <el-form-item>
<el-checkbox v-model="ruleForm.specialOfferCheckbox">特惠商品</el-checkbox> <el-checkbox v-model="ruleForm.specialOfferCheckbox" @change="startrebateRatiocheck">特惠商品</el-checkbox>
</el-form-item> </el-form-item>
<el-form-item label="嘀币返利比例(%):" prop="rebateRatio"> <el-form-item label="嘀币返利比例(%):" prop="rebateRatio">
<el-input <el-input
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
size="middle" size="middle"
style="width: 60%" style="width: 60%"
:disabled="!ruleForm.specialOfferCheckbox" :disabled="!ruleForm.specialOfferCheckbox"
id="rebateRatioId" id="rebateRatio"
></el-input> ></el-input>
</el-form-item> </el-form-item>
...@@ -171,7 +171,7 @@ export default { ...@@ -171,7 +171,7 @@ export default {
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" }
], ],
explain: [ explain: [
{ {
...@@ -179,10 +179,18 @@ export default { ...@@ -179,10 +179,18 @@ export default {
max: 200, max: 200,
required: true, required: true,
message: "请填写200字以内的说明", message: "请填写200字以内的说明",
trigger: "blur", trigger: "blur"
}, },
], ],
validity: [{ required: true, message: "请选择有效期", trigger: "blur" }], validity: [{ required: true, message: "请选择有效期", trigger: "blur" }],
currencyInpution: [{ required: false, message: "请填写嘀币值", trigger: "blur" }],
oilInpution:[{ required: false, message: "请填写半径值", trigger: "blur" }],
timeInpution:[{ required: false, message: "请填写最长间隔", trigger: "blur" }],
rebateRatio:[{ required: false, message: "嘀币返利比例", trigger: "blur" }]
// currencyInpution: [ // currencyInpution: [
// { required: true, message: "请填写返回的嘀币数", trigger: "blur" }, // { required: true, message: "请填写返回的嘀币数", trigger: "blur" },
// ], // ],
...@@ -193,11 +201,31 @@ export default { ...@@ -193,11 +201,31 @@ export default {
}; };
}, },
methods: { methods: {
jumpScroll(idName) { //开启input验证
document.getElementById(idName).scrollIntoView(); startcurrencyInputioncheck(){
this.rules.currencyInpution[0].required = !this.rules.currencyInpution[0].required
this.$refs.ruleForm.clearValidate();
},
startoilInputioncheck(){
this.rules.oilInpution[0].required = !this.rules.oilInpution[0].required
this.rules.timeInpution[0].required = !this.rules.timeInpution[0].required
this.$refs.ruleForm.clearValidate();
},
startpushCollisioncheck(){
this.rules.pushCollision[0].required = !this.rules.pushCollision[0].required
this.$refs.ruleForm.clearValidate();
},
startrebateRatiocheck(){
this.rules.rebateRatio[0].required = !this.rules.rebateRatio[0].required
this.$refs.ruleForm.clearValidate();
},
//检验跳转
jumpScroll(nameId) {
document.getElementById(nameId).scrollIntoView();
}, },
cancel() { cancel() {
window.history.go(-1); window.history.go(-1);
this.ruleForm = {};
}, },
jump(formName) { jump(formName) {
var equityItemJson = { var equityItemJson = {
...@@ -275,7 +303,7 @@ export default { ...@@ -275,7 +303,7 @@ export default {
this.ruleForm = {}; this.ruleForm = {};
this.$message({ this.$message({
message: "增加成功!", message: "增加成功!",
type: "error", type: "success",
}); });
} else { } else {
...@@ -286,8 +314,13 @@ export default { ...@@ -286,8 +314,13 @@ export default {
message: "增加失败!", message: "增加失败!",
type: "error", type: "error",
}); });
console.log(options) console.log(Object.keys(options))
this.jumpScroll(options) //转换成prop对应的id,需要分别转,最好id取唯一的prop值
// var temp = {
// "name": 'nameId'
// }
// this.jumpScroll(temp[Object.keys(options)[0]])
this.jumpScroll(Object.keys(options)[0])
return false; return false;
} }
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!