更新记录

1.0.1(2023-04-01)

支持优惠券为空场景优化

1.0.0(2023-04-01)

支持优惠券兑换,自动计算可用以及不可用优惠券数量


平台兼容性

Vue2 Vue3
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
app-vue app-nvue
钉钉小程序 快手小程序 飞书小程序 京东小程序
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari
<template>
    <view>
        <coupon-card-list :showClose="showClose" :useInPage="useInPage" :couponList="couponList"
            :defaultSelectType="defaultSelectType" @handleConvert="handleConvert" @handleSelectType="handleSelectType"
            @handClickCoupon="handClickCoupon" @handleClose="handleClose"></coupon-card-list>
    </view>
</template>

<script>
    import CouponCardList from '@/components/coupon-card-list/coupon-card-list.vue'
    export default {
        data() {
            return {
                showClose: true,
                useInPage: true,
                defaultSelectType: 'available',
                couponList: [{
                    id: 1,
                    couponName: '优惠券名称',
                    couponAmountText: '无门槛 最多优惠12元',
                    couponTime: '2017.03.10 - 2017.12.30',
                    couponDesc: '描述信息',
                    discountPrice: '1.5',
                    unit: '元',
                    type: 'available',
                }, {
                    id: 2,
                    couponName: '不可用优惠券',
                    couponAmountText: '无门槛 最多优惠12元',
                    couponTime: '2017.03.10 - 2017.12.30',
                    couponDesc: '描述信息',
                    discountPrice: '1.5',
                    unit: '元',
                    type: 'notavailable'
                }, {
                    id: 3,
                    couponName: '可用优惠券',
                    couponAmountText: '无门槛 最多优惠12元',
                    couponTime: '2017.03.10 - 2017.12.30',
                    couponDesc: '描述信息',
                    discountPrice: '1.5',
                    unit: '元',
                    type: 'available'
                }, {
                    id: 4,
                    couponName: '可用优惠券',
                    couponAmountText: '无门槛 最多优惠12元',
                    couponTime: '2017.03.10 - 2017.12.30',
                    couponDesc: '描述信息',
                    discountPrice: '1.5',
                    unit: '元',
                    type: 'available'
                }, {
                    id: 5,
                    couponName: '不可用优惠券',
                    couponAmountText: '无门槛 最多优惠12元',
                    couponTime: '2017.03.10 - 2017.12.30',
                    couponDesc: '描述信息',
                    discountPrice: '1.5',
                    unit: '元',
                    type: 'notavailable'
                }, {
                    id: 6,
                    couponName: '可用优惠券',
                    couponAmountText: '无门槛 最多优惠12元',
                    couponTime: '2017.03.10 - 2017.12.30',
                    couponDesc: '描述信息',
                    discountPrice: '1.5',
                    unit: '元',
                    type: 'available'
                }],
            }
        },
        onLoad() {},
        components: {
            CouponCardList
        },
        methods: {
            handClickCoupon(item) {
                console.log('选中优惠券名称:' + item.couponName);
                console.log('选中优惠券优惠金额:' + item.discountPrice);
            },
            /**
             * 点击兑换
             */
            handleConvert(type) {
                console.log('-点击兑换-');
                console.log('兑换码:' + type);
            },
            /**
             * 切换优惠券类别
             */
            handleSelectType(type) {
                console.log('切换优惠券类别:' + type);
            },
            /**
             * 关闭优惠券:浮层时候使用
             */
            handleClose() {
                console.log('点击不使用优惠券');
            }
        }
    }
</script>

组件入参

参数 类型 默认值 描述
showClose Boolean true 展示【不使用】按钮
useInPage Boolean false 是否在页面中使用,浮层使用传 false
defaultSelectType String 'available' 优惠券 Tab 类别: available notavailable
couponList Array [] 优惠券列表数据

优惠券列表数据参数 ICouponItem

参数 类型 默认值 描述
id Number String '' 优惠券唯一识别 id
couponName String '' 优惠券名称
couponAmountText String '' 优惠券使用条件
couponTime String '' 优惠券有效时间
couponDesc String '' 优惠券描述信息
discountPrice String '' 优惠券优惠金额
unit String '' 优惠券优惠金额币种
type String '' 优惠券类型:available notavailable

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问