HomeLease/pages/InstallationAgreement/InstallationAgreement.vue

170 lines
8.1 KiB
Vue
Raw Normal View History

<EFBFBD><EFBFBD><template>
<view class="page">
<uv-form ref="form" :model="userInfo" :rules="rules" labelPosition="left" labelWidth="auto">
<uv-form-item borderBottom label="5u݋:" prop="phone">
<uv-input v-model="userInfo.phone" border="none"></uv-input>
</uv-form-item>
<uv-form-item borderBottom label="0W@W:" prop="location">
<uv-input v-model="userInfo.location" border="none"></uv-input>
</uv-form-item>
<uv-form-item borderBottom label=";NSO T<EFBFBD>y:" prop="name">
<uv-input v-model="userInfo.name" border="none"></uv-input>
</uv-form-item>
<uv-form-item borderBottom label="<00>~N>yO<>O(u<>Nx:" prop="code">
<uv-input v-model="userInfo.code" border="none"></uv-input>
</uv-form-item>
<uv-form-item borderBottom label="'`+R:" prop="sex">
<uv-input v-model="userInfo.sex" border="none" readonly @click="showSexSelect"></uv-input>
</uv-form-item>
<uv-form-item label="%<25>Ngbgq" prop="pics">
<image-uploader
ref="uploader"
:height="'150rpx'"
:width="'150rpx'"
@success="handleUploadSuccess"
/>
</uv-form-item>
<uv-button
customStyle="margin-top: 10px"
text="<00>c<EFBFBD>N"
type="primary"
@click="submit"
></uv-button>
<uv-button customStyle="margin-top: 10px" text="͑n" type="error" @click="reset"></uv-button>
</uv-form>
<uv-action-sheet
ref="sexSelect"
:actions="actions"
description="<00>Y<EFBFBD>g <09><>b<EFBFBD>O<EFBFBD>[O<>b<19>"
title="<00><> <09><>b'`+R"
@select="sexSelect"
>
</uv-action-sheet>
</view>
</template>
<script>
export default {
data() {
return {
userInfo: {
name: '',
sex: '',
code: '',
phone: '',
location: '',
businessLicense: '',
},
actions: [
{
name: '7u',
},
{
name: 'sY',
},
{
name: '<00>O<EFBFBD>[',
},
],
rules: {
name: {
type: 'string',
required: true,
message: '<00><>kX<6B>Q;NSO T<EFBFBD>y',
trigger: ['blur', 'change'],
},
phone: {
type: 'string',
required: true,
pattern: /^1[3-9]\d{9}$/,
message: '<00><>kX<6B>Qcknx<6E>vKb:g<>Sx',
trigger: ['blur', 'change'],
},
location: {
type: 'string',
required: true,
message: '<00><>kX<6B>Q0W@W',
trigger: ['blur', 'change'],
},
code: {
type: 'string',
required: true,
pattern: /^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/,
message: '<00><>kX<6B>Qcknx<6E>v<EFBFBD>~N>yO<>O(u<>Nx',
trigger: ['blur', 'change'],
},
sex: {
type: 'string',
required: true,
message: '<00><> <09><>b'`+R',
trigger: ['blur', 'change'],
},
},
radio: '',
switchVal: false,
}
},
methods: {
handleUploadSuccess(result) {
console.log('<EFBFBD>VGr
N Ob<EFBFBD>R:', result.url)
this.userInfo.businessLicense = result.url
uni.showToast({
title: '
N Ob<EFBFBD>R',
icon: 'success',
})
},
// <EFBFBD>c<EFBFBD>N
submit() {
// <EFBFBD>Y<EFBFBD>g g<EFBFBD><EFBFBD><EFBFBD> <EFBFBD>O(Wcatch-<EFBFBD>V<EFBFBD>b<EFBFBD><EFBFBD>Oo`pe<EFBFBD>~ <0C>!h<><68><1A>ǏR(Wthen-Nԏ<4E>Vtrue
this.$refs.form
.validate()
.then(res => {
uni.showToast({
icon: 'success',
title: '!h<><68><1A>Ǐ',
})
// ُ̑<EFBFBD>S<EFBFBD>N<EFBFBD>m<EFBFBD>R<EFBFBD>[E<EFBFBD><EFBFBD>v<EFBFBD>c<EFBFBD>N;<EFBFBD><EFBFBD><EFBFBD>
console.log('h<>USpenc:', this.userInfo)
})
.catch(errors => {
uni.showToast({
icon: 'error',
title: '!h<><68>1Y%<25>',
})
console.log('<00><><EFBFBD><EFBFBD><19><><EFBFBD>:', errors)
})
},
// ͑n
reset() {
this.$refs.form.resetFields()
this.$refs.form.clearValidate()
this.userInfo.businessLicense = ''
},
// '`+R <09><>b
showSexSelect() {
this.$refs.sexSelect.open()
this.hideKeyboard()
},
// '`+R <09><><62>V<EFBFBD>~<7E>g
sexSelect(e) {
this.userInfo.sex = e.name
// <EFBFBD>[<EFBFBD><EFBFBD>Rh<EFBFBD>USW[<EFBFBD>kۏL<EFBFBD>!h<EFBFBD><EFBFBD>
this.$refs.form.validateField('sex', err => {
// Yt<EFBFBD><EFBFBD><EFBFBD>T<EFBFBD>v;<EFBFBD><EFBFBD><EFBFBD>
})
},
hideKeyboard() {
uni.hideKeyboard()
},
},
}
</script>
<style lang="scss" scoped>
.page {
padding: 10rpx 30rpx;
}
</style>