给我一个电商的记录优惠活动和卡券抵扣信息的订单详情表的设计
订单详情表设计如下:
| 字段名 | 数据类型 | 描述 | | ------ | ------ | ------ | | order_id | int | 订单编号,主键 | | user_id | int | 用户编号,外键关联用户表 | | product_id | int | 商品编号,外键关联商品表 | | product_name | varchar | 商品名称 | | price | decimal | 商品价格 | | quantity | int | 商品数量 | | subtotal | decimal | 商品小计金额 | | discount | decimal | 商品折扣金额 | | coupon_id | int | 卡券编号,外键关联卡券表 | | coupon_amount | decimal | 卡券抵扣金额 | | promotion_id | int | 优惠活动编号,外键关联优惠活动表 | | promotion_discount | decimal | 优惠活动折扣金额 | | total_amount | decimal | 订单总金额 |
其中,卡券表和优惠活动表的设计如下:
卡券表:
| 字段名 | 数据类型 | 描述 | | ------ | ------ | ------ | | coupon_id | int | 卡券编号,主键 | | coupon_name | varchar | 卡券名称 | | coupon_amount | decimal | 卡券抵扣金额 | | start_time | datetime | 卡券有效期开始时间 | | end_time | datetime | 卡券有效期结束时间 | | is_valid | tinyint | 卡券是否有效,0表示无效,1表示有效 |
优惠活动表:
| 字段名 | 数据类型 | 描述 | | ------ | ------ | ------ | | promotion_id | int | 优惠活动编号,主键 | | promotion_name | varchar | 优惠活动名称 | | promotion_type | tinyint | 优惠活动类型,1表示满减,2表示打折 | | promotion_condition | decimal | 优惠活动条件,如满100元 | | promotion_discount | decimal | 优惠活动折扣金额 | | promotion_start_time | datetime | 优惠活动开始时间 | | promotion_end_time | datetime | 优惠活动结束时间 | | is_valid | tinyint | 优惠活动是否有效,0表示无效,1表示有效 |
通过该订单详情表的设计,可以记录每个订单的商品信息、价格、数量、优惠折扣信息和卡券抵扣信息等,方便电商企业进行订单记录和分析。同时,通过关联卡券表和优惠活动表,可以实现卡券和优惠活动的管理和使用。
原文地址: http://www.cveoy.top/t/topic/bEGK 著作权归作者所有。请勿转载和采集!