rewrite tab swiper 8.7
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
<template>
|
||||
<view class="coupon-swiper">
|
||||
<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>
|
||||
<swiper :current="swiperCouponCurrent" @animationfinish="couponAnimationFinish" :style="{ height: swiperHeight }">
|
||||
<scroll-view scroll-x="true" class="classify-coupon">
|
||||
<view v-for="(classify, index) in couponGroupList" :key="index" class="classify-item" :class="{ 'active': couponCurrent == index }" @click="couponTabsChange(index)">{{ classify.gc_name }}</view>
|
||||
</scroll-view>
|
||||
<!-- <swiper :current="swiperCouponCurrent" @animationfinish="couponAnimationFinish" :style="{ height: swiperHeight }">
|
||||
<swiper-item class="swiper-coupon-item" v-for="(_, i) in couponGroupList" :key="i">
|
||||
<scroll-view scroll-y style="height: 100%;" @scrolltolower="onreachBottom">
|
||||
<scroll-view scroll-y style="height: 100%;" @scrolltolower="onreachBottom" class="coupon-scroll">
|
||||
<view v-for="(coupon, index) in couponList" :key="index" class="coupon-item">
|
||||
<Coupon :couponInfo="coupon" :status='0' :type="0" @exchange="exchangeCoupon($event)"></Coupon>
|
||||
</view>
|
||||
@@ -11,7 +13,14 @@
|
||||
<u-empty text="暂无优惠券" mode="coupon" color="#000" v-if="!couponList.length"></u-empty>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</swiper> -->
|
||||
<scroll-view scroll-y style="height: 100%;" @scrolltolower="onreachBottom" class="coupon-scroll" :style="{ height: swiperHeight }">
|
||||
<view v-for="(coupon, index) in couponList" :key="index" class="coupon-item">
|
||||
<Coupon :couponInfo="coupon" :status='0' :type="0" @exchange="exchangeCoupon($event)"></Coupon>
|
||||
</view>
|
||||
<u-loadmore :status="loadStatus" bgColor="#FFF" margin-top="20" margin-bottom="20" v-if="couponList.length>=pageSize" @loadmore="onreachBottom"></u-loadmore>
|
||||
<u-empty text="暂无优惠券" mode="coupon" color="#000" v-if="!couponList.length"></u-empty>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
@@ -19,7 +28,7 @@ import Coupon from "@/components/mine/coupon/index";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
pageSize: 12,
|
||||
pageSize: 5, // 页面显示的条数
|
||||
swiperHeight: '',
|
||||
couponCurrent: 0,
|
||||
swiperCouponCurrent: 0,
|
||||
@@ -39,9 +48,10 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
couponCurrent(index) {
|
||||
this.couponList = [];
|
||||
const id = this.couponGroupList[index].gc_id;
|
||||
this.getCouponList({ gc_id: id, load: 'reload' });
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onreachBottom() {
|
||||
@@ -89,6 +99,7 @@ export default {
|
||||
},
|
||||
couponTabsChange(index) {
|
||||
this.couponCurrent = index;
|
||||
this.swiperCouponCurrent = this.couponCurrent;
|
||||
},
|
||||
couponAnimationFinish(e) {
|
||||
const current = e.detail.current;
|
||||
@@ -104,64 +115,92 @@ export default {
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.coupon-swiper {
|
||||
.swiper-coupon-item {
|
||||
box-sizing: border-box;
|
||||
.classify-coupon {
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
background-color: #ffffff;
|
||||
padding: 30rpx {
|
||||
top: 0;
|
||||
};
|
||||
.coupon-item {
|
||||
margin-bottom: 20rpx;
|
||||
margin-bottom: 2rpx;
|
||||
.classify-item {
|
||||
display: inline-block;
|
||||
line-height: 88rpx;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
.active {
|
||||
color: #FF780F;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
// .swiper-coupon-item {
|
||||
// box-sizing: border-box;
|
||||
// background-color: #ffffff;
|
||||
// padding: 30rpx {
|
||||
// top: 0;
|
||||
// };
|
||||
// .coupon-item {
|
||||
// margin-bottom: 20rpx;
|
||||
// }
|
||||
// .coupon-item {
|
||||
// padding: 30rpx;
|
||||
// background-color: #ffffff;
|
||||
// display: flex;
|
||||
// align-items: flex-end;
|
||||
// // margin-bottom: 2rpx;
|
||||
// > img {
|
||||
// width: 180rpx;
|
||||
// height: 160rpx;
|
||||
// border-radius: 10rpx;
|
||||
// margin-right: 30rpx;
|
||||
// }
|
||||
// .coupon-main {
|
||||
// .coupon-title {
|
||||
// font-size: 30rpx;
|
||||
// color: rgba(51,51,51,1);
|
||||
// }
|
||||
// .coupon-date {
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
// margin: 29rpx 0 20rpx;
|
||||
// > img {
|
||||
// width: 24rpx;
|
||||
// height: 24rpx;
|
||||
// margin-right: 15rpx;
|
||||
// }
|
||||
// > view {
|
||||
// font-size: 24rpx;
|
||||
// color: rgba(153,153,153,1);
|
||||
// }
|
||||
// }
|
||||
// .coupon-integral {
|
||||
// font-size: 30rpx;
|
||||
// font-weight: 500;
|
||||
// color: rgba(255,120,15,1);
|
||||
// }
|
||||
// }
|
||||
// .coupon-btn {
|
||||
// margin-left: auto;
|
||||
// width: 85rpx;
|
||||
// // height: 42rpx;
|
||||
// border: 2rpx solid rgba(255,120,15,1);
|
||||
// border-radius: 10rpx;
|
||||
// font-size: 26rpx;
|
||||
// color: rgba(255,120,15,1);
|
||||
// line-height: 42rpx;
|
||||
// text-align: center;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
.coupon-scroll {
|
||||
background-color: #ffffff;
|
||||
padding-top: 30rpx;
|
||||
.coupon-item {
|
||||
padding: 30rpx {
|
||||
top: 0;
|
||||
};
|
||||
}
|
||||
// .coupon-item {
|
||||
// padding: 30rpx;
|
||||
// background-color: #ffffff;
|
||||
// display: flex;
|
||||
// align-items: flex-end;
|
||||
// // margin-bottom: 2rpx;
|
||||
// > img {
|
||||
// width: 180rpx;
|
||||
// height: 160rpx;
|
||||
// border-radius: 10rpx;
|
||||
// margin-right: 30rpx;
|
||||
// }
|
||||
// .coupon-main {
|
||||
// .coupon-title {
|
||||
// font-size: 30rpx;
|
||||
// color: rgba(51,51,51,1);
|
||||
// }
|
||||
// .coupon-date {
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
// margin: 29rpx 0 20rpx;
|
||||
// > img {
|
||||
// width: 24rpx;
|
||||
// height: 24rpx;
|
||||
// margin-right: 15rpx;
|
||||
// }
|
||||
// > view {
|
||||
// font-size: 24rpx;
|
||||
// color: rgba(153,153,153,1);
|
||||
// }
|
||||
// }
|
||||
// .coupon-integral {
|
||||
// font-size: 30rpx;
|
||||
// font-weight: 500;
|
||||
// color: rgba(255,120,15,1);
|
||||
// }
|
||||
// }
|
||||
// .coupon-btn {
|
||||
// margin-left: auto;
|
||||
// width: 85rpx;
|
||||
// // height: 42rpx;
|
||||
// border: 2rpx solid rgba(255,120,15,1);
|
||||
// border-radius: 10rpx;
|
||||
// font-size: 26rpx;
|
||||
// color: rgba(255,120,15,1);
|
||||
// line-height: 42rpx;
|
||||
// text-align: center;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -5,7 +5,7 @@
|
||||
</view>
|
||||
<swiper :current="swiperCurrent" @animationfinish="animationfinish" :style="{ height: swiperHeight }">
|
||||
<swiper-item class="swiper-item" v-for="(item, index) in list" :key="index">
|
||||
<scroll-view scroll-y style="height: 100%;" @scrolltolower="reachBottom">
|
||||
<scroll-view scroll-y style="height: 100%;" @scrolltolower="reachBottom" class="order-scroll">
|
||||
<view>
|
||||
<view class="item-container" v-for="order in orderList" :key="order.order_id">
|
||||
<OrderItem :order="order" @refreshOrderList="refreshOrderList" v-if="current != 4"></OrderItem>
|
||||
@@ -13,7 +13,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<u-empty text="暂无订单" mode="order" color="#000000" v-if="!orderList.length"></u-empty>
|
||||
<u-loadmore :status="loadStatus[index]" bgColor="#ECECEC" margin-bottom="20"></u-loadmore>
|
||||
<u-loadmore :status="loadStatus[index]" bgColor="#ECECEC" margin-bottom="20" v-if="current != 4 && orderList.length>3" class="order-loadmore"></u-loadmore>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
@@ -162,8 +162,7 @@ export default {
|
||||
return res.data.list.length;
|
||||
},
|
||||
reachBottom() {
|
||||
// 大于15条才会加载更多
|
||||
if(this.orderList.length < 15) return false;
|
||||
if(this.current == 4) return;
|
||||
if(!this.timer) return false;
|
||||
this.timer = false;
|
||||
this.loadStatus.splice(this.current, 1, "loading");
|
||||
@@ -171,8 +170,8 @@ export default {
|
||||
let promise;
|
||||
// if(this.current == 6) promise = this.getAfterSaleList();
|
||||
// else
|
||||
if(this.current == 4) promise = this.goodsTryOrderList();
|
||||
else promise = this.getOrderList();
|
||||
// if(this.current == 4) promise = this.goodsTryOrderList();
|
||||
promise = this.getOrderList();
|
||||
promise.then(length => {
|
||||
this.loadStatus.splice(this.current, 1, "nomore");
|
||||
if(length == 0) this.page--;
|
||||
@@ -204,8 +203,10 @@ export default {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.swiper-item {
|
||||
.item-container {
|
||||
padding: 20rpx 30rpx;
|
||||
.order-scroll {
|
||||
.item-container {
|
||||
padding: 20rpx 30rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user