設計數據表結構
1, 支持抵扣積分, 余額支付, 在線支付
2, 支持退款按支付方式原路返回
3, 支持訂單 部分發貨
4, 支持 多個訂單,同一物流編號發貨
流程
創建訂單=>在線支付=>回調修改支付狀態=>申請退貨=>同意退貨/駁回退貨(退貨和退款是一個流程)
發貨=>部分發貨/多訂單同一物流編號發貨=>確認收貨(7天自動確認)=>評價(暫時不做)
這些流程中, 注意狀態的修改.
后台發貨退貨的體驗
前台界面狀態的判斷
其他冗余字段根據業務完成
具體表結構如下:
/*
Navicat Premium Data Transfer
Source Server : 127.0.0.1
Source Server Type : MySQL
Source Server Version : 50719
Source Host : 127.0.0.1
Source Database : btc
Target Server Type : MySQL
Target Server Version : 50719
File Encoding : utf-8
Date: 08/06/2018 11:14:03 AM
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for `express`
-- ----------------------------
DROP TABLE IF EXISTS `express`;
CREATE TABLE `express` (
`id` tinyint(1) unsigned NOT NULL AUTO_INCREMENT COMMENT '索引ID',
`name` varchar(50) NOT NULL COMMENT '公司名稱',
`kuaidi_no` varchar(100) DEFAULT NULL COMMENT '快遞100編號',
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '狀態0為正常1為關閉',
`create_time` int(11) DEFAULT NULL COMMENT '創建時間',
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='快遞公司';
-- ----------------------------
-- Table structure for `order_goods`
-- ----------------------------
DROP TABLE IF EXISTS `order_goods`;
CREATE TABLE `order_goods` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`goods_id` int(11) DEFAULT NULL COMMENT '商品id',
`goods_price_id` int(11) DEFAULT NULL COMMENT '商品規格id (一個規格一個價格)',
`pay_status` tinyint(1) DEFAULT '0' COMMENT '0未支付 1已支付',
`pay_money` decimal(11,2) DEFAULT '0.00' COMMENT '在線支付金額',
`money` decimal(11,2) DEFAULT '0.00' COMMENT '余額支付金額',
`point` int(11) DEFAULT '0' COMMENT '使用抵扣積分金額',
`fh_status` tinyint(1) DEFAULT '0' COMMENT '0未發貨 1部分發貨 2全部發貨',
`order_status` tinyint(1) DEFAULT '0' COMMENT '訂單狀態 0待支付 1待收貨 2待確認 3已完成 4已取消',
`sh_name` varchar(20) DEFAULT NULL COMMENT '收貨人姓名',
`sh_phone` varchar(20) DEFAULT NULL COMMENT '收貨人電話',
`sh_address` varchar(80) DEFAULT NULL COMMENT '收貨地址',
`create_time` int(11) DEFAULT '0' COMMENT '創建訂單的時間',
`update_time` int(11) DEFAULT '0' COMMENT '更新時間',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `order_goods_detail`
-- ----------------------------
DROP TABLE IF EXISTS `order_goods_detail`;
CREATE TABLE `order_goods_detail` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`goods_id` int(11) DEFAULT NULL COMMENT '商品id',
`goods_price_id` int(11) DEFAULT NULL COMMENT '商品規格id (一個規格一個價格)',
`order_goods_id` int(11) DEFAULT NULL COMMENT '關聯訂單id',
`express_id` int(11) DEFAULT NULL COMMENT '物流公司表id',
`wuliu_order_no` varchar(30) DEFAULT NULL COMMENT '物流編號',
`pay_money` decimal(11,2) DEFAULT '0.00' COMMENT '在線支付金額',
`money` decimal(11,2) DEFAULT '0.00' COMMENT '余額支付金額',
`point` int(11) DEFAULT '0' COMMENT '使用抵扣積分金額',
`tk_status` tinyint(1) DEFAULT '0' COMMENT '退款狀態 0 未申請退款 1申請退款 2駁回申請退款 3申請退款',
`fh_status` tinyint(1) DEFAULT '0' COMMENT '0未發貨 1部分發貨 2全部發貨',
`create_time` int(11) DEFAULT '0' COMMENT '創建訂單的時間',
`update_time` int(11) DEFAULT '0' COMMENT '更新時間',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `order_pay`
-- ----------------------------
DROP TABLE IF EXISTS `order_pay`;
CREATE TABLE `order_pay` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` int(11) DEFAULT '0' COMMENT '支付類型 0微信 1支付寶 2銀行卡',
`tab` varchar(20) DEFAULT NULL COMMENT '對應表',
`tab_id` int(11) DEFAULT '0' COMMENT '表id',
`tab_order_no` varchar(22) DEFAULT NULL COMMENT '對應訂單表訂單編號',
`three_order_no` varchar(22) DEFAULT NULL COMMENT '支付方的訂單編號',
`money` decimal(11,2) DEFAULT '0.00' COMMENT '支付金額',
`pay_status` tinyint(1) DEFAULT '0' COMMENT '0未支付 1已支付',
`notice_data` text COMMENT '通知內容',
`create_time` int(11) DEFAULT NULL COMMENT '創建時間',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `order_refund`
-- ----------------------------
DROP TABLE IF EXISTS `order_refund`;
CREATE TABLE `order_refund` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`order_pay_id` int(11) DEFAULT '0' COMMENT '關聯支付表id',
`money` decimal(11,2) DEFAULT '0.00' COMMENT '退款金額',
`status` tinyint(1) DEFAULT '0' COMMENT '0申請退款 1已退款',
`create_time` int(11) DEFAULT NULL COMMENT '創建時間',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `user_bill`
-- ----------------------------
DROP TABLE IF EXISTS `user_bill`;
CREATE TABLE `user_bill` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
`user_id` int(11) NOT NULL DEFAULT '0' COMMENT '用戶id',
`order_no` varchar(50) DEFAULT '' COMMENT '訂單編號',
`tab` varchar(20) NOT NULL COMMENT '對應表名',
`tab_id` int(11) NOT NULL DEFAULT '0' COMMENT '對應表id',
`type` int(4) NOT NULL DEFAULT '0' COMMENT '業務類型',
`before_money` decimal(11,2) NOT NULL DEFAULT '0.00' COMMENT '之前金額',
`money` decimal(11,2) NOT NULL DEFAULT '0.00' COMMENT '變化金額',
`show_money` varchar(30) DEFAULT NULL COMMENT '顯示金額',
`after_money` decimal(11,2) DEFAULT '0.00' COMMENT '之后金額',
`fee` decimal(11,2) DEFAULT '0.00' COMMENT '手續費',
`note` varchar(100) DEFAULT '' COMMENT '備注',
`create_time` int(10) NOT NULL DEFAULT '0' COMMENT '創建時間',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;