|
|
|
@ -1,6 +1,5 @@ |
|
|
|
|
<template> |
|
|
|
|
<view class="v-page"> |
|
|
|
|
|
|
|
|
|
<template v-for="(item,index) in dynamicLists"> |
|
|
|
|
<uni-forms ref="form" :modelValue="dynamicLists[index]" label-position="top" :label-width='150' |
|
|
|
|
:rules="rules"> |
|
|
|
@ -45,11 +44,20 @@ |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
<view class="yuyue-btn"> |
|
|
|
|
|
|
|
|
|
<view class="an_box_2"> |
|
|
|
|
<view class="amt_60"> |
|
|
|
|
<button form-type="submit" class="yue_fm_btn yue_e_bun" @click="saveReserve('dynamicForm')"> |
|
|
|
|
<view class="amt_30"> |
|
|
|
|
<view class="yue_xuzhi"> |
|
|
|
|
<radio-group> |
|
|
|
|
<label class="radio"> |
|
|
|
|
<radio :checked="agreementChecked" @click="radioChange"/> |
|
|
|
|
</label>我已阅读并同意<text @click="gotoNotice">《游客须知》</text> |
|
|
|
|
</radio-group> |
|
|
|
|
</view> |
|
|
|
|
<button form-type="submit" class="yue_fm_btn yue_e_bun" :class="agreementChecked?'active':''" @click="saveReserve('dynamicForm')"> |
|
|
|
|
预约 |
|
|
|
|
</button> |
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
@ -62,12 +70,14 @@ |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
formData: { |
|
|
|
|
agreementChecked: false, |
|
|
|
|
formData: { |
|
|
|
|
name: {}, |
|
|
|
|
phone: {}, |
|
|
|
|
documentsType: {}, |
|
|
|
|
idCardNumber: {}, |
|
|
|
|
passportNumber: {}, |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
dynamicLists: [], |
|
|
|
|
rules: { |
|
|
|
@ -83,7 +93,7 @@ |
|
|
|
|
errorMessage: '电话号码不能为空' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
validateFunction: function(rule, value, data, callback) { |
|
|
|
|
validateFunction: function(rule, value, data, callback) { |
|
|
|
|
let reg = /^[1][3,4,5,7,8,9][0-9]{9}$/ |
|
|
|
|
if (!reg.test(value)) { |
|
|
|
|
callback('请填写正确的手机号码') |
|
|
|
@ -101,15 +111,17 @@ |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
validateFunction: function(rule, value, data, callback) { |
|
|
|
|
if(data.documentsType=='5502'){ |
|
|
|
|
if (data.documentsType == '5502') { |
|
|
|
|
return true |
|
|
|
|
}else{let idreg = |
|
|
|
|
/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/; |
|
|
|
|
if (!idreg.test(value)) { |
|
|
|
|
callback('请填写正确的身份证件号码') |
|
|
|
|
} else { |
|
|
|
|
return true |
|
|
|
|
}} |
|
|
|
|
let idreg = |
|
|
|
|
/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/; |
|
|
|
|
if (!idreg.test(value)) { |
|
|
|
|
callback('请填写正确的身份证件号码') |
|
|
|
|
} else { |
|
|
|
|
return true |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
] |
|
|
|
@ -139,6 +151,13 @@ |
|
|
|
|
this.addReserve() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
radioChange: function(e) { |
|
|
|
|
this.agreementChecked = !this.agreementChecked;}, |
|
|
|
|
gotoNotice: function() { |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '/sunPackIndex/scenic/subscribe/yuyue/yue-notice' |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
//创建预约人 |
|
|
|
|
addReserve: function() { |
|
|
|
|
if (this.isAdd) { |
|
|
|
@ -166,19 +185,21 @@ |
|
|
|
|
}, |
|
|
|
|
//预约按钮 |
|
|
|
|
saveReserve: function() { |
|
|
|
|
let errList = [] |
|
|
|
|
const promises = this.dynamicLists.map((item, index) => { |
|
|
|
|
return new Promise(resolve => { |
|
|
|
|
this.$refs.form[index].validate(err => { |
|
|
|
|
errList = err |
|
|
|
|
if(this.agreementChecked){ |
|
|
|
|
let errList = [] |
|
|
|
|
const promises = this.dynamicLists.map((item, index) => { |
|
|
|
|
return new Promise(resolve => { |
|
|
|
|
this.$refs.form[index].validate(err => { |
|
|
|
|
errList = err |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
setTimeout(() => { |
|
|
|
|
if (errList == null) { |
|
|
|
|
this.postReserve() |
|
|
|
|
} |
|
|
|
|
}, 500) |
|
|
|
|
setTimeout(() => { |
|
|
|
|
if (errList == null) { |
|
|
|
|
this.postReserve() |
|
|
|
|
} |
|
|
|
|
}, 500) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//传输数据 |
|
|
|
|
postReserve: function() { |
|
|
|
@ -259,7 +280,7 @@ |
|
|
|
|
|
|
|
|
|
<style> |
|
|
|
|
.v-page { |
|
|
|
|
padding-bottom: 120rpx; |
|
|
|
|
padding-bottom: 180rpx; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.uni-data-checklist .checklist-group .checklist-box.is--button { |
|
|
|
@ -269,4 +290,13 @@ |
|
|
|
|
.uni-forms-item__label { |
|
|
|
|
padding: 0 !important; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.yue_xuzhi { |
|
|
|
|
font-size: 28rpx; |
|
|
|
|
margin-bottom: 10rpx; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.yue_xuzhi text { |
|
|
|
|
color: rgb(22, 119, 255); |
|
|
|
|
} |
|
|
|
|
</style> |