Commit dfa60c9a by TengFengLian

预约看房提示

parent dffa0bec
Showing with 35 additions and 12 deletions
......@@ -64,16 +64,41 @@ Page({
this.setData({
formName: funcValue
})
if (this.data.formName === '') {
this.setData({
errorName: '请输入姓名'
})
} else {
this.setData({
errorName: ''
})
}
break
case 'phone':
this.setData({
formPhone: funcValue
})
if (this.data.formPhone === '') {
this.setData({
errorPhone: '请输入手机号码'
})
} else if (this.data.formPhone.length != 11) {
this.setData({
errorPhone: '请输入11位手机号码'
})
} else {
this.setData({
errorPhone: ''
})
}
break
}
this.inspectForm()
},
onQuantityCut: function () {
......@@ -118,12 +143,12 @@ Page({
},
inspectForm: function () {
let complete = true
if (this.data.formName === '') {
this.setData({
canSubmit: false,
errorName: '请输入姓名'
})
return
complete = false
} else {
this.setData({
errorName: ''
......@@ -132,16 +157,14 @@ Page({
if (this.data.formPhone === '') {
this.setData({
canSubmit: false,
errorPhone: '请输入手机号码'
})
return
complete = false
} else if (this.data.formPhone.length != 11) {
this.setData({
canSubmit: false,
errorPhone: '请输入11位手机号码'
})
return
complete = false
} else {
this.setData({
errorPhone: ''
......@@ -150,10 +173,9 @@ Page({
if (this.data.formQuantity === 0) {
this.setData({
canSubmit: false,
errorQuantity: '预约人数不能为 0'
})
return
complete = false
} else {
this.setData({
errorQuantity: ''
......@@ -161,9 +183,11 @@ Page({
}
this.setData({
canSubmit: true
canSubmit: complete
})
return complete
},
onSubmit: function () {
......@@ -171,8 +195,7 @@ Page({
app.login({
success: function() {
if (!that.data.canSubmit || that.data.isSubmit) {
// that.inspectForm()
if (!that.inspectForm() || that.data.isSubmit) {
return
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment