Files
liche/sql/receiver/order.sql
T
2023-03-30 15:10:03 +08:00

204 lines
14 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交接信息 4车辆买卖合同补充协议 5委托服务补充协议)',
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='交付确认订单';
alter table lc_receiver_order_deliverys add info varchar(255) not null default '' comment '随车资料' after o_id;
alter table lc_receiver_order_deliverys add tool varchar(255) not null default '' comment '随车工具' after info;
alter table lc_receiver_order_deliverys add remark varchar(255) not null default '' comment '备注' after tool;
-- ----------------------------
-- 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='订单贷款表';
alter table lc_receiver_order_loans add num tinyint(3) not null default 0 comment '贷款期数' after first_price;
alter table lc_receiver_order_loans add loan_time timestamp not null default '0000-00-00 00:00:00' comment '放款时间' after status;
-- ----------------------------
-- 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电话 3修改订单信息',
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='订单操作日志表';
alter table lc_receiver_order_oplogs add log_json json default null comment '修改json数据' after log;
-- ----------------------------
-- 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
--- jsondata if_fine 是否选择精品尊享包
-- info_json entrust_name 代办人姓名 entrust_idcard 代办人身份证 name 姓名 sex 性别 nation 民族 birth 出生日期 address 家庭地址 cardid 身份证 c_address 创建时输入的地址 c_cardid 创建时输入的身份证
-- money_json price_car 裸车价 price_book 定金 price_insure 保险价格 price_fine 精品报价 price_finance 金融报价 price_loan贷款金额 price_discount优惠金额 price_intention意向金 price_fine_discount精品优惠金额 price_fine_select精品选装总金额 price_options选装金额
-- ---------------------------
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',
clue_id 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='订单表';
alter table lc_receiver_orders add pack_id int(10) unsigned not null default 0 comment '服务包id' after incor_id;
alter table lc_receiver_orders add main_type tinyint(1) unsigned not null default 0 comment '购车主体(0个人 1公司)' after admin_id;
alter table lc_receiver_orders add ifentrust tinyint(1) unsigned not null default 0 comment '是否委托代办' after main_type;
alter table lc_receiver_orders add delry_time timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '期望交付时间' after status;
alter table lc_receiver_orders add finance_id int(10) unsigned not null default 0 comment '车型金融信息id' after payway;
alter table lc_receiver_orders add money_json json default null comment "价格json数据" after info_json;
alter table lc_receiver_orders add srv_ids varchar(100) not null default '' comment '服务id多个逗号隔开' after pack_id;
alter table lc_receiver_orders add fine_ids varchar(100) not null default '' comment '精品id多个逗号隔开' after srv_ids;
alter table lc_receiver_orders add bill_time timestamp not null default '0000-00-00 00:00:00' comment '开票时间' after delry_time;
alter table lc_receiver_orders add order_time timestamp not null default '0000-00-00 00:00:00' comment '下定时间' after bill_time;
alter table lc_receiver_orders add bak_mobile varchar(11) not null default '' comment '备用手机号' after mobile;