diff --git a/pages/canteenRent/rentList.vue b/pages/canteenRent/rentList.vue index eb3b172..da109be 100644 --- a/pages/canteenRent/rentList.vue +++ b/pages/canteenRent/rentList.vue @@ -7,27 +7,26 @@ - + - + - - {{state.model.city_name ? proCity:'地区' }} + + {{state.model.city_name ? state.model.city_name:'全国' }} - - - - - {{dictLabel || '标签'}} + + {{dictLabel || '标签'}} @@ -55,7 +54,18 @@ {{item.platform_title}} - 标签 + + + + {{e}} + + + + + - - - + @@ -123,10 +124,12 @@ address1: null, categoryId: null, tags: '', + cate_ids: '', area: null, city: null, + province: null, district: null, - keywords:null, + keywords: null, // district: '', }) @@ -135,18 +138,11 @@ onLoad(() => { getList(); + getTagList() }) onShow(() => {}) - - // 数据 - const pagination = { - data: [], - current_page: 1, - total: 1, - last_page: 1, - }; - + const state = reactive({ showRegion: false, model: { @@ -162,21 +158,14 @@ address, region, }, - currentTab: 0, - pagination: { - data: [], - current_page: 1, - total: 1, - last_page: 1, - }, loadStatus: '', type: '', }); const proCity = ref(''); //省市页面显示 - function searchRent() { - console.log('搜索'); + console.log('搜索',listQuery.value.keywords); + getList() } const onRegionConfirm = (e) => { @@ -186,76 +175,90 @@ ...state.model, ...e, }; - - proCity.value = state.model.province_name + " " + state.model.city_name + // proCity.value = state.model.province_name + " " + state.model.city_name console.log('onRegionConfirm33', state.model, proCity.value); + listQuery.value.province = state.model.province_id + listQuery.value.city = state.model.city_id + getList() state.showRegion = false; }; /* 标签 */ - // const getTagList = () => { - // const obj = [{ - // dictLabel:'全部', - // dictCode:'' - // }] - // getTag(listQuery.value).then(res => { - // tagList.value = obj.concat(res.data) - // total.value = res.total - // }) - // } + const tagShowList = ref([]) + async function getTagList() { + const obj = [{ + name: '全部', + id: '' + }] + const res = await sheep.$api.rent.tagsList({}); + if (res.code == 1) { + tagList.value = obj.concat(res.data.list) + tagShowList.value = tagList.value.map(({ + name, + id + }) => ({ + name, + id + })); + console.log('tagList', tagList.value, tagShowList.value); + } + } /**选择标签 */ - // function onChangeTag(e) { - // const value = e.detail.value; - // listQuery.value.tags = tagList.value[e.detail.value].dictLabel; - // dictLabel.value = tagList.value[e.detail.value].dictLabel; - // console.log('标签',listQuery.value); - // getList(listQuery.value); + function onChangeTag(e) { + const value = e.detail.value; + listQuery.value.cate_ids = tagList.value[e.detail.value].id; + dictLabel.value = tagList.value[e.detail.value].name; + console.log('标签', listQuery.value); + getList(listQuery.value); - // } + } const rentList = ref([]) //招租列表 async function getList() { - // state.loadStatus = 'loading'; - let res = await sheep.$api.rent.rentlist({ - keywords: listQuery.keywords, - page:listQuery.page, - limit: listQuery.limit, - my:1, - order:'normal', - status:1, + const res = await sheep.$api.rent.rentlist({ + keywords: listQuery.value.keywords, + page: listQuery.value.page, + limit: listQuery.value.limit, + cate_ids: listQuery.value.cate_ids, + my: 1, + order: 'normal', + status: 1, + province: listQuery.value.province, + city: listQuery.value.city, }); - console.log('getList',res); - if (res.code === 1) { - rentList.value = res.data.list - for(let i = 0;i { + // Create a new object with all properties from the original item + const newItem = { + ...item + }; + + // Only process release_time_text if it exists + if (newItem.release_time_text) { + newItem.release_time_text = newItem.release_time_text.substring(0, 10); + } + + return newItem; + }); + } else { + // Handle case where data is not in expected format + rentList.value = []; } - // if (state.pagination.current_page < state.pagination.last_page) { - // state.loadStatus = 'more'; - // } else { - // state.loadStatus = 'noMore'; + + // rentList.value = res.data.list; + // for(let i=0;i { - // loadmore(); - }); + .ui-btn-picker--primary { + color: blue; + } + + .ui-btn-picker--tips { + color: red; + } + \ No newline at end of file