Commit dfa60c9a by TengFengLian

预约看房提示

parent dffa0bec
Showing with 35 additions and 12 deletions
...@@ -64,16 +64,41 @@ Page({ ...@@ -64,16 +64,41 @@ Page({
this.setData({ this.setData({
formName: funcValue formName: funcValue
}) })
if (this.data.formName === '') {
this.setData({
errorName: '请输入姓名'
})
} else {
this.setData({
errorName: ''
})
}
break break
case 'phone': case 'phone':
this.setData({ this.setData({
formPhone: funcValue 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 break
} }
this.inspectForm()
}, },
onQuantityCut: function () { onQuantityCut: function () {
...@@ -118,12 +143,12 @@ Page({ ...@@ -118,12 +143,12 @@ Page({
}, },
inspectForm: function () { inspectForm: function () {
let complete = true
if (this.data.formName === '') { if (this.data.formName === '') {
this.setData({ this.setData({
canSubmit: false,
errorName: '请输入姓名' errorName: '请输入姓名'
}) })
return complete = false
} else { } else {
this.setData({ this.setData({
errorName: '' errorName: ''
...@@ -132,16 +157,14 @@ Page({ ...@@ -132,16 +157,14 @@ Page({
if (this.data.formPhone === '') { if (this.data.formPhone === '') {
this.setData({ this.setData({
canSubmit: false,
errorPhone: '请输入手机号码' errorPhone: '请输入手机号码'
}) })
return complete = false
} else if (this.data.formPhone.length != 11) { } else if (this.data.formPhone.length != 11) {
this.setData({ this.setData({
canSubmit: false,
errorPhone: '请输入11位手机号码' errorPhone: '请输入11位手机号码'
}) })
return complete = false
} else { } else {
this.setData({ this.setData({
errorPhone: '' errorPhone: ''
...@@ -150,10 +173,9 @@ Page({ ...@@ -150,10 +173,9 @@ Page({
if (this.data.formQuantity === 0) { if (this.data.formQuantity === 0) {
this.setData({ this.setData({
canSubmit: false,
errorQuantity: '预约人数不能为 0' errorQuantity: '预约人数不能为 0'
}) })
return complete = false
} else { } else {
this.setData({ this.setData({
errorQuantity: '' errorQuantity: ''
...@@ -161,9 +183,11 @@ Page({ ...@@ -161,9 +183,11 @@ Page({
} }
this.setData({ this.setData({
canSubmit: true canSubmit: complete
}) })
return complete
}, },
onSubmit: function () { onSubmit: function () {
...@@ -171,8 +195,7 @@ Page({ ...@@ -171,8 +195,7 @@ Page({
app.login({ app.login({
success: function() { success: function() {
if (!that.data.canSubmit || that.data.isSubmit) { if (!that.inspectForm() || that.data.isSubmit) {
// that.inspectForm()
return 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