zoukankan      html  css  js  c++  java
  • 电商订单流程 数据结构设计

    设计数据表结构
    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;
    
    
  • 相关阅读:
    Redis源代码分析(十三)--- redis-benchmark性能測试
    kvm中运行kvm
    umount.nfs device busy day virsh extend diskSpace, attachDisk
    ultravnc
    openNebula dubug
    maintenance ShellScripts
    virsh VMI deploy data serial xml
    cloud computing platform,virtual authentication encryption
    基于C 的libvirt 接口调用
    storage theory
  • 原文地址:https://www.cnblogs.com/xielisen/p/9429245.html
Copyright © 2011-2022 走看看