Commit 39c1ddb4 by zhouzy

绑了id

1 parent 04d76c41
...@@ -12,13 +12,15 @@ ...@@ -12,13 +12,15 @@
<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%"></el-input> <el-input v-model="ruleForm.name" style="width: 60%" id="nameId"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="权益卡说明:" prop="explain"> <el-form-item label="权益卡说明:" prop="explain">
<el-input <el-input
maxlength="200"
type="textarea" type="textarea"
v-model="ruleForm.explain" v-model="ruleForm.explain"
style="width: 60%" style="width: 60%"
id="explainId"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="套餐有效期:" prop="validity" <el-form-item label="套餐有效期:" prop="validity"
...@@ -28,6 +30,7 @@ ...@@ -28,6 +30,7 @@
controls-position="right" controls-position="right"
:min="1" :min="1"
size="mini" size="mini"
id="validityId"
></el-input-number> ></el-input-number>
月内有效 月内有效
</el-form-item> </el-form-item>
...@@ -43,6 +46,7 @@ ...@@ -43,6 +46,7 @@
size="middle" size="middle"
style="width: 60%" style="width: 60%"
:disabled="!ruleForm.currencyCheckbox" :disabled="!ruleForm.currencyCheckbox"
id="currencyInputionId"
></el-input ></el-input
>个 >个
</el-form-item> </el-form-item>
...@@ -57,6 +61,7 @@ ...@@ -57,6 +61,7 @@
size="middle" size="middle"
style="width: 60%" style="width: 60%"
:disabled="!ruleForm.oilCheckbox" :disabled="!ruleForm.oilCheckbox"
id="oilInputionId"
></el-input ></el-input
>公里 >公里
</el-form-item> </el-form-item>
...@@ -66,6 +71,7 @@ ...@@ -66,6 +71,7 @@
size="middle" size="middle"
style="width: 60%" style="width: 60%"
:disabled="!ruleForm.oilCheckbox" :disabled="!ruleForm.oilCheckbox"
id="timeInputionId"
></el-input ></el-input
>天 >天
</el-form-item> </el-form-item>
...@@ -96,6 +102,7 @@ ...@@ -96,6 +102,7 @@
size="middle" size="middle"
style="width: 60%" style="width: 60%"
:disabled="!ruleForm.specialOfferCheckbox" :disabled="!ruleForm.specialOfferCheckbox"
id="rebateRatioId"
></el-input> ></el-input>
</el-form-item> </el-form-item>
...@@ -120,7 +127,7 @@ ...@@ -120,7 +127,7 @@
</template> </template>
<script> <script>
import { insertMemberCardDefineRf } from '@/api/test' import { insertMemberCardDefineRf } from "@/api/test";
export default { export default {
data() { data() {
return { return {
...@@ -132,22 +139,22 @@ export default { ...@@ -132,22 +139,22 @@ export default {
// }, // },
submit: false, submit: false,
ruleForm: { ruleForm: {
name: '', name: "",
explain: '', explain: "",
validity: 1, validity: 1,
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,
...@@ -155,127 +162,135 @@ export default { ...@@ -155,127 +162,135 @@ 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" },
], ],
explain: [ explain: [
{ {
min: 0, min: 0,
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: [ // currencyInpution: [
// { required: true, message: "请填写返回的嘀币数", trigger: "blur" }, // { required: true, message: "请填写返回的嘀币数", trigger: "blur" },
// ], // ],
// 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" }],
} },
} };
}, },
methods: { methods: {
jumpScroll(idName) {
document.getElementById(idName).scrollIntoView();
},
cancel() { cancel() {
window.history.go(-1) window.history.go(-1);
}, },
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) => { this.$refs[formName].validate((valid, options) => {
if (valid) { if (valid) {
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 = {};
alert('增加权益卡成功')
} else {
this.$message({ this.$message({
message: '请至少选择一项服务', message: "增加成功!",
type: 'error' type: "error",
}) });
} else {
} }
}) });
} else { } else {
alert('必选项未填,增加权益卡失败') this.$message({
return false message: "增加失败!",
type: "error",
});
console.log(options)
this.jumpScroll(options)
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) => {
...@@ -302,7 +317,7 @@ export default { ...@@ -302,7 +317,7 @@ export default {
// type: "error", // type: "error",
// }); // });
// } // }
} },
// inableInpution(checkStatus, inputStatus) { // inableInpution(checkStatus, inputStatus) {
// this[inputStatus] = !this[checkStatus] // this[inputStatus] = !this[checkStatus]
...@@ -312,8 +327,8 @@ export default { ...@@ -312,8 +327,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!