移动系统liao
2025-02-17 557c2711a3e103ebc3d0492344eca9730d5e92b2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<template>
    <view>
        <u-toast ref="uToast" /><u-no-network></u-no-network>
        <u-navbar title="优惠券" safeAreaInsetTop fixed placeholder>
            <view class="coreshop-navbar-left-slot" slot="left">
                <u-icon name="arrow-left" size="19" @click="goNavigateBack"></u-icon>
                <u-line direction="column" :hairline="false" length="16" margin="0 8px"></u-line>
                <u-icon name="home" size="22" @click="goHome"></u-icon>
            </view>
            <view slot="right">
            </view>
        </u-navbar>
 
        <view class="coreshop-coupon  coreshop-margin-left-10 coreshop-margin-right-10 coreshop-margin-bottom-10  coreshop-margin-top-10">
            <view v-if="list.length">
                <view class="coreshop-coupon-card-view coreshop-margin-bottom-10" :class="item.maxRecevieNums > 0 && item.getNumber >= item.maxRecevieNums ?'coreshop-lower-shelf':''" v-for="(item, key) in list" :key="key">
                    <view class="img-lower-box" v-if="item.maxRecevieNums > 0 && item.getNumber >= item.maxRecevieNums ">已领完</view>
                    <view class="card-price-view">
                        <view class="coreshop-text-red price-left-view">
                            <image class="icon" src="/static/images/coupon/coupon-element.png" mode=""></image>
                        </view>
                        <view class="name-content-view">
                            <view class="u-line-1 coreshop-text-red"> {{item.name}}</view>
                            <view class="coreshop-font-xs">
                                优惠方式:<text v-for="(itemResult, index) in item.results" :key="index">{{itemResult}}</text>
                            </view>
                            <view class="coreshop-font-xs">领取时间:{{$u.timeFormat(item.startTime, 'yyyy-mm-dd')}} - {{$u.timeFormat(item.endTime, 'yyyy-mm-dd')}}</view>
                        </view>
                        <view class="btn-right-view">
                            <u-button type="success" shape="circle" size="mini" @click="receiveCoupon(item.id)">立即领取</u-button>
                        </view>
                    </view>
                    <view class="card-num-view coreshop-flex coreshop-flex-direction-row  coreshop-justify-between">
                        <view class="coreshop-font-xs coreshop-flex-direction-row coreshop-basis-9 u-line-2">
                            <text v-for="(itemCondition, index) in item.conditions" :key="index">【{{itemCondition}}】</text>
                        </view>
                        <view class="coreshop-width-fit-content">
                            <u-icon name="arrow-down-fill" class="coreshop-float-right" size="14"></u-icon>
                        </view>
                    </view>
                </view>
                <u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" margin-top="20" margin-bottom="20" />
            </view>
            <view class="services-none" v-else>
                <view class="page-box">
                    <view>
                        <view class="coreshop-emptybox">
                            <u-empty :icon="$globalConstVars.apiFilesUrl+'/static/images/empty/coupon.png'" icon-size="150" mode="order" text="暂无优惠券可领取"></u-empty>
                            <navigator class="coreshop-btn" url="/pages/category/index/index" open-type="switchTab">随便逛逛</navigator>
                        </view>
                    </view>
                </view>
            </view>
        </view>
        <!-- 登录提示 -->
        <coreshop-login-modal></coreshop-login-modal>
    </view>
</template>
 
<script>
 
    export default {
 
        computed: {
        },
        data() {
            return {
                page: 1,
                limit: 10,
                list: [],
                status: 'loadmore',
                iconType: 'flower',
                loadText: {
                    loadmore: '轻轻上拉',
                    loading: '努力加载中',
                    nomore: '实在没有了'
                }
            };
        },
        onLoad() {
            this.getCouponlist()
        },
        onShow() {
        },
        onReachBottom() {
            if (this.status === 'loadmore') {
                this.getCouponlist()
            }
        },
        methods: {
            getCouponlist() {
                let _this = this;
                let data = {
                    page: this.page,
                    limit: this.limit
                }
                this.status = 'loading'
                this.$u.api.couponList(data).then(res => {
                    if (res.status) {
                        if (res.data) {
                            let _list = res.data
                            this.list = [...this.list, ..._list]
                        }
                        if (res.code >= _this.list.length) {
                            _this.page++
                            _this.status = 'loadmore'
                        } else {
                            _this.status = 'nomore'
                        }
                    } else {
                        _this.$u.toast(res.msg)
                    }
                })
            },
        }
    };
</script>
 
<style lang="scss">
</style>