Feat:接口对接

This commit is contained in:
lifizer
2023-11-20 15:54:00 +08:00
parent 4652b6706a
commit a3ac5a2506
24 changed files with 2305 additions and 152 deletions
+129 -33
View File
@@ -66,10 +66,10 @@
</view>
<!-- 快捷跳转块v4end -->
<view style="padding-bottom:20rpx;background: #fff;">
<!-- <view style="padding-bottom:20rpx;background: #fff;">-->
<!-- 转盘-->
<!-- <image class="home-luck" :src="`${webUrl}/20220519145845818243.png`" mode="scaleToFill" @click="goLuck"></image>-->
</view>
<!-- </view>-->
<!-- 伴手礼精品 -->
<!-- <view class="wrapper hot" v-if="likeInfo.length > 0">-->
@@ -212,30 +212,48 @@
<!-- v4 每天特价结束 -->
<!-- v9 专题 -->
<!-- <view class="subject-box">-->
<!-- <view class="section-half flex jc-between">-->
<!-- <image src="@/static/images/v9/subject-148@2x.png" mode="scaleToFill"/>-->
<!-- <image src="@/static/images/v9/subject-149@2x.png" mode="scaleToFill"/>-->
<!-- </view>-->
<!-- <view class="section-full flex jc-between">-->
<!-- <image src="@/static/images/v9/subject-148@2x.png" mode="scaleToFill"/>-->
<!-- <image src="@/static/images/v9/subject-149@2x.png" mode="scaleToFill"/>-->
<!-- </view>-->
<!-- </view>-->
<view class="subject-box">
<view class="section-half flex jc-between">
<image class="bg-img" :src="countyFamous.backgroundImage" mode="scaleToFill"
@click="$global.commonJump('/pkg_product/views/famousList')" v-if="countyFamous.backgroundImage"/>
<view class="food-box" @click="$global.commonJump('/pkg_product/views/seasonList')">
<image class="bg-img" :src="seasonalFood.backgroundImage" mode="scaleToFill"
v-if="seasonalFood.backgroundImage"/>
<swiper class="swiper" circular autoplay :interval="3000">
<swiper-item v-for="(arr,arrIndex) in seasonalFood.groupList" :key="arrIndex">
<view class="flex">
<image :src="item.image" mode="scaleToFill" v-for="(item,index) in arr" :key="index"/>
</view>
</swiper-item>
</swiper>
</view>
</view>
<view class="section-full flex jc-between">
<swiper class="swiper" circular autoplay :interval="3000">
<swiper-item v-for="(stay,stayIndex) in contentHomestay" :key="stayIndex">
<image :src="stay.indexImage" mode="scaleToFill" @click="goHomeStay(stay)"/>
</swiper-item>
</swiper>
<!-- <image :src="contentHomestay.indexImage" mode="scaleToFill" @click="goHomeStay" v-if="contentHomestay.indexImage"/>-->
<image :src="contentFestival.indexImage" mode="scaleToFill" @click="goFestival"
v-if="contentFestival.indexImage"/>
</view>
</view>
<!-- v9 老用户弹窗 -->
<!-- <u-popup :show="isOldUser" mode="center" bgColor="transparent">-->
<!-- <view class="popup-old-user flex flex-col ai-center">-->
<!-- <image class="main" src="@/static/images/v9/subject-149@2x.png" mode="scaleToFill"/>-->
<!-- <view class="icon-box flex jc-center ai-center" @click="isOldUser=false">-->
<!-- <image :src="webUrl+'/20230608112219219303.png'" mode="scaleToFill"/>-->
<!-- </view>-->
<!-- </view>-->
<!-- </u-popup>-->
<u-popup :show="isOldUser" mode="center" bgColor="transparent">
<view class="popup-old-user flex flex-col ai-center">
<image class="main" :src="oldUserPopup.image" mode="scaleToFill" @click="$global.commonJump(oldUserPopup.url)"/>
<view class="icon-box flex jc-center ai-center" @click="changeOldPopup(false)">
<image :src="webUrl+'/20230608112219219303.png'" mode="scaleToFill"/>
</view>
</view>
</u-popup>
<!-- 2022/6/20 add 尖货推荐 special-offer-->
<view class="bast-box">
<view style="padding: 0 32rpx">
<view style="padding: 0 32rpx;background: #FFFFFF;">
<image class="bast-title" :src="webUrl+'/20230407111908318221.png'" mode="scaleToFill"/>
</view>
<view class="list flex" v-if="bastList.length">
@@ -431,6 +449,11 @@ export default {
bannarList: [], // 尖货推荐横幅
shareAppImg: "", // 发送给朋友
isOldUser: true, // 老用户弹窗
oldUserPopup: {},
contentHomestay: {},
contentFestival: {},
countyFamous: {},
seasonalFood: {}
};
},
onLoad: function (options) {
@@ -545,6 +568,23 @@ export default {
}
return item;
}));
that.$set(that, 'oldUserPopup', res.data.oldUserPopup)
that.$set(that, 'contentHomestay', res.data.contentHomestay)
that.$set(that, 'contentFestival', res.data.contentFestival)
that.$set(that, 'countyFamous', res.data.countyFamous)
// 处理时令尝鲜轮播图所需数据
const foodLen = res.data.seasonalFood.productsCarousels.length;
const foods = res.data.seasonalFood.productsCarousels;
let groupList = [];
if (foodLen) {
const count = 4;
for (let i = 0; i < foodLen; i += count) {
groupList.push(foods.slice(i, i + count))
}
}
res.data.seasonalFood.groupList = groupList;
that.$set(that, 'seasonalFood', res.data.seasonalFood)
if (that.firstList.length > 0) {
that.newGoods = that.firstList[0];
@@ -575,12 +615,12 @@ export default {
}, 1)
// 尖货推荐
let temp = {
storeName: "swiper",
image: "https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg",
bannarList: that.bannarList
}
res.data.bastList.unshift(temp);
// let temp = {
// storeName: "swiper",
// image: "https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg",
// bannarList: that.bannarList
// }
// res.data.bastList.unshift(temp);
for (let i = 0; i < res.data.bastList.length; i++) {
res.data.bastList[i].hide = true;
}
@@ -838,6 +878,28 @@ export default {
from
}
});
},
changeOldPopup(state) {
this.isOldUser = state;
},
goHomeStay(stay) {
if (stay.type === 2 && stay.isLinkToProduct) {
this.$yrouter.push({
path: '/pages/shop/GoodsCon/index',
query: {
id: stay.productId
}
});
}
if (stay.type === 1) {
uni.navigateTo({url: '/pkg_product/views/homestay?id=' + stay.id})
}
},
goFestival() {
uni.navigateTo({url: '/pkg_product/views/festival'})
}
}
};
@@ -1721,7 +1783,8 @@ export default {
}
.subject-box {
padding: 40rpx 32rpx;
padding: 20rpx 32rpx 40rpx;
background: #FFFFFF;
image {
vertical-align: middle;
@@ -1730,10 +1793,38 @@ export default {
.section-half {
margin-bottom: 16rpx;
image {
.bg-img {
width: 336rpx;
height: 180rpx;
}
.food-box {
position: relative;
width: 336rpx;
height: 180rpx;
overflow: hidden;
.swiper {
position: absolute;
left:20rpx;
bottom:20rpx;
width: 296rpx;
height: 72rpx;
overflow: hidden;
z-index: 10;
image {
width: 72rpx;
height: 72rpx;
margin-right: 4rpx;
border-radius: 4rpx;
}
image:last-child {
margin-right: 0;
}
}
}
}
.section-full {
@@ -1741,6 +1832,11 @@ export default {
width: 336rpx;
height: 480rpx;
}
.swiper {
width: 336rpx;
height: 480rpx;
}
}
}
@@ -1759,10 +1855,10 @@ export default {
width: 96rpx;
height: 96rpx;
margin-top: 40rpx;
background: rgba(51,51,51,.4);
background: rgba(51, 51, 51, .4);
border-radius: 50%;
image{
image {
width: 40rpx;
height: 40rpx;
}
@@ -1773,7 +1869,7 @@ export default {
.bast-title {
width: 312rpx;
height: 40rpx;
margin: 32rpx 0 16rpx;
margin: 16rpx 0 16rpx;
}
.bannar-swiper {
@@ -1786,7 +1882,7 @@ export default {
}
.list {
padding: 0 32rpx 32rpx;
padding: 32rpx;
.item {
position: relative;