第一次提交

This commit is contained in:
gxwebsoft
2023-08-04 13:14:48 +08:00
commit 1b923e5cff
1030 changed files with 128016 additions and 0 deletions

797
sub_pages/house/add.vue Normal file
View File

@@ -0,0 +1,797 @@
<template>
<view class="container">
<u--form :model="form" ref="uForm" :rules="rules" labelPosition="top" :labelStyle="{paddingLeft: '10rpx'}"
label-width="200rpx">
<!-- 表单组件 -->
<view class="his-head">
<text class="title">房源信息</text>
</view>
<view class="form-wrapper">
<u-cell-group :border="false">
<u-form-item prop="houseTitle">
<u-cell title="标题" :isLink="true" customStyle="">
<u-input slot="value" class="input" v-model="form.houseTitle" inputAlign="right"
maxlength="30" :border="false" placeholder="请输入标题" />
</u-cell>
</u-form-item>
<u-form-item prop="area">
<u-cell title="城市" @click="onArea" :isLink="true">
<u-input slot="value" class="input" v-model="form.area" inputAlign="right" maxlength="30"
:border="false" placeholder="请选择所在城市" />
</u-cell>
</u-form-item>
<u-form-item prop="address">
<u-cell title="详细地址" :isLink="true">
<u-input slot="value" class="input" v-model="form.address" inputAlign="right" maxlength="30"
:border="false" placeholder="请输入详细地址" />
</u-cell>
</u-form-item>
<u-form-item prop="houseType">
<u-cell title="户型" :isLink="true" @click="showHouseType = true">
<u-input slot="value" class="input" v-model="form.houseType" inputAlign="right"
maxlength="30" :border="false" placeholder="请选择房子户型" />
</u-cell>
</u-form-item>
<u-form-item prop="leaseMethod">
<u-cell title="租赁方式" :isLink="true" @click="showLeaseMethod = true">
<u-input slot="value" class="input" v-model="form.leaseMethod" inputAlign="right"
maxlength="30" :border="false" placeholder="请选择租赁方式" />
</u-cell>
</u-form-item>
<u-form-item prop="rent">
<u-cell title="租金(元/m²)" :isLink="true">
<u-input slot="value" class="input" v-model="form.rent" inputAlign="right" maxlength="30"
:border="false" placeholder="请输入租金" />
</u-cell>
</u-form-item>
<u-form-item prop="monthlyRent">
<u-cell title="月租金(每月)" :isLink="true">
<u-input slot="value" class="input" v-model="form.monthlyRent" inputAlign="right"
maxlength="30" :border="false" placeholder="请输入您的月租金" />
</u-cell>
</u-form-item>
<u-form-item prop="extent">
<u-cell title="面积(m²)" :isLink="true">
<u-input slot="value" class="input" v-model="form.extent" inputAlign="right" maxlength="30"
:border="false" placeholder="该房屋面积" />
</u-cell>
</u-form-item>
<u-form-item prop="floor">
<u-cell title="楼层" :isLink="true" @click="showFloor = true">
<u-input slot="value" class="input" v-model="form.floor" inputAlign="right" maxlength="30"
:border="false" placeholder="请选择楼层" />
</u-cell>
</u-form-item>
<u-form-item prop="roomNumber">
<u-cell title="房号" :isLink="true">
<u-input slot="value" class="input" v-model="form.roomNumber" inputAlign="right"
maxlength="30" :border="false" placeholder="请输入房号" />
</u-cell>
</u-form-item>
<u-form-item prop="phone">
<u-cell title="业主电话" :isLink="true">
<u-input slot="value" class="input" v-model="form.phone" inputAlign="right" maxlength="30"
:border="false" placeholder="请输入业主电话" />
</u-cell>
</u-form-item>
<u-form-item prop="password">
<u-cell title="密码" :isLink="true">
<u-input slot="value" class="input" v-model="form.password" inputAlign="right"
maxlength="30" :border="false" placeholder="请输入房屋密码" />
</u-cell>
</u-form-item>
<u-form-item prop="toward">
<u-cell title="朝向" :isLink="true" @click="showToward = true">
<u-input slot="value" class="input" v-model="form.toward" inputAlign="right" maxlength="30"
:border="false" placeholder="请选择房源朝向" />
</u-cell>
</u-form-item>
</u-cell-group>
</view>
<u-form-item prop="houseLabel">
<view class="his-head">
<text class="title">房源标签</text>
</view>
<view class="form-wrapper">
<view class="house-label" v-if="dict">
<view class="u-page__tag-item" v-for="(item, index) in dict.houseLabel[0]" :key="index">
<u-tag :text="`${item}`" type="info" :plain="inArr(item)" :name="index"
:bgColor="inArr(item) ? '' : '#fd8008'" :borderColor="inArr(item) ? '' : '#fd8008'"
@click="onHouseLabel(item)">
</u-tag>
</view>
</view>
</view>
</u-form-item>
<u-form-item prop="supporting">
<view class="his-head">
<text class="title">办公室配套</text>
</view>
<view class="form-wrapper">
<view class="house-label" v-if="dict">
<view class="u-page__tag-item" v-for="(item, index) in dict.supporting[0]" :key="index">
<u-tag :text="`${item}`" type="info" :plain="inArr(item)" :name="index"
:bgColor="inArr(item) ? '' : '#fd8008'" :borderColor="inArr(item) ? '' : '#fd8008'"
@click="onHouseLabel(item)">
</u-tag>
</view>
</view>
</view>
</u-form-item>
<u-form-item prop="images">
<view class="his-head">
<text class="title">房源照片</text>
</view>
<view class="form-wrapper">
<view class="images">
<u-upload :fileList="fileList1" :maxSize="3145728" :width="72" :height="72"
@afterRead="afterRead" @delete="deletePic" name="1" multiple :maxCount="6"></u-upload>
</view>
</view>
</u-form-item>
<u-form-item prop="introduction">
<view class="his-head">
<text class="title">房源介绍</text>
</view>
<view class="form-wrapper">
<view class="textarea">
<u--textarea v-model="form.content" placeholder="请输入房源介绍"
:customStyle="{backgroundColor: '#f3f3f3'}" maxlength="200"></u--textarea>
</view>
</view>
</u-form-item>
<block v-if="dict">
<u-action-sheet :show="showSex" :actions="actions" title="请选择性别" description="请选择男或女"
@close="showSex = false" @select="sexSelect">
</u-action-sheet>
<u-datetime-picker ref="datetimePicker" :show="showBirthday" v-model="birthday" mode="date"
@close="closeBirthday" @confirm="confirmBirthday" :minDate="0" :maxDate="1112102400000"
@cancel="closeBirthday" :closeOnClickOverlay="true">
</u-datetime-picker>
<u-picker :show="showHouseType" :columns="dict.houseType" @confirm="confirmHouseType"
@cancel="closeHouseType" :closeOnClickOverlay="true" @close="closeHouseType">
</u-picker>
<u-picker :show="showLeaseMethod" :columns="dict.leaseMethod" @confirm="confirmLeaseMethod"
@cancel="closeLeaseMethod" :closeOnClickOverlay="true" @close="closeLeaseMethod">
</u-picker>
<u-picker :show="showFloor" :columns="dict.floor" @confirm="confirmFloor" @cancel="closeFloor"
:closeOnClickOverlay="true" @close="closeFloor">
</u-picker>
<u-picker :show="showToward" :columns="dict.toward" @confirm="confirmToward" @cancel="closeToward"
:closeOnClickOverlay="true" @close="closeToward">
</u-picker>
<!-- 地址选择器 -->
<liu-customize-sel ref="area" @change="chooseSuccess"></liu-customize-sel>
</block>
</u--form>
<u-gap height="80"></u-gap>
<!-- 操作按钮 -->
<view class="footer">
<view class="btn-wrapper">
<u-button text="发布" color="linear-gradient(to bottom, #27b0fd, #3f72f4)" :disabled="disabled"
shape="circle" @click="handleSubmit()"></u-button>
</view>
</view>
</view>
</template>
<script>
import store from '@/store'
import {
fileUrl
} from '@/config.js'
import {
dateFormat
} from '@/utils/util.js'
import * as UserApi from '@/api/user'
import * as HouseInfoApi from '@/api/house-info.js'
import * as UploadApi from '@/api/upload'
import * as DictApi from '@/api/dict.js'
// tab栏数据
const tabs = [{
name: `基本信息`,
value: 10
}, {
name: `择偶条件`,
value: 20
}]
export default {
data() {
return {
tabs,
tabIndex: 10,
dict: null,
// 按钮禁用
disabled: false,
// 头像路径 (用于显示)
avatarUrl: '',
// 临时图片 (用于上传)
tempFile: null,
// 表单数据
form: {
houseTitle: '',
area: ''
},
fileList1: [],
loading: false,
// regionsData: [
// ['广西壮族自治区','广东'],
// ['南宁市', '北海市', '贵港市']
// ],
showHouseType: false,
showLeaseMethod: false,
showFloor: false,
showToward: false,
houseLabel: [],
showRegion: false,
actions: [{
name: '男',
},
{
name: '女',
},
{
name: '保密',
},
],
minDate: '',
columnsHeight: [
['160cm', '170cm', '180cm']
],
birthday: Number(new Date()),
// 验证规则
rules: {
'houseTitle': {
type: 'string',
required: true,
message: '请填写标题',
trigger: ['blur', 'change']
}
},
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {
this.getDict()
},
// 必须要在onReady生命周期因为onLoad生命周期组件可能尚未创建完毕
onReady() {
// this.$refs.uForm.setRules(this.rules)
// 微信小程序需要用此写法
// this.$refs.datetimePicker.setFormatter(this.formatter)
},
methods: {
getDict() {
DictApi.listDictionary().then(res => {
this.dict = res.data;
})
},
onChangeTab(e) {
const app = this
app.tabIndex = e.value
},
sexSelect(e) {
const app = this
console.log("e.name: ", e.name);
app.form.sexName = e.name
if (e.name == '男') {
app.form.userInfo.sex = 1
}
if (e.name == '女') {
app.form.userInfo.sex = 2
}
if (e.name == '保密') {
app.form.userInfo.sex = 0
}
console.log("app.form.userInfo.sex: ", app.form.userInfo.sex);
this.$refs.uForm.validateField('sexName')
},
// 选择微信地址
// #ifdef MP-WEIXIN
chooseAddress() {
const {
form,
$refs
} = this
uni.chooseAddress({
success(res) {
const names = $refs.sRegion.getOptionItemByNames(res)
form.name = res.userName
form.phone = res.telNumber
form.detail = res.detailInfo
form.region = names.length > 0 ? names : []
}
})
},
// #endif
// 点击头像按钮事件
onClickAvatar() {
// #ifdef MP-WEIXIN
return
// #endif
this.chooseImage()
},
// 选择头像事件 - 仅限微信小程序
// #ifdef MP-WEIXIN
onChooseAvatar({
detail
}) {
const app = this
app.form.avatar = detail.avatarUrl
app.tempFile = detail.avatarUrl
// 上传头像图片
app.uploadFile()
},
// #endif
// 选择图片
chooseImage() {
const app = this
console.log("选择图片: ");
// 选择图片
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success(chooseImageRes) {
const tempFilePaths = chooseImageRes.tempFilePaths;
UploadApi.uploadFile({
filePath: tempFilePaths[0],
fileType: 'image',
name: 'file'
}).then(res => {
console.log("res: ", res);
app.form.avatar = fileUrl + res.data.path
console.log("form: ", app.form);
})
}
});
},
// 上传图片
uploadFile() {
const app = this
UploadApi.uploadFile({
filePath: app.tempFile,
fileType: 'image',
name: 'file'
}).then(res => {
app.form.avatar = res.data.url
HouseInfoApi.updateUserProfile(app.form)
})
},
// 确认修改
async handleSubmit() {
const app = this
if (app.disabled === true) return
console.log("app.tempFile: ", app.tempFile);
this.$refs.uForm.validate().then(() => {
app.form.houseLabel = JSON.stringify(app.houseLabel)
app.form.files = JSON.stringify(app.fileList1)
HouseInfoApi.addHouseInfo(app.form).then(result => {
app.$toast(result.message)
}).catch(err => {
uni.$u.toast(err)
})
}).catch(errors => {
uni.$u.toast('校验失败')
})
// 判断是否重复提交
// if (app.disabled === true) return
// app.$refs.uForm.validate(async valid => {
// if (valid) {
// console.log("valid: ", valid);
// // 按钮禁用
// app.disabled = true
// // 先上传头像图片
// if (app.tempFile) {
// await app.uploadFile()
// }
// // 提交保存个人信息
// UserApi.updateUser(app.form)
// .then(result => {
// app.$toast(result.message)
// setTimeout(() => {
// app.disabled = false
// uni.navigateBack()
// }, 1500)
// })
// .catch(err => app.disabled = false)
// }
// })
},
// 确认修改
// async handleSubmit() {
// const app = this
// if (app.disabled === true) return
// return new Promise((resolve, reject) => {
// app.$refs.uForm.validate().then(() => {
// app.form.houseLabel = JSON.stringify(app.houseLabel)
// app.form.images = JSON.stringify(app.fileList1)
// HouseInfoApi.addHouseInfo(app.form).then(result => {
// console.log("result: ",result);
// app.$toast(result.message)
// }).catch(err => {
// uni.$u.toast(err)
// })
// }).catch(errors => {
// // uni.$u.toast('校验失败')
// })
// })
// },
onHouseLabel(text) {
const app = this
if (app.houseLabel.indexOf(text) > -1) {
console.log("1: ");
app.houseLabel.splice(app.houseLabel.indexOf(text), 1)
} else {
console.log("2: ");
app.houseLabel.push(text)
}
},
inArr(text) {
const {
houseLabel
} = this
if (houseLabel.indexOf(text) > -1) {
return false
}
return true
},
// 绑定昵称输入框 (用于微信小程序端快速填写昵称能力)
onInputNickName(val) {
console.log("val: ", val);
if (val) {
this.form.nickname = val
}
},
formatter(type, value) {
if (type === 'year') {
return `${value}`
}
if (type === 'month') {
return `${value}`
}
if (type === 'day') {
return `${value}`
}
console.log("value: ", value);
return value
},
onArea() {
this.$refs.area.open()
},
//地址选择成功
chooseSuccess(e) {
const data = e.value
this.form.province = data[0].label
this.form.city = data[1].label
this.form.region = data[2].label
this.form.area = `${data[0].label} ${data[1].label} ${data[2].label}`
console.log("this.form.area: ",this.form.area);
},
changeHandler(e) {
console.log("e: ", e);
},
confirmHouseType(e) {
this.form.houseType = e.value[0]
this.showHouseType = false
},
closeHouseType() {
this.showHouseType = false
},
confirmLeaseMethod(e) {
this.form.leaseMethod = e.value[0]
this.showLeaseMethod = false
},
closeLeaseMethod() {
this.showLeaseMethod = false
},
confirmFloor(e) {
this.form.floor = e.value[0]
this.showFloor = false
},
closeFloor() {
this.showFloor = false
},
confirmToward(e) {
this.form.toward = e.value[0]
this.showToward = false
},
closeToward() {
this.showToward = false
},
confirmRegion(e) {
this.form.region = e.value[0] + ' ' + e.value[1]
this.showRegion = false
},
pickerRegion(e) {
console.log("e: ", e);
},
chooseBgImage() {
const app = this;
uni.showActionSheet({
itemList: ['更换背景图'],
success() {
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success(chooseImageRes) {
const tempFilePaths = chooseImageRes.tempFilePaths;
app.uploadFilePromise(tempFilePaths[0]).then(result => {
app.form.bgImage = result.url
console.log(app.form, result.url);
})
}
});
}
})
},
// 删除图片
deletePic(event) {
this[`fileList${event.name}`].splice(event.index, 1)
},
// 新增图片
async afterRead(event) {
console.log("event: ", event);
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
let lists = [].concat(event.file)
let fileListLen = this[`fileList${event.name}`].length
lists.map((item) => {
this[`fileList${event.name}`].push({
...item,
status: 'uploading',
message: '上传中'
})
})
for (let i = 0; i < lists.length; i++) {
const result = await this.uploadFilePromise(lists[i].url)
let item = this[`fileList${event.name}`][fileListLen]
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
status: 'success',
message: '',
url: result.url,
thumb: result.thumbUrl
}))
fileListLen++
}
},
uploadFilePromise(url) {
return new Promise((resolve, reject) => {
UploadApi.uploadFile({
filePath: url,
fileType: 'image',
name: 'file',
header: {
Authorization: uni.getStorageSync('AccessToken')
},
}).then(result => {
setTimeout(() => {
resolve(result.data)
}, 1000)
}).catch(err => {
console.log("err: ", err);
})
// UploadApi.uploadFile()
// let a = uni.uploadFile({
// url: fileUrl + '/file/image', // 仅为示例,非真实的接口地址
// filePath: url,
// name: 'file',
// header: {
// Authorization: uni.getStorageSync('AccessToken')
// },
// formData: {
// user: 'test'
// },
// success: (res) => {
// const result = JSON.parse(res.data)
// setTimeout(() => {
// resolve(result)
// }, 1000)
// }
// });
})
},
}
}
</script>
<style>
page {
background: #f7f8fa;
}
</style>
<style lang="scss" scoped>
.container {}
.bg {
width: 750rpx;
height: 100%;
position: absolute;
top: 0;
z-index: 0;
background-color: #0d0119;
opacity: .3;
}
.page-title {
width: 94%;
margin: 0 auto;
padding-top: 40rpx;
font-size: 28rpx;
color: rgba(69, 90, 100, 0.6);
}
.header {
height: 220rpx;
padding: 40rpx 0;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
background-color: #101010;
color: #cccccc;
font-size: 24rpx;
position: relative;
overflow: hidden;
button {
background: none;
}
text {
padding: 12rpx 0;
}
}
.form-wrapper {
margin: 20rpx auto 20rpx auto;
padding: 20rpx;
width: 660rpx;
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
border-radius: 16rpx;
background: #fff;
.input {
text-align: right !important;
width: 500rpx !important;
}
.house-label {
padding: 10rpx;
display: flex;
justify-content: flex-start;
flex-wrap: wrap;
.u-page__tag-item {
margin-bottom: 10rpx;
margin-right: 10rpx;
white-space: nowrap;
}
}
}
/* 底部操作栏 */
.footer {
margin-top: 50rpx;
padding-bottom: 50rpx;
position: fixed;
z-index: 999;
left: 0;
right: 0;
bottom: 0;
background-color: #f7f8fa;
padding-top: 20rpx;
.btn-wrapper {
width: 360rpx;
margin: auto;
// display: flex;
// align-items: center;
padding: 0 20rpx;
}
.btn-item {
flex: 1;
font-size: 28rpx;
height: 86rpx;
color: #fff;
border-radius: 50rpx;
display: flex;
justify-content: center;
align-items: center;
}
.btn-item-wechat {
background: #0ba90b;
margin-bottom: 26rpx;
}
.btn-item-main {
background: linear-gradient(to right, $main-bg, $main-bg2);
color: $main-text;
// 禁用按钮
&.disabled {
opacity: 0.6;
}
}
}
.tabs {
width: 700rpx;
margin: auto;
display: flex;
justify-content: center;
}
.textarea {
background-color: #f3f3f3;
}
.images {
padding: 10rpx;
}
.his-head {
width: 660rpx;
margin: auto;
display: flex;
justify-content: flex-start;
align-items: center;
font-size: 30rpx;
padding-top: 20rpx;
color: #333333;
font-weight: 600;
.line {
background-color: #681752;
width: 8rpx;
height: 30rpx;
margin-right: 12rpx;
}
.icon {
float: right;
}
}
</style>

577
sub_pages/house/detail.vue Normal file
View File

@@ -0,0 +1,577 @@
<template>
<view class="page">
<!-- 幻灯片 -->
<view class="swiper">
<u-swiper :list="form.files" :height="250" :radius="0" @change="e => currentNum = e.current"
indicatorStyle="right: 20px; bottom: 50px" @click="click">
<view slot="indicator" class="indicator-num">
<text class="indicator-num__text">{{ currentNum + 1 }}/{{ swiperList.length + 1 }}</text>
</view>
</u-swiper>
<!-- 房源参数 -->
<view class="house-info">
<view class="title">
{{ form.houseTitle }}
<!-- 五象航洋城三室一厅采光好新房精装修三房一厅 采光好乘诚意出售 -->
</view>
<view class="label">
<view class="u-page__tag-item" v-for="tag in form.houseLabel">
<u-tag :text="tag" type="primary" plain size="mini"></u-tag>
</view>
</view>
<view class="dict">
<view class="dict-item">
<text class="title">{{ form.monthlyRent }}/</text>
<text class="desc">月租</text>
</view>
<view class="dict-item">
<text class="title">{{ form.extent }}</text>
<text class="desc">建筑面积</text>
</view>
<view class="dict-item">
<text class="title">{{ form.houseType }}</text>
<text class="desc">户型</text>
</view>
<view class="dict-item">
<text class="title">{{ form.floor }}</text>
<text class="desc">楼层</text>
</view>
</view>
</view>
</view>
<!-- 房源介绍 -->
<u-gap height="124"></u-gap>
<view class="house-card">
<view class="title">
房源介绍
</view>
<view class="field-list">
<view class="item col-2">
城市{{ form.city }}
</view>
<view class="item col-2">
/{{ form.region }}
</view>
<view class="item col-1">
详细地址{{ form.address }}
</view>
<view class="item col-2">
租金(/){{ form.rent }}
</view>
<view class="item col-2">
房号{{ form.roomNumber }}
</view>
<view class="item col-2">
密码{{ form.password }}
</view>
<view class="item col-2">业主电话{{ form.phone }}</view>
</view>
</view>
<!-- 办公室配套 -->
<u-gap></u-gap>
<view class="house-card">
<view class="title">
办公室配套
</view>
<view class="field-list">
<u-grid :border="false" col="5" @click="click">
<u-grid-item v-for="(baseListItem,baseListIndex) in form.supporting" :key="baseListIndex">
<u-icon :customStyle="{paddingTop:20+'rpx'}" :name="baseListItem.name" :size="22"></u-icon>
<text class="grid-text">{{baseListItem.title}}</text>
</u-grid-item>
</u-grid>
</view>
</view>
<!-- 房源介绍 -->
<u-gap></u-gap>
<view class="house-card">
<view class="title">
房源介绍
</view>
<view class="about">
<mp-html :content="form.content" />
</view>
</view>
<!-- 房源位置 -->
<u-gap></u-gap>
<view class="house-card">
<view class="title">
房源位置
</view>
<view class="position">
<map style="width: 100%; height: 200px;" :latitude="form.latitude" :longitude="form.longitude"
:markers="covers">
</map>
</view>
</view>
<!-- 房产经纪人 -->
<u-gap></u-gap>
<view class="user-card">
<u-cell :title="`${form.nickname}`" :label="`发布房源10套`" :border="false">
<u-avatar slot="icon" size="50"
:src="form.avatar"
customStyle="margin: -3px 5px -3px 0"></u-avatar>
<!-- <view solt="label">
<text class="desc-text">{{ `ID${item.userId}` }}</text>
<text class="desc-text">{{ `粉丝:${item.id}` }}</text>
</view> -->
<view slot="right-icon" class="follow-btn" @click.stop="onFollow">
<text style="color: #666666;">{{ form.gradeName }}</text>
</view>
</u-cell>
</view>
<!-- 操作栏 -->
<u-gap height="100"></u-gap>
<view class="pay-tools">
<view class="item" @click="onHeart">
<u-icon name="heart-fill" size="28" color="#ff0000" v-if="heart"></u-icon>
<u-icon name="heart" size="28" v-else></u-icon>
<text v-if="heart">已收藏</text>
<text v-else>收藏</text>
</view>
<view class="item" @click="$push('sub_pages/checkout/checkout?id=' + form.houseId)">
<u-button icon="map" type="error" text="预约看房"></u-button>
</view>
<view class="item" @click="onCall">
<u-button icon="phone" type="primary" text="电话咨询"></u-button>
</view>
</view>
</view>
</template>
<script>
import * as Util from '@/utils/util.js'
import store from '@/store'
import storage from '@/utils/storage'
import * as HouseInfoApi from '@/api/house-info.js'
const menu = [{
name: '推荐',
reset: true
},
{
name: '必看房源',
reset: false
}
];
const region = [{
value: 0,
text: "青秀区"
},
{
value: 1,
text: "兴宁区"
}
];
const price = [{
value: 0,
text: "3000"
},
{
value: 1,
text: "4000"
}
];
const extent = [{
value: 0,
text: "200平"
},
{
value: 1,
text: "300平"
}
];
const sort = [{
value: 0,
text: "升序"
},
{
value: 1,
text: "降序"
}
];
const baseList = [{
name: 'star',
title: '价格低'
},
{
name: 'star',
title: '间隔'
},
{
name: 'star',
title: '工区大'
},
{
name: 'star',
title: '朝向东'
},
{
name: 'star',
title: '朝向西'
},
{
name: 'star',
title: '朝向南'
},
{
name: 'star',
title: '朝向北'
},
{
name: 'star',
title: '中间楼层'
},
{
name: 'star',
title: '高楼层'
},
{
name: 'star',
title: '低楼层'
},
{
name: 'star',
title: '落地窗'
},
{
name: 'star',
title: '通上下水'
},
{
name: 'star',
title: '可做厨房'
},
{
name: 'star',
title: '中央空调'
},
]
const loginUserId = uni.getStorageSync('userId')
export default {
data() {
return {
houseId: 0,
form: {
},
swiperList: [
'https://file.wsdns.cn/20230802/f33f5ac239c843438b36f40941d946ef.png',
'https://file.wsdns.cn/20230802/1116a02b07904991b2ebdc2c3da4a691.png',
],
menu,
region,
price,
extent,
sort,
baseList,
currentNum: 0,
scrollTop: 0,
old: {
scrollTop: 0
},
actionStyle: {
background: '#3f72f4',
color: '#ffffff',
padding: '12rpx 0',
borderRadius: '12rpx'
},
heart: false,
latitude: 39.909,
longitude: 116.39742,
covers: [{
latitude: 39.909,
longitude: 116.39742,
iconPath: 'https://oss.wsdns.cn/20230803/49fe9c001370488caf29c3decb34f6c7.png?x-oss-process=image/resize,w_750/quality,Q_90'
}]
};
},
onLoad(options) {
this.houseId = options.houseId
this.getHouseInfo()
},
onShow() {},
onBackPress() {},
onUnload() {
},
onPageScroll(e) {
this.scrollTop = e.scrollTop
},
methods: {
getHouseInfo() {
const app = this
const {
houseId
} = this
HouseInfoApi.getHouseInfo(houseId).then(res => {
app.form = res.data
app.form.files = JSON.parse(res.data.files) || []
app.form.houseLabel = JSON.parse(res.data.houseLabel) || []
// app.form.supporting = JSON.parse(res.data.supporting) || []
}).catch(err => {
app.$error(err.message)
})
},
onHeart() {
this.heart = !this.heart
},
onCall() {
uni.makePhoneCall({
phoneNumber: '15878179339'
})
}
},
watch: {
}
};
</script>
<style lang="scss" scoped>
.page {
.search-fix {
width: 750rpx;
margin: auto;
display: flex;
.search {
width: 690rpx;
margin: 15rpx auto;
display: flex;
justify-content: space-between;
align-items: center;
}
}
.search-tools {
width: 700rpx;
margin: auto;
display: flex;
justify-content: space-around;
.region {
width: 170rpx;
background-color: #ffffff;
}
}
.fixed {
position: fixed;
top: 300rpx;
left: 125rpx;
}
.no-fixed {
position: absolute;
top: 0rpx;
left: 125rpx;
}
.tabs {
margin-top: 50rpx;
}
.swiper {
position: relative;
.house-info {
width: 660rpx;
height: 240rpx;
background-color: #FFFFFF;
border-radius: 15rpx;
margin: auto;
padding: 20rpx;
position: absolute;
bottom: -200rpx;
left: 25rpx;
z-index: 100;
.label {
margin: 10rpx 0;
display: flex;
.u-page__tag-item {
margin-bottom: 10rpx;
margin-right: 10rpx;
white-space: nowrap;
}
}
.dict {
display: flex;
justify-content: space-between;
.dict-item {
display: flex;
flex-direction: column;
font-size: 26rpx;
.title {
color: #ff0000;
}
.desc {
color: #999999;
}
}
}
}
}
.user-card {
width: 660rpx;
background-color: #FFFFFF;
border-radius: 15rpx;
margin: auto;
padding: 20rpx;
z-index: 100;
}
.house-card {
width: 660rpx;
min-height: 240rpx;
background-color: #FFFFFF;
border-radius: 15rpx;
margin: auto;
padding: 20rpx;
z-index: 100;
.title {
font-size: 36rpx;
padding-bottom: 10rpx;
}
.field-list {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.item {
width: 320rpx;
font-weight: 350;
font-size: 28rpx;
line-height: 1.7rem;
color: #4b4b4b;
}
.col-1 {
width: 640rpx !important;
}
.col-2 {
width: 320rpx;
}
.grid-text {
font-weight: 350;
font-size: 28rpx;
color: #4b4b4b;
}
.about {
color: #4b4b4b;
font-weight: 350;
font-size: 28rpx;
}
}
}
.house-list {
width: 700rpx;
margin: 20rpx auto;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.item {
margin-bottom: 40rpx;
border-radius: 20rpx;
// box-shadow: 0 3rpx 10rpx 0px #cccccc;
background-color: #ffffff;
width: 338rpx;
image {
border-radius: 20rpx 20rpx 0 0;
height: 420rpx;
width: 338rpx;
}
.info {
padding: 20rpx 20rpx;
display: flex;
flex-direction: column;
.title {
font-size: 30rpx;
text-overflow: -o-ellipsis-lastline;
overflow: hidden; //溢出内容隐藏
text-overflow: ellipsis; //文本溢出部分用省略号表示
display: -webkit-box; //特别显示模式
-webkit-line-clamp: 2; //行数
line-clamp: 2;
-webkit-box-orient: vertical; //盒子中内容竖直排列
}
.desc {
color: #999999;
font-size: 28rpx;
}
.price {
color: #ff0000;
font-size: 30rpx;
}
}
}
}
}
.pay-tools {
position: fixed;
bottom: 0;
height: 120rpx;
width: 750rpx;
border-top: 1rpx solid #f3f3f3;
background-color: #ffffff;
display: flex;
justify-content: space-around;
.item {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 28rpx;
}
}
.indicator-num {
padding: 2px 0;
background-color: rgba(0, 0, 0, 0.35);
border-radius: 100px;
width: 35px;
@include flex;
justify-content: center;
&__text {
color: #FFFFFF;
font-size: 12px;
}
}
.demo-layout {
color: #ff0000;
}
</style>

295
sub_pages/house/house.vue Normal file
View File

@@ -0,0 +1,295 @@
<template>
<view class="search">
<u-sticky>
<view class="search-wrapper">
<u-search color="#333333" border-color="#E8E8E8" :showAction="true" actionText="搜索" :animation="false"
v-model="where.keywords" @search="onSearch" @custom="onSearch"
:actionStyle="actionStyle"></u-search>
</view>
</u-sticky>
<view class="order-total">
<view class="pay-btn">
<view class="btn">
<u-button text="上架" plain size="small" @click="onPay(item.logId)"></u-button>
</view>
<view class="btn">
<u-button text="下架" plain size="small" @click="onPay(item.logId)"></u-button>
</view>
<view class="btn">
<u-button text="删除" plain size="small" @click="onPay(item.logId)"></u-button>
</view>
<view class="btn">
<u-button text="分享" plain size="small" @click="onPay(item.logId)"></u-button>
</view>
<!-- <view class="btn" v-if="item.payStatus == 10">
<u-button text="取消订单" size="small" @click="onRemove(item.logId)"></u-button>
</view> -->
</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>
<view class="list">
<view class="item" @click="$push('sub_pages/house/detail?id=')">
<view class="badge" @click="onBadge(1)"><u-badge :isDot="true" type="info" :bgColor="bgColor"></u-badge></view>
<image class="image" src="https://oss-aishangjia.oss-cn-shenzhen.aliyuncs.com/v2_rwr9ba.jpg"></image>
<view class="info">
<view class="title">整租·万科云城 2室1厅1卫</view>
<view class="desc"><text>50.8|</text></view>
<view class="price">6600/</view>
</view>
</view>
<view class="item" @click="$push('sub_pages/house/detail?id=')">
<image class="image" src="https://oss-aishangjia.oss-cn-shenzhen.aliyuncs.com/v2_rwr9ba.jpg"></image>
<view class="info">
<view class="title">整租·万科云城 2室1厅1卫</view>
<view class="desc"><text>50.8|</text></view>
<view class="price">6600/</view>
</view>
</view>
<view class="item" @click="$push('sub_pages/house/detail?id=')">
<image class="image" src="https://oss-aishangjia.oss-cn-shenzhen.aliyuncs.com/v2_rwr9ba.jpg"></image>
<view class="info">
<view class="title">整租·万科云城 2室1厅1卫</view>
<view class="desc"><text>50.8|</text></view>
<view class="price">6600/</view>
</view>
</view>
<view class="item" @click="$push('sub_pages/house/detail?id=')">
<image class="image" src="https://oss-aishangjia.oss-cn-shenzhen.aliyuncs.com/v2_rwr9ba.jpg"></image>
<view class="info">
<view class="title">整租·万科云城 2室1厅1卫</view>
<view class="desc"><text>50.8|</text></view>
<view class="price">6600/</view>
</view>
</view>
</view>
</view>
<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>
</view>
</view>
</view>
</template>
<script>
import store from '@/store'
import {
fileUrl
} from '@/config.js'
import {
dateFormat
} from '@/utils/util.js'
import * as UserApi from '@/api/user'
import * as UserProfileApi from '@/api/love-user-profile.js'
import * as UploadApi from '@/api/upload'
import * as DictApi from '@/api/dict.js'
export default {
data() {
return {
select: [],
bgColor: '#ffffff'
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {
// this.getDict()
},
// 必须要在onReady生命周期因为onLoad生命周期组件可能尚未创建完毕
onReady() {
// this.$refs.uForm.setRules(this.rules)
// 微信小程序需要用此写法
// this.$refs.datetimePicker.setFormatter(this.formatter)
},
methods: {
onSearch() {
this.$push('/sub_pages/member/member', this.where)
},
onBadge(id){
this.bgColor = '#ff0000'
}
}
}
</script>
<style>
page {
background: #f7f8fa;
}
</style>
<style lang="scss" scoped>
.container {}
.search-wrapper {
display: flex;
height: 64rpx;
padding: 20rpx;
background-color: #FFFFFF;
}
// 搜索输入框
.search-input {
width: 80%;
background: #fff;
height: 72rpx;
line-height: 72rpx;
border-radius: 10rpx 0 0 10rpx;
box-sizing: border-box;
overflow: hidden;
.search-input-wrapper {
display: flex;
.left {
display: flex;
width: 60rpx;
justify-content: center;
align-items: center;
.search-icon {
display: block;
color: #b4b4b4;
font-size: 28rpx;
}
}
.right {
flex: 1;
input {
font-size: 28rpx;
height: 72rpx;
line-height: 72rpx;
display: flex;
align-items: center;
.input-placeholder {
color: #aba9a9;
}
}
}
}
}
// 搜索按钮
.search-button {
width: 20%;
box-sizing: border-box;
.button {
height: 64rpx;
font-size: 28rpx;
border-radius: 0 10rpx 10rpx 0;
background: $main-bg;
color: $main-text;
display: flex;
justify-content: center;
align-items: center;
}
}
// 订单合计
.order-total {
margin: 10rpx auto;
font-size: 26rpx;
vertical-align: bottom;
text-align: right;
height: 50rpx;
padding-top: 10rpx;
display: flex;
justify-content: center;
.pay-btn{
display: flex;
.btn{
margin-right: 16rpx;
}
}
.total-price{
display: flex;
align-items: center;
}
.unit {
margin-left: 8rpx;
margin-right: -2rpx;
font-size: 26rpx;
}
.money {
font-size: 28rpx;
color: #ff0000;
}
}
.house{
margin: 30rpx auto;
width: 680rpx;
.btn{
width: 150rpx;
margin: 40rpx 0;
}
.list{
width: 680rpx;
margin: auto;
.item{
border-radius: 30rpx 30rpx 0 0;
box-shadow: 0 3rpx 10rpx 0px #999999;
background-color: #FFFFFF;
margin: 50rpx auto;
position: relative;
.badge{
position: absolute;
left: 30rpx;
top: 30rpx;
}
.image{
width: 680rpx;
height: 360rpx;
border-radius: 30rpx 30rpx 0 0;
}
.info{
padding: 20rpx 20rpx;
display: flex;
flex-direction: column;
.title{
font-size: 40rpx;
}
.desc{
color: #999999;
font-size: 28rpx;
}
.price{
color: #ff0000;
font-size: 30rpx;
}
}
}
}
}
.float{
width: 750rpx;
display: flex;
justify-content: center;
position: fixed;
bottom: 100rpx;
.release{
width: 500rpx;
opacity: 0.9;
}
}
</style>