123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397 |
- <template>
- <view>
- <u-navbar :border-bottom="false" :is-back="true" title="我的委托"></u-navbar>
- <view class="wrap">
- <view class="u-tabs-box">
- <u-tabs-swiper ref="tabs" :current="current" :is-scroll="false" :list="list" activeColor="#2979ff"
- swiperWidth="750" @change="change"></u-tabs-swiper>
- </view>
- <swiper :current="swiperCurrent" class="swiper-box" @animationfinish="animationfinish" @transition="transition">
- <swiper-item v-for="(swiper,i) in orderList" :key="i" class="swiper-item">
- <scroll-view scroll-y style="height: 100%;width: 100%;">
- <view class="page-box">
- <view v-if="swiper.length === 0">
- <view class="centre">
- <image :src="empty" mode=""></image>
- <view class="explain">
- 您还没有相关的房源
- <view class="tips">可以去委托房源</view>
- </view>
- <view class="btn" @click="publishHouse">委托房源</view>
- </view>
- </view>
- <view v-for="(item, index) in swiper"
- v-else :key="index" class="order">
- <view class="top">
- <view class="left">
- <view class="store">{{ item.code }}</view>
- <u-icon :size="26" color="rgb(203,203,203)" name="arrow-right"></u-icon>
- </view>
- </view>
- <view class="item">
- <view class="left">
- <image :src="item.image" mode="aspectFill"></image>
- </view>
- <view class="content">
- <view class="title u-line-2">
- {{ item.villageName }}
- {{ item.type == '整租' ? item.houseNum + item.houseHall + item.toiletNum : item.roomType }}
- </view>
- <view class="price">¥{{ item.price }}</view>
- <view class="type">
- {{ item.type }} | {{ item.type == '整租' ? item.houseArea : item.roomArea }}㎡ |
- {{ item.decoration }}
- </view>
- </view>
- </view>
- <view class="bottom">
- <view v-if="item.state == 0" class="evaluate btn" @click.stop="clickImage(item.id)">修改</view>
- <view v-else class="evaluate btn" @click.stop="viewImage(item.id)">查看</view>
- </view>
- </view>
- </view>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- <view class="buttom">
- <view class="loginType">
- <view class="wechat item">
- <view class="icon">
- <u-icon color="#999" name="server-man" size="60" @click="server"></u-icon>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import config from "@/common/config.js" // 全局配置文件
- export default {
- data() {
- return {
- empty: '/static/empty/default.png',
- orderList: [[], [], [], []],
- list: [
- {
- name: '待审核'
- },
- {
- name: '待出租',
- // count: 1
- },
- {
- name: '已出租'
- },
- {
- name: '已下架',
- }
- ],
- current: 0,
- swiperCurrent: 0,
- tabsHeight: 0,
- dx: 0,
- pageNum: 1,
- pageSize: 100,
- };
- },
- onLoad() {
- this.getOrderList(0);
- this.getOrderList(1);
- this.getOrderList(2);
- this.getOrderList(3);
- },
- methods: {
- login() {
- this.$u.route('/pages/login/login')
- },
- // 页面数据
- getOrderList(idx) {
- this.findHouseList(idx)
- },
- // tab栏切换
- change(index) {
- this.swiperCurrent = index;
- this.orderList[index] = []
- this.getOrderList(index);
- },
- transition({detail: {dx}}) {
- this.$refs.tabs.setDx(dx);
- },
- animationfinish({detail: {current}}) {
- this.$refs.tabs.setFinishCurrent(current);
- this.swiperCurrent = current;
- this.current = current;
- },
- findHouseList(idx) {
- let url = "/api/houseApi/findHouseRoomList";
- let defaultData = {
- state: idx,
- publishId: uni.getStorageSync('lifeData').vuex_user.user.userId,
- villageCity: uni.getStorageSync('lifeData').vuex_city,
- pageNum: this.pageNum,
- pageSize: this.pageSize,
- orderByColumn: 'update_time,create_time',
- isAsc: 'desc'
- }
- this.$u.get(url, {...defaultData, ...this.searchData}).then(result => {
- const data = result.rows;
- this.houseList = data;
- for (let i = 0; i < this.houseList.length; i++) {
- // 先转成字符串再转成对象,避免数组对象引用导致数据混乱
- let item = this.houseList[i]
- if (!item.faceUrl.includes(config.staticUrl)) {
- item.image = config.staticUrl + item.faceUrl
- } else {
- item.image = item.faceUrl
- }
- if (item.type == 0) {
- item.type = '整租'
- } else if (item.type == 1) {
- item.type = '合租'
- }
- if (item.roomType == 1) {
- item.roomType = '主卧'
- } else if (item.roomType == 2) {
- item.roomType = '次卧'
- } else {
- item.roomType = '未知'
- }
- if (this.$u.test.isEmpty(item.houseNum)) {
- item.houseNum = ''
- }
- if (this.$u.test.isEmpty(item.houseHall)) {
- item.houseHall = ''
- }
- if (this.$u.test.isEmpty(item.toiletNum)) {
- item.toiletNum = ''
- }
- this.orderList[idx].push(item);
- }
- });
- },
- publishHouse() {
- this.$u.route('/pages/detail/preHouse');
- },
- server() {
- // window.open ('https://sourcebyte.cn')
- uni.makePhoneCall({
- phoneNumber: "18720989281",
- });
- },
- clickImage(houseId) {
- this.$u.route({
- url: '/pages/detail/preHouse',
- params: {
- houseId: houseId
- }
- })
- },
- viewImage(houseId) {
- this.$u.route({
- url: '/pages/detail/detail',
- params: {
- houseId: houseId
- }
- })
- }
- }
- };
- </script>
- <style>
- /* #ifndef H5 */
- page {
- height: 100%;
- background-color: #f2f2f2;
- }
- /* #endif */
- </style>
- <style lang="scss" scoped>
- .container {
- width: 100%;
- height: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- text-align: center;
- .empty {
- overflow: hidden;
- .tip {
- color: #909399;
- }
- .btn {
- color: #fff;
- background-color: #2979ff;
- width: 200 rpx;
- padding: 15 rpx 28 rpx;
- border-radius: 130 rpx;
- margin: 30 rpx 0 0 100 rpx;
- }
- }
- }
- .order {
- width: 710 rpx;
- background-color: #ffffff;
- margin: 20 rpx auto;
- border-radius: 20 rpx;
- box-sizing: border-box;
- padding: 20 rpx;
- font-size: 28 rpx;
- .top {
- display: flex;
- justify-content: space-between;
- .left {
- display: flex;
- align-items: center;
- .store {
- // margin: 0 10rpx;
- font-size: 32 rpx;
- }
- }
- .right {
- color: #2979ff;
- }
- }
- .item {
- display: flex;
- margin: 20 rpx 0 0 0;
- .left {
- margin-right: 30 rpx;
- image {
- width: 150 rpx;
- height: 150 rpx;
- border-radius: 10 rpx;
- }
- }
- .content {
- .title {
- font-weight: bold;
- font-size: 28 rpx;
- line-height: 50 rpx;
- }
- .price {
- margin: 10 rpx 0;
- font-size: 30 rpx;
- }
- .type {
- margin: 10 rpx 0;
- font-size: 24 rpx;
- color: $u-tips-color;
- }
- .desc {
- margin: 10 rpx 0;
- font-size: 24 rpx;
- color: $u-tips-color;
- }
- }
- }
- .bottom {
- display: flex;
- margin-top: 20 rpx;
- padding: 0 10 rpx;
- justify-content: flex-end;
- align-items: center;
- .btn {
- margin-left: 20 rpx;
- line-height: 52 rpx;
- width: 160 rpx;
- border-radius: 26 rpx;
- border: 2 rpx solid $u-border-color;
- font-size: 26 rpx;
- text-align: center;
- color: $u-type-info-dark;
- }
- .evaluate {
- // color: #2979ff;
- // border-color: #2979ff;
- color: $u-tips-color;
- border-color: $u-tips-color;
- }
- }
- }
- .centre {
- text-align: center;
- margin: 200 rpx auto;
- font-size: 32 rpx;
- image {
- width: 164 rpx;
- height: 164 rpx;
- border-radius: 50%;
- margin-bottom: 20 rpx;
- }
- .tips {
- font-size: 24 rpx;
- color: #999999;
- margin-top: 20 rpx;
- }
- .btn {
- margin: 80 rpx auto;
- width: 200 rpx;
- border-radius: 32 rpx;
- line-height: 64 rpx;
- color: #ffffff;
- font-size: 26 rpx;
- background-image: linear-gradient(to left, #2979ff, rgba(#2979ff, 0.6));
- }
- }
- .wrap {
- display: flex;
- flex-direction: column;
- height: calc(100vh - var(--window-top));
- width: 100%;
- }
- .swiper-box {
- flex: 1;
- }
- .swiper-item {
- height: 100%;
- }
- .buttom {
- .loginType {
- font-size: 14px;
- position: fixed;
- right: 30 rpx;
- bottom: 120 rpx;
- width: 60px;
- height: 60px;
- padding: 4px;
- cursor: pointer;
- background: #FFF;
- text-align: center;
- line-height: 60px;
- border-radius: 100%;
- -webkit-box-shadow: 0px 1px 20px 0px rgba(0, 0, 0, 0.1), inset 0px -1px 0px 0px rgba(0, 0, 0, 0.1);
- box-shadow: 0px 1px 20px 0px rgba(0, 0, 0, 0.1), inset 0px -1px 0px 0px rgba(0, 0, 0, 0.1);
- }
- }
- </style>
|