GULIMMO
2023-11-03 0ac75878dd4fd980c874146913c1eda11f0e2e69
首页、租户上报、新增租户等
6 files modified
265 ■■■■ changed files
pages/home/index.vue 15 ●●●● patch | view | raw | blame | history
subPackage/bs/components/form/rentForm.vue 20 ●●●● patch | view | raw | blame | history
subPackage/bs/components/list/rentList.vue 28 ●●●● patch | view | raw | blame | history
subPackage/bs/views/rentDetail.vue 147 ●●●● patch | view | raw | blame | history
subPackage/house/roomControl/index.vue 22 ●●●● patch | view | raw | blame | history
subPackage/house/roomDetails/index.vue 33 ●●●● patch | view | raw | blame | history
pages/home/index.vue
@@ -301,7 +301,9 @@
                    title: '-',
                    useSlot: true
                }],
                menuList: []
                menuList: [],
                curHouseCode: ''
            }
        },
@@ -326,7 +328,6 @@
                }
            }
        },
        methods: {
            //初始化
@@ -376,7 +377,7 @@
                    } else {
                        this.curSelectSite = dataList[0];
                    }
                    this.curHouseCode = this.curSelectSite.id
                }
            },
@@ -420,7 +421,8 @@
                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) {
@@ -523,7 +525,7 @@
            navTo() {
                this.$u.func.globalNavigator("/subPackage/bs/views/zhsb", "navTo")
                this.$u.func.globalNavigator(`/subPackage/bs/views/zhsb?houseCode=${this.curHouseCode}`, "navTo")
            },
            navigatorPage() {
@@ -567,8 +569,7 @@
                    obj[arr[0]] = arr[1];
                }
                return obj
            }
            },
        }
    }
</script>
subPackage/bs/components/form/rentForm.vue
@@ -1,5 +1,5 @@
<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>
@@ -37,9 +37,21 @@
                        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'],
                    }]
                }
subPackage/bs/components/list/rentList.vue
@@ -11,8 +11,8 @@
            <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>
@@ -57,10 +57,30 @@
                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
subPackage/bs/views/rentDetail.vue
@@ -3,31 +3,31 @@
        <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>
@@ -48,8 +48,8 @@
                            <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" />
@@ -65,9 +65,9 @@
            :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">
@@ -103,13 +103,35 @@
        },
        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,
@@ -175,6 +197,9 @@
            }
        },
        mounted() {
            this.currentRole = uni.getStorageSync("activeRole")
        },
        methods: {
            showSelectBus(data, title, model, key) {
                this.selectBusList = data
@@ -199,22 +224,53 @@
                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 = []
@@ -225,6 +281,7 @@
                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,
@@ -233,8 +290,28 @@
                    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 = []
@@ -255,6 +332,24 @@
                    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 => {
@@ -286,10 +381,10 @@
                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
                    })
                })
            }
        }
subPackage/house/roomControl/index.vue
@@ -147,6 +147,7 @@
        },
        onShow() {
            this.getLabelList()
            this.getHouseDetailInfo()
        },
        methods: {
            showLabelPopup(item) {
@@ -163,17 +164,16 @@
            },
            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()
subPackage/house/roomDetails/index.vue
@@ -11,7 +11,7 @@
                            {{ 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>
@@ -93,11 +93,11 @@
            <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>
@@ -114,6 +114,7 @@
        data() {
            return {
                currentId: '',
                houseCode: '',
                houseInfo: {
                    // 房间号
                    houseName: '',
@@ -141,15 +142,24 @@
        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
@@ -165,12 +175,19 @@
                    // 多人个租客将第一个作为显示
                    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')
            }
        }
    }