Merge branch 'dev' into dev-AI-v5

This commit is contained in:
lifizer
2026-06-01 09:14:12 +08:00
6 changed files with 708 additions and 196 deletions
+382 -121
View File
@@ -349,7 +349,7 @@
</view>
</view>
<view class="v12-px-6" >
<u-divider :text="infoArray.length === 0 ? ' · 暂无资讯 · ' : ' · 已经到底啦 · '" textPosition="center"></u-divider>
<u-divider :text="infoArray.length === 0 ? ' · 暂无资讯 · ' : ` · ${getLoadMoreText(infoLoading, infoHasMore, infoArray)} · `" textPosition="center"></u-divider>
</view>
</view>
</view>
@@ -401,7 +401,7 @@
v-if="activeIndex === 2"
class="guide-section"
>
<view v-if="isLoadInfoListSuccess">
<view v-if="isLoadGuideListoSuccess">
<view class="guide-list">
<view
v-for="(item, index) in guideList"
@@ -430,7 +430,7 @@
class="no-data-loadend"
/> -->
<view class="v12-px-6" >
<u-divider :text="guideList.length === 0 ? ' · 暂无攻略 · ' : ' · 已经到底啦 · '" textPosition="center"></u-divider>
<u-divider :text="guideList.length === 0 ? ' · 暂无攻略 · ' : ` · ${getLoadMoreText(guideLoading, guideHasMore, guideList)} · `" textPosition="center"></u-divider>
</view>
</view>
<goo-skeleton v-else />
@@ -533,6 +533,9 @@
</view>
</view>
</view>
<view v-if="industryList.length > 0 || investmentFileList.length > 0" class="load-more-status">
{{ getLoadMoreText(industryLoading || investmentLoading, industryHasMore || investmentHasMore, industryList.length ? industryList : investmentFileList) }}
</view>
<!-- <view class="project-wrap">
<view class="title">
<image
@@ -633,6 +636,9 @@
</view>
</view>
</view>
<view v-if="shopList.length > 0" class="load-more-status">
{{ getLoadMoreText(shopLoading, shopHasMore, shopList) }}
</view>
</view>
<view v-if="industryTabIndex === 2">
<view class="card-wrap">
@@ -698,6 +704,9 @@
</view>
</view>
</view>
<view v-if="jiaLouList.length > 0" class="load-more-status">
{{ getLoadMoreText(jiaLouLoading, jiaLouHasMore, jiaLouList) }}
</view>
</view>
<view v-if="industryTabIndex === 3">
<view class="card-wrap">
@@ -769,6 +778,9 @@
</view>
</view>
</view>
<view v-if="villageList.length > 0" class="load-more-status">
{{ getLoadMoreText(villageLoading, villageHasMore, villageList) }}
</view>
</view>
</view>
<!-- 产品 -->
@@ -907,7 +919,6 @@ import {
postCountyFamousNewsZan,
postCountyFamousNewsView,
getCountyFamousIndustry,
getCountyFamousIndustryProject,
getCountyFamousInvestmentFile,
getCountyFamousVillage,
getCountyFamousCityDetail,
@@ -958,6 +969,7 @@ export default {
showShare: false,
posterUrl: '', // 分享海报
id: null,
pageSize: 10,
partnerId: null,
isLike: false, //点赞
isFavorite: false,
@@ -1006,10 +1018,42 @@ export default {
countyId: null,
newsCategoryList: [],
newsCurrent: 0,
newsCategoryInited: false,
newsCategoryLoading: false,
shopList: [],
shopTypeList: [],
shopTypeActive: '',
detail: {}
shopTypeInited: false,
detail: {},
infoPage: 1,
infoHasMore: true,
infoLoading: false,
infoInited: false,
guidePage: 1,
guideHasMore: true,
guideLoading: false,
guideInited: false,
industryPage: 1,
industryHasMore: true,
industryLoading: false,
industryInited: false,
investmentPage: 1,
investmentHasMore: true,
investmentLoading: false,
investmentInited: false,
shopPage: 1,
shopHasMore: true,
shopLoading: false,
shopInited: false,
jiaLouPage: 1,
jiaLouHasMore: true,
jiaLouLoading: false,
jiaLouInited: false,
villagePage: 1,
villageHasMore: true,
villageLoading: false,
villageInited: false,
saleListInited: false
}
},
onShareAppMessage() {
@@ -1027,6 +1071,35 @@ export default {
onPageScroll(e) {
this.scrollData = e
},
onReachBottom() {
if (this.activeIndex === 3) {
this.getInfoReq()
return
}
if (this.activeIndex === 2) {
this.getGuideReq()
return
}
if (this.activeIndex !== 0) {
return
}
if (this.industryTabIndex === 0) {
this.getIndustryReq()
this.getInvestmentFileReq()
return
}
if (this.industryTabIndex === 1) {
this.getShopList()
return
}
if (this.industryTabIndex === 2) {
this.getJiaLouListReq()
return
}
if (this.industryTabIndex === 3) {
this.getVillageListReq()
}
},
onLoad(options) {
const id = options.id || ''
this.id = id
@@ -1044,29 +1117,77 @@ export default {
}
if (this.partnerId) cookie.set('spread', this.partnerId)
this.getShopDetailReq()
this.getInfoReq()
this.getGuideReq()
// this.initPoster()
this.getListReq()
this.getSaleListReq()
this.queryGuide('countyFamousIndex')
this.getCityNewsCategoryReq()
},
methods: {
getPageList(data) {
if (Array.isArray(data)) {
return data
}
return (data && (data.records || data.list || data.data)) || []
},
getHasMore(data, list, page) {
const pageCount = Number(
data && (data.pages || data.totalPage || data.last_page || data.pageCount || 0)
)
const total = Number(
data && (data.total || data.totalCount || data.count || 0)
)
if (pageCount > 0) {
return page < pageCount
}
if (total > 0) {
return page * this.pageSize < total
}
return list.length >= this.pageSize
},
getLoadMoreText(loading, hasMore, list) {
if (!list.length) return ''
if (loading) return '加载中...'
if (hasMore) return '上拉加载更多'
return '没有更多了'
},
formatInfoList(list = []) {
return list.map(info => {
var pt = info.createTime.replace(/-/g, "/")
info.year = formatDateTime(pt, 'yyyy')
info.monthDay = formatDateTime(pt, 'MM/dd')
info.time = formatDateTime(pt, 'HH:mm:ss')
info.showMore = false
return info
})
},
formatGuideList(list = []) {
return list.map((info) => {
var pt = info.createTime.replace(/-/g, "/")
info.year = formatDateTime(pt, 'yyyy')
info.monthDay = formatDateTime(pt, 'MM/dd')
info.time = formatDateTime(pt, 'HH:mm:ss')
return info
})
},
/**
* 获取县城资讯类别
*/
getCityNewsCategoryReq() {
getCityNewsCategory().then(res => {
if (this.newsCategoryInited || this.newsCategoryLoading) {
return Promise.resolve()
}
this.newsCategoryLoading = true
return getCityNewsCategory().then(res => {
if(res.status === 200) {
this.newsCategoryList = [{name: '全部', id: ''}].concat(res.data || [])
this.newsCategoryInited = true
}
}).finally(() => {
this.newsCategoryLoading = false
})
},
changeNewsTab(index) {
if (this.newsCurrent === index) return
this.newsCurrent = index
this.getInfoReq()
this.getInfoReq(true)
},
formatterTime(time) {
const now = new Date();
@@ -1229,27 +1350,18 @@ export default {
} else {
this.saleActived = e.id
}
getCountyFamousVillage({
countyFamousDataId: this.id,
categoryId: this.saleActived,
page: 1,
limit: 9999
}).then(res => {
const { success, data } = res
if (success) {
this.villageList = data.records || []
}
})
this.getVillageListReq(true)
},
getSaleListReq() {
const params = {
countyFamousDataId: this.id,
page: 1,
limit: 9999
if (this.saleListInited) {
return Promise.resolve()
}
getSaleList(params).then(res => {
const params = {
countyFamousDataId: this.id
}
return getSaleList(params).then(res => {
this.saleList = [{name: '全部', id: ''}].concat(res.data || [])
this.saleListInited = true
})
},
goStore(item) {
@@ -1276,49 +1388,9 @@ export default {
}
})
},
getListReq(id) {
// getPoster(this.id).then(({data}) => this.posterUrl = data)
getCountyFamousIndustry({
countyFamousDataId: this.id,
page: 1,
limit: 9999
}).then(res => {
const { success, data } = res
if (success) {
this.industryList = data.records || []
}
})
getCountyFamousIndustryProject({
countyFamousDataId: this.id,
page: 1,
limit: 9999
}).then(res => {
const { success, data } = res
if (success) {
this.industryProjectList = data.records || []
}
})
getCountyFamousInvestmentFile({
countyFamousDataId: this.id,
page: 1,
limit: 9999
}).then(res => {
const { success, data } = res
if (success) {
this.investmentFileList = data.records || []
}
})
getCountyFamousVillage({
countyFamousDataId: this.id,
categoryId: id,
page: 1,
limit: 9999
}).then(res => {
const { success, data } = res
if (success) {
this.villageList = data.records || []
}
})
getListReq() {
this.getIndustryReq(true)
this.getInvestmentFileReq(true)
getCountyFamousCityDetail(this.id).then(res => {
const { success, data } = res
if (success) {
@@ -1405,34 +1477,38 @@ export default {
})
},
// 资讯
getInfoReq() {
getInfoReq(reset = false) {
const _this = this
if (_this.loading) {
if (_this.infoLoading) {
return
}
if (!reset && !_this.infoHasMore) {
return
}
_this.isLoadInfoListSuccess = false
_this.loading = true
_this.infoArray = []
_this.infoLoading = true
const page = reset ? 1 : _this.infoPage
if (reset) {
_this.infoPage = 1
_this.infoHasMore = true
_this.infoArray = []
}
const categoryId = this.newsCategoryList[this.newsCurrent] ? this.newsCategoryList[this.newsCurrent].id : ''
getCountyFamousCityNews({
page: 1,
limit: 9999,
page,
limit: this.pageSize,
countyFamousDataId: _this.id,
categoryId: categoryId
}).then(res => {
const { data } = res
_this.loading = false
_this.infoArray.push.apply(_this.infoArray, _this.toTop(data.records).map((info) => {
var pt = info.createTime.replace(/-/g, "/")
info.year = formatDateTime(pt, 'yyyy')
info.monthDay = formatDateTime(pt, 'MM/dd')
info.time = formatDateTime(pt, 'HH:mm:ss')
info.showMore = false
return info
}))
// console.log(this.toTop(_this.infoArray));
const list = _this.formatInfoList(_this.getPageList(data))
const merged = page === 1 ? list : _this.infoArray.concat(list)
_this.infoArray = _this.toTop(merged)
_this.infoHasMore = _this.getHasMore(data, list, page)
_this.infoPage = page + 1
_this.infoInited = true
}).finally(() => {
_this.loading = false
_this.infoLoading = false
_this.isLoadInfoListSuccess = true
uni.stopPullDownRefresh()
})
@@ -1443,30 +1519,35 @@ export default {
})
},
// 攻略
getGuideReq() {
getGuideReq(reset = false) {
const _this = this
if (_this.loading) {
if (_this.guideLoading) {
return
}
if (!reset && !_this.guideHasMore) {
return
}
_this.isLoadGuideListoSuccess = false
_this.loading = true
_this.guideList = []
_this.guideLoading = true
const page = reset ? 1 : _this.guidePage
if (reset) {
_this.guidePage = 1
_this.guideHasMore = true
_this.guideList = []
}
getCountyFamousCityGuide({
page: 1,
limit: 9999,
page,
limit: this.pageSize,
countyFamousDataId: _this.id
}).then(res => {
const { data } = res
_this.loading = false
_this.guideList.push.apply(_this.guideList, data.records.map((info) => {
var pt = info.createTime.replace(/-/g, "/")
info.year = formatDateTime(pt, 'yyyy')
info.monthDay = formatDateTime(pt, 'MM/dd')
info.time = formatDateTime(pt, 'HH:mm:ss')
return info
}))
const list = _this.formatGuideList(_this.getPageList(data))
_this.guideList = page === 1 ? list : _this.guideList.concat(list)
_this.guideHasMore = _this.getHasMore(data, list, page)
_this.guidePage = page + 1
_this.guideInited = true
}).finally(() => {
_this.loading = false
_this.guideLoading = false
_this.isLoadGuideListoSuccess = true
uni.stopPullDownRefresh()
})
@@ -1478,10 +1559,35 @@ export default {
// 刷新数据
switch (this.activeIndex) {
case 3:
this.getInfoReq()
this.getCityNewsCategoryReq().finally(() => {
if (!this.infoInited) {
this.getInfoReq(true)
}
})
break
case 2:
this.getGuideReq()
if (!this.guideInited) {
this.getGuideReq(true)
}
break
case 0:
if (this.industryTabIndex === 1) {
if (!this.shopTypeInited) {
this.getShopTypeList()
}
if (!this.shopInited) {
this.getShopList(true)
}
}
if (this.industryTabIndex === 2 && !this.jiaLouInited) {
this.getJiaLouListReq(true)
}
if (this.industryTabIndex === 3) {
this.getSaleListReq()
if (!this.villageInited) {
this.getVillageListReq(true)
}
}
break
default:
break
@@ -1726,26 +1832,30 @@ export default {
if (index === this.industryTabIndex) return
this.industryTabIndex = index
if (index === 2) {
const params = {
countyId: this.countyId,
shopType: 'countyFamous',
name: '',
page: 1,
limit: 9999
if (!this.jiaLouInited) {
this.getJiaLouListReq(true)
}
getJiaLouList(params).then(res => {
this.jiaLouList = res.data.records || []
})
}
if (index === 1) {
this.shopTypeActive = ''
if (this.shopTypeList.length === 0) {
this.getShopTypeList()
}
this.getShopList()
if (!this.shopInited) {
this.getShopList(true)
}
}
if (index === 3) {
this.getSaleListReq()
if (!this.villageInited) {
this.getVillageListReq(true)
}
}
},
getShopTypeList() {
if (this.shopTypeInited) {
return
}
getCountyFamousHotelType({
page: 1,
limit: 9999
@@ -1754,25 +1864,170 @@ export default {
? res.data
: (res.data && (res.data.hotelTypeList || res.data.list || res.data.records)) || []
this.shopTypeList = [{ name: '全部', id: '' }].concat(listData || [])
this.shopTypeInited = true
})
},
getShopList() {
getIndustryReq(reset = false) {
if (this.industryLoading) {
return
}
if (!reset && !this.industryHasMore) {
return
}
const page = reset ? 1 : this.industryPage
if (reset) {
this.industryPage = 1
this.industryHasMore = true
this.industryList = []
}
this.industryLoading = true
getCountyFamousIndustry({
countyFamousDataId: this.id,
page,
limit: this.pageSize
}).then(res => {
const { success, data } = res
if (success) {
const list = this.getPageList(data)
this.industryList = page === 1 ? list : this.industryList.concat(list)
this.industryHasMore = this.getHasMore(data, list, page)
this.industryPage = page + 1
this.industryInited = true
}
}).finally(() => {
this.industryLoading = false
})
},
getInvestmentFileReq(reset = false) {
if (this.investmentLoading) {
return
}
if (!reset && !this.investmentHasMore) {
return
}
const page = reset ? 1 : this.investmentPage
if (reset) {
this.investmentPage = 1
this.investmentHasMore = true
this.investmentFileList = []
}
this.investmentLoading = true
getCountyFamousInvestmentFile({
countyFamousDataId: this.id,
page,
limit: this.pageSize
}).then(res => {
const { success, data } = res
if (success) {
const list = this.getPageList(data)
this.investmentFileList = page === 1 ? list : this.investmentFileList.concat(list)
this.investmentHasMore = this.getHasMore(data, list, page)
this.investmentPage = page + 1
this.investmentInited = true
}
}).finally(() => {
this.investmentLoading = false
})
},
getJiaLouListReq(reset = false) {
if (this.jiaLouLoading || !this.countyId) {
return
}
if (!reset && !this.jiaLouHasMore) {
return
}
const page = reset ? 1 : this.jiaLouPage
if (reset) {
this.jiaLouPage = 1
this.jiaLouHasMore = true
this.jiaLouList = []
}
this.jiaLouLoading = true
const params = {
countyId: this.countyId,
shopType: 'countyFamous',
name: '',
page,
limit: this.pageSize
}
getJiaLouList(params).then(res => {
const list = this.getPageList(res.data)
this.jiaLouList = page === 1 ? list : this.jiaLouList.concat(list)
this.jiaLouHasMore = this.getHasMore(res.data, list, page)
this.jiaLouPage = page + 1
this.jiaLouInited = true
}).finally(() => {
this.jiaLouLoading = false
})
},
getShopList(reset = false) {
if (this.shopLoading) {
return
}
if (!reset && !this.shopHasMore) {
return
}
const page = reset ? 1 : this.shopPage
if (reset) {
this.shopPage = 1
this.shopHasMore = true
this.shopList = []
}
const params = {
countyFamousDataId: this.id,
page: 1,
limit: 9999
page,
limit: this.pageSize
}
if (this.shopTypeActive) {
params.countyFamousHotelType = this.shopTypeActive
}
this.shopLoading = true
getCityShopList(params).then(res => {
this.shopList = (res.data && (res.data.records || res.data.list)) || []
const list = this.getPageList(res.data)
this.shopList = page === 1 ? list : this.shopList.concat(list)
this.shopHasMore = this.getHasMore(res.data, list, page)
this.shopPage = page + 1
this.shopInited = true
}).finally(() => {
this.shopLoading = false
})
},
handleShopType(type) {
if (this.shopTypeActive === type.id) return
this.shopTypeActive = type.id
this.getShopList()
this.getShopList(true)
},
getVillageListReq(reset = false) {
if (this.villageLoading) {
return
}
if (!reset && !this.villageHasMore) {
return
}
const page = reset ? 1 : this.villagePage
if (reset) {
this.villagePage = 1
this.villageHasMore = true
this.villageList = []
}
this.villageLoading = true
getCountyFamousVillage({
countyFamousDataId: this.id,
categoryId: this.saleActived,
page,
limit: this.pageSize
}).then(res => {
const { success, data } = res
if (success) {
const list = this.getPageList(data)
this.villageList = page === 1 ? list : this.villageList.concat(list)
this.villageHasMore = this.getHasMore(data, list, page)
this.villagePage = page + 1
this.villageInited = true
}
}).finally(() => {
this.villageLoading = false
})
},
fileItemClick(file) {
const url = file.attachment || ''
@@ -1900,6 +2155,12 @@ export default {
white-space: nowrap;
}
}
.load-more-status{
padding: 24rpx 0 8rpx;
text-align: center;
font-size: 24rpx;
color: #999;
}
.video-item {
width: 100%;
height: 400rpx;
+45 -6
View File
@@ -1,7 +1,13 @@
<template>
<view class="gift-page">
<view class="banner" @click="linkTo">
<rich-text :nodes="topBannerHtml" />
<view v-if="topBannerImage" class="banner-image-wrap">
<image
:src="topBannerImage"
class="banner-img"
mode="aspectFill"
/>
</view>
</view>
<view class="province-enter-wrap">
<view
@@ -60,7 +66,12 @@
class="item"
>
<view class="bg" @click="provinceItemClick(item)">
<rich-text :nodes="item.bgHtml" />
<image
:src="item.backgroundImage"
class="bg-img"
mode="aspectFill"
lazy-load
/>
</view>
<view class="good-list">
<view
@@ -70,7 +81,7 @@
@click.stop="goodItemClick(goodItem)"
>
<view class="good-img">
<image :src="goodItem.productImage" class="img" />
<image :src="goodItem.productImage" class="img" lazy-load />
</view>
<view class="name">
{{ goodItem.productName }}
@@ -97,7 +108,7 @@ export default {
data() {
return {
provinceList: [],
topBannerHtml: '',
topBannerImage: '',
topBannerUrl: '',
toggleStatus: false,
pageKeyId: Object.freeze('customizedGiftIndex')
@@ -111,7 +122,7 @@ export default {
customizedGift().then(res => {
const { success, data } = res
if (success) {
this.topBannerHtml = `<img src="${data.topBanner.image}" style="display: block;max-width: 100%;">`
this.topBannerImage = data.topBanner.image || ''
this.topBannerUrl = data.topBanner.appUrl || ''
const list = data.cities || []
if (list.length > 0) {
@@ -120,7 +131,7 @@ export default {
if (backgroundImage && item.productList.length > 0) {
this.provinceList.push({
...item,
bgHtml: `<img src="${item.backgroundImage}" style="display: block;max-width: 100%;">`
backgroundImage
})
}
})
@@ -164,6 +175,21 @@ export default {
.banner {
position: relative;
z-index: 1;
.banner-image-wrap {
position: relative;
width: 100%;
padding-top: 46%;
overflow: hidden;
background-color: #f6f6f6;
}
.banner-img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: block;
}
}
.province-enter-wrap {
position: relative;
@@ -243,6 +269,19 @@ export default {
.bg {
position: relative;
z-index: 2;
width: 100%;
padding-top: 62%;
overflow: hidden;
border-radius: 20rpx;
background-color: #f6f6f6;
.bg-img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: block;
}
}
.good-list {
position: absolute;
+60 -23
View File
@@ -164,10 +164,13 @@
<image :src="webUrl + '/orderIcon/微信图片_20241009220552.png'" mode="widthFix"></image>
</view>
</view>
<view v-if="items.length > 0" class="load-more-status">
{{ loading ? '加载中...' : (hasMore ? '上拉加载更多' : '没有更多了') }}
</view>
</view>
</template>
<script>
import { getCategory,getWellnessPlace } from '@/api/health'
import { getCategory } from '@/api/health'
import { getJiaLouList } from '@/api/qianxian'
import { getWellnessTopImage } from '@/api/health'
export default {
@@ -176,12 +179,15 @@ export default {
webUrl: this.$VUE_APP_RESOURCES_URL,
tabs: [],
items: [],
traveItems: [],
actived: 0,
cityId: '',
cityName: '',
categoryId: null,
topImageConfig: {}
topImageConfig: {},
page: 1,
pageSize: 10,
loading: false,
hasMore: true
}
},
computed: {
@@ -208,11 +214,13 @@ export default {
getCategory().then(res => {
this.tabs = res.data
this.categoryId = res.data[0].id
this.getList()
this.getList(true)
})
this.getTop()
this.getTopImage()
},
onReachBottom() {
this.getList()
},
onUnload() {
// uni.navigateBack({
// delta: 0
@@ -220,9 +228,10 @@ export default {
},
methods: {
handleTab(index, tab) {
if (this.actived === index) return
this.actived = index
this.categoryId = tab.id
this.getList()
this.getList(true)
},
toSanctun() {
uni.redirectTo({
@@ -234,18 +243,52 @@ export default {
url: '/pkg_product/views/healthFoods?city=' + this.cityId + '&cityName=' + this.cityName
})
},
getList() {
getPageList(data) {
if (Array.isArray(data)) {
return data
}
return (data && (data.records || data.list || data.data)) || []
},
getHasMore(data, list, page) {
const pageCount = Number(
data && (data.pages || data.totalPage || data.last_page || data.pageCount || 0)
)
const total = Number(
data && (data.total || data.totalCount || data.count || 0)
)
if (pageCount > 0) {
return page < pageCount
}
if (total > 0) {
return page * this.pageSize < total
}
return list.length >= this.pageSize
},
getList(reset = false) {
if (this.loading) return
if (!reset && !this.hasMore) return
const page = reset ? 1 : this.page
if (reset) {
this.page = 1
this.hasMore = true
this.items = []
}
const params = {
// countyId: this.cityId,
goodCityId: this.cityId,
wellnessPlaceCateId : this.categoryId,
shopType: 'wellnessCate',
page: 1,
limit: 9999
page,
limit: this.pageSize
}
this.loading = true
getJiaLouList(params).then(res => {
// console.log(res);
this.items = res.data.records
const list = this.getPageList(res.data)
this.items = page === 1 ? list : this.items.concat(list)
this.hasMore = this.getHasMore(res.data, list, page)
this.page = page + 1
}).finally(() => {
this.loading = false
})
},
search() {
@@ -253,18 +296,6 @@ export default {
url: '/pkg_product/views/healthSearch?city=' + this.cityId + '&cityName=' + this.cityName
})
},
getTop() {
const params = {
goodCityId: this.cityId,
shopType: 'wellnessTop',
page: 1,
limit: 9999
}
getJiaLouList(params).then(res => {
// console.log(res);
this.traveItems = res.data.records
})
},
toStore(item) {
if(item.dataType === 'wellnessPlace'){
this.$yrouter.push({
@@ -436,4 +467,10 @@ export default {
border-radius: 100rpx;
padding: 4rpx 20rpx;
}
.load-more-status{
padding: 24rpx 0 40rpx;
text-align: center;
font-size: 24rpx;
color: #999;
}
</style>
+59 -23
View File
@@ -134,24 +134,27 @@
<image :src="webUrl + '/orderIcon/微信图片_20241009220552.png'" mode="widthFix"></image>
</view>
</view>
<view v-if="items.length > 0" class="load-more-status">
{{ loading ? '加载中...' : (hasMore ? '上拉加载更多' : '没有更多了') }}
</view>
</view>
</template>
<script>
import { getCategory,getWellnessPlace } from '@/api/health'
import { getJiaLouList } from '@/api/qianxian'
import { getWellnessTopImage } from '@/api/health'
export default {
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
tabs: [],
items: [],
traveItems: [],
actived: 0,
cityId: '',
cityName: '',
categoryId: null,
topImageConfig: {}
topImageConfig: {},
page: 1,
pageSize: 10,
loading: false,
hasMore: true
}
},
computed: {
@@ -175,41 +178,69 @@ export default {
this.cityId = opts.city
this.cityName = decodeURIComponent(decodeURIComponent(opts.cityName))
getCategory().then(res => {
this.tabs = res.data
this.categoryId = res.data[0].id
this.getList()
})
this.getList(true)
this.getTop()
this.getTopImage()
},
onReachBottom() {
this.getList()
},
onUnload() {
// uni.navigateBack({
// delta: 0
// })
},
methods: {
handleTab(index, tab) {
this.actived = index
this.categoryId = tab.id
this.getList()
},
toFoods() {
uni.redirectTo({
url: '/pkg_product/views/healthFoods?city=' + this.cityId + '&cityName=' + this.cityName
})
},
getList() {
getPageList(data) {
if (Array.isArray(data)) {
return data
}
return (data && (data.records || data.list || data.data)) || []
},
getHasMore(data, list, page) {
const pageCount = Number(
data && (data.pages || data.totalPage || data.last_page || data.pageCount || 0)
)
const total = Number(
data && (data.total || data.totalCount || data.count || 0)
)
if (pageCount > 0) {
return page < pageCount
}
if (total > 0) {
return page * this.pageSize < total
}
return list.length >= this.pageSize
},
getList(reset = false) {
if (this.loading) return
if (!reset && !this.hasMore) return
const page = reset ? 1 : this.page
if (reset) {
this.page = 1
this.hasMore = true
this.items = []
}
const params = {
// countyId: this.cityId,
goodCityId: this.cityId,
shopType: 'wellnessTravel',
page: 1,
limit: 9999
page,
limit: this.pageSize
}
this.loading = true
getJiaLouList(params).then(res => {
// console.log(res);
this.items = res.data.records
const list = this.getPageList(res.data)
this.items = page === 1 ? list : this.items.concat(list)
this.hasMore = this.getHasMore(res.data, list, page)
this.page = page + 1
}).finally(() => {
this.loading = false
})
},
search() {
@@ -222,11 +253,10 @@ export default {
goodCityId: this.cityId,
shopType: 'wellnessTop',
page: 1,
limit: 9999
limit: 10
}
getJiaLouList(params).then(res => {
// console.log(res);
this.traveItems = res.data.records
this.traveItems = this.getPageList(res.data)
})
},
toStore(item) {
@@ -390,4 +420,10 @@ export default {
border-radius: 6rpx;
bottom: 5rpx;
}
.load-more-status{
padding: 24rpx 0 40rpx;
text-align: center;
font-size: 24rpx;
color: #999;
}
</style>
+54 -2
View File
@@ -1,9 +1,28 @@
<template>
<view class="pkg-product-heritage">
<image style="width: 100%" :src="topImage" mode="widthFix" />
<view class="top-image-wrap">
<image
style="width: 100%"
:src="topImage"
mode="widthFix"
:class="{ loaded: topImageLoaded }"
class="top-image"
@load="handleTopImageLoad"
/>
</view>
<view class="main-box" id="main-box">
<image style="width: 100%" :src="backgroundImage" mode="widthFix" @load="loadImg" />
<view class="bg-image-wrap">
<image
style="width: 100%"
:src="backgroundImage"
mode="widthFix"
class="bg-image"
:class="{ loaded: bgImageLoaded }"
@load="loadImg"
/>
</view>
<view
v-if="showItems"
class="item"
:style="{ left: item.gx + 'rpx', top: item.gy + 'rpx' }"
v-for="(item, index) in contents"
@@ -14,6 +33,7 @@
class="img-item"
:src="item.image"
:class="{ unlink: !item.isLink }"
lazy-load
/>
</view>
@@ -40,6 +60,9 @@ export default {
topImage: "",
backgroundImage: "",
bgImgWidth: 0,
topImageLoaded: false,
bgImageLoaded: false,
showItems: false,
pageKeyId: Object.freeze("ichIndex"),
};
},
@@ -53,7 +76,14 @@ export default {
this.queryGuide('ichIndex')
},
methods: {
handleTopImageLoad() {
this.topImageLoaded = true
},
loadImg(e) {
this.bgImageLoaded = true
this.$nextTick(() => {
this.showItems = true
})
this.queryGuide('ichIndex')
},
showFunctionGuide() {
@@ -125,6 +155,9 @@ export default {
},
init() {
getICH().then(({ data }) => {
this.topImageLoaded = false
this.bgImageLoaded = false
this.showItems = false
this.contents = data.contents;
this.topImage = data.topImage;
this.backgroundImage = data.backgroundImage;
@@ -178,6 +211,24 @@ export default {
vertical-align: middle;
}
.top-image-wrap,
.bg-image-wrap {
background: #f6f6f6;
overflow: hidden;
}
.top-image,
.bg-image {
display: block;
opacity: 0;
transition: opacity .25s ease;
}
.top-image.loaded,
.bg-image.loaded {
opacity: 1;
}
.main-box {
position: relative;
@@ -188,6 +239,7 @@ export default {
display: flex;
flex-direction: column;
align-items: center;
will-change: transform;
.title {
position: relative;
width: fit-content;
+108 -21
View File
@@ -121,6 +121,9 @@
</view>
</view>
</block>
<view v-if="sendList.length > 0" class="load-more">
{{ sendLoading ? '加载中...' : (sendHasMore ? '上拉加载更多' : '没有更多了') }}
</view>
<view v-if="sendList.length === 0" class="noCart">
<view class="pictrue">
<image :src="webUrl + '/20240102232734472795.png'"/>
@@ -203,6 +206,9 @@
</view>
</view>
</block>
<view v-if="receiveList.length > 0" class="load-more">
{{ receiveLoading ? '加载中...' : (receiveHasMore ? '上拉加载更多' : '没有更多了') }}
</view>
<view v-if="receiveList.length === 0" class="noCart">
<view class="pictrue">
<image :src="webUrl + '/20240102232734472795.png'"/>
@@ -283,6 +289,15 @@ export default {
giftItem: {},
orderInfo: {},
isShowPayPwdPop: false,
pageSize: 10,
sendPage: 1,
receivePage: 1,
sendLoading: false,
receiveLoading: false,
sendHasMore: true,
receiveHasMore: true,
sendInited: false,
receiveInited: false
}
},
computed: mapGetters(["userInfo"]),
@@ -290,7 +305,14 @@ export default {
giftNotice().then(res => {
this.giftNotice = res.data
})
this.getGiftCardSendList()
this.getGiftCardSendList(true)
},
onReachBottom() {
if (this.cateIndex === 0) {
this.getGiftCardSendList()
return
}
this.getGiftCardReceiveList()
},
onShareAppMessage() {
uni.updateShareMenu({
@@ -318,7 +340,7 @@ export default {
id: item.id
}).then(qRes => {
if (qRes.success) {
this.getGiftCardSendList()
this.getGiftCardSendList(true)
}
}).finally(() => {
uni.hideLoading()
@@ -338,7 +360,7 @@ export default {
//网络请求
yuePayOrderHandle(this.orderInfo.orderId, "yue", this.from, payPwd).then(res => {
console.log(res);
this.getGiftCardSendList()
this.getGiftCardSendList(true)
this.payPassword = "";
})
},
@@ -348,7 +370,7 @@ export default {
wechatPay(type) {
payOrderHandle(this.orderInfo.orderId, type, this.from).then(res => {
console.log(res);
this.getGiftCardSendList()
this.getGiftCardSendList(true)
})
},
goBuy(order) {
@@ -370,43 +392,102 @@ export default {
cateItemClickHanlde(item, index) {
if (this.cateIndex === index || !this.isLoad) return
this.cateIndex = index
if (this.cateIndex === 0) {
this.getGiftCardSendList()
if (this.cateIndex === 0 && !this.sendInited) {
this.getGiftCardSendList(true)
}
if (this.cateIndex === 1) {
this.getGiftCardReceiveList()
if (this.cateIndex === 1 && !this.receiveInited) {
this.getGiftCardReceiveList(true)
}
},
getGiftCardReceiveList() {
this.isLoad = false
getListResult(data, page) {
const list = Array.isArray(data)
? data
: (data && (data.records || data.list || data.data)) || []
const pageCount = Number(
data && (data.pages || data.totalPage || data.last_page || data.pageCount || 0)
)
const total = Number(
data && (data.total || data.totalCount || data.count || 0)
)
let hasMore = false
if (pageCount > 0) {
hasMore = page < pageCount
} else if (total > 0) {
hasMore = page * this.pageSize < total
} else {
hasMore = list.length >= this.pageSize
}
return {
list,
hasMore
}
},
getGiftCardReceiveList(reset = false) {
if (this.receiveLoading) return
if (!reset && !this.receiveHasMore) return
const page = reset ? 1 : this.receivePage
if (reset) {
this.receivePage = 1
this.receiveHasMore = true
this.receiveList = []
}
if (page === 1 && this.cateIndex === 1) {
this.isLoad = false
}
this.receiveLoading = true
giftCardReceiveList({
page: 1,
limit: 999
page,
limit: this.pageSize
}).then(res => {
const { success, data } = res
if (success) {
this.receiveList = data || []
const { list, hasMore } = this.getListResult(data, page)
this.receiveList = page === 1 ? list : this.receiveList.concat(list)
this.receiveHasMore = hasMore
this.receivePage = page + 1
this.receiveInited = true
}
}).catch(err => {
console.log(err)
}).finally(() => {
this.isLoad = true
this.receiveLoading = false
if (this.cateIndex === 1) {
this.isLoad = true
}
})
},
getGiftCardSendList() {
this.isLoad = false
getGiftCardSendList(reset = false) {
if (this.sendLoading) return
if (!reset && !this.sendHasMore) return
const page = reset ? 1 : this.sendPage
if (reset) {
this.sendPage = 1
this.sendHasMore = true
this.sendList = []
}
if (page === 1 && this.cateIndex === 0) {
this.isLoad = false
}
this.sendLoading = true
giftCardSendList({
page: 1,
limit: 999
page,
limit: this.pageSize
}).then(res => {
const { success, data } = res
if (success) {
this.sendList = data || []
const { list, hasMore } = this.getListResult(data, page)
this.sendList = page === 1 ? list : this.sendList.concat(list)
this.sendHasMore = hasMore
this.sendPage = page + 1
this.sendInited = true
}
}).catch(err => {
console.log(err)
}).finally(() => {
this.isLoad = true
this.sendLoading = false
if (this.cateIndex === 0) {
this.isLoad = true
}
})
},
getStatus(order) {
@@ -655,4 +736,10 @@ export default {
line-height: 40rpx;
font-size: 26rpx;
}
</style>
.load-more {
padding: 0 0 24rpx;
text-align: center;
font-size: 24rpx;
color: #999;
}
</style>