Commit b189f46a by zhouzy

新建提交方式改变

1 parent 1b8f2a18
...@@ -181,7 +181,6 @@ export default { ...@@ -181,7 +181,6 @@ export default {
// name:ruleForm.name, // name:ruleForm.name,
// validitVaule:"" // validitVaule:""
// }, // },
submit: false,
ruleForm: { ruleForm: {
name: '', name: '',
explain: '', explain: '',
...@@ -255,84 +254,102 @@ export default { ...@@ -255,84 +254,102 @@ export default {
}, },
// 检验跳转 // 检验跳转
jumpScroll(nameId) { jumpScroll(nameId) {
document.getElementById(nameId).scrollIntoView() var dom = document.getElementById(nameId)
document.documentElement.scrollTop = dom.clientHeight
// document.getElementById(nameId).scrollIntoView()
}, },
cancel() { cancel() {
window.history.go(-1) window.history.go(-1)
this.ruleForm = {} this.ruleForm = {}
}, },
clear(params) {
console.log(params);
for (let i in params) {
if (params[i] instanceof Array) {
for (let j in params[i]) this.clear(params[i][j])
}
if (params[i] instanceof Object) this.clear((params[i]))
if (params[i] == '' || params[i] == null || params[i] == undefined) delete params[i]
}
console.log(params);
return params
},
jump(formName) { jump(formName) {
let submit = false
this.jumpScroll('validity')
var equityItemJson = { var equityItemJson = {
returnDicoins: this.ruleForm.currencyInpution, returnDicoins: this.ruleForm.currencyInpution,
oilWorry: { oilRecommendRadius: +this.ruleForm.oilInpution,
oilRadius: +this.ruleForm.oilInpution, oilRemindInterval: +this.ruleForm.timeInpution,
oioilInterval: +this.ruleForm.timeInpution
},
collisionPush: this.ruleForm.pushCollision, collisionPush: this.ruleForm.pushCollision,
dicoinRatio: this.ruleForm.rebateRatio, dicoinRebateRatio: 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 equityItem = this.clear(equityItemJson)
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(equityItem)
}) })
this.submit = true 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(equityItem)
}) })
this.submit = true 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(equityItem)
}) })
this.submit = true 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(equityItem)
}) })
this.submit = true 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(equityItem)
}) })
this.submit = true 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(equityItem)
}) })
this.submit = true 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(equityItem)
}) })
this.submit = true submit = true
} }
this.$refs[formName].validate((valid, options) => { this.$refs[formName].validate((valid, options) => {
if (valid) { if (valid) {
if (this.submit == true) { if (submit == true) {
insertMemberCardDefineRf(params).then((res) => { var data = this.clear(params)
insertMemberCardDefineRf(data).then((res) => {
if (res > 0) { if (res > 0) {
window.history.go(-1) window.history.go(-1)
this.ruleForm = {} this.ruleForm = {}
...@@ -354,17 +371,13 @@ export default { ...@@ -354,17 +371,13 @@ export default {
}) })
} }
} else { } else {
this.$message({
message: '增加失败!',
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
} }
......
...@@ -64,6 +64,7 @@ export default { ...@@ -64,6 +64,7 @@ export default {
{ {
label: '权益内容', label: '权益内容',
prop: 'name', prop: 'name',
minWidth: '200',
formatter: (cellValue) => { formatter: (cellValue) => {
let arr = [] let arr = []
cellValue.memberRights.map(e => { cellValue.memberRights.map(e => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!