Files
liche/sql/receiver/order.sql
T
xiaoyu c63370bb40 sql
2021-07-22 18:56:03 +08:00

183 lines
11 KiB
SQL

-- ----------------------------
-- Title:订单代办表
-- Author:lcc
-- Table:lc_receiver_order_agents
-- ---------------------------
drop table if exists lc_receiver_order_agents;
create table lc_receiver_order_agents (
id int(10) unsigned not null auto_increment comment '自增id',
o_id int(10) unsigned not null default '0' comment '订单表id',
car_num varchar(20) not null default '' comment '车牌号',
if_ins tinyint(1) not null default '0' comment '否是交强制险',
car_img varchar(100) not null default '' comment '行驶证',
ins_img json default null comment '保险单图片',
ins_time timestamp not null default '0000-00-00 00:00:00' comment '保险到期时间',
status tinyint(1) not null default '0' comment '状态(0未完成 1完成代办)',
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),
unique key o_id (o_id)
) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COLLATE=UTF8MB4_0900_AI_CI COMMENT='订单代办表';
-- ----------------------------
-- Title:订单开票
-- Author:lcc
-- Table:lc_receiver_order_bills
-- ---------------------------
drop table if exists lc_receiver_order_bills;
create table lc_receiver_order_bills (
id int(10) unsigned not null auto_increment comment '自增id',
o_id int(10) unsigned not null default '0' comment '订单表id',
cardida varchar(100) not null default '' comment '身份证正面图片',
cardidb varchar(100) not null default '' comment '身份证正面图片',
money decimal(10,2) not null default '0.00' comment '到账金额',
file varchar(100) not null default '' comment 'pdf文件',
jsondata json default null comment 'json数据',
status tinyint(1) not null default '0' comment '状态(0未开票 1已开票)',
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),
unique key o_id (o_id)
) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COLLATE=UTF8MB4_0900_AI_CI COMMENT='订单开票';
-- ----------------------------
-- Title:订单车辆确定表
-- Author:lcc
-- Table:lc_receiver_order_ckcars
-- ---------------------------
drop table if exists lc_receiver_order_ckcars;
create table lc_receiver_order_ckcars (
id int(10) unsigned not null auto_increment comment '自增id',
o_id int(10) unsigned not null default '0' comment '订单表id',
status tinyint(1) not null default '0' comment '状态(0未确定 1后台确定 2用户签名)',
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),
unique key o_id (o_id)
) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COLLATE=UTF8MB4_0900_AI_CI COMMENT='订单车辆确定表';
-- ----------------------------
-- Title:订单合同信息
-- Author:lcc
-- Table:lc_receiver_order_contracts
-- ---------------------------
drop table if exists lc_receiver_order_contracts;
create table lc_receiver_order_contracts (
id int(10) unsigned not null auto_increment comment '自增id',
cid varchar(32) not null comment '合同编号',
o_id int(10) unsigned not null default '0' comment '订单表id',
file varchar(255) not null default '' comment '合同文件地址',
imgs json default null comment '合同图片地址',
jsondata json default null comment '其他信息',
type tinyint(1) not null default '0' comment '合同类型(0整车合同 1代理协议 2确定信息 3交接信息)',
status tinyint(1) not null default '0' comment '状态(0未签署 1已签署)',
sign_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)
) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COLLATE=UTF8MB4_0900_AI_CI COMMENT='订单合同信息';
-- ----------------------------
-- Title:交付确认订单
-- Author:lcc
-- Table:lc_receiver_order_deliverys
-- ---------------------------
drop table if exists lc_receiver_order_deliverys;
create table lc_receiver_order_deliverys (
id int(10) unsigned not null auto_increment comment '自增id',
o_id int(10) unsigned not null default '0' comment '订单表id',
status tinyint(1) not null default '0' comment '状态(0待确认 1用户已确认 2销售已确认)',
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),
unique key o_id (o_id)
) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COLLATE=UTF8MB4_0900_AI_CI COMMENT='交付确认订单';
-- ----------------------------
-- Title:订单贷款表
-- Author:lcc
-- Table:lc_receiver_order_loans
-- ---------------------------
drop table if exists lc_receiver_order_loans;
create table lc_receiver_order_loans (
id int(10) unsigned not null auto_increment comment '自增id',
o_id int(10) unsigned not null default '0' comment '订单表id',
title varchar(100) not null default '' comment '产品名称',
year tinyint(2) not null default '0' comment '贷款年限',
first_price decimal(9,2) not null default '0.00' comment '首付金额',
notify_file varchar(100) not null default '' comment '通知函文件',
lend_file varchar(100) not null default '' comment '放款函文件',
status tinyint(1) not null default '0' comment '状态(0审核中 1已放款)',
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),
unique key o_id (o_id)
) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COLLATE=UTF8MB4_0900_AI_CI COMMENT='订单贷款表';
-- ----------------------------
-- Title:订单操作日志表
-- Author:lcc
-- Table:lc_receiver_order_oplogs
-- ---------------------------
drop table if exists lc_receiver_order_loans;
create table lc_receiver_order_oplogs (
id int(10) unsigned not null auto_increment comment '自增id',
order_id int(10) unsigned not null comment '订单id',
uid int(10) unsigned not null comment '操作用户id',
uname varchar(32) not null default '' comment '用户名',
type tinyint(1) not null default '0' comment '类型 0 普通 1短信 2电话',
log varchar(256) not null default '' comment '操作内容',
cf_platform varchar(10) not null default '' 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)
) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COLLATE=UTF8MB4_0900_AI_CI COMMENT='订单操作日志表';
-- ----------------------------
-- Title:订单合同签订
-- Author:lcc
-- Table:lc_receiver_order_signs
-- ---------------------------
drop table if exists lc_receiver_order_signs;
create table lc_receiver_order_signs (
id int(10) unsigned not null auto_increment comment '自增id',
o_id int(10) unsigned not null default '0' comment '订单表id',
status tinyint(1) not null default '0' comment '状态(0已生成合同 1已签合同 2已预交款)',
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),
unique key o_id (o_id)
) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COLLATE=UTF8MB4_0900_AI_CI COMMENT='订单合同签订';
-- ----------------------------
-- Title:订单表
-- Author:lcc
-- Table:lc_receiver_orders
-- ---------------------------
drop table if exists lc_receiver_orders;
create table lc_receiver_orders (
id int(10) unsigned not null auto_increment comment '自增id',
rid int(10) not null default '0' comment '客户池id',
sid varchar(32) not null comment '订单号',
name varchar(32) not null comment '客户姓名',
mobile varchar(11) not null comment '客户手机号码',
biz_id int(10) not null default '0' comment '门店id',
item_id int(10) unsigned not null default '0' comment '商品id',
brand_id int(10) not null default '0' comment '车型品牌id',
s_id int(10) not null default '0' comment '车系id',
v_id int(10) not null default '0' comment '车型号',
cor_id int(10) not null default '0' comment '车身颜色id',
incor_id int(10) not null default '0' comment '内饰颜色',
price decimal(10,2) not null default '0.00' comment '车辆指导价',
deposit decimal(8,2) not null default '0.00' comment '车辆定金',
payway tinyint(1) not null default '0' comment '付款方式(0分期 1全款)',
admin_id int(10) not null default '0' comment '销售id',
info_json json default null comment '用户其它信息',
car_json json default null comment '车信息',
jsondata json default null comment '其他信息',
status tinyint(2) not null default '0' comment '状态 0签合同 1办理分期 2车辆确认 3开票 4代理服务 5车辆交付 6完成交付 7退款',
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)
) ENGINE=INNODB DEFAULT CHARSET=UTF8MB4 COLLATE=UTF8MB4_0900_AI_CI COMMENT='订单表';