1
xuxueyang
2024-09-03 6d583f26009a2cbc74f5963fb92ff184019f6c2b
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
<template>
    <view class="coupon-container">
        <view class="">
            <no-data v-if="!list||list.length==0" style="width: 100%;"></no-data>
 
            <view v-for="(item,index) of list" :key="index" class="coupont-item all">
                <view class="flex container img100">
                    <view class="info-price">
                        <view class="price1">
                            {{item.maxDiscountAmount?(`${item.maxDiscountAmount}折`):(`¥${item.couponDiscountValue}`)}}
                        </view>
                        <view class="price2">{{item.minOrderAmount?(`满¥${item.minOrderAmount}可用`):'无门槛'}}</view>
                    </view>
                    <view class="info flex1">
                        <view class="title">
                            {{item.couponName||'-'}}
                        </view>
                        <view class="time">
                            领取后{{item.usageTimeNum||''}}{{item.usageTimeTypeName||''}}有效
                        </view>
                        <view class="button" @click="getCoupon(item)">
                            立即领取
                        </view>
                    </view>
                </view>
                <view class="tip">
                    <span class="t-red">*</span>此券每人限领1张。仅限用于花满芜鲜花交易平台鲜切花花款满额使用,不可与其他优惠同享、不可叠加使用
                </view>
            </view>
        </view>
 
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                query: {
                    status: ''
                },
                list: []
            }
        },
        async onLoad() {
            this.listApi = '/api/v2/coupon/app' + `/center/list`
 
            this.getList()
        },
 
        methods: {
            async getCoupon(item) {
                this.$message.showLoading()
                const {
                    code,
                    data
                } = await this.$http.request('post', '/api/v2/coupon/app/receive', {
                    data: {
                        couponId: item.id,
                        num: 1
                    }
                })
                if (code == 0) {
                    await this.$message.showToast('领取成功')
                    this.$store.dispatch('sign_add', 'coupon')
                    this.refreshList()
                }
            }
 
        },
        async onPullDownRefresh() {
            await this.refreshList()
            uni.stopPullDownRefresh()
 
        },
    }
</script>
 
<style lang="scss" scoped>
    @import './coupon.scss';
 
    .coupon-container {}
</style>