123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439 |
- <template>
- <scroll-view class="home" scroll-y @scrolltolower='onBottom'>
- <!-- <van-tabs >
- <van-tab title="标签 1">内容 1</van-tab>
- <van-tab title="标签 2">内容 2</van-tab>
- <van-tab title="标签 3">内容 3</van-tab>
- <van-tab title="标签 4">内容 4</van-tab>
- </van-tabs> -->
- <view class="top-list">
- <image class="background-img" style="width: 100vw;" src="https://t1-1305573081.cos.ap-shanghai.myqcloud.com/wxapp/static/imgs/%E9%A1%B6%E9%83%A8%E8%83%8C%E6%99%AF3.png"
- mode="widthFix"></image>
- <topbar class="topbar-slot">
- <view>
- <text style="color: #FFFFFF;">极速生活圈</text>
- </view>
- </topbar>
- <loadSke :loading='topLoading' :list='bannerList'>
- <swiper class="swiper-box" :current="current" autoplay circular indicator-dots>
- <swiper-item v-for="(item,index) in bannerList" :key='index'>
- <image @click="clickJumpType(item)" class="image" :src="item.fileUrl" mode="scaleToFill" :draggable="false" />
- </swiper-item>
- </swiper>
- <view class="eat-box">
- <view class="eat" v-for="(item,index) in couponList" :key='index' @click="clickJumpType(item)">
- <image :src="item.fileUrl" mode="scaleToFill" class="img"></image>
- <view class="text-box">
- <text class="text-1">{{item.pictureName}}</text>
- <text class="text-2">{{item.dataDescribe.split(' ')[0]}}</text>
- <text class="text-3">{{item.dataDescribe.split(' ')[1]}}</text>
- </view>
- </view>
- </view>
- <view class="menu-box">
- <view class="menu" v-for="(item,index) in menuList" :key='index' @click="clickJumpType(item)">
- <image :src="item.fileUrl" mode="scaleToFill" class="img"></image>
- <text class="text-1">{{item.pictureName}}</text>
- <text class="text-2">{{item.dataDescribe || '暂无描述'}}</text>
- </view>
- </view>
- </loadSke>
- </view>
- <view class="bottom-ad" v-for="(item,index) in bottomAD" :key='index' @click="clickJumpType(item)">
- <image style="width: 100%;" :src="item.fileUrl" mode="widthFix"></image>
- <text>今日仅剩{{dynamicQuantity(index)}}个</text>
- <button>免费领取</button>
- </view>
- <view class="item-box">
- <view class="item-titBox">
- <text class="item-tit">限时特价</text>
- <!-- <text class="item-tit-right" @tap='go()'>更多视频 ></text> -->
- </view>
- <loadSke :loading='pddLoading' :list='pddList'>
- <view class="flex-box">
- <view class="film-box" v-for="(item,index) in pddList" :key='index' @click="goMiniApp(JSON.stringify({appId:item.we_app_info.app_id,path:item.we_app_info.page_path}))">
- <image :src="item.goods_image_url" mode="widthFix" class="img" draggable></image>
- <view class="bottom-box">
- <view class="tit">
- <text class="text-1">{{item.goods_name}}</text>
- </view>
- <view class="des-box">
- <view class="des">{{item.unified_tags}}</view>
- </view>
- <view class="buy-box">
- <text class="price">{{'¥'+(item.min_group_price)/100}}</text>
- <button type="default" class="buy">活动价 {{'¥'+(item.min_group_price-item.coupon_discount)/100}}</button>
- </view>
- </view>
- </view>
- <view v-if="pddDataLoading" class="bottom-loading">
- 正在加载中...
- </view>
- </view>
- </loadSke>
- </view>
- </scroll-view>
- </template>
- <script>
- import {
- getHomePageDataList,
- getPDD,
- getPddWxData
- } from '@/api/home.js'
- export default {
- data: () => ({
- bannerList: [],
- couponList: [],
- menuList: [],
- bottomAD: [],
- topLoading: true,
- pddList: [],
- pddLoading: true,
- limit: 6,
- page: 0,
- pddDataLoading: false
- }),
- mounted() {
- this.init()
- },
- methods: {
- onBottom() {
- if (this.pddDataLoading) return
- this.pddDataLoading = true
- this.page++
- getPddWxData({
- limit: this.limit,
- offset: this.page * this.limit
- }).then(res => {
- this.pddList = this.pddList.concat(res)
- this.$nextTick(() => {
- this.pddLoading = false
- this.pddDataLoading = false
- })
- })
- },
- dynamicQuantity(index) {
- index++
- let x = new Date().getHours() / 3
- let num = ((x - 8) ** 2) + index * (8 - x) * 1 + index * 3 + 1
- return parseInt(num)
- },
- init() {
- getHomePageDataList().then(res => {
- this.bannerList = res.data.carouselChart
- this.couponList = res.data.coupon.slice(0, 4)
- this.menuList = res.data.menu
- this.bottomAD = res.data.bottomAD
- this.$nextTick(() => {
- this.topLoading = false
- })
- })
- getPddWxData({
- limit: this.limit,
- offset: this.page * this.limit
- }).then(res => {
- this.pddList = res
- this.$nextTick(() => {
- this.pddLoading = false
- })
- })
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .home{
- height: 100%;
- }
-
- .top-list {
- padding: 30rpx;
- padding-top: 0;
- box-sizing: border-box;
- width: 100%;
- background-color: #FFFFFF;
- position: relative;
- .topbar-slot {
- z-index: 1;
- align-self: center;
- display: flex;
- justify-content: center;
- }
- .background-img {
- position: absolute;
- top: 0;
- left: 0;
- }
- .swiper-box {
- width: 690rpx;
- height: 342rpx;
- overflow: hidden;
- .image {
- width: 100%;
- height: 100%;
- border-radius: 10px;
- }
- }
- .eat-box {
- margin-top: 30rpx;
- display: flex;
- justify-content: space-between;
- .eat {
- width: 158rpx;
- height: 240rpx;
- position: relative;
- .img {
- width: 100%;
- height: 100%;
- }
- .text-box {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- position: absolute;
- bottom: 10rpx;
- left: 50%;
- width: 100%;
- transform: translateX(-50%);
- .text-1 {
- font-size: 24rpx;
- color: #0F0404;
- text-align: center;
- }
- .text-2 {
- margin-top: 5rpx;
- font-size: 20rpx;
- color: #FE3232;
- text-align: center;
- }
- .text-3 {
- font-size: 20rpx;
- color: #666666;
- text-align: center;
- }
- }
- }
- }
- .menu-box {
- display: flex;
- justify-content: flex-start;
- flex-wrap: wrap;
- margin: 0 -10rpx;
- .menu {
- width: 20%;
- padding: 0 10rpx;
- box-sizing: border-box;
- // height: 121rpx;
- margin-top: 40rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- align-items: center;
- .img {
- flex-shrink: 0;
- width: 83rpx;
- height: 83rpx;
- border-radius: 50%;
- }
- .text-1 {
- margin-top: 10rpx;
- font-size: 24rpx;
- color: #0F0404;
- text-align: center;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .text-2 {
- font-size: 20rpx;
- color: #666666;
- text-align: center;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- }
- }
- .bottom-ad {
- margin-top: -15rpx;
- position: relative;
- &:nth-child(2) {
- margin-top: 20rpx;
- }
- text {
- position: absolute;
- top: 104rpx;
- left: 220rpx;
- padding: 10rpx 15rpx;
- background: #FFE1D9;
- font-size: 22rpx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #A40303;
- }
- button {
- position: absolute;
- top: 67rpx;
- right: 40rpx;
- display: inline-block;
- margin: 0;
- padding: 0rpx 26rpx;
- background: linear-gradient(90deg, #E31818, #ED3E24, #ED4F24);
- border-radius: 30rpx;
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #FFFFFF;
- }
- }
- .item-box {
- background-color: #fff;
- // margin-top: 40rpx;
- .item-titBox {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 20rpx;
- border-bottom: 1rpx solid #e8e8e8;
- .item-tit {
- border-left: 8rpx solid #E31818;
- font-size: 30rpx;
- padding: 11rpx;
- margin-left: 20rpx;
- }
- .item-tit-right {
- font-size: 26rpx;
- color: #666666;
- line-height: 58rpx;
- padding: 11rpx;
- }
- }
- .flex-box {
- width: 100%;
- display: flex;
- justify-content: center;
- align-items: flex-start;
- // flex-direction: column;
- flex-wrap: wrap;
- background-color: #F8F8F8;
- padding-bottom: 20rpx;
- .film-box {
- width: 334rpx;
- border-radius: 20rpx;
- overflow: hidden;
- background: #FFFFFF;
- margin: 30rpx 11rpx 0;
- .img {
- width: 100%;
- }
- .bottom-box {
- padding: 30rpx 20rpx;
- .tit {
- display: flex;
- justify-content: space-between;
- .text-1 {
- width: 100%;
- font-size: 26rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- // white-space: nowrap;
- }
- }
- .des-box {
- margin-top: 10rpx;
- .des {
- width: 100%;
- font-size: 22rpx;
- color: #666666;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- .buy-box {
- margin-top: 20rpx;
- display: flex;
- justify-content: flex-start;
- align-items: center;
- .price {
- // color: #E31818;
- text-decoration: line-through;
- font-size: 34rpx;
- }
- .buy {
- height: 40rpx;
- background: linear-gradient(90deg, #E31818, #ED3E24, #ED4F24);
- border-radius: 20rpx;
- margin-left: 10rpx;
- font-size: 20rpx;
- color: #FFFFFF;
- display: flex;
- justify-content: center;
- align-items: center;
- white-space: nowrap;
- }
- }
- }
- }
- }
- .bottom-loading{
- margin-top: 5rpx;
- padding: 10rpx;
- }
- }
- .ad-video {
- margin-top: 40rpx;
- }
- </style>
|