|
|
|
@ -1,8 +1,7 @@ |
|
|
|
|
<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"> |
|
|
|
|
<uni-forms ref="form" :modelValue="dynamicLists[index]" label-position="top" :label-width='150'> |
|
|
|
|
<view class="an_box_2 rcd_box box_1"> |
|
|
|
|
<view class="title_t_1"> |
|
|
|
|
<text v-if="index==0" class="fill-full">预约人</text><text class="fill-full" |
|
|
|
@ -28,7 +27,7 @@ |
|
|
|
|
|
|
|
|
|
<uni-forms-item v-if="item.documentsType=='5501'" label="证件号码" required name="idCardNumber"> |
|
|
|
|
<uni-easyinput type="text" v-model="item.idCardNumber" placeholder="请输入身份证号码号码" /> |
|
|
|
|
<view class="v-form-tip" v-if="item.idCardState">请填写正确的身份证件号码</view> |
|
|
|
|
<view class="v-form-tip" v-if="item.idCardState">请填写正确的身份证件号码</view> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
<uni-forms-item v-if="item.documentsType=='5502'" label="证件号码" required name="passportNumber"> |
|
|
|
|
<uni-easyinput type="text" v-model="item.passportNumber" placeholder="请输入护照码号码" /> |
|
|
|
@ -169,14 +168,14 @@ |
|
|
|
|
phone: "", |
|
|
|
|
documentsType: '5501', |
|
|
|
|
idCardNumber: "", |
|
|
|
|
idCardState: false, |
|
|
|
|
state: false, |
|
|
|
|
passportNumber: "", |
|
|
|
|
} |
|
|
|
|
//判断最多预约人数 |
|
|
|
|
this.dynamicLists.push(newData); |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.$refs.form[this.dynamicLists.length-1].setRules(this.rules); |
|
|
|
|
}); |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.$refs.form[this.dynamicLists.length - 1].setRules(this.rules); |
|
|
|
|
}); |
|
|
|
|
if (this.dynamicLists.length > 4) { |
|
|
|
|
this.isAdd = false |
|
|
|
|
} |
|
|
|
@ -193,34 +192,29 @@ |
|
|
|
|
//预约按钮 |
|
|
|
|
saveReserve: function() { |
|
|
|
|
let that = this |
|
|
|
|
let promise = new Promise(function(resolve, reject) { |
|
|
|
|
let state = [] |
|
|
|
|
if(this.agreementChecked==true){ |
|
|
|
|
let promise = new Promise(function(resolve, reject) { |
|
|
|
|
that.dynamicLists.map((item, index) => { |
|
|
|
|
that.$refs.form[index].validate().then(res => { |
|
|
|
|
|
|
|
|
|
state[index] = '1' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).catch(err => { |
|
|
|
|
state[index] = '0' |
|
|
|
|
that.dynamicLists[index].idCardState=false |
|
|
|
|
that.$refs.form[index].validate().then(res => { |
|
|
|
|
that.dynamicLists[index].state = '1' |
|
|
|
|
}).catch(err => { |
|
|
|
|
that.dynamicLists[index].state = '0' |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
setTimeout(function() { |
|
|
|
|
let reState = state.every((item, index) => { |
|
|
|
|
return item == '1' |
|
|
|
|
}) |
|
|
|
|
if (reState) { |
|
|
|
|
resolve('success'); |
|
|
|
|
} |
|
|
|
|
setTimeout(function() { |
|
|
|
|
resolve('success'); |
|
|
|
|
}, 1000); |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
promise.then(value => { |
|
|
|
|
if (value == 'success') { |
|
|
|
|
let reState = that.dynamicLists.every((item, index) => { |
|
|
|
|
return item.state == '1' |
|
|
|
|
}) |
|
|
|
|
console.log("asd",reState) |
|
|
|
|
if (reState == true) { |
|
|
|
|
console.log("asd",reState) |
|
|
|
|
this.postReserve() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
})} |
|
|
|
|
}, |
|
|
|
|
//传输数据 |
|
|
|
|
postReserve: function() { |
|
|
|
@ -320,12 +314,14 @@ |
|
|
|
|
.yue_xuzhi text { |
|
|
|
|
color: rgb(22, 119, 255); |
|
|
|
|
} |
|
|
|
|
.v-form-tip{color: #f56c6c; |
|
|
|
|
font-size: 12px; |
|
|
|
|
line-height: 1; |
|
|
|
|
padding-top: 4px; |
|
|
|
|
position: absolute; |
|
|
|
|
top: 5px; |
|
|
|
|
left: 0; |
|
|
|
|
|
|
|
|
|
.v-form-tip { |
|
|
|
|
color: #f56c6c; |
|
|
|
|
font-size: 12px; |
|
|
|
|
line-height: 1; |
|
|
|
|
padding-top: 4px; |
|
|
|
|
position: absolute; |
|
|
|
|
top: 5px; |
|
|
|
|
left: 0; |
|
|
|
|
} |
|
|
|
|
</style> |