🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
```[sql] -- ---------------------------- -- Table structure for ns_promotion_coupon -- ---------------------------- DROP TABLE IF EXISTS `ns_promotion_coupon`; CREATE TABLE `ns_promotion_coupon` ( `coupon_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '优惠券id', `type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '优惠券类型 reward-满减 discount-折扣 random-随机', `coupon_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '优惠券名称', `coupon_type_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠券类型id', `site_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '站点Id', `coupon_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '优惠券编码', `member_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '领用人', `use_order_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠券使用订单id', `goods_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用', `goods_ids` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '适用商品id', `at_least` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '最小金额', `money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '面额', `discount` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '1 =< 折扣 <= 9.9 当type为discount时需要添加', `discount_limit` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '最多折扣金额 当type为discount时可选择性添加', `is_mark` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否同时给会员打标签 0-否 1-是', `member_label_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '会员标签id', `is_share` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '分享设置 优惠券允许分享给好友领取', `is_handsel` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '转赠设置 优惠券允许转赠给好友', `is_forbid_preference` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用', `is_expire_notice` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否开启过期提醒0-不开启 1-开启', `expire_notice_fixed_term` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '过期前N天提醒', `is_noticed` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否已提醒', `state` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠券状态 1已领用(未使用) 2已使用 3已过期', `get_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取', `related_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '获取优惠券的关联id', `fetch_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '领取时间', `use_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用时间', `start_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '可使用的开始时间', `end_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '有效期结束时间', PRIMARY KEY (`coupon_id`) USING BTREE, INDEX `IDX_ns_promotion_coupon_coupon_type_id`(`coupon_type_id`) USING BTREE, INDEX `IDX_ns_promotion_coupon_end_time`(`end_time`) USING BTREE, INDEX `IDX_ns_promotion_coupon_member_id`(`member_id`) USING BTREE, INDEX `IDX_ns_promotion_coupon_site_id`(`site_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 AVG_ROW_LENGTH = 287 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '优惠券表' ROW_FORMAT = Compact; -- ---------------------------- -- Table structure for ns_promotion_coupon_type -- ---------------------------- DROP TABLE IF EXISTS `ns_promotion_coupon_type`; CREATE TABLE `ns_promotion_coupon_type` ( `coupon_type_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '优惠券类型Id', `type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '优惠券类型 reward-满减 discount-折扣 random-随机', `site_id` int(11) NOT NULL DEFAULT 1 COMMENT '站点id', `coupon_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '优惠券名称', `coupon_name_remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '名称备注', `image` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '优惠券图片', `count` int(11) NOT NULL DEFAULT 0 COMMENT '发放数量', `lead_count` int(11) NOT NULL DEFAULT 0 COMMENT '已领取数量', `used_count` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '已使用数量', `goods_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用', `goods_ids` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '适用商品id', `is_limit` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用门槛0-无门槛 1-有门槛', `at_least` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '满多少元使用 0代表无限制', `money` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '发放面额 当type为reward时需要添加', `discount` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '1 =< 折扣 <= 9.9 当type为discount时需要添加', `discount_limit` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '最多折扣金额 当type为discount时可选择性添加', `min_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '最低金额 当type为radom时需要添加', `max_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '最大金额 当type为radom时需要添加', `validity_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期', `start_use_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用开始日期 过期类型1时必填', `end_use_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用结束日期 过期类型1时必填', `fixed_term` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效', `is_limit_member` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否限制会员身份0-不限制 1限制', `member_level_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '若开启会员身份限制,需要添加会员等级id', `is_limitless` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否无限制0-否 1是', `max_fetch` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '每人最大领取个数', `is_expire_notice` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否开启过期提醒0-不开启 1-开启', `expire_notice_fixed_term` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '过期前N天提醒', `is_mark` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否同时给会员打标签 0-否 1-是', `member_label_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '会员标签id', `is_share` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '分享设置 优惠券允许分享给好友领取', `is_handsel` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '转赠设置 优惠券允许转赠给好友', `is_forbid_preference` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用', `is_show` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否显示', `discount_order_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '订单的优惠总金额', `order_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '用券总成交额', `is_forbidden` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否禁止发放0-否 1-是', `old_member_num` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用优惠券的老会员数', `new_member_num` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '平台第一次购买使用优惠券的会员数', `order_goods_num` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用优惠券购买的商品数量', `status` int(11) NOT NULL DEFAULT 0 COMMENT '状态(1进行中2已结束-1已关闭)', `create_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间', `update_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '修改时间', `end_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '有效日期结束时间', PRIMARY KEY (`coupon_type_id`) USING BTREE, INDEX `IDX_ns_promotion_coupon_type_site_id`(`site_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 AVG_ROW_LENGTH = 1820 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '优惠券类型表' ROW_FORMAT = Compact;