完成房产模块功能

This commit is contained in:
gxwebsoft
2023-08-23 13:09:58 +08:00
parent 93e0876e13
commit 9e931e9f6b
10 changed files with 149 additions and 74 deletions

View File

@@ -7,15 +7,13 @@
:actionStyle="actionStyle"></u-search>
</view>
</u-sticky>
{{ select }}
<view class="order-total">
<view class="pay-btn">
<view class="btn">
<u-button text="上架" plain size="small" @click="onStatus(0)"></u-button>
</view>
<view class="btn">
<u-button text="下架" plain size="small" @click="onStatus(1)"></u-button>
<u-button text="下架" plain size="small" @click="onStatus(10)"></u-button>
</view>
<view class="btn">
<u-button text="删除" plain size="small" @click="onDel()"></u-button>
@@ -32,15 +30,20 @@
</view>
</view>
<view class="house">
<view class="btn">
<u-radio-group v-model="select">
<u-radio activeColor="red" label="全选"></u-radio>
</u-radio-group>
<view class="btn" @click="onRadio">
<label class="radio"><radio value="r1" color="#ff0000" :checked="checked" />全选</label>
<!-- <u-radio activeColor="red" v-model="select" label="全选" @change="onRadio"></u-radio> -->
<!-- <u-radio label="取消" @change="onRadio"></u-radio> -->
</view>
<view class="list">
<block v-for="(item,index) in list" :key="index">
<view class="item" @click="$push('sub_pages/house/add?id=' + item.houseId)">
<view class="badge" @click.stop="onBadge(item.houseId)"><u-badge :isDot="true" type="info" :bgColor="item.houseId == selectId ? bgColor : ''"></u-badge></view>
<view class="item" @click="addHouseInfo(item.houseId)">
<view class="badge" @click.stop="onBadge(item,index)"><u-badge :isDot="true" type="info"
:bgColor="item.selected ? bgColor : ''"></u-badge></view>
<view class="status">
<u-tag :text="item.status == 0 ? '上架' : '下架'" plain
:type="item.status == 0 ? 'success' : 'error'"></u-tag>
</view>
<image class="image" :src="item.files[0].url" mode="widthFix"></image>
<view class="info">
<view class="title">{{ item.houseTitle }}</view>
@@ -56,7 +59,7 @@
<u-gap></u-gap>
<view class="float">
<view class="release">
<u-button text="添加房源" type="primary" shape="circle" @click="$push('sub_pages/house/add')"></u-button>
<u-button text="添加房源" type="primary" shape="circle" @click="addHouseInfo"></u-button>
</view>
</view>
</view>
@@ -85,7 +88,8 @@
page: 1,
where: {},
select: [],
bgColor: '#ffffff',
checked: false,
bgColor: '#ff0000',
selectId: 0
}
},
@@ -94,8 +98,7 @@
* 生命周期函数--监听页面加载
*/
onLoad() {
this.list = []
this.onRefreshList()
this.onSearch()
// this.getDict()
},
@@ -135,45 +138,79 @@
} else {
app.canReset = false
}
console.log("app.list: ",app.list);
console.log("app.list: ", app.list);
resolve(list)
})
})
},
onEdit(){
const { selectId } = this
if(selectId > 0){
onEdit() {
const {
selectId
} = this
if(selectId == 0){
this.$error('请选择房源')
return false
}
if (selectId > 0) {
this.$push('sub_pages/house/add?id=' + selectId)
}
},
onDel(){
onDel() {
const app = this
const { selectId } = this
if(selectId > 0){
HouseInfoApi.removeHouseInfo(selectId).then(res => {
})
}
app.list.map(d => {
if (d.selected == true) {
HouseInfoApi.removeHouseInfo(d.houseId).then(res => {
app.$success(res.message)
})
}
})
app.onSearch()
},
onStatus(status){
console.log('this.select: ',this.select);
onStatus(status) {
const app = this
app.list.map(d => {
if (d.selected == true) {
HouseInfoApi.updateHouseInfo({
houseId: d.houseId,
status
})
}
})
app.onSearch()
},
onSearch() {
console.log('this.where: ',this.where);
this.list = []
this.page = 1
this.checked = false
this.onRefreshList()
// this.$push('/sub_pages/member/member', this.where)
},
onBadge(id){
this.selectId = id
this.bgColor = '#ff0000'
this.select.push(id)
console.log('this.select: ',this.select);
onBadge(item, index) {
this.list[index].selected = true
this.selectId = item.houseId
},
addHouseInfo(id) {
const app = this
uni.navigateTo({
url: `/sub_pages/house/add?id=` + id,
events: {
reload: ({
status // false
}) => {
app.onSearch()
}
}
})
},
onRadio(e) {
const { list } = this
this.list = list.map((d) => {
d.selected = true
return d
})
}
}
}
@@ -186,6 +223,7 @@
</style>
<style lang="scss" scoped>
.container {}
.search-wrapper {
display: flex;
height: 64rpx;
@@ -255,7 +293,7 @@
align-items: center;
}
}
// 订单合计
.order-total {
margin: 10rpx auto;
@@ -266,67 +304,85 @@
padding-top: 10rpx;
display: flex;
justify-content: center;
.pay-btn{
.pay-btn {
display: flex;
.btn{
.btn {
margin-right: 16rpx;
}
}
.total-price{
.total-price {
display: flex;
align-items: center;
}
.unit {
margin-left: 8rpx;
margin-right: -2rpx;
font-size: 26rpx;
}
.money {
font-size: 28rpx;
color: #ff0000;
}
}
.house{
.house {
margin: 30rpx auto;
width: 680rpx;
.btn{
.btn {
width: 150rpx;
margin: 40rpx 0;
}
.list{
.list {
width: 680rpx;
margin: auto;
.item{
.item {
border-radius: 30rpx 30rpx 0 0;
box-shadow: 0 3rpx 10rpx 0px #999999;
background-color: #FFFFFF;
margin: 50rpx auto;
position: relative;
.badge{
.badge {
position: absolute;
left: 30rpx;
top: 30rpx;
}
.image{
.status {
position: absolute;
right: 30rpx;
top: 30rpx;
}
.image {
width: 680rpx;
height: 360rpx;
border-radius: 30rpx 30rpx 0 0;
}
.info{
.info {
padding: 20rpx 20rpx;
display: flex;
flex-direction: column;
.title{
.title {
font-size: 40rpx;
}
.desc{
.desc {
color: #999999;
font-size: 28rpx;
}
.price{
.price {
color: #ff0000;
font-size: 30rpx;
}
@@ -334,13 +390,15 @@
}
}
}
.float{
.float {
width: 750rpx;
display: flex;
justify-content: center;
position: fixed;
bottom: 100rpx;
.release{
.release {
width: 500rpx;
opacity: 0.9;
}