This commit is contained in:
2020-07-17 17:34:42 +08:00
parent 5a4e302899
commit 7b9479d56c
10 changed files with 308 additions and 291 deletions

View File

@@ -3,25 +3,25 @@
<view class="top">
商品推荐
</view>
<view class="label">
<!-- <view class="label">
<text v-for="item in classifyList" :key="item.gc_id">{{ item.gc_name }}</text>
</view>
<view class="item">
<item v-for="item in goodsList" :key="item.goods_id" :info="item"></item>
</view>
<!-- <view>
<u-tabs-swiper ref="uTabs" :list="tabList" :current="current" @change="tabsChange" :is-scroll="false"
swiperWidth="750" height="60"></u-tabs-swiper>
</view> -->
<view>
<u-tabs-swiper ref="uTabs" :list="classifyList" name="gc_name" :is-scroll="true" active-color="#FF780F" :current="current" font-size="24" :show-bar="false" @change="tabsChange" height="60" ></u-tabs-swiper>
</view>
<swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" >
<swiper-item class="swiper-item" v-for="(_, index) in tabList" :key="index">
<scroll-view scroll-y style="height: 800rpx;width: 100%;">
<swiper-item class="swiper-item" v-for="(_, index) in classifyList" :key="index">
<!-- <scroll-view scroll-y style="height: 800rpx;width: 100%;"> -->
<view class="item">
<item v-for="item in goodsList" :key="item.goods_id" :info="item"></item>
</view>
</scroll-view>
<u-empty text="暂无商品" mode="list" color="#000" v-if="!goodsList.length"></u-empty>
<!-- </scroll-view> -->
</swiper-item>
</swiper> -->
</swiper>
</view>
</template>
<script>
@@ -30,21 +30,39 @@ export default {
name:"list",
data() {
return {
tabList: [{name: '推荐'}, {name: '推荐'}, {name: '推荐'}],
tabList: [],
current: 0,
current: Number,
swiperCurrent: 0,
goodsList: [],
}
},
components:{
item
},
props: {
classifyList: Array,
goodsList: Array,
classifyList: Array
},
watch: {
current(index) {
const id = this.classifyList[index].gc_id;
this.getGoodsRecommend(id);
}
},
created() {
this.current = 0;
console.log(this.classifyList);
},
methods: {
getGoodsRecommend(gc_id) {
this.$u.api.getGoodsRecommend({
page: 1,
gc_id: gc_id,
}).then((res)=>{
if (res.errCode == 0) {
this.goodsList = res.data.goodsList;
console.log(this.goodsList);
}
})
},
// tabs通知swiper切换
tabsChange(index) {
this.swiperCurrent = index;
@@ -74,21 +92,21 @@ export default {
text-align: center;
color: #333;
}
.label{
display: flex;
color: #999;
flex-wrap: wrap;
>text{
margin-right: 34rpx;
margin-bottom: 10rpx;
}
}
.item{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-top: 20rpx;
// .label{
// display: flex;
// color: #999;
// flex-wrap: wrap;
// >text{
// margin-right: 34rpx;
// margin-bottom: 10rpx;
// }
// }
// .item{
// display: flex;
// flex-wrap: wrap;
// justify-content: space-between;
// margin-top: 20rpx;
}
// }
}
</style>

View File

@@ -1,16 +1,16 @@
<template>
<view class="recommend">
<view class="top">
<text>今日秒杀推荐</text>
<text>{{ type == 'spike' ? '今日秒杀推荐' : '今日拼团推荐' }}</text>
<text>点击查看更多></text>
</view>
<view class="connect">
<view class="time" v-if="type=='spike'">
<view class="time" v-if="type == 'spike'">
<image src="/static/image/common/15.png"></image>
<text>{{ info.groupbuy_starttime_histime }}</text>
</view>
<view class="info">
<text class="u-line-1">{{ info.groupbuy_name }}</text>
<text class="u-line-1">{{ type == 'spike' ? info.groupbuy_name : '' }}</text>
<text class="u-line-2">{{ info.goods_name }}</text>
<view>
<text>{{ info.groupbuy_price }}</text>

View File

@@ -1,72 +1,119 @@
<template>
<view class="youhq">
<view class="top">
<text>全部优惠券</text>
<text>查看更多></text>
</view>
<view class="label">
<text>sda</text>
<text>asda</text>
<text>dsad</text>
<text>asdas</text>
</view>
<scroll-view style="width:100%;margin-top: 21rpx;" scroll-x="true">
<view class="list">
<sitem></sitem>
<sitem></sitem>
<sitem></sitem>
<sitem></sitem>
<sitem></sitem>
</view>
</scroll-view>
</view>
<view class="coupon-swiper">
<view class="top">
<view class="title">全部优惠券</view>
<view class="view-more" @click="toCouponPage">查看更多></view>
</view>
<u-tabs-swiper ref="coupon" :list="couponGroupList" name="gc_name" :is-scroll="true" active-color="#FF780F" :current="couponCurrent" font-size="24" :show-bar="false" @change="couponTabsChange" height="88" ></u-tabs-swiper>
<!-- :style="{ height: swiperHeight }" -->
<swiper :current="swiperCouponCurrent" @animationfinish="couponAnimationFinish">
<swiper-item class="swiper-coupon-item" v-for="(_, i) in couponGroupList" :key="i">
<!-- <scroll-view scroll-y style="height: 100%;"> -->
<view v-for="(coupon, index) in couponList.slice(0, 4)" :key="index" class="coupon-item">
<Coupon :couponInfo="coupon" :status='0' :type="0"></Coupon>
</view>
<u-empty text="暂无优惠券" mode="coupon" color="#000" v-if="!couponList.length"></u-empty>
<!-- </scroll-view> -->
</swiper-item>
</swiper>
</view>
</template>
<script>
import sitem from "./item"
import Coupon from "@/components/mine/coupon/index";
export default {
name:"youhq",
components:{
sitem
},
data(){
return {
}
}
}
data() {
return {
swiperHeight: '',
couponCurrent: 0,
swiperCouponCurrent: 0,
couponGroupList: [],
couponList: [],
}
},
components: {
Coupon
},
watch: {
couponCurrent(index) {
const id = this.couponGroupList[index].gc_id;
this.getCouponList(id);
}
},
created() {
this.setViewHeight();
this.getGoodsClass();
},
methods: {
getGoodsClass() {
this.$u.api.getGoodsClass().then(res => {
if(res.errCode == 0) {
this.couponGroupList = res.data;
this.getCouponList(this.couponGroupList[0].gc_id);
}
})
},
getCouponList(gc_id) {
this.$u.api.getCouponList({
page: 0,
gc_id: gc_id,
}).then(res => {
if(res.errCode == 0) {
this.couponList = res.data;
} else {
this.couponList = [];
}
})
},
couponTabsChange(index) {
this.couponCurrent = index;
},
couponAnimationFinish(e) {
const current = e.detail.current;
this.swiperCouponCurrent = current;
this.couponCurrent = current;
},
setViewHeight() {
const res = uni.getSystemInfoSync();
// this.swiperHeight = res.windowHeight - ((88 + 10 + 88) / 2) + 'px';
this.swiperHeight = '450px';
},
toCouponPage() {
this.$u.route({
url: '/pageE/mine/MemberServe',
params: {
current: 1
}
})
},
},
};
</script>
<style lang="scss" scoped>
.youhq{
.top{
height: 90rpx;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
>text:first-child{
font-size: 30rpx;
color: #333;
}
>text:last-child{
font-size: 18rpx;
color: #999;
}
}
.label{
display: flex;
font-size: 24rpx;
color: #999;
>text{
margin-right: 34rpx;
}
}
.list{
display: flex;
// justify-content: space-between;
width: auto;
}
.coupon-swiper {
.top {
padding-top: 30rpx;
display: flex;
align-items: center;
justify-content: space-between;
.title {
font-size: 30rpx;
font-weight: 500;
color: rgba(51,51,51,1);
}
.view-more {
font-size: 18rpx;
color: rgba(153,153,153,1);
}
}
.swiper-coupon-item {
box-sizing: border-box;
background-color: #ffffff;
// padding: 30rpx {
// top: 0;
// };
.coupon-item {
margin-bottom: 20rpx;
}
}
}
</style>

View File

@@ -1,83 +0,0 @@
<template>
<view class="item">
<view class="top">
<view class="pic">
<text></text>
<text>12</text>
</view>
<view class="man">
<text></text>
<text></text>
</view>
<text class="button">
立即<br />领取
</text>
</view>
<view class="time">
使用时间2020.01.24-2020.05.08
</view>
</view>
</template>
<script>
export default {
name:"item"
}
</script>
<style lang="scss" scoped>
.item{
padding: 10rpx;
width: 254rpx;
height: 94rpx;
border: 2rpx solid #FDD360;
border-radius: 20rpx;
flex-shrink: 0;
margin-right: 16rpx;
.top{
display: flex;
align-items: center;
justify-content: space-between;
.pic{
display: flex;
align-items: flex-end;
color:#FDD360;
>text:first-child{
font-size: 24rpx;
}
>text:last-child{
font-size: 48rpx;
}
}
.man{
display: flex;
flex-direction: column;
align-items: center;
color: #FDD360;
>text:first-child{
font-size: 14rpx;
}
>text:last-child{
font-size: 18rpx;
font-weight: bold;
}
}
.button{
width: 61rpx;
height: 61rpx;
border-radius: 50%;
font-size: 18rpx;
background-color: #FDD360;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
}
}
.time{
font-size: 12rpx;
color: #FDD360;
font-weight: bold;
}
}
</style>