123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <template>
- <!-- TODO -->
- <view class="coupon-find-list">
- <!-- tabs -->
- <tui-tabs
- :tabs="tabs"
- :currentTab="currentTab"
- @change="tabChange"
- :sliderWidth="118"
- color="#333333"
- selectedColor="#FF457B"
- sliderBgColor="#FF457B"
- ></tui-tabs>
- <!-- 优惠券列表 -->
- <swiper
- :indicator-dots="false"
- :autoplay="false"
- class="swiper"
- :style="{ height: swiperHeight + 'px' }"
- :current="currentTab"
- @change="swiperChange"
- >
- <swiper-item class="coupon-list"> <cm-coupon :key="i" v-for="i in 15"></cm-coupon> </swiper-item>
- <swiper-item class="coupon-list"> <cm-coupon :key="i" v-for="i in 3"></cm-coupon> </swiper-item>
- <swiper-item class="coupon-list">
- <cm-empty message="暂无任何优惠券~" :image="baseUrl + 'icon-coupon-empty.png'" :offset="-12"></cm-empty>
- </swiper-item>
- </swiper>
- <!-- 跳转领券中心 -->
- <view class="footer"> <view class="btn">领券中心</view> </view>
- </view>
- </template>
- <script>
- import CmCoupon from '@/components/cm-module/cm-coupon/cm-coupon.vue'
- import CmEmpty from '@/components/cm-module/cm-empty/cm-empty.vue'
- import { mapGetters } from 'vuex'
- export default {
- components: {
- CmCoupon,
- CmEmpty
- },
- data() {
- return {
- windowHeight: 0,
- baseUrl: this.$Static,
- tabs: [
- {
- name: '未使用10'
- },
- {
- name: '已使用10'
- },
- {
- name: '已失效10'
- }
- ],
- currentTab: 0
- }
- },
- computed: {
- ...mapGetters(['isIphoneX']),
- swiperHeight() {
- if (this.isIphoneX) {
- return this.windowHeight - 120
- }
- return this.windowHeight - 80
- // return this.swiperHeight
- }
- },
- onLoad() {
- this.getWindowHeight()
- },
- methods: {
- tabChange(e) {
- this.currentTab = e.index
- },
- swiperChange(e){
- this.currentTab = e.detail.current
- },
- // 获取可用屏幕高度
- getWindowHeight(){
- this.windowHeight = uni.getSystemInfoSync().windowHeight
- console.log(this.windowHeight)
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- page{
- width: 100%;
- height: 100%;
- background: #f7f7f7;
- }
- .swiper {
- height: 800rpx;
- background: #f7f7f7;
- .coupon-list{
- height: 100%;
- overflow-y: scroll;
- }
- }
- .footer {
- display: flex;
- justify-content: center;
- align-items: center;
- background: #f7f7f7;
- padding-top: 20rpx;
- .btn {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 600rpx;
- height: 90rpx;
- background: linear-gradient(90deg, #fc32b4 0%, #f83c6c 100%);
- border-radius: 45rpx;
- font-size: 30rpx;
- color: #ffffff;
- }
- }
- </style>
|