59 lines
4.2 KiB
SQL
59 lines
4.2 KiB
SQL
-- ----------------------------
|
|
-- Title:消费订单表
|
|
-- Author:lcc
|
|
-- Table:lc_order_purchase
|
|
-- ---------------------------
|
|
drop table if exists hd_order_purchase;
|
|
create table `lc_order_purchase` (
|
|
`id` int(10) unsigned not null auto_increment,
|
|
`app_id` int(10) unsigned not null comment '小程序id',
|
|
`app_uid` int(10) unsigned not null comment '小程序用户id',
|
|
`sid` varchar(32) not null default '' comment '订单号',
|
|
`item_id` int(10) unsigned not null comment '商品/服务id',
|
|
`sku_id` int(10) unsigned not null default '0' comment 'id',
|
|
`item_title` varchar(1024) not null default '' comment '商品/服务名称',
|
|
`item_num` int(10) unsigned not null default '1' comment '商品/服务数量',
|
|
`item_price` decimal(12,2) not null default '0.00' comment '商品/服务价格',
|
|
`biz_id` int(11) not null default '0' comment '商家id',
|
|
`carriage` int(10) unsigned not null default '0' comment '运费',
|
|
`total_price` decimal(12,2) not null default '0.00' comment '订单价格',
|
|
`pay_price` decimal(12,2) not null default '0.00' comment '实付金额',
|
|
`uname` varchar(16) not null default '' comment '订单用户姓名',
|
|
`mobile` varchar(11) not null default '' comment '手机号码',
|
|
`type` tinyint(1) not null default '0' comment '订单类型 1实物 2虚拟 3活动定金 4合同定金',
|
|
`payway` tinyint(1) not null default '0' comment '支付方式 0未选择 1微信',
|
|
`pay_time` timestamp not null default '0000-00-00 00:00:00' comment '付款时间',
|
|
`jsondata` json default null comment '订单其它数据',
|
|
`descrip` varchar(255) not null default '' comment '备注/描述',
|
|
`cf_id` int(10) unsigned not null default '0' comment '来源id',
|
|
`cf_uid` int(10) unsigned not null default '0' comment '来源用户id',
|
|
`cf_platform` varchar(16) not null default '' comment '来源平台',
|
|
`status` tinyint(1) not null default '0' comment '订单状态[-2已过期 -1删除 0待支付 1已支付 2退款中 3已退款]',
|
|
`status_detail` tinyint(1) not null default '0' comment 'status',
|
|
`expire_time` int(10) unsigned not null default '0' comment '订单过期时间(0不过期)',
|
|
`express_time` timestamp not null default '0000-00-00 00:00:00' comment '发货时间',
|
|
`finish_time` timestamp not null default '0000-00-00 00:00:00' comment '交易完成时间(核销完成|确认收货)',
|
|
`c_time` int(10) unsigned not null default '0' comment '创建时间',
|
|
`u_time` timestamp not null default current_timestamp on update current_timestamp,
|
|
primary key (`id`),
|
|
key `idx_user_order` (`app_id`,`app_uid`,`status`),
|
|
key `idx_sid` (`sid`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='消费订单表';
|
|
|
|
|
|
-- ----------------------------
|
|
-- Title:订单总表
|
|
-- Author:lcc
|
|
-- Table:lc_orders
|
|
-- ---------------------------
|
|
drop table if exists lc_orders;
|
|
create table lc_orders(
|
|
id int unsigned not null auto_increment,
|
|
app_id int unsigned not null default 1 comment '小程序ID',
|
|
app_uid int unsigned not null default 1 comment '小程序用户ID',
|
|
sid varchar(32) not null default '' comment '订单号',
|
|
mobile varchar(11) not null default '' comment '手机号码',
|
|
type varchar(16) not null default '' comment '订单类型(表名)',
|
|
primary key(id)
|
|
)ENGINE=InnoDB default CHARSET=utf8mb4 comment='订单表';
|