| | |
| | | title: '-',
|
| | | useSlot: true
|
| | | }],
|
| | | menuList: []
|
| | | menuList: [], |
| | | curHouseCode: '' |
| | | |
| | | }
|
| | | },
|
| | |
|
| | |
| | | }
|
| | | }
|
| | | },
|
| | |
|
| | | methods: {
|
| | |
|
| | | //初始化
|
| | |
| | | } else {
|
| | | this.curSelectSite = dataList[0];
|
| | | }
|
| | |
|
| | | this.curHouseCode = this.curSelectSite.id
|
| | | }
|
| | | },
|
| | |
|
| | |
| | | console.log('confirm', e)
|
| | | this.curSelectSite = e.value[e.value.length - 1]
|
| | | this.selectBoxShow = false
|
| | | this.getHouseDataList(e.value[1].id)
|
| | | this.getHouseDataList(e.value[1]?.id) |
| | | this.curHouseCode = e.value[0].id
|
| | | console.log("curSite=>", this.curSelectSite);
|
| | | },
|
| | | getMenu(menuName, menuList, resultArr) {
|
| | |
| | |
|
| | |
|
| | | navTo() {
|
| | | this.$u.func.globalNavigator("/subPackage/bs/views/zhsb", "navTo")
|
| | | this.$u.func.globalNavigator(`/subPackage/bs/views/zhsb?houseCode=${this.curHouseCode}`, "navTo")
|
| | | },
|
| | |
|
| | | navigatorPage() {
|
| | |
| | | obj[arr[0]] = arr[1];
|
| | | }
|
| | | return obj
|
| | | }
|
| | |
|
| | | },
|
| | | }
|
| | | }
|
| | | </script>
|
| | |
| | | <template>
|
| | | <u-form :model="form" class="form-box" :rules="rules">
|
| | | <u-form :model="form" class="form-box" :rules="rules" ref="refForm">
|
| | | <u-form-item class="form-item" label="姓名" required prop="name" labelWidth="80">
|
| | | <u-input v-model="form.name" border="none" placeholder="姓名" />
|
| | | </u-form-item>
|
| | |
| | | trigger: ['change', 'blur'],
|
| | | }],
|
| | | idCard: [{
|
| | | required: true, |
| | | message: '请输入身份证号', |
| | | // 可以单个或者同时写两个触发验证方式 |
| | | required: true,
|
| | | message: '请输入身份证号',
|
| | | // 可以单个或者同时写两个触发验证方式 |
| | | trigger: ['change', 'blur'],
|
| | | }, {
|
| | | // 自定义验证函数,见上说明
|
| | | validator: (rule, value, callback) => {
|
| | | const reg = /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/
|
| | | if (reg.test(value)) { |
| | | return true |
| | | } |
| | | return false |
| | | },
|
| | | message: '请输入正确的身份证号',
|
| | | // 触发器可以同时用blur和change
|
| | | trigger: ['change', 'blur'],
|
| | | }]
|
| | | }
|
| | |
| | |
|
| | | <view class="line">
|
| | | <view class="l">{{item.rentalTime}} - {{item.dueTime}}</view>
|
| | | <view class="r status">
|
| | | {{item.status}}
|
| | | <view class="r status"> |
| | | {{ findObjValue(item.status, status) }}
|
| | | </view>
|
| | | </view>
|
| | |
|
| | |
| | | isPickerShow: false,
|
| | | istPickerShow: false,
|
| | | currentRentalId: '',
|
| | | isModelShow: false
|
| | | isModelShow: false, |
| | | status: [ |
| | | { |
| | | name: '未到期', |
| | | value: 0 |
| | | }, |
| | | { |
| | | name: '已到期', |
| | | value: 1 |
| | | }, |
| | | { |
| | | name: '已终止', |
| | | value: 2 |
| | | }, |
| | | ]
|
| | | }
|
| | | },
|
| | | methods: {
|
| | | methods: { |
| | | findObjValue(value, obj) { |
| | | const res = obj.find(item => { |
| | | return item.value == value |
| | | }) |
| | | return res.name |
| | | },
|
| | | deleteRental(item) {
|
| | | this.currentRentalId = item.housingRentalId
|
| | | this.isModelShow = true
|
| | |
| | | <u-form labelWidth="70" :model="form" :rules="rules" ref="form">
|
| | | <view class="basic-info">
|
| | | <u-form-item @click="showSelectBus(dataList.relation, '租客关系', 'relationName', 'relation')"
|
| | | class="form-item" labelWidth="100" label="租客关系" required prop="type">
|
| | | class="form-item" labelWidth="100" label="租客关系" required prop="relation">
|
| | | <u--input border="none" v-model="relationName" disabled disabledColor="#ffffff" placeholder="请选择">
|
| | | </u--input>
|
| | | <u-icon slot="right" name="arrow-right"></u-icon>
|
| | | </u-form-item>
|
| | | <u-form-item @click="showSelectBus(dataList.houseType, '房屋状态', 'houseTypeName', 'houseType')"
|
| | | class="form-item" labelWidth="100" label="房屋状态:" required prop="type">
|
| | | class="form-item" labelWidth="100" label="房屋状态:" required prop="houseType">
|
| | | <u--input border="none" v-model="houseTypeName" disabled disabledColor="#ffffff" placeholder="请选择">
|
| | | </u--input>
|
| | | <u-icon slot="right" name="arrow-right"></u-icon>
|
| | | </u-form-item>
|
| | | <u-form-item @click="showSelectBus(dataList.rentalUse, '租房用途', 'rentalUseName', 'rentalUse')"
|
| | | class="form-item" labelWidth="100" label="租房用途:" required prop="type">
|
| | | class="form-item" labelWidth="100" label="租房用途:" required prop="rentalUse">
|
| | | <u--input border="none" v-model="rentalUseName" disabled disabledColor="#ffffff" placeholder="请选择">
|
| | | </u--input>
|
| | | <u-icon slot="right" name="arrow-right"></u-icon>
|
| | | </u-form-item>
|
| | | <u-form-item @click="rentTimeShow = true" class="form-item" labelWidth="100" label="租房时间:" required
|
| | | prop="type">
|
| | | prop="rentTime">
|
| | | <u--input border="none" v-model="form.rentTime" disabled disabledColor="#ffffff" placeholder="请选择">
|
| | | </u--input>
|
| | | <u-icon slot="right" name="arrow-right"></u-icon>
|
| | | </u-form-item>
|
| | | <u-form-item @click="dueTimeShow = true" class="form-item" labelWidth="100" label="到期时间:" required
|
| | | prop="type">
|
| | | prop="dueTime">
|
| | | <u--input border="none" v-model="form.dueTime" disabled disabledColor="#ffffff" placeholder="请选择">
|
| | | </u--input>
|
| | | <u-icon slot="right" name="arrow-right"></u-icon>
|
| | |
| | | <view class="line"></view>
|
| | | <view class="title">{{ '租客信息-#' + item }}</view>
|
| | | </view>
|
| | | <view class="r" v-if="index === 1">
|
| | | <u-icon name="trash-fill" color="#ff0000" size="20" @click="decRentForm"></u-icon>
|
| | | <view class="r" v-if="item > 1">
|
| | | <u-icon name="trash-fill" color="#ff0000" size="20" @click="decRentForm(index)"></u-icon>
|
| | | </view>
|
| | | </view>
|
| | | <rentForm ref="rentform" />
|
| | |
| | | :popupTitle="selectBusTitle" :dataLists="selectBusList" @cancel="typeShow = false" @submit="typeSelect">
|
| | | </select-bus>
|
| | | <!--出租时间选择-->
|
| | | <u-datetime-picker :show="rentTimeShow" mode="date" @confirm="rentTimeConfirm"
|
| | | <u-datetime-picker :closeOnClickOverlay="true" @close="rentTimeShow = false" :show="rentTimeShow" mode="date" @confirm="rentTimeConfirm"
|
| | | @cancel="rentTimeShow = false"></u-datetime-picker>
|
| | | <u-datetime-picker :show="dueTimeShow" mode="date" @confirm="dueTimeConfirm"
|
| | | <u-datetime-picker :closeOnClickOverlay="true" @close="dueTimeShow = false" :show="dueTimeShow" mode="date" @confirm="dueTimeConfirm"
|
| | | @cancel="dueTimeShow = false"></u-datetime-picker>
|
| | |
|
| | | <view class="bottom-tools">
|
| | |
| | | },
|
| | | data() {
|
| | | return {
|
| | | currentRole: '',
|
| | | form: {
|
| | | relation: "",
|
| | | rentTime: "",
|
| | | dueTime: "",
|
| | | },
|
| | | imagesList: [],
|
| | | rules: {},
|
| | | rules: {
|
| | | relation: [{
|
| | | required: true,
|
| | | message: '请选择租客关系'
|
| | | }],
|
| | | houseType: [{
|
| | | required: true,
|
| | | message: '请选择房屋状态'
|
| | | }],
|
| | | rentalUse: [{
|
| | | required: true,
|
| | | message: '请选择房屋用途'
|
| | | }],
|
| | | rentTime: [{
|
| | | required: true,
|
| | | message: '请选择租房时间'
|
| | | }],
|
| | | dueTime: [{
|
| | | required: true,
|
| | | message: '请选择到期时间'
|
| | | }]
|
| | | },
|
| | | rentTimeShow: false,
|
| | | dueTimeShow: false,
|
| | | rentFormNum: 1,
|
| | |
| | | }
|
| | |
|
| | | },
|
| | | mounted() {
|
| | | this.currentRole = uni.getStorageSync("activeRole")
|
| | | },
|
| | | methods: {
|
| | | showSelectBus(data, title, model, key) {
|
| | | this.selectBusList = data
|
| | |
| | | this.form.dueTime = time
|
| | | this.dueTimeShow = false
|
| | | },
|
| | | beforeUpload(e) {
|
| | | console.log(e)
|
| | | return false
|
| | | async afterReadImg(e) { |
| | | // const formData = new FormData() |
| | | // const { file } = e |
| | | // formData.append('file', file[0])
|
| | | // const res = await uploadFile(formData)
|
| | | },
|
| | | addRentForm() {
|
| | | this.rentFormNum++
|
| | | },
|
| | | decRentForm() {
|
| | | this.rentFormNum > 1 && this.rentFormNum--
|
| | | decRentForm(i) {
|
| | | try{ |
| | | let formData = [] |
| | | this.$refs.rentform.forEach(vc => { |
| | | formData.push(vc.form) |
| | | }) |
| | | formData.splice(i, 1) |
| | | formData.forEach((sform, i) => { |
| | | this.$refs.rentform[i].form = sform |
| | | }) |
| | | this.rentFormNum > 1 && this.rentFormNum-- |
| | | uni.showToast({ |
| | | title: "删除成功", |
| | | icon: "success", |
| | | duration: 1500 |
| | | }) |
| | | }catch(e){ |
| | | uni.showToast({ |
| | | title: "删除失败", |
| | | icon: "success", |
| | | duration: 1500 |
| | | }) |
| | | }
|
| | | },
|
| | | saveOrUpdate() {
|
| | | if (this.rentId === '') {
|
| | | this.save()
|
| | | return
|
| | | }
|
| | | this.update()
|
| | | this.$refs.form.validate().then(res => {
|
| | | let rentFormValidGroup = []
|
| | | this.$refs.rentform.forEach(item => {
|
| | | rentFormValidGroup.push(item.$refs.refForm.validate());
|
| | | })
|
| | | Promise.all(rentFormValidGroup).then(result => {
|
| | | if (this.rentId === '') {
|
| | | this.save()
|
| | | return
|
| | | }
|
| | | this.update()
|
| | | })
|
| | | })
|
| | | },
|
| | | async save() {
|
| | | let houseTenantVOList = []
|
| | |
| | | const statusIndex = this.dataList.houseType.findIndex(item => item.name === this.houseTypeName)
|
| | | const rentalIndex = this.dataList.rentalUse.findIndex(item => item.name === this.rentalUseName)
|
| | | let params = {
|
| | | audit_status: this.currentRole.roleAlias === 'inhabitant' ? 0 : 1,
|
| | | houseCode: this.houseCode,
|
| | | tenantRelationship: this.dataList.relation[relationIndex].value,
|
| | | rentalTime: this.form.rentTime,
|
| | |
| | | rentalUse: this.dataList.rentalUse[rentalIndex].value,
|
| | | houseTenantVOList
|
| | | }
|
| | |
|
| | | const res = await addHouseRental(params)
|
| | | const {
|
| | | code,
|
| | | data
|
| | | } = await addHouseRental(params)
|
| | | if (code !== 200) {
|
| | | uni.showToast({
|
| | | title: "添加租户信息失败",
|
| | | icon: "error",
|
| | | duration: 1500
|
| | | })
|
| | | return
|
| | | }
|
| | | uni.showToast({
|
| | | title: "添加租户信息成功",
|
| | | icon: "success",
|
| | | duration: 1500,
|
| | | success: () => {
|
| | | setTimeout(() => {
|
| | | uni.navigateBack()
|
| | | }, 1500)
|
| | | }
|
| | | })
|
| | | },
|
| | | async update() {
|
| | | let houseTenantVOList = []
|
| | |
| | | houseTenantVOList
|
| | | }
|
| | | const res = await updateRetalInfo(data)
|
| | | if (res.code !== 200) {
|
| | | uni.showToast({
|
| | | title: "修改租户信息失败",
|
| | | icon: "error",
|
| | | duration: 1500
|
| | | })
|
| | | return
|
| | | }
|
| | | uni.showToast({
|
| | | title: "修改租户信息成功",
|
| | | icon: "success",
|
| | | duration: 1500,
|
| | | success: () => {
|
| | | setTimeout(() => {
|
| | | uni.navigateBack()
|
| | | }, 1500)
|
| | | }
|
| | | })
|
| | | },
|
| | | findObjValue(value, obj) {
|
| | | const res = obj.find(item => {
|
| | |
| | | this.relationName = this.findObjValue(tenantRelationship, this.dataList.relation)
|
| | | this.houseTypeName = this.findObjValue(houseStatus, this.dataList.houseType)
|
| | | this.rentFormNum = houseTenantVOList.length
|
| | | this.$nextTick(() => { |
| | | houseTenantVOList.forEach((item, index) => { |
| | | this.$refs.rentform[index].form = item |
| | | }) |
| | | this.$nextTick(() => {
|
| | | houseTenantVOList.forEach((item, index) => {
|
| | | this.$refs.rentform[index].form = item
|
| | | })
|
| | | })
|
| | | }
|
| | | }
|
| | |
| | | }, |
| | | onShow() { |
| | | this.getLabelList() |
| | | this.getHouseDetailInfo() |
| | | }, |
| | | methods: { |
| | | showLabelPopup(item) { |
| | |
| | | }, |
| | | async getHouseDetailInfo() { |
| | | const res = await getHouseDetail() |
| | | const { phone, address, property_price, service_due, image_urls } = res.data |
| | | this.form = { |
| | | phone, |
| | | address, |
| | | property_price, |
| | | service_due, |
| | | image_urls: [ |
| | | image_urls |
| | | ] |
| | | } |
| | | |
| | | // const { phone, address, property_price, service_due, image_urls } = res.data |
| | | // this.form = { |
| | | // phone, |
| | | // address, |
| | | // property_price, |
| | | // service_due, |
| | | // image_urls: [ |
| | | // image_urls |
| | | // ] |
| | | // } |
| | | }, |
| | | async getLabelList() { |
| | | const res = await getHouseLabelList() |
| | |
| | | {{ houseInfo.unitName }}单元 {{ houseInfo.houseName }}室(共{{ houseInfo.allNum }}人)
|
| | | </view>
|
| | | <view class="flex a-i-c">
|
| | | <u-button @click="pushPage" size='small' shape="circle" type="primary" :plain="true"
|
| | | <u-button @click="rommManage" size='small' shape="circle" type="primary" :plain="true"
|
| | | text="房屋管理"></u-button>
|
| | | </view>
|
| | | </view>
|
| | |
| | |
|
| | | <view class="edit-btn">
|
| | | <view>
|
| | | <u-button type="primary" text="添加成员"></u-button>
|
| | | <u-button type="primary" text="添加成员" @click="addMember"></u-button>
|
| | | </view>
|
| | |
|
| | | <view>
|
| | | <u-button type="primary" :plain="true" text="添加租赁信息"></u-button>
|
| | | <u-button type="primary" :plain="true" text="添加租赁信息" @click="addRental"></u-button>
|
| | | </view>
|
| | | </view>
|
| | | </view>
|
| | |
| | | data() {
|
| | | return {
|
| | | currentId: '',
|
| | | houseCode: '',
|
| | | houseInfo: {
|
| | | // 房间号
|
| | | houseName: '',
|
| | |
| | | methods: {
|
| | | async getHouseRentInfoList() {
|
| | | const res = await getHouseRentInfo(this.currentId)
|
| | | if (res.code !== 200) {
|
| | | uni.showToast({
|
| | | title: "数据加载失败",
|
| | | icon: "error",
|
| | | duration: 1500
|
| | | }) |
| | | return
|
| | | }
|
| | | const {
|
| | | addressCode,
|
| | | aoiName,
|
| | | buildingName,
|
| | | houseName,
|
| | | unitName,
|
| | | houseRentalList,
|
| | | householdList
|
| | | } = res.data |
| | | console.log(res.data)
|
| | | } = res.data
|
| | | this.houseCode = addressCode
|
| | | this.rentOutList = houseRentalList
|
| | | this.ownerInfoList = householdList
|
| | | this.houseInfo.houseName = houseName
|
| | |
| | | // 多人个租客将第一个作为显示
|
| | | item.tenant = item.houseTenantVOList.length > 0 ? item.houseTenantVOList[0].name : ''
|
| | | })
|
| | | this.houseInfo.allNum = householdList.length |
| | | console.log(res.data)
|
| | | this.houseInfo.allNum = householdList.length
|
| | |
|
| | | },
|
| | | pushPage() {
|
| | | rommManage() {
|
| | | const url = `/subPackage/house/roomControl/index?code=${this.currentId}`
|
| | | this.$u.func.globalNavigator(url, "navTo")
|
| | | },
|
| | | addRental() {
|
| | | const url = `/subPackage/bs/views/rentDetail?houseCode=${this.houseCode}`
|
| | | this.$u.func.globalNavigator(url, "navTo")
|
| | | }, |
| | | addMember() { |
| | | this.$u.func.globalNavigator('/subPackage/house/member/index') |
| | | }
|
| | | }
|
| | | }
|