我的房屋流程对接接口,缴费页面功能修改一版
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -32,21 +32,23 @@
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">小区</text>
|
||||
<text class="info-value">{{form.community}}}</text>
|
||||
<text class="info-value">{{form.villageName}}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">房间号</text>
|
||||
<text class="info-value">{{form.houseNumber}}</text>
|
||||
<text class="info-value">{{form.houseNo}}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">业主</text>
|
||||
<text class="info-value">{{form.owner}}</text>
|
||||
<text class="info-value">{{form.ownerName}}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">房间状态</text>
|
||||
<text class="info-value"
|
||||
:style="{color: form.status === '自住' ? '#00aaff' : form.status === '闲置' ?
|
||||
'#FF700A' : form.status === '租赁' ? '#00aa00' : form.status === '其他' ? '#00557f' : '#999' }">{{form.status}}</text>
|
||||
<text class="info-value" :style="{color: form.status === '0' ? '#00aaff' : form.status === '1' ?
|
||||
'#FF700A' : form.status === '2' ? '#00aa00' : form.status === '3' ? '#00557f' : '#999' }">{{
|
||||
form.status === '0' ? '自住' : form.status === '1' ?
|
||||
'闲置' : form.status === '2' ? '租赁' : form.status === '3' ? '其他' : ''
|
||||
}}</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
@@ -59,35 +61,42 @@
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">住户</text>
|
||||
<text class="info-value">{{form.resident}}</text>
|
||||
<text class="info-value">{{form.name}}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">房间号</text>
|
||||
<text class="info-value">{{form.gender}}</text>
|
||||
<text class="info-value">{{form.houseNo}}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">证件类型</text>
|
||||
<text class="info-value">{{form.documentType}}</text>
|
||||
<text
|
||||
class="info-value">{{form.idCardType=='0'?'居民身份证':form.idCardType=='1'?'护照':form.idCardType=='2'?'其他':''}}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">证件号码</text>
|
||||
<text class="info-value">{{form.documentNumber}}</text>
|
||||
<text class="info-value">{{form.idCard}}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">与业主关系</text>
|
||||
<text class="info-value">{{form.relationship}}</text>
|
||||
<text
|
||||
class="info-value">{{form.ownerRelationship=='0'?'本人':form.ownerRelationship=='1'?'配偶':form.ownerRelationship=='2'?'父母':form.ownerRelationship=='3'?'子女':form.ownerRelationship=='4'?'亲属':form.ownerRelationship=='5'?'租户':form.ownerRelationship=='6'?'其他':''}}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">手机号码</text>
|
||||
<text class="info-value">{{form.phoneNum}}</text>
|
||||
<text class="info-value">{{form.phone}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 身份证照片区 -->
|
||||
<view class="photo-row">
|
||||
<text class="info-label" style="width: 200rpx;">本人身份证照片</text>
|
||||
<view class="photo-list">
|
||||
<view class="photo-item"></view>
|
||||
<view class="photo-item"></view>
|
||||
<view class="photo-item"
|
||||
:style="{backgroundImage: `url(${form.cardImageFront||''})`,backgroundSize: 'cover', backgroundPosition: 'center', backgroundRepeat: 'no-repeat'}">
|
||||
</view>
|
||||
<view class="photo-item"
|
||||
:style="{backgroundImage: `url(${form.cardImageBack||''})`,backgroundSize: 'cover', backgroundPosition: 'center', backgroundRepeat: 'no-repeat'}">
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -103,143 +112,149 @@
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
onReady: function(e) {},
|
||||
components: {
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
onMounted,
|
||||
computed
|
||||
} from 'vue'
|
||||
import {
|
||||
onReachBottom,
|
||||
onPullDownRefresh,
|
||||
onLoad,
|
||||
onShow
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
getMyHouseDetail,
|
||||
deleteMyHouse
|
||||
} from '/pageSubPack/api/apiSub.js'
|
||||
|
||||
// 响应式数据
|
||||
const statusBarHeight = ref(20)
|
||||
const id = ref()
|
||||
const currentStatus = ref('')
|
||||
const stepList = ref(["房屋信息", "住户信息", "物业审核", "认证成功"])
|
||||
const form = ref([])
|
||||
const statusMap = ref({
|
||||
success: {
|
||||
title: "房屋认证成功",
|
||||
iconClass: "icon-success",
|
||||
iconText: "✓",
|
||||
currentStep: 4,
|
||||
},
|
||||
computed: {
|
||||
// 动态计算当前状态配置
|
||||
statusConfig() {
|
||||
return this.statusMap[this.currentStatus];
|
||||
},
|
||||
// 动态计算当前步骤
|
||||
currentStep() {
|
||||
return this.statusConfig.currentStep;
|
||||
},
|
||||
|
||||
pending: {
|
||||
title: "房屋审核中,请耐心等待",
|
||||
iconClass: "icon-pending",
|
||||
iconText: "⏳",
|
||||
currentStep: 3,
|
||||
},
|
||||
|
||||
created() {
|
||||
|
||||
fail: {
|
||||
title: "房屋认证失败,请重新提交",
|
||||
iconClass: "icon-fail",
|
||||
iconText: "✕",
|
||||
currentStep: 3,
|
||||
},
|
||||
onShow() {
|
||||
})
|
||||
|
||||
},
|
||||
onLoad(option) {
|
||||
this.id = option.id;
|
||||
this.currentStatus = option.statusClass;
|
||||
// 计算属性
|
||||
const statusConfig = computed(() => {
|
||||
return statusMap.value[currentStatus.value]
|
||||
})
|
||||
const currentStep = computed(() => {
|
||||
return statusConfig.value.currentStep
|
||||
})
|
||||
|
||||
// 生命周期
|
||||
onLoad((option) => {
|
||||
id.value = option.id
|
||||
currentStatus.value = option.certificationStatus == '0' ? 'pending' : option.certificationStatus == '1' ?
|
||||
'success' : option.certificationStatus == '2' ? 'fail' : ''
|
||||
|
||||
},
|
||||
mounted() {},
|
||||
data() {
|
||||
return {
|
||||
/* 设定状态栏默认高度 */
|
||||
statusBarHeight: 20,
|
||||
// 可通过页面传参动态修改状态:success / pending / fail
|
||||
id: undefined,
|
||||
currentStatus: "",
|
||||
stepList: ["房屋信息", "住户信息", "物业审核", "认证成功"],
|
||||
form: {
|
||||
community: '北境碧桂园小区小区',
|
||||
houseNumber: '101栋2单元402',
|
||||
owner: '张三',
|
||||
status: '租赁',
|
||||
resident: '蒋依依',
|
||||
gender: '女',
|
||||
documentType: '身份证',
|
||||
documentNumber: '371100200001010888',
|
||||
relationship: '亲属',
|
||||
phoneNum: '16599999999',
|
||||
},
|
||||
// 状态配置表
|
||||
statusMap: {
|
||||
success: {
|
||||
title: "房屋认证成功",
|
||||
iconClass: "icon-success",
|
||||
iconText: "✓",
|
||||
currentStep: 4,
|
||||
},
|
||||
pending: {
|
||||
title: "房屋审核中,请耐心等待",
|
||||
iconClass: "icon-pending",
|
||||
iconText: "⏳",
|
||||
currentStep: 3,
|
||||
},
|
||||
fail: {
|
||||
title: "房屋认证失败,请重新提交",
|
||||
iconClass: "icon-fail",
|
||||
iconText: "✕",
|
||||
currentStep: 3,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
onShow(() => {})
|
||||
onMounted(() => {
|
||||
getDetail()
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
const getDetail = async () => {
|
||||
// 防重复请求
|
||||
|
||||
try {
|
||||
const res = await getMyHouseDetail({
|
||||
id: id.value
|
||||
})
|
||||
|
||||
methods: {
|
||||
// 修改按钮事件(仅认证失败显示)
|
||||
clickUpdate() {
|
||||
uni.setStorageSync('operationType', 'update')
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/addHouse?id=' + this.id + '&sourcePage=' + 'addHouse',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
},
|
||||
const data = res.data
|
||||
form.value = data
|
||||
console.log(form.value);
|
||||
} catch (err) {
|
||||
uni.showToast({
|
||||
title: `${err}`,
|
||||
icon: 'none'
|
||||
})
|
||||
console.error('列表接口报错:', err)
|
||||
} finally {
|
||||
|
||||
// 删除按钮事件
|
||||
onDelete() {
|
||||
uni.showModal({
|
||||
title: "确认删除",
|
||||
content: "确认删除此房屋信息吗?",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showLoading({
|
||||
title: '删除中...',
|
||||
mask: true
|
||||
}
|
||||
}
|
||||
// 方法(函数名完全不变)
|
||||
const clickUpdate = () => {
|
||||
uni.setStorageSync('operationType', 'update')
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/addHouse?id=' + id.value + '&sourcePage=addHouse'
|
||||
})
|
||||
}
|
||||
|
||||
const onDelete = () => {
|
||||
uni.showModal({
|
||||
title: "确认删除",
|
||||
content: "确认删除此房屋信息吗?",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showLoading({
|
||||
title: '删除中...',
|
||||
mask: true
|
||||
})
|
||||
deleteMyHouse({
|
||||
id: id.value
|
||||
}).then(res => {
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
})
|
||||
setTimeout(() => {
|
||||
goBack()
|
||||
}, 1000)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'error'
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
});
|
||||
}, 1000);
|
||||
setTimeout(() => {
|
||||
// 提交成功后跳转列表页
|
||||
uni.hideLoading();
|
||||
this.goBack();
|
||||
}, 2500);
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
goBack() {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/myHouseIndex',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
},
|
||||
|
||||
},
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err,
|
||||
icon: 'error'
|
||||
});
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const goBack = () => {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/myHouseIndex'
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background: #fff;
|
||||
@@ -251,7 +266,6 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
/* 关键:占满屏幕高度 */
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
|
||||
@@ -262,13 +276,10 @@
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
|
||||
/* 顶部状态区 */
|
||||
.status-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
padding: 20rpx 0px 20rpx;
|
||||
}
|
||||
|
||||
@@ -284,17 +295,14 @@
|
||||
|
||||
.icon-success {
|
||||
background-color: #2F77FD;
|
||||
/* border: 4rpx solid #00b42a; */
|
||||
}
|
||||
|
||||
.icon-pending {
|
||||
background-color: #2F77FD;
|
||||
/* border: 4rpx solid #1677ff; */
|
||||
}
|
||||
|
||||
.icon-fail {
|
||||
background-color: #E34D59;
|
||||
/* border: 4rpx solid #f53f3f; */
|
||||
}
|
||||
|
||||
.icon-text {
|
||||
@@ -322,7 +330,6 @@
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
/* 步骤条 */
|
||||
.step-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -382,7 +389,6 @@
|
||||
background-color: #1677ff;
|
||||
}
|
||||
|
||||
/* 信息卡片 */
|
||||
.info-card {
|
||||
padding: 20rpx;
|
||||
border: 1rpx solid #f0f0f0;
|
||||
@@ -435,7 +441,6 @@
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* 身份证照片区 */
|
||||
.photo-row {
|
||||
margin-top: 30rpx;
|
||||
display: flex;
|
||||
@@ -456,13 +461,10 @@
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
/* 底部按钮区 */
|
||||
.bottom-btn-wrap {
|
||||
padding: 20rpx 30rpx 40rpx;
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
|
||||
/* background-color: #fff; */
|
||||
}
|
||||
|
||||
.btn-modify {
|
||||
@@ -491,7 +493,6 @@
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
/* 成功提示弹窗 */
|
||||
.toast-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
|
||||
@@ -18,10 +18,12 @@
|
||||
<!-- 标题 + 状态 -->
|
||||
<view class="card-header">
|
||||
<view class="title-box">
|
||||
<text class="tag-default" v-if="item.isDefault">默认</text>
|
||||
<text class="house-name">{{ item.houseName }}</text>
|
||||
<text class="tag-default" v-if="item.isDefault==1">默认</text>
|
||||
<text
|
||||
class="house-name">{{ item.villageName+item.buildingName+item.unitNo+'单元'+item.floorNo+'楼' }}</text>
|
||||
</view>
|
||||
<text class="status-tag" :class="item.statusClass">{{ item.statusText }}</text>
|
||||
<text class="status-tag"
|
||||
:class="item.certificationStatus=='0'?'pending':item.certificationStatus=='1'?'success':item.certificationStatus=='2'?'fail':''">{{ item.certificationStatus=='0'?'未认证':item.certificationStatus=='1'?'认证成功':item.certificationStatus=='2'?'认证失败':'' }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 房屋信息 -->
|
||||
@@ -29,21 +31,22 @@
|
||||
<view class="row">
|
||||
<text class="label">房间号</text>
|
||||
<view class="value-box">
|
||||
<text class="value">{{ item.roomNo }}</text>
|
||||
<text class="value">{{ item.houseNo }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="label">业主</text>
|
||||
<text class="value">{{ item.owner }}</text>
|
||||
<text class="value">{{ item.name }}</text>
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="label">房屋状态</text>
|
||||
<text class="value">{{ item.houseStatus }}</text>
|
||||
<text
|
||||
class="value">{{ item.houseStatus==0?'自住':item.houseStatus==1?'闲置':item.houseStatus==2?'租赁':item.houseStatus==3?'其他':''}}</text>
|
||||
</view>
|
||||
<view class="defaultBox" v-if="item.statusText=='认证成功'&&!item.isDefault">
|
||||
<view class="defaultBox" v-if="item.certificationStatus=='1'&&!item.isDefault==1">
|
||||
<text class="set-default">设为默认</text>
|
||||
<switch class="no-cross-switch" :checked="item.isDefault" color="#1677ff"
|
||||
@change="onSwitchChange($event,index)" @click.stop />
|
||||
<switch class="no-cross-switch" :checked="item.isDefault==1" color="#1677ff"
|
||||
@change="onSwitchChange($event,item)" @click.stop />
|
||||
</view>
|
||||
<!-- <text v-if="item.showSetDefault" class="set-default"
|
||||
@click="setDefault(item.id)">设为默认</text> -->
|
||||
@@ -61,147 +64,166 @@
|
||||
|
||||
|
||||
</template>
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
onMounted,
|
||||
|
||||
<script>
|
||||
export default {
|
||||
onReady: function(e) {},
|
||||
components: {
|
||||
|
||||
},
|
||||
|
||||
computed: {
|
||||
} from 'vue'
|
||||
import {
|
||||
onReachBottom,
|
||||
onPullDownRefresh
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
getMyHouseList,
|
||||
setMyHouseDefault
|
||||
} from '/pageSubPack/api/apiSub.js'
|
||||
|
||||
|
||||
},
|
||||
created() {
|
||||
const houseList = ref([])
|
||||
const loadingMore = ref(false)
|
||||
const noMoreData = ref(false)
|
||||
|
||||
},
|
||||
onShow() {
|
||||
const pageNum = ref(1)
|
||||
const pageSize = ref(10)
|
||||
// ==================== 获取列表数据 ====================
|
||||
const getList = async () => {
|
||||
// 防重复请求
|
||||
|
||||
},
|
||||
onUnload() {
|
||||
// 页面卸载时清除定时器
|
||||
if (this.timer) clearInterval(this.timer)
|
||||
},
|
||||
mounted() {},
|
||||
data() {
|
||||
return {
|
||||
/* 设定状态栏默认高度 */
|
||||
statusBarHeight: 20,
|
||||
houseList: [{
|
||||
id: 1,
|
||||
houseName: "北境碧桂园小区(别墅)",
|
||||
roomNo: "2号楼2层",
|
||||
owner: "张三",
|
||||
houseStatus: "自住",
|
||||
isDefault: true,
|
||||
statusText: "认证成功",
|
||||
statusClass: "success",
|
||||
showSetDefault: false,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
houseName: "北境碧桂园小区(别墅)",
|
||||
roomNo: "3号楼2层",
|
||||
owner: "张三",
|
||||
houseStatus: "自住",
|
||||
isDefault: false,
|
||||
statusText: "认证成功",
|
||||
statusClass: "success",
|
||||
showSetDefault: true,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
houseName: "北境碧桂园小区(别墅)",
|
||||
roomNo: "2号楼1层",
|
||||
owner: "张三",
|
||||
houseStatus: "闲置",
|
||||
isDefault: false,
|
||||
statusText: "认证失败",
|
||||
statusClass: "fail",
|
||||
showSetDefault: false,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
houseName: "北境碧桂园小区(别墅)",
|
||||
roomNo: "2号楼1层",
|
||||
owner: "张三",
|
||||
houseStatus: "闲置",
|
||||
isDefault: false,
|
||||
statusText: "认证中",
|
||||
statusClass: "pending",
|
||||
if (loadingMore.value || noMoreData.value) return
|
||||
|
||||
showSetDefault: false,
|
||||
},
|
||||
|
||||
]
|
||||
loadingMore.value = true
|
||||
try {
|
||||
const res = await getMyHouseList({
|
||||
pageNum: pageNum.value,
|
||||
pageSize: pageSize.value
|
||||
})
|
||||
|
||||
const data = res
|
||||
const newList = data.rows || []
|
||||
|
||||
// 第一页 → 覆盖数据
|
||||
if (pageNum.value === 1) {
|
||||
houseList.value = newList
|
||||
} else {
|
||||
// 后续页 → 追加数据
|
||||
houseList.value = [...houseList.value, ...newList]
|
||||
}
|
||||
},
|
||||
// 判断是否没有更多数据
|
||||
if (newList.length < pageSize.value) {
|
||||
noMoreData.value = true
|
||||
} else {
|
||||
pageNum.value++
|
||||
}
|
||||
} catch (err) {
|
||||
uni.showToast({
|
||||
title: '加载失败',
|
||||
icon: 'none'
|
||||
})
|
||||
console.error('列表接口报错:', err)
|
||||
} finally {
|
||||
loadingMore.value = false
|
||||
uni.stopPullDownRefresh() // 关闭下拉刷新
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== 上拉加载更多(页面生命周期) ====================
|
||||
onReachBottom(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
// ==================== 下拉刷新 ====================
|
||||
const refresh = () => {
|
||||
// 重置所有状态
|
||||
pageNum = 1
|
||||
pageSize = 10
|
||||
noMoreData = false
|
||||
houseList = []
|
||||
loadingMore = false
|
||||
getList()
|
||||
}
|
||||
onPullDownRefresh(() => {
|
||||
refresh()
|
||||
})
|
||||
|
||||
// 页面加载时请求第一页
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
|
||||
methods: {
|
||||
// 开关切换
|
||||
onSwitchChange(e, i) {
|
||||
|
||||
uni.showLoading({
|
||||
title: '设置中...',
|
||||
mask: true
|
||||
const onSwitchChange = async (e, i) => {
|
||||
// uni.showLoading({
|
||||
// title: '设置中...',
|
||||
// mask: true
|
||||
// });
|
||||
|
||||
try {
|
||||
const res = await setMyHouseDefault({
|
||||
houseId: i.houseId
|
||||
})
|
||||
const data = res
|
||||
if (data.code === 200) {
|
||||
// uni.hideLoading();
|
||||
loadingMore.value = false
|
||||
noMoreData.value = false
|
||||
getList()
|
||||
uni.setStorageSync('houseIsDefault', e.detail.value)
|
||||
uni.showToast({
|
||||
title: '设置默认房屋成功',
|
||||
icon: 'success'
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: '设置默认房屋成功',
|
||||
icon: 'success'
|
||||
});
|
||||
}, 1000);
|
||||
setTimeout(() => {
|
||||
this.houseList.forEach((item, index) => {
|
||||
if (index != i) {
|
||||
item.isDefault = false
|
||||
} else {
|
||||
this.houseList[i].isDefault = e.detail.value
|
||||
|
||||
}
|
||||
})
|
||||
uni.setStorageSync('houseIsDefault', e.detail.value)
|
||||
}, 2500);
|
||||
},
|
||||
tapHouse(item) {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/houseDetail?id=' + item.id + '&statusClass=' + item.statusClass,
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
},
|
||||
|
||||
addHouse() {
|
||||
uni.setStorageSync('operationType', 'add');
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/addHouse',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
} else {
|
||||
// uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: `${res.msg}`,
|
||||
icon: 'error'
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
// uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: `${err}`,
|
||||
icon: 'none'
|
||||
})
|
||||
console.error('列表接口报错:', err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
goBack() {
|
||||
uni.switchTab({
|
||||
url: '/pages/myIndex/myIndex',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
},
|
||||
const tapHouse = (item) => {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/houseDetail?id=' + item.id + '&certificationStatus=' + item.certificationStatus,
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
const addHouse = () => {
|
||||
uni.setStorageSync('operationType', 'add');
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/addHouse',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
const goBack = () => {
|
||||
uni.switchTab({
|
||||
url: '/pages/myIndex/myIndex',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
// background: #F3F8FD;
|
||||
@@ -224,6 +246,7 @@
|
||||
padding: 0px 40rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 空状态 */
|
||||
.empty-state {
|
||||
display: flex;
|
||||
@@ -233,7 +256,7 @@
|
||||
padding: 100rpx 0;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
|
||||
.empty-text {
|
||||
font-size: 32rpx;
|
||||
color: #999;
|
||||
@@ -273,19 +296,25 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
width: 100%;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.house-name {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.tag-default {
|
||||
background: #007aff;
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
padding:2rpx 16rpx;
|
||||
padding: 2rpx 16rpx;
|
||||
border-radius: 30rpx;
|
||||
min-width: 48rpx;
|
||||
}
|
||||
|
||||
/* 状态标签 */
|
||||
@@ -294,6 +323,8 @@
|
||||
padding: 6rpx 14rpx;
|
||||
font-weight: 600;
|
||||
border-radius: 6rpx;
|
||||
min-width: 120rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.success {
|
||||
@@ -345,7 +376,7 @@
|
||||
}
|
||||
|
||||
.defaultBox {
|
||||
margin-top:10rpx;
|
||||
margin-top: 10rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
@@ -8,17 +8,17 @@
|
||||
<scroll-view class="page" scroll-y>
|
||||
<!-- 楼栋网格列表 -->
|
||||
|
||||
<view v-if="dataList.length === 0" class="empty-state">
|
||||
<uni-icons type="info" size="60" color="#ccc"></uni-icons>
|
||||
<text class="empty-text">
|
||||
{{ '暂无数据'}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="building-grid">
|
||||
<view v-if="dataList.length === 0" class="empty-state">
|
||||
<uni-icons type="info" size="60" color="#ccc"></uni-icons>
|
||||
<text class="empty-text">
|
||||
{{ '暂无数据'}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="building-item"
|
||||
:class="{ active:(checkType=='楼栋'&& selectedBuilding === item.id)||(checkType=='单元'&& selectedUnit === item.id)||(checkType=='楼层'&&selectedFloor === item.id) ||(checkType=='户号'&&selectedHouseNumber === item.id) }"
|
||||
v-for="(item, index) in dataList" :key="index" @click="selectBuilding(item)">
|
||||
<text class="building-text">{{ item.name }}</text>
|
||||
<text class="building-text">{{item.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@@ -29,339 +29,209 @@
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
onReady: function(e) {},
|
||||
components: {
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
onMounted,
|
||||
} from 'vue'
|
||||
import {
|
||||
onUnload,
|
||||
onShow
|
||||
|
||||
},
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
getHouseBuildings,
|
||||
getHouseUnits,
|
||||
getHouseFloors,
|
||||
getHouseHouses
|
||||
} from '/pageSubPack/api/apiSub.js'
|
||||
|
||||
computed: {
|
||||
// 状态栏高度
|
||||
const statusBarHeight = ref(20)
|
||||
|
||||
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
onShow() {
|
||||
|
||||
},
|
||||
onUnload() {},
|
||||
mounted() {
|
||||
|
||||
if (this.checkType == '楼栋') {
|
||||
this.dataList = this.buildingList
|
||||
|
||||
} else if (this.checkType == '单元') {
|
||||
this.dataList = this.unitList
|
||||
|
||||
} else if (this.checkType == '楼层') {
|
||||
this.dataList = this.floorList
|
||||
|
||||
} else if (this.checkType == '户号') {
|
||||
this.dataList = this.houseNumberList
|
||||
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
/* 设定状态栏默认高度 */
|
||||
statusBarHeight: 20,
|
||||
checkType: uni.getStorageSync('checkType'),
|
||||
dataList: [],
|
||||
// 楼栋列表(可动态生成/接口返回)
|
||||
buildingList: [{
|
||||
id: 1,
|
||||
name: '01栋'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '02栋'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '03栋'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: '04栋'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: '05栋'
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: '06栋'
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: '07栋'
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: '08栋'
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: '09栋'
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: '10栋'
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: '11栋'
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: '12栋'
|
||||
}
|
||||
],
|
||||
|
||||
floorList: [{
|
||||
id: 13,
|
||||
name: '01层'
|
||||
},
|
||||
{
|
||||
id: 14,
|
||||
name: '02层'
|
||||
},
|
||||
{
|
||||
id: 15,
|
||||
name: '03层'
|
||||
},
|
||||
{
|
||||
id: 16,
|
||||
name: '04层'
|
||||
}, {
|
||||
id: 17,
|
||||
name: '05层'
|
||||
},
|
||||
{
|
||||
id: 18,
|
||||
name: '06层'
|
||||
},
|
||||
{
|
||||
id: 19,
|
||||
name: '07层'
|
||||
},
|
||||
{
|
||||
id: 20,
|
||||
name: '08层'
|
||||
}, {
|
||||
id: 21,
|
||||
name: '09层'
|
||||
},
|
||||
{
|
||||
id: 22,
|
||||
name: '10层'
|
||||
},
|
||||
{
|
||||
id: 23,
|
||||
name: '11层'
|
||||
},
|
||||
{
|
||||
id: 24,
|
||||
name: '12层'
|
||||
}, {
|
||||
id: 25,
|
||||
name: '13层'
|
||||
},
|
||||
{
|
||||
id: 26,
|
||||
name: '14层'
|
||||
},
|
||||
{
|
||||
id: 27,
|
||||
name: '15层'
|
||||
},
|
||||
{
|
||||
id: 28,
|
||||
name: '16层'
|
||||
},
|
||||
{
|
||||
id: 29,
|
||||
name: '17层'
|
||||
},
|
||||
{
|
||||
id: 30,
|
||||
name: '18层'
|
||||
},
|
||||
{
|
||||
id: 31,
|
||||
name: '19层'
|
||||
},
|
||||
{
|
||||
id: 32,
|
||||
name: '20层'
|
||||
},
|
||||
|
||||
],
|
||||
|
||||
unitList: [{
|
||||
id: 33,
|
||||
name: '01单元'
|
||||
},
|
||||
{
|
||||
id: 34,
|
||||
name: '02单元'
|
||||
},
|
||||
{
|
||||
id: 35,
|
||||
name: '03单元'
|
||||
},
|
||||
{
|
||||
id: 36,
|
||||
name: '04单元'
|
||||
},
|
||||
|
||||
],
|
||||
houseNumberList: [{
|
||||
id: 37,
|
||||
name: '01'
|
||||
},
|
||||
{
|
||||
id: 38,
|
||||
name: '02'
|
||||
},
|
||||
{
|
||||
id: 39,
|
||||
name: '03'
|
||||
},
|
||||
{
|
||||
id: 40,
|
||||
name: '04'
|
||||
},
|
||||
|
||||
],
|
||||
// 选中的楼栋
|
||||
selectedBuilding: uni.getStorageSync('buildingId'),
|
||||
// 选中的单元
|
||||
selectedUnit: uni.getStorageSync('unitId'),
|
||||
// 选中的楼层
|
||||
selectedFloor: uni.getStorageSync('floorId'),
|
||||
// 选中的户号
|
||||
selectedHouseNumber: uni.getStorageSync('houseNumberId'),
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
methods: {
|
||||
selectBuilding(item) {
|
||||
let modalContent = '确认选择此' + this.checkType + '吗?'
|
||||
uni.showModal({
|
||||
title: "确认选择",
|
||||
content: modalContent,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showLoading({
|
||||
title: '选择中...',
|
||||
mask: true
|
||||
});
|
||||
// 从缓存获取类型
|
||||
const checkType = ref(uni.getStorageSync('checkType') || '')
|
||||
const dataList = ref([])
|
||||
|
||||
|
||||
|
||||
// 选中项(从缓存读取)
|
||||
const selectedBuilding = ref(uni.getStorageSync('buildingId') || '')
|
||||
const selectedUnit = ref(uni.getStorageSync('unitId') || '')
|
||||
const selectedFloor = ref(uni.getStorageSync('floorId') || '')
|
||||
const selectedHouseNumber = ref(uni.getStorageSync('houseNumberId') || '')
|
||||
|
||||
if (this.checkType == '楼栋') {
|
||||
this.selectedBuilding = item.id
|
||||
uni.setStorageSync('buildingId', item.id);
|
||||
uni.setStorageSync('buildingName', item.name);
|
||||
uni.removeStorageSync('unitId');
|
||||
uni.removeStorageSync('unitName');
|
||||
uni.removeStorageSync('floorId');
|
||||
uni.removeStorageSync('floorName');
|
||||
uni.removeStorageSync('houseNumberId');
|
||||
uni.removeStorageSync('houseNumberName');
|
||||
uni.setStorageSync('checkType', '单元');
|
||||
} else if (this.checkType == '单元') {
|
||||
this.selectedUnit = item.id
|
||||
uni.setStorageSync('unitId', item.id);
|
||||
uni.setStorageSync('unitName', item.name);
|
||||
uni.removeStorageSync('floorId');
|
||||
uni.removeStorageSync('floorName');
|
||||
uni.removeStorageSync('houseNumberId');
|
||||
uni.removeStorageSync('houseNumberName');
|
||||
uni.setStorageSync('checkType', '楼层');
|
||||
} else if (this.checkType == '楼层') {
|
||||
this.selectedFloor = item.id
|
||||
uni.setStorageSync('floorId', item.id);
|
||||
uni.setStorageSync('floorName', item.name);
|
||||
uni.removeStorageSync('houseNumberId');
|
||||
uni.removeStorageSync('houseNumberName');
|
||||
uni.setStorageSync('checkType', '户号');
|
||||
} else if (this.checkType == '户号') {
|
||||
this.selectedHouseNumber = item.id
|
||||
uni.setStorageSync('houseNumberId', item.id);
|
||||
uni.setStorageSync('houseNumberName', item.name);
|
||||
// 页面挂载后赋值列表
|
||||
onMounted(() => {
|
||||
console.log(checkType);
|
||||
if (checkType.value === '楼栋') {
|
||||
getList('楼栋')
|
||||
} else if (checkType.value === '单元') {
|
||||
getList('单元')
|
||||
} else if (checkType.value === '楼层') {
|
||||
getList('楼层')
|
||||
} else if (checkType.value === '户号') {
|
||||
getList('户号')
|
||||
}
|
||||
|
||||
}
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: '选择成功',
|
||||
icon: 'success'
|
||||
});
|
||||
}, 500);
|
||||
setTimeout(() => {
|
||||
// 提交成功后跳转列表页
|
||||
uni.hideLoading();
|
||||
this.goFreash();
|
||||
}, 2000);
|
||||
})
|
||||
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
},
|
||||
goFreash() {
|
||||
console.log(this.checkType, '刷新页面');
|
||||
if (this.checkType != '户号') {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/selectBuilding',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/addHouse',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
}
|
||||
},
|
||||
goBackAdd() {
|
||||
if (this.checkType == '楼栋') {
|
||||
uni.removeStorageSync('buildingId');
|
||||
uni.removeStorageSync('buildingName');
|
||||
} else if (this.checkType == '单元') {
|
||||
uni.removeStorageSync('unitId');
|
||||
uni.removeStorageSync('unitName');
|
||||
} else if (this.checkType == '楼层') {
|
||||
uni.removeStorageSync('floorId');
|
||||
uni.removeStorageSync('floorName');
|
||||
} else if (this.checkType == '户号') {
|
||||
uni.removeStorageSync('houseNumberId');
|
||||
uni.removeStorageSync('houseNumberName');
|
||||
// 选择项方法
|
||||
const selectBuilding = (item) => {
|
||||
const modalContent = `确认选择此${checkType.value}吗?`
|
||||
uni.showModal({
|
||||
title: '确认选择',
|
||||
content: modalContent,
|
||||
success: (res) => {
|
||||
if (!res.confirm) return
|
||||
uni.showLoading({
|
||||
title: '选择中...',
|
||||
mask: true
|
||||
})
|
||||
if (checkType.value === '楼栋') {
|
||||
selectedBuilding.value = item.id
|
||||
uni.setStorageSync('buildingId', item.id)
|
||||
uni.setStorageSync('buildingName', item.name)
|
||||
uni.removeStorageSync('unitId')
|
||||
uni.removeStorageSync('unitName')
|
||||
uni.removeStorageSync('floorId')
|
||||
uni.removeStorageSync('floorName')
|
||||
uni.removeStorageSync('houseNumberId')
|
||||
uni.removeStorageSync('houseNumberName')
|
||||
uni.setStorageSync('checkType', '单元')
|
||||
} else if (checkType.value === '单元') {
|
||||
selectedUnit.value = item.id
|
||||
uni.setStorageSync('unitId', item.id)
|
||||
uni.setStorageSync('unitName', item.name)
|
||||
uni.removeStorageSync('floorId')
|
||||
uni.removeStorageSync('floorName')
|
||||
uni.removeStorageSync('houseNumberId')
|
||||
uni.removeStorageSync('houseNumberName')
|
||||
uni.setStorageSync('checkType', '楼层')
|
||||
} else if (checkType.value === '楼层') {
|
||||
selectedFloor.value = item.id
|
||||
uni.setStorageSync('floorId', item.id)
|
||||
uni.setStorageSync('floorName', item.name)
|
||||
uni.removeStorageSync('houseNumberId')
|
||||
uni.removeStorageSync('houseNumberName')
|
||||
uni.setStorageSync('checkType', '户号')
|
||||
} else if (checkType.value === '户号') {
|
||||
selectedHouseNumber.value = item.id
|
||||
uni.setStorageSync('houseNumberId', item.id)
|
||||
uni.setStorageSync('houseNumberName', item.name)
|
||||
}
|
||||
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/addHouse',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: '选择成功',
|
||||
icon: 'success'
|
||||
})
|
||||
}, 500)
|
||||
|
||||
setTimeout(() => {
|
||||
uni.hideLoading()
|
||||
goFreash()
|
||||
}, 2000)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 刷新跳转
|
||||
const goFreash = () => {
|
||||
console.log(checkType.value, '刷新页面')
|
||||
if (checkType.value !== '户号') {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/selectBuilding'
|
||||
})
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/addHouse'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 返回新增
|
||||
const goBackAdd = () => {
|
||||
if (checkType.value === '楼栋') {
|
||||
uni.removeStorageSync('buildingId')
|
||||
uni.removeStorageSync('buildingName')
|
||||
} else if (checkType.value === '单元') {
|
||||
uni.removeStorageSync('unitId')
|
||||
uni.removeStorageSync('unitName')
|
||||
} else if (checkType.value === '楼层') {
|
||||
uni.removeStorageSync('floorId')
|
||||
uni.removeStorageSync('floorName')
|
||||
} else if (checkType.value === '户号') {
|
||||
uni.removeStorageSync('houseNumberId')
|
||||
uni.removeStorageSync('houseNumberName')
|
||||
}
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/addHouse'
|
||||
})
|
||||
}
|
||||
// 获取数据
|
||||
const getList = async (type) => {
|
||||
try {
|
||||
if (type == '楼栋') {
|
||||
const res = await getHouseBuildings({
|
||||
villageId: uni.getStorageSync('communityId')
|
||||
})
|
||||
const newList = res.data.map(item => ({
|
||||
id: item.id,
|
||||
name: item.buildingName
|
||||
}))
|
||||
|
||||
dataList.value = newList
|
||||
} else if (type == '单元') {
|
||||
const res = await getHouseUnits({
|
||||
buildingId: selectedBuilding.value
|
||||
})
|
||||
const newList = res.data.map(item => ({
|
||||
id: item,
|
||||
name: item
|
||||
}))
|
||||
|
||||
dataList.value = newList
|
||||
} else if (type == '楼层') {
|
||||
const res = await getHouseFloors({
|
||||
buildingId: selectedBuilding.value,
|
||||
unitNo: selectedUnit.value
|
||||
})
|
||||
const newList = res.data.map(item => ({
|
||||
id: item,
|
||||
name: item
|
||||
}))
|
||||
|
||||
dataList.value = newList
|
||||
} else if (type == '户号') {
|
||||
const res = await getHouseHouses({
|
||||
buildingId: selectedBuilding.value,
|
||||
unitNo: selectedUnit.value,
|
||||
floorNo: selectedFloor.value
|
||||
})
|
||||
const newList = res.data.map(item => ({
|
||||
id: item.houseId,
|
||||
name: item.houseNo
|
||||
}))
|
||||
|
||||
dataList.value = newList
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
uni.showToast({
|
||||
title: '加载失败',
|
||||
icon: 'none'
|
||||
})
|
||||
console.error('列表接口报错:', err)
|
||||
} finally {
|
||||
|
||||
}
|
||||
}
|
||||
// 生命周期
|
||||
onShow(() => {
|
||||
|
||||
})
|
||||
onUnload(() => {})
|
||||
</script>
|
||||
<style lang="scss">
|
||||
page {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
</view>
|
||||
<view class="community-item" v-for="(item, index) in filteredList" :key="index"
|
||||
@click="selectCommunity(item)">
|
||||
<text class="community-name">{{ item.name }}</text>
|
||||
<text class="community-name">{{ item.villageName }}</text>
|
||||
<text class="item-arrow"></text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -33,147 +33,140 @@
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
onReady: function(e) {},
|
||||
components: {
|
||||
|
||||
},
|
||||
computed: {
|
||||
// 过滤后的列表(搜索功能)
|
||||
filteredList() {
|
||||
if (!this.searchKey.trim()) {
|
||||
return this.communityList
|
||||
}
|
||||
return this.communityList.filter(item =>
|
||||
item.name.includes(this.searchKey.trim())
|
||||
)
|
||||
},
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
onMounted,
|
||||
computed
|
||||
} from 'vue'
|
||||
import {
|
||||
onReachBottom,
|
||||
onPullDownRefresh,
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
getVillageList
|
||||
} from '/pageSubPack/api/apiSub.js'
|
||||
|
||||
|
||||
},
|
||||
|
||||
created() {
|
||||
const sourcePage = ref('')
|
||||
const searchKey = ref('')
|
||||
const communityList = ref([])
|
||||
// const refreshing = ref(false)
|
||||
const filteredList = computed(() => {
|
||||
if (!searchKey.value.trim()) {
|
||||
return communityList.value
|
||||
}
|
||||
return communityList.value.filter(item =>
|
||||
item.villageName.includes(searchKey.value.trim())
|
||||
)
|
||||
|
||||
},
|
||||
|
||||
onShow() {
|
||||
|
||||
},
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
onLoad(option) {
|
||||
// addHouse
|
||||
// addParkingSpace
|
||||
this.sourcePage = option.sourcePage;
|
||||
|
||||
},
|
||||
mounted() {},
|
||||
data() {
|
||||
return {
|
||||
|
||||
/* 设定状态栏默认高度 */
|
||||
statusBarHeight: 20,
|
||||
sourcePage: '',
|
||||
searchKey: '',
|
||||
communityList: [{
|
||||
id: 1,
|
||||
name: '北境碧桂园小区'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '东境碧桂园小区'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '南境碧桂园小区'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: '西境碧桂园小区'
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
]
|
||||
onLoad((option) => {
|
||||
sourcePage.value = option.sourcePage;
|
||||
getList()
|
||||
})
|
||||
|
||||
// ==================== 获取列表数据 ====================
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
const getList = async () => {
|
||||
|
||||
|
||||
methods: {
|
||||
// 搜索输入事件
|
||||
onSearch() {
|
||||
// 实时过滤,computed 自动处理
|
||||
},
|
||||
try {
|
||||
const res = await getVillageList({
|
||||
|
||||
// 选择小区
|
||||
selectCommunity(item) {
|
||||
uni.setStorageSync('communityId', item.id);
|
||||
uni.setStorageSync('communityName', item.name);
|
||||
uni.setStorageSync('checkType', '楼栋');
|
||||
uni.removeStorageSync('buildingId');
|
||||
uni.removeStorageSync('buildingName');
|
||||
uni.removeStorageSync('unitId');
|
||||
uni.removeStorageSync('unitName');
|
||||
uni.removeStorageSync('floorId');
|
||||
uni.removeStorageSync('floorName');
|
||||
uni.removeStorageSync('houseNumberId');
|
||||
uni.removeStorageSync('houseNumberName');
|
||||
})
|
||||
console.log(res);
|
||||
const data = res
|
||||
communityList.value = data.data || []
|
||||
|
||||
uni.removeStorageSync('bindHouseId');
|
||||
uni.removeStorageSync('bindHouseName');
|
||||
uni.removeStorageSync('parkingLotId');
|
||||
uni.removeStorageSync('parkingLotName');
|
||||
uni.removeStorageSync('parkingSpaceId');
|
||||
uni.removeStorageSync('parkingSpaceName');
|
||||
} catch (err) {
|
||||
uni.showToast({
|
||||
title: '加载失败',
|
||||
icon: 'none'
|
||||
})
|
||||
console.error('列表接口报错:', err)
|
||||
} finally {
|
||||
|
||||
if (this.sourcePage == 'addHouse') {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/selectBuilding',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
} else if (this.sourcePage == 'addParkingSpace') {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/bindHouse',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// 搜索输入事件
|
||||
const onSearch = () => {
|
||||
// 实时过滤,computed 自动处理
|
||||
}
|
||||
|
||||
},
|
||||
goBackAdd() {
|
||||
uni.removeStorageSync('communityId');
|
||||
uni.removeStorageSync('communityName');
|
||||
if (this.sourcePage == 'addHouse') {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/addHouse',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
} else if (this.sourcePage == 'addParkingSpace') {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/addParkingSpace',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
} else {
|
||||
// 选择小区
|
||||
const selectCommunity = (item) => {
|
||||
uni.setStorageSync('communityId', item.villageId);
|
||||
uni.setStorageSync('communityName', item.villageName);
|
||||
uni.setStorageSync('checkType', '楼栋');
|
||||
uni.removeStorageSync('buildingId');
|
||||
uni.removeStorageSync('buildingName');
|
||||
uni.removeStorageSync('unitId');
|
||||
uni.removeStorageSync('unitName');
|
||||
uni.removeStorageSync('floorId');
|
||||
uni.removeStorageSync('floorName');
|
||||
uni.removeStorageSync('houseNumberId');
|
||||
uni.removeStorageSync('houseNumberName');
|
||||
|
||||
}
|
||||
},
|
||||
},
|
||||
uni.removeStorageSync('bindHouseId');
|
||||
uni.removeStorageSync('bindHouseName');
|
||||
uni.removeStorageSync('parkingLotId');
|
||||
uni.removeStorageSync('parkingLotName');
|
||||
uni.removeStorageSync('parkingSpaceId');
|
||||
uni.removeStorageSync('parkingSpaceName');
|
||||
|
||||
if (sourcePage.value == 'addHouse') {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/selectBuilding',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
} else if (sourcePage.value == 'addParkingSpace') {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/bindHouse',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
const goBackAdd = () => {
|
||||
uni.removeStorageSync('communityId');
|
||||
uni.removeStorageSync('communityName');
|
||||
if (sourcePage.value == 'addHouse') {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/addHouse',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
} else if (sourcePage.value == 'addParkingSpace') {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/addParkingSpace',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background: #f6f6f6;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="contentStyle" style="">
|
||||
<view class="contentStyle">
|
||||
<view class="status-bar"></view>
|
||||
<uni-nav-bar title="设置" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false">
|
||||
</uni-nav-bar>
|
||||
@@ -8,7 +8,6 @@
|
||||
<view class="setting-item" v-for="(item, index) in settingList" :key="index" @click="onItemClick(item)">
|
||||
<text class="item-title">{{ item.title }}</text>
|
||||
|
||||
<!-- 不同类型的右侧内容 -->
|
||||
<view class="item-right" v-if="item.type === 'text'">
|
||||
<text :class="item.valueClass || 'item-value'">{{ item.value }}</text>
|
||||
<view class="item-arrow"></view>
|
||||
@@ -20,251 +19,211 @@
|
||||
<view class="item-arrow" v-else></view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- 底部下一步按钮 -->
|
||||
|
||||
<view class="bottom-btn">
|
||||
<button class="logout-btn" @click="logout">退出登录</button>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
onReady: function(e) {},
|
||||
components: {
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
onMounted,
|
||||
reactive
|
||||
} from 'vue'
|
||||
import {
|
||||
onReachBottom,
|
||||
onLoad,
|
||||
onUnload,
|
||||
onPullDownRefresh
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
authLogout
|
||||
} from '/pageSubPack/api/apiSub.js'
|
||||
|
||||
//
|
||||
const statusBarHeight = ref(20)
|
||||
const cacheSize = ref(0)
|
||||
const settingList = ref([{
|
||||
title: '更改手机号码',
|
||||
type: 'arrow'
|
||||
},
|
||||
|
||||
computed: {
|
||||
|
||||
|
||||
{
|
||||
title: '修改密码',
|
||||
type: 'arrow'
|
||||
},
|
||||
created() {
|
||||
|
||||
{
|
||||
title: '消息通知',
|
||||
type: 'switch',
|
||||
checked: false
|
||||
},
|
||||
onShow() {
|
||||
|
||||
{
|
||||
title: '清除缓存',
|
||||
type: 'text',
|
||||
value: '9.2M'
|
||||
},
|
||||
onLoad() {
|
||||
{
|
||||
title: '升级版本',
|
||||
type: 'text',
|
||||
value: '当前版本 2.9.8',
|
||||
valueClass: 'item-version'
|
||||
}
|
||||
])
|
||||
|
||||
},
|
||||
mounted() {},
|
||||
data() {
|
||||
return {
|
||||
message: '',
|
||||
/* 设定状态栏默认高度 */
|
||||
statusBarHeight: 20,
|
||||
cacheSize: 0,
|
||||
settingList: [{
|
||||
title: '更改手机号码',
|
||||
type: 'arrow'
|
||||
},
|
||||
{
|
||||
title: '修改密码',
|
||||
type: 'arrow'
|
||||
},
|
||||
{
|
||||
title: '消息通知',
|
||||
type: 'switch',
|
||||
checked: false
|
||||
},
|
||||
{
|
||||
title: '清除缓存',
|
||||
type: 'text',
|
||||
value: '9.2M'
|
||||
},
|
||||
{
|
||||
title: '升级版本',
|
||||
type: 'text',
|
||||
value: '当前版本 2.9.8',
|
||||
valueClass: 'item-version'
|
||||
}
|
||||
]
|
||||
//
|
||||
const onItemClick = (item) => {
|
||||
if (item.title == '更改手机号码') {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/changePhone'
|
||||
});
|
||||
} else if (item.title == '修改密码') {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/changePwd'
|
||||
});
|
||||
} else if (item.title == '清除缓存') {
|
||||
uni.clearStorageSync();
|
||||
settingList.value[3].value = '0M'
|
||||
uni.showLoading({
|
||||
title: '清除中...',
|
||||
mask: true
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: '清除成功',
|
||||
icon: 'success'
|
||||
});
|
||||
}, 1000);
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
}, 2500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
methods: {
|
||||
onItemClick(item) {
|
||||
// console.log('点击了:', item.title,item.title == '更改手机号码')
|
||||
if (item.title == '更改手机号码') {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/changePhone',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
} else if (item.title == '修改密码') {
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/my/changePwd',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
} else if (item.title == '清除缓存') {
|
||||
uni.clearStorageSync();
|
||||
this.message = '清除成功'
|
||||
this.settingList[3].value = '0M'
|
||||
const logout = () => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要退出当前账号吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showLoading({
|
||||
title: '清除中...',
|
||||
title: '退出中...',
|
||||
mask: true
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: '清除成功',
|
||||
icon: 'success'
|
||||
});
|
||||
}, 1000);
|
||||
setTimeout(() => {
|
||||
// 提交成功后跳转列表页
|
||||
uni.hideLoading();
|
||||
|
||||
}, 2500);
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
logout() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要退出当前账号吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.message = '退出成功'
|
||||
uni.showLoading({
|
||||
title: '退出中...',
|
||||
mask: true
|
||||
authLogout().then(res => {
|
||||
if (res.code === 200) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '退出成功',
|
||||
icon: 'success'
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: '退出成功',
|
||||
icon: 'success'
|
||||
});
|
||||
}, 1000);
|
||||
setTimeout(() => {
|
||||
// 登出成功后跳转回登录页
|
||||
uni.hideLoading();
|
||||
|
||||
uni.redirectTo({
|
||||
url: '/pageSubPack/loginSub/pwd-login',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
url: '/pageSubPack/loginSub/pwd-login'
|
||||
});
|
||||
|
||||
}, 2500);
|
||||
|
||||
}, 1500);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: `${res.msg}`,
|
||||
icon: 'error'
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
onSwitchChange(item, e) {
|
||||
item.checked = e.detail.value
|
||||
},
|
||||
goBack() {
|
||||
uni.switchTab({
|
||||
url: '/pages/myIndex/myIndex',
|
||||
success: res => {},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
},
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
uni.showToast({
|
||||
title: `${err}`,
|
||||
icon: 'error'
|
||||
});
|
||||
})
|
||||
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const onSwitchChange = (item, e) => {
|
||||
item.checked = e.detail.value
|
||||
}
|
||||
|
||||
const goBack = () => {
|
||||
uni.switchTab({
|
||||
url: '/pages/myIndex/myIndex'
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background: #f9f9f9;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.contentStyle {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
/* 关键:占满屏幕高度 */
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
.page {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 0px 40rpx;
|
||||
padding: 0 40rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
/* 底部按钮 */
|
||||
.bottom-btn {
|
||||
padding: 20rpx 30rpx 40rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
/* 列表项 */
|
||||
.setting-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background-color: #ffffff;
|
||||
padding: 30rpx 30rpx;
|
||||
background-color: #fff;
|
||||
padding: 30rpx;
|
||||
border-bottom: 2rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
/* 标题文字 */
|
||||
.item-title {
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
color: #333;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
/* 右侧区域(文字+箭头) */
|
||||
.item-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
/* 右侧数值/版本文字 */
|
||||
.item-value {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.item-version {
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* 右侧箭头 */
|
||||
.item-arrow {
|
||||
display: inline-block;
|
||||
width: 10rpx;
|
||||
height: 10rpx;
|
||||
border-top: 2rpx solid #999;
|
||||
border-right: 2rpx solid #999;
|
||||
transform: rotate(45deg);
|
||||
margin-left: 10rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
/* 开关样式适配 */
|
||||
/* switch {
|
||||
transform: scale(0.8);
|
||||
} */
|
||||
/* 底部按钮 */
|
||||
.logout-btn {
|
||||
|
||||
width: 100%;
|
||||
height: 96rpx;
|
||||
line-height: 96rpx;
|
||||
@@ -273,31 +232,27 @@
|
||||
border-radius: 12rpx;
|
||||
color: #666;
|
||||
background-color: #F3F3F3;
|
||||
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
/* 按钮点击态 */
|
||||
.logout-btn:active {
|
||||
background-color: #f5f5f5;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
|
||||
.status-bar {
|
||||
width: 100vw;
|
||||
height: 46px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
::v-deep .uni-switch-input:before {
|
||||
background-color: #cccccd !important;
|
||||
}
|
||||
|
||||
/* 隐藏 switch 关闭状态的 × 号 */
|
||||
.no-cross-switch::before {
|
||||
display: none !important;
|
||||
|
||||
}
|
||||
|
||||
.no-cross-switch {
|
||||
|
||||
Reference in New Issue
Block a user