301 lines
7.5 KiB
Vue
301 lines
7.5 KiB
Vue
<template>
|
|
<view>
|
|
<view class="search-bg sticky">
|
|
<view class="search-box">
|
|
<view class="search-box-input">
|
|
<u-input v-model="keyword" placeholder="请输入标题进行搜索" placeholder-style="color: #969696" prefixIcon="search"
|
|
prefixIconStyle="font-size: 24px;color: #909399;" border="true" @change="getInput">
|
|
</u-input>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="content">
|
|
<ShowShopList v-if="listId == 0" :isEdit="true" :showStyle="1" :shopInfoList="searchInfoList" @delItem="handleDel"
|
|
@updateItem="handleUpdate1"></ShowShopList>
|
|
<SearchShopList v-if="listId == 1" :searchInfoList="searchInfoList" :is-edit="true" :showStyle="1"
|
|
@delItem="handleDel" @updateItem="handleUpdate2">
|
|
</SearchShopList>
|
|
<ShowShopList v-if="listId == 3" :is-edit="true" :showStyle="2" :shopInfoList="searchInfoList"
|
|
@delItem="handleDel" @updateItem="handleUpdate3"></ShowShopList>
|
|
<ShowShopList v-if="listId == 2" :is-edit="true" :showStyle="2" :shopInfoList="searchInfoList"
|
|
@delItem="handleDel" @updateItem="handleUpdate4"></ShowShopList>
|
|
<ShowShopList v-if="listId == 4" :showStyle="0" :shopInfoList="matchList"></ShowShopList>
|
|
</view>
|
|
<view v-if="showNull" class="showNull">
|
|
<text>没有符合条件的数据, 请下拉刷新重置数据~
|
|
</text>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
titletext: '',
|
|
listId: '',
|
|
matchList: [],
|
|
shopInfoList: [],
|
|
searchInfoList: [],
|
|
matchListLength: '',
|
|
searchListLength: '',
|
|
pageSize: 5,
|
|
pageNum: 1,
|
|
matchPageSize: 5,
|
|
matchPageNum: 1,
|
|
keyword: '',
|
|
refresh: false,
|
|
showNull: false,
|
|
}
|
|
},
|
|
onPullDownRefresh() {
|
|
console.log('this.listId', this.listId);
|
|
this.refresh = true
|
|
if (this.listId !== 4) {
|
|
this.getMyPublished(this.listId + 1, this.pageSize, this.pageNum)
|
|
} else {
|
|
this.getMatch()
|
|
}
|
|
this.keyword = ''
|
|
},
|
|
onReachBottom() {
|
|
if (this.listId !== 4 && !this.refresh && this.searchListLength !== 0) {
|
|
this.pageNum++
|
|
this.getMyPublished(this.listId + 1, this.pageSize, this.pageNum)
|
|
} else if (this.listId == 4 && this.matchListLength !== 0) {
|
|
this.matchPageNum++
|
|
this.getMatch()
|
|
} else if (this.searchListLength == 0) {
|
|
this.pageNum = 1
|
|
}
|
|
this.keyword = ''
|
|
},
|
|
methods: {
|
|
getInput(val) {
|
|
console.log('搜索值', val);
|
|
if (this.pageNum !== 1) {
|
|
this.pageNum = 1
|
|
}
|
|
if (this.listId !== 4) {
|
|
this.$api.getMyPublished({
|
|
type: this.listId + 1,
|
|
pageSize: this.pageSize,
|
|
pageNum: this.pageNum,
|
|
title: val
|
|
}).then(res => {
|
|
console.log('发布信息', res);
|
|
if (res.data.code == 1) {
|
|
this.searchListLength = res.data.data.length
|
|
this.searchInfoList = res.data.data
|
|
if (res.data.data.length == 0) {
|
|
this.showNull = true
|
|
} else {
|
|
this.showNull = false
|
|
}
|
|
} else {
|
|
uni.$u.toast(res.data.msg)
|
|
}
|
|
})
|
|
} else {
|
|
this.$api.getMyMatch({
|
|
pageSize: this.matchPageSize,
|
|
pageNum: this.matchPageNum,
|
|
title: val
|
|
}).then(res => {
|
|
if (res.data.code == 1) {
|
|
this.matchListLength = res.data.data.length
|
|
this.matchList = res.data.data[0]
|
|
if (res.data.data.length == 0) {
|
|
this.showNull = true
|
|
} else {
|
|
this.showNull = false
|
|
}
|
|
} else {
|
|
uni.$u.toast(res.data.msg)
|
|
}
|
|
})
|
|
}
|
|
},
|
|
handleUpdate1(searchid) {
|
|
console.log('页面更新');
|
|
uni.navigateTo({
|
|
url: '/pages/publish/publishTransfer/publishTransfer?item=' + 1 + '&id=' +
|
|
searchid
|
|
})
|
|
},
|
|
handleUpdate2(searchid) {
|
|
console.log('页面更新');
|
|
uni.navigateTo({
|
|
url: '/pages/publish/publishAddress/publishAddress?item=' + 2 + '&id=' +
|
|
searchid
|
|
})
|
|
},
|
|
handleUpdate3(searchid) {
|
|
console.log('页面更新');
|
|
uni.navigateTo({
|
|
url: '/pages/publish/publishInvestment/publishInvestment?item=' + 3 + '&id=' +
|
|
searchid
|
|
})
|
|
},
|
|
handleUpdate4(searchid) {
|
|
console.log('页面更新');
|
|
uni.navigateTo({
|
|
url: '/pages/publish/publishRent/publishRent?item=' + 4 + '&id=' +
|
|
searchid
|
|
})
|
|
},
|
|
handleDel(shopid) {
|
|
console.log('页面删除', this.listId + 1, shopid);
|
|
var that = this
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '你确定要删除吗?',
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
that.$api.deleteMyPublished({
|
|
type: that.listId + 1,
|
|
id: shopid
|
|
}).then(res => {
|
|
if (res.data.code == 1) {
|
|
that.$toast.warn('删除成功')
|
|
that.getMyPublished(that.listId + 1, that.pageSize, that.pageNum, 1)
|
|
} else {
|
|
that.$toast.warn(res.data.msg)
|
|
}
|
|
})
|
|
} else if (res.cancel) {
|
|
that.$toast.warn('取消操作')
|
|
}
|
|
}
|
|
})
|
|
|
|
},
|
|
getMatch() {
|
|
this.$api.getMyMatch({
|
|
pageSize: this.matchPageSize,
|
|
pageNum: this.matchPageNum
|
|
}).then(res => {
|
|
if (res.data.code == 1) {
|
|
this.matchListLength = res.data.data.length
|
|
this.matchList = [...this.matchList, ...res.data.data[0]]
|
|
uni.stopPullDownRefresh()
|
|
} else {
|
|
uni.$u.toast(res.data.msg)
|
|
}
|
|
})
|
|
},
|
|
getMyPublished(type, pageSize, pageNum, isDelete) {
|
|
this.$api.getMyPublished({
|
|
type: type,
|
|
pageSize: pageSize,
|
|
pageNum: pageNum
|
|
}).then(res => {
|
|
console.log('发布信息l', res, res.data.data.length);
|
|
if (res.data.code == 1) {
|
|
this.searchListLength = res.data.data.length
|
|
if (isDelete == 1) {
|
|
this.searchInfoList = res.data.data
|
|
this.refresh = false
|
|
if (res.data.data.length == 0) {
|
|
this.showNull = true
|
|
} else {
|
|
this.showNull = false
|
|
}
|
|
} else {
|
|
this.searchInfoList = [...this.searchInfoList, ...res.data.data]
|
|
}
|
|
uni.stopPullDownRefresh()
|
|
} else {
|
|
uni.$u.toast(res.data.msg)
|
|
}
|
|
})
|
|
}
|
|
},
|
|
onLoad: function(option) {
|
|
console.log('option', option.listId);
|
|
this.listId = option.listId
|
|
wx.setNavigationBarTitle({
|
|
title: option.titletext
|
|
})
|
|
this.titletext = option.titletext
|
|
if (this.titletext == '发布的店铺转让') {
|
|
this.listId = 0
|
|
this.getMyPublished(1, this.pageSize, this.pageNum)
|
|
}
|
|
if (this.titletext == '发布的找店选址') {
|
|
this.listId = 1
|
|
this.getMyPublished(2, this.pageSize, this.pageNum)
|
|
}
|
|
if (this.titletext == '发布的店铺出租') {
|
|
this.listId = 2
|
|
this.getMyPublished(3, this.pageSize, this.pageNum)
|
|
}
|
|
if (this.titletext == '发布的项目招商') {
|
|
this.listId = 3
|
|
this.getMyPublished(4, this.pageSize, this.pageNum)
|
|
}
|
|
|
|
if (this.titletext == '我的匹配') {
|
|
this.listId = 4
|
|
this.getMatch()
|
|
}
|
|
|
|
},
|
|
computed: {
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.showNull {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
height: 100rpx;
|
|
color: darkgray;
|
|
}
|
|
|
|
.search-bg {
|
|
height: 28px;
|
|
padding-top: 20rpx;
|
|
padding-bottom: 20rpx;
|
|
}
|
|
|
|
.search-box {
|
|
position: relative;
|
|
z-index: 1;
|
|
left: 50%;
|
|
width: 84.6%;
|
|
transform: translateX(-50%);
|
|
|
|
.search-box-input {
|
|
border-radius: 12rpx;
|
|
background-color: #fff;
|
|
opacity: 0.85;
|
|
|
|
.u-border {
|
|
border: none;
|
|
|
|
.u-input__content {
|
|
height: 62rpx;
|
|
border-radius: 12rpx;
|
|
background-color: #fff;
|
|
|
|
.u-input__content__field-wrapper__field {
|
|
font-size: 26rpx !important;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
page {
|
|
background-color: #F8F8F8;
|
|
}
|
|
|
|
.content {
|
|
margin: 0 10px;
|
|
}
|
|
</style> |