|
|
@ -1,9 +1,9 @@ |
|
|
|
<!-- 报修 --> |
|
|
|
<template> |
|
|
|
<view class="repair bx reserveSpace"> |
|
|
|
<uv-form :model="form" :rules="rules" :useBeforeRead="true" ref="form" labelPosition="left" labelWidth="140"> |
|
|
|
<uv-form :model="form" :rules="rules" errorType="toast" ref="form" labelPosition="left" labelWidth="140"> |
|
|
|
|
|
|
|
<uv-form-item label="楼栋" prop="form.building" borderBottom> |
|
|
|
<uv-form-item label="楼栋" prop="building" borderBottom> |
|
|
|
<uv-input @focus="floorPickerOpen" placeholder="请选择楼层" v-model="form.building" border="none" |
|
|
|
:fontSize="30"></uv-input> |
|
|
|
<template v-slot:right> |
|
|
@ -11,7 +11,7 @@ |
|
|
|
</template> |
|
|
|
</uv-form-item> |
|
|
|
|
|
|
|
<uv-form-item label="室号" prop="form.room" borderBottom> |
|
|
|
<uv-form-item label="室号" prop="room" borderBottom> |
|
|
|
<uv-input @focus="roomPickerOpen" placeholder="请选择室号" v-model="form.room" border="none" |
|
|
|
:fontSize="30"></uv-input> |
|
|
|
<template v-slot:right> |
|
|
@ -19,25 +19,25 @@ |
|
|
|
</template> |
|
|
|
</uv-form-item> |
|
|
|
|
|
|
|
<uv-form-item label="维修物品" prop="form.project" borderBottom> |
|
|
|
<uv-form-item label="维修物品" prop="project" borderBottom> |
|
|
|
<uv-input v-model="form.project" placeholder="请填写维修物品的名称" :fontSize="30" border="none"></uv-input> |
|
|
|
</uv-form-item> |
|
|
|
|
|
|
|
|
|
|
|
<uv-form-item label="你的姓名" prop="form.name" borderBottom> |
|
|
|
<uv-form-item label="你的姓名" prop="name" borderBottom> |
|
|
|
<uv-input v-model="form.name" placeholder="请填写姓名" :fontSize="30" border="none"></uv-input> |
|
|
|
</uv-form-item> |
|
|
|
|
|
|
|
<uv-form-item label="你的电话" prop="form.name" borderBottom> |
|
|
|
<uv-form-item label="你的电话" prop="phone" borderBottom> |
|
|
|
<uv-input v-model="form.phone" placeholder="请填写电话号" border="none" :fontSize="30"></uv-input> |
|
|
|
</uv-form-item> |
|
|
|
|
|
|
|
<uv-form-item label="描述说明" prop="form.context" borderBottom> |
|
|
|
<uv-form-item label="描述说明" prop="context" borderBottom> |
|
|
|
<uv-textarea v-model="form.context" :height="140" :maxlength="200" textStyle="font-size : 30rpx" count |
|
|
|
placeholder="请输入描述说明"></uv-textarea> |
|
|
|
</uv-form-item> |
|
|
|
|
|
|
|
<uv-form-item label="照片" prop="form.image" labelPosition="top"> |
|
|
|
<uv-form-item label="照片" prop="image" labelPosition="top"> |
|
|
|
<view class="image-list"> |
|
|
|
<view @click="openImageMenu(index)" v-for="(item,index) in form.image" :key="index" |
|
|
|
class="image-item"> |
|
|
@ -64,7 +64,7 @@ |
|
|
|
<!-- 图片操作菜单 --> |
|
|
|
<uv-action-sheet ref="actionSheet" :actions="list" :round="20" cancelText="取消" title="图片操作" |
|
|
|
@select="selectImageSheet"> </uv-action-sheet> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 隐私政策 --> |
|
|
|
<PrivacyAgreementPoup ref="showPrivacy"></PrivacyAgreementPoup> |
|
|
|
</view> |
|
|
@ -89,12 +89,53 @@ |
|
|
|
image: [] |
|
|
|
}, |
|
|
|
rules: { //参数校验 |
|
|
|
// 'form.name': { |
|
|
|
// type: 'string', |
|
|
|
// required: true, |
|
|
|
// message: '请填写姓名', |
|
|
|
// trigger: ['blur', 'change'] |
|
|
|
// } |
|
|
|
building: { |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请选择楼栋', |
|
|
|
trigger: ['blur', 'change'] |
|
|
|
}, |
|
|
|
room: { |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请选择室号', |
|
|
|
trigger: ['blur', 'change'] |
|
|
|
}, |
|
|
|
project: { |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请填写维修物品', |
|
|
|
trigger: ['blur', 'change'] |
|
|
|
}, |
|
|
|
name: { |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请填写姓名', |
|
|
|
trigger: ['blur', 'change'] |
|
|
|
}, |
|
|
|
phone: [{ |
|
|
|
required: true, |
|
|
|
message: '请填写手机号', |
|
|
|
trigger: ['blur', 'change'] |
|
|
|
}, { |
|
|
|
validator: (rule, value, callback) => { |
|
|
|
return uni.$uv.test.mobile(value); |
|
|
|
}, |
|
|
|
message: '手机号格式错误', |
|
|
|
trigger: ['blur'] |
|
|
|
}], |
|
|
|
context: { |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请填写描述说明', |
|
|
|
trigger: ['blur', 'change'] |
|
|
|
}, |
|
|
|
image: { |
|
|
|
type: 'array', |
|
|
|
required: true, |
|
|
|
message: '请上传图片', |
|
|
|
trigger: ['blur', 'change'] |
|
|
|
}, |
|
|
|
}, |
|
|
|
maxUpload: 4, //最大上传图片张数 |
|
|
|
list: [ //图片操作菜单操作项 |
|
|
@ -132,7 +173,7 @@ |
|
|
|
], //室号列表 |
|
|
|
} |
|
|
|
}, |
|
|
|
onShow(){ |
|
|
|
onShow() { |
|
|
|
if (wx.onNeedPrivacyAuthorization) { |
|
|
|
console.log('onNeedPrivacyAuthorization'); |
|
|
|
wx.onNeedPrivacyAuthorization(resolve => { |
|
|
@ -141,6 +182,22 @@ |
|
|
|
this.$refs.showPrivacy.init(resolve) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
this.$refs.showPrivacy.init({}) |
|
|
|
},2000) |
|
|
|
|
|
|
|
wx.getPrivacySetting({ |
|
|
|
success: res => { |
|
|
|
console.log(res) |
|
|
|
if (res.needAuthorization) { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
onReady() { |
|
|
|
this.$refs.form.setRules(this.rules); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
//上传图片 |
|
|
@ -208,21 +265,34 @@ |
|
|
|
|
|
|
|
//提交报修 |
|
|
|
submitRepair() { |
|
|
|
this.form.image = this.form.image.join() |
|
|
|
this.$api('addSchoolOrder', this.form, res => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.$refs.form.validate().then(res => { |
|
|
|
let images = this.form.image.join() |
|
|
|
this.$api('addSchoolOrder', { |
|
|
|
...this.form, |
|
|
|
image: images |
|
|
|
}, res => { |
|
|
|
uni.showToast({ |
|
|
|
icon: 'none', |
|
|
|
title: '提交成功' |
|
|
|
}); |
|
|
|
this.cleanForm() |
|
|
|
this.toRepairList() |
|
|
|
} |
|
|
|
title: '申请报修成功' |
|
|
|
}) |
|
|
|
if (res.code == 200) { |
|
|
|
this.cleanfrom() |
|
|
|
this.$refs.form.clearValidate(); |
|
|
|
this.toRepairList() |
|
|
|
} |
|
|
|
}) |
|
|
|
}).catch(errors => {}) |
|
|
|
}, |
|
|
|
|
|
|
|
//跳转到报修记录 |
|
|
|
toRepairList() { |
|
|
|
uni.navigateTo({ |
|
|
|
url: '/pages/repairList/repairList' |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
//重置表单数据 |
|
|
|
cleanForm() { |
|
|
|
//清除表单数据 |
|
|
|
cleanfrom() { |
|
|
|
this.form = { |
|
|
|
building: '', //楼栋 |
|
|
|
room: '', //室号 |
|
|
@ -230,15 +300,8 @@ |
|
|
|
phone: '', //手机号 |
|
|
|
name: '', //姓名 |
|
|
|
context: '', //简介 |
|
|
|
image: [] //报修图片 |
|
|
|
image: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
//跳转到报修记录 |
|
|
|
toRepairList(){ |
|
|
|
uni.switchTab({ |
|
|
|
url: '/pages/repairList/repairList' |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|