完成房产模块功能

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

@@ -9,12 +9,12 @@ module.exports = {
appSecret: '1f1d186d98ea4620ac65afbf34940051', appSecret: '1f1d186d98ea4620ac65afbf34940051',
// 开发环境 // 开发环境
apiUrl: "http://127.0.0.1:9090/api", // apiUrl: "http://127.0.0.1:9090/api",
// socketUrl: 'ws://localhost:9190', // socketUrl: 'ws://localhost:9190',
// fileUrl: 'https://file.wsdns.cn', // fileUrl: 'https://file.wsdns.cn',
// 测试环境 // 测试环境
// apiUrl: 'https://server.gxwebsoft.com/api', apiUrl: 'https://server.gxwebsoft.com/api',
socketUrl: 'wss://server.gxwebsoft.com', socketUrl: 'wss://server.gxwebsoft.com',
fileUrl: 'https://file.wsdns.cn', fileUrl: 'https://file.wsdns.cn',

View File

@@ -69,7 +69,7 @@
reset: true reset: true
}, },
{ {
name: '必看房', name: '必看房',
reset: false reset: false
} }
]; ];

View File

@@ -64,7 +64,7 @@
reset: true reset: true
}, },
{ {
name: '必看房', name: '必看房',
reset: false reset: false
} }
]; ];
@@ -104,6 +104,9 @@
this.getDict() this.getDict()
this.list = [] this.list = []
this.onRefreshList() this.onRefreshList()
uni.$u.mpShare = {
title: '爱尚家找房'
}
}, },
onShow() {}, onShow() {},
onBackPress() {}, onBackPress() {},
@@ -208,7 +211,7 @@
font-size: 28rpx; font-size: 28rpx;
} }
.input{ .input{
width: 250rpx; width: 330rpx;
} }
} }
} }

View File

@@ -104,7 +104,7 @@
}, },
onShareAppMessage() { onShareAppMessage() {
return { return {
title: '高端婚恋交友平台', title: '爱尚家找房',
path: 'pages/index/index?user_id=' + uni.getStorageSync('userId'), path: 'pages/index/index?user_id=' + uni.getStorageSync('userId'),
imageUrl: 'https://file-jimei.oss-cn-shenzhen.aliyuncs.com/static/mp-share.png' imageUrl: 'https://file-jimei.oss-cn-shenzhen.aliyuncs.com/static/mp-share.png'
} }

View File

@@ -196,7 +196,7 @@
dateFormat dateFormat
} from '@/utils/util.js' } from '@/utils/util.js'
import * as UserApi from '@/api/user' import * as UserApi from '@/api/user'
import { updateHouseInfo,getHouseInfo } from '@/api/house-info.js' import { updateHouseInfo,getHouseInfo,addHouseInfo } from '@/api/house-info.js'
import * as UploadApi from '@/api/upload' import * as UploadApi from '@/api/upload'
import * as DictApi from '@/api/dict.js' import * as DictApi from '@/api/dict.js'
@@ -225,7 +225,8 @@
// 表单数据 // 表单数据
form: { form: {
houseTitle: '', houseTitle: '',
area: '' area: '',
status: 10
}, },
fileList1: [], fileList1: [],
loading: false, loading: false,
@@ -288,7 +289,12 @@
// 微信小程序需要用此写法 // 微信小程序需要用此写法
// this.$refs.datetimePicker.setFormatter(this.formatter) // this.$refs.datetimePicker.setFormatter(this.formatter)
}, },
onUnload() {
const eventChannel = this.getOpenerEventChannel();
eventChannel.emit('reload', {
status: true
});
},
methods: { methods: {
getDict() { getDict() {
DictApi.listDictionary().then(res => { DictApi.listDictionary().then(res => {
@@ -409,15 +415,20 @@
if (app.disabled === true) return if (app.disabled === true) return
console.log("app.tempFile: ", app.tempFile); console.log("app.tempFile: ", app.tempFile);
this.$refs.uForm.validate().then(() => { this.$refs.uForm.validate().then(() => {
app.disabled = true
app.form.houseLabel = JSON.stringify(app.houseLabel) app.form.houseLabel = JSON.stringify(app.houseLabel)
app.form.files = JSON.stringify(app.fileList1) app.form.files = JSON.stringify(app.fileList1)
const saveOrUpdate = app.selectId > 0 ? updateHouseInfo : addHouseInfo; const saveOrUpdate = app.selectId > 0 ? updateHouseInfo : addHouseInfo;
saveOrUpdate(app.form).then(result => { saveOrUpdate(app.form).then(result => {
app.$toast('保存成功') app.$toast('保存成功')
setTimeout(() => {
uni.navigateBack()
},1000)
}).catch(err => { }).catch(err => {
uni.$u.toast(err) uni.$u.toast(err)
}) })
}).catch(errors => { }).catch(errors => {
console.log('errors: ',errors);
uni.$u.toast('校验失败') uni.$u.toast('校验失败')
}) })

View File

@@ -165,7 +165,7 @@
reset: true reset: true
}, },
{ {
name: '必看房', name: '必看房',
reset: false reset: false
} }
]; ];
@@ -324,6 +324,12 @@
app.swiperList = app.form.files app.swiperList = app.form.files
app.form.houseLabel = JSON.parse(res.data.houseLabel) || [] app.form.houseLabel = JSON.parse(res.data.houseLabel) || []
// app.form.supporting = JSON.parse(res.data.supporting) || [] // app.form.supporting = JSON.parse(res.data.supporting) || []
uni.$u.mpShare = {
title: `${app.form.houseTitle} ${app.form.monthlyRent}元/月 ${app.form.houseType} ${app.form.extent}`,
path: `sub_pages/house/detail?houseId=${app.form.houseId}&user_id=${uni.getStorageSync('userId')}`
// path: '' + app.form.houseId + app.form.monthlyRent + '&user_id=' + uni.getStorageSync('userId')
}
}).catch(err => { }).catch(err => {
app.$error(err.message) app.$error(err.message)
}) })

View File

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

View File

@@ -181,13 +181,13 @@
console.log(res.target) console.log(res.target)
} }
return { return {
title: '高端婚恋交友平台', title: '爱尚家找房',
path: 'pages/index/index?user_id=' + uni.getStorageSync('userId') path: 'pages/index/index?user_id=' + uni.getStorageSync('userId')
} }
}, },
onShareAppMessage() { onShareAppMessage() {
return { return {
title: '高端婚恋交友平台', title: '爱尚家找房',
path: 'pages/index/index?user_id=' + uni.getStorageSync('userId'), path: 'pages/index/index?user_id=' + uni.getStorageSync('userId'),
imageUrl: 'https://oss.jimeigroup.cn/static/mp-share.png' imageUrl: 'https://oss.jimeigroup.cn/static/mp-share.png'
} }

View File

@@ -104,7 +104,7 @@
}, },
onShareAppMessage() { onShareAppMessage() {
return { return {
title: '高端婚恋交友平台', title: '爱尚家找房',
path: 'pages/index/index?user_id=' + uni.getStorageSync('userId'), path: 'pages/index/index?user_id=' + uni.getStorageSync('userId'),
imageUrl: 'https://file-jimei.oss-cn-shenzhen.aliyuncs.com/static/mp-share.png' imageUrl: 'https://file-jimei.oss-cn-shenzhen.aliyuncs.com/static/mp-share.png'
} }

View File

@@ -2,15 +2,12 @@ module.exports = {
onLoad() { onLoad() {
// 设置默认的转发参数 // 设置默认的转发参数
uni.$u.mpShare = { uni.$u.mpShare = {
title: '', // 默认为小程序名称 title: '爱尚家找房', // 默认为小程序名称
path: '', // 默认为当前页面路径 path: 'pages/index/index?user_id=' + uni.getStorageSync('userId'), // 默认为当前页面路径
imageUrl: '' // 默认为当前页面的截图 imageUrl: '' // 默认为当前页面的截图
} }
}, },
onShareAppMessage() { onShareAppMessage() {
return { return uni.$u.mpShare
title: '高端婚恋交友平台',
path: 'pages/index/index?user_id=' + uni.getStorageSync('userId')
}
} }
} }