电商订单详情表设计:记录优惠活动和卡券抵扣信息
电商订单详情表设计:记录优惠活动和卡券抵扣信息
电商平台需要记录订单的详细信息,包括商品信息、价格、数量、优惠折扣以及卡券抵扣等信息。以下设计了一个电商订单详情表,方便记录和分析订单数据。
订单详情表设计
| 字段名 | 数据类型 | 描述 | | ------ | ------ | ------ | | '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表示有效 |
通过以上设计,电商平台可以方便地记录每个订单的商品信息、价格、数量、优惠折扣信息和卡券抵扣信息等。同时,通过关联卡券表和优惠活动表,可以实现卡券和优惠活动的管理和使用。
原文地址: https://www.cveoy.top/t/topic/m8TW 著作权归作者所有。请勿转载和采集!