Skip to content

税率迭代

税率迭代

项目说明


订单中的税率数据是在订单创建和修改的时候就写进去了
目前的订单数据查询是进入 mongo -> xnn_core_product_2 -> order_new 集合中查询的数据

现要对税率进行调整
    > 允许使用设置税率为 0
    > 同时将订单中未设置税率的 sku 的此项值标识为「未设置」,而不在以「0」标识

税率数据的写入与展示
    > 订单创建时的税率写入
        > 对订单中的的「detail」中的 sku 数据增加一个字段进行标识--是否设置的税率
        > 数据存储
            > 订单数据同时保存在 MySQL 和 MongoDB 中,所以 mysql 和 mongo 中均需要添加
            > 订单数据中增加一个字段,来标识是未设置还是设置为 0
            > 原标识税率的字段的范围扩宽,允许设置为 0
    > 订单数据的展示
        > 在获取订单数据的接口中,在返回数据中添加标识税率的字段

有数据库结构变动和刷数据
    > 订单历史数据中的设定
        > is_set_tax 设置成 1,刷去成已设置状态

数据库变动


MySQL

库表
    > order - order_detail
    > delivery - tbl_delivery_sku

在「订单详情」表中添加一个字段来「is_set_tax」标识商品是否设置过税率
    > 字段值的类型:Int
    > 0:未设定 1:已设定  默认值为:0

    > 为保证历史数据的一致性,需要对历史数据中也加上这个字段
        > 历史数据的设定
            > 历史数据中 tax_rate 为 0 的,is_set_tax 设为 0
            > 历史数据中 tax_rate 不为 0 的,is_set_tax 设为 1

MongoDB

mongo -> xnn_core_product_2 -> order_new

订单数据写入时,在写入的数据中添加是否设定税率的标识字段「is_set_tax」
    > 0:未设定 1:已设定  默认值为:0

    > 为保证历史数据的一致性,需要对历史数据中也加上这个字段
        > 历史数据的设定
            > 历史数据中 tax_rate 为 0 的,is_set_tax 设为 0
            > 历史数据中 tax_rate 不为 0 的,is_set_tax 设为 1

station 工程


/station/tax/tax_rule/create 新建税率规则

接口:
    /station/tax/tax_rule/create
class:
    website/station/views/tax.py/TaxRuleCreateView
方法:
    POST
请求:
    tax_name   M    String        规则名
    status     O    Int           状态 0:无效 1:有效   默认有效
    address    M    List<Dict>    商户列表 
        [
            {
                address_id       M    Int        商户 id
                address_name     M    String     商户名称
            },
            ...
        ]
    spu        M    List<Dict>    spu列表
        [
            {
                spu_id       M    String    spu_id
                spu_name     M    String    商品名
                tax_rate     M    String    税率  大于等于 0 小于 100
            },
            ...
        ]
响应:
    code       M    Int           状态码
    msg        M    String        状态消息
    data       M    Int           响应消息 -- 税率跪着规则 id
示例:
    请求:
        {
            "tax_name": "zzzzz",
            "status": 1,
            "address": [
                {
                    "address_id": 107394,
                    "address_name": "miao测试商户01"
                }
            ],
            "spu": [
                {
                  "spu_id": "C1968574",
                  "spu_name": "老坛酸菜牛肉面",
                  "tax_rate": "25"
                }
            ]
        }
    响应:
        {
            "msg": "ok",
            "data": 320,
            "code": 0
        }
说明:
    该接口在本次更新中,请求和响应均为发生变化,内部对 tax_rate 的判定放宽至 [0,100)

    税率规则的创建,涉及三张表格,均存储在 MySQL > management 中,关键字段如下
    * tbl_tax_rule
        > id  税率规则的 id  在另外两张表中映射成 tax_rate_id
        > status  税率规则状态 0无效 1 有效
        > station_id  站点 id
    * tbl_address_tax_rate
        > tax_rate_id  税率规则的 id
        > address_id  商户 id
        > station_id  站点 id
    * tbl_spu_tax_rate
        > tax_rate_id  税率规则的 id
        > spu_id  商品的 id
        > tax_rate  税率
        > station_id  站点 id

/station/tax/tax_rule/edit 修改税率规则

接口:
    /station/tax/tax_rule/create
class:
    website/station/views/tax.py/TaxRuleCreateView
方法:
    POST
请求:
    tax_id     M    Int           税率规则 id
    tax_name   O   String        规则名
    status     O    Int           状态 0:无效 1:有效   默认有效
    address    M    List<Dict>    商户列表 
        [
            {
                address_id       M    Int        商户 id
                address_name     M    String     商户名称
            },
            ...
        ]
    spu        M    List<Dict>    spu列表
        [
            {
                spu_id       M    String    spu_id
                spu_name     M    String    商品名
                tax_rate     M    String    税率  大于等于 0 小于等于 100
            },
            ...
        ]
响应:
    code       M    Int           状态码
    msg        M    String        状态消息
    data       M    Int           响应消息 -- 税率规则 id
示例:
    请求:
        {
            "tax_id": 319
            "tax_name": "zzzzz",
            "status": 1,
            "address": [
                {
                    "address_id": 107394,
                    "address_name": "miao测试商户01"
                }
            ],
            "spu": [
                {
                  "spu_id": "C1968574",
                  "spu_name": "老坛酸菜牛肉面",
                  "tax_rate": "25"
                }
            ]
        }
    响应:
        {
            "msg": "ok",
            "data": 319,
            "code": 0
        }
说明:
    该接口在本次更新中,请求和响应均为发生变化,内部对 tax_rate 的判定放宽至 [0,100)

/station/skus/addr 新建订单-商品搜索

'fetch_category': Param(str),
        'time_config_id': Param(str),
        'address_id': Param(str),
        'search_text': Param(str, optional=True),
        'offset': Param(int, default=0),
        'limit': Param(int, default=20),
        'usual_type': Param(int
接口:
    /station/skus/addr
class:
    website/station/views/skuproduct.py/SkuQueryByAddrView
方法:
    GET
请求:
    fetch_category    M    String        是否拉取分类  0不拉取分类;1拉取分类
    time_config_id    M    String        运营时间 id
    address_id        M    String        商户 id
    search_text       O    String        搜索字段
    active            M    String        商品状态  0全部状态商品 1上架商品       
    usual_type        M    Int           搜索范围  1常用商品列表 2sku搜索接口  
    offset            M    Int           分页 偏移量
    limit             M    Int           分页 返回结果的条数
响应:
    code              M    Int           状态码
    msg               M    String        状态消息
    data              M    List<Dict>    响应内容
        [
            {
                #################  本次更改涉及的字段  ##################
                tax_rate                 M    Int         税率
                is_set_tax               M    Int         是否设置税率  0未设置 1已设置

                id                       M    String      sku_id
                sync_origin_id           M    String      真实交易ID
                spu_id                   M    String      spu_id
                category_id_1            M    String      一级分类ID
                category_id_2            M    String      二级分类ID
                category_title_1         O    String      一级分类名
                category_title_2         O    String      二级分类名
                station_id               M    String      站点ID
                salemenu_id              M    String      销售单ID
                salemenu_name            M    String      销售单名称
                supplier_name            M    String      供应商名
                name                     M    String      商品名字
                desc                     M    String      描述
                remark_type              M    Int         商品类型  1是采购规格 其他-销售规格
                sale_unit_name           M    String      销售单位名
                std_unit_name            M    String      基本单位名
                unit_price               M    Float       基本单位价格
                sale_ratio               M    Float       销售单位 
                sale_price               M    Float       销售单位价格
                state                    M    Int         是否上架
                is_weigh                 M    Int         是否称重
                sale_num_least           M    Float       最小售卖数
                outer_id                 M    String      自定义ID
                is_price_timing          M    Bool        是否时价
                frequency                O    Int         下单频次
                imgs                     M    String      sku图片
                clean_food               M    Bool        是否为净菜
                price_origin             M    Int         价格来源  1来自报价单 2来自锁价
                version                  M    Int         sku版本号
                stocks                   M    Int         库存量
                stock_type               M    Int         库存状态
                last_quote_price         M    Int         最近询价
                last_purchase_price      M    Int         最近采购价
                last_in_stock_price      M    Int         最新入库价
                stock_avg_price          M    Int         库存均价
                latest_in_stock_price    M    Int         最近入库价  不存在为null
                latest_quote_price       M    Int         最近询价  不存在为null
                suggest_price_max        M    String      建议最大售价  不存在为null
                suggest_price_min        M    String      建议最小售价  不存在为null
                split_flag               M    Int         服务标识[注1]
                s_type                   M    Int         商品类型[注2]
                attrition_rate           M    Float       损耗率  必须在0-100之间
                create_time              M    DateTime    创建时间
                ingredients              O    List<Dcit>  原料列表
                    [
                        {
                            id                M    String    物料ID
                            supplier_id       O    String    供应商id  商品类型采购规格时才需要传
                            proportion        M    Float     配比  sku的销售单位:原料的基本单位
                            remark_type       M    Int       商品类型  1是采购规格 其他-销售规格
                            attrition_rate    M    Float     损耗率  必须在0-100之间
                            version           M    Int       版本号
                        }
                    ]
            },
            ...
        ]
示例:
    请求:
        {
            address_id: 266603
            offset: 0
            limit: 10
            search_text: n
            fetch_category: 1
            active: 1
            time_config_id: ST2185
            usual_type: 2
        }
    响应:
        {
            code: 0,
            msg: 'ok',
            data: [
                {
                    attrition_rate: 0
                    category_id_1: "A21491"
                    category_id_2: "B76873"
                    category_title_1: "三只松鼠"
                    category_title_2: "三只松鼠"
                    clean_food: false
                    create_time: "2019-06-21T19:17:49.997"
                    desc: ""
                    frequency: 1
                    id: "D13413088"
                    imgs: ""
                    ingredients: [
                        {
                            attrition_rate: 0
                            id: "D13413087"
                            proportion: 1
                            remark_type: 1
                            supplier_id: "T36221"
                            version: 1
                        }
                    ]
                    is_price_timing: false
                    is_weigh: true
                    last_in_stock_price: {
                        earlier: [], 
                        newest: {
                            purchase_supplier_id: "T36221",
                            purchase_supplier_name: "三只松鼠", 
                            price: 500
                        }
                    }
                    last_purchase_price: {
                        earlier: [], 
                        newest: {
                            purchase_supplier_id: "T36221",
                            purchase_supplier_name: "三只松鼠", 
                            price: 0
                        }
                    }
                    last_quote_price: {
                        earlier: [], 
                        newest: {
                            purchase_supplier_id: null, 
                            purchase_supplier_name: null, 
                            price: null
                        }
                    }
                    latest_in_stock_price: 500
                    latest_quote_price: null
                    latest_std_sale_price: 12300
                    latest_std_unit_name: "袋"
                    modify_time: "2019-09-04T17:47:15.546"
                    name: "蔓越莓干"
                    now_stocks: -99999
                    outer_id: ""
                    pinlei_id: "P450135"
                    price_origin: 1
                    purchase_create_version: 1
                    purchase_spec_id: "D13413087"
                    purchase_supplier_id: "T36221"
                    remark_type: 2
                    s_type: 0
                    sale_num_least: 1
                    sale_price: "1.00"
                    sale_ratio: 1
                    sale_unit_name: "袋"
                    salemenu_id: "S18665"
                    split_flag: 3
                    spu_id: "C2723971"
                    spu_remark: null
                    state: 1
                    station_id: "T10001"
                    status: 2
                    std_unit_name: "袋"
                    stock_avg_price: 9309.096284309457
                    stock_type: 1
                    stocks: -99999
                    suggest_price_max: null
                    suggest_price_min: null
                    supplier_name: "三只松鼠报价"
                    sync_origin_id: "D13413088"
                    sync_state: 1
                    unit_price: "1.00"
                    version: 4

                    ###############  本次更新涉及的字段  ###########
                    tax_rate: 5200
                    is_set_tax: 1
                },
                ...
            ]
说明:
    *注1  split_flag  服务标识
        0只配送 1只投框 2只分切 3投框+分切
    *注2  s_type  商品类型
        0单一商品,即只改变价格,售卖方式 1组合商品,即有多个上游商品

/station/order/create 创建订单

接口:
    /station/order/create
class:
    website/station/views/order.py/OrderCreateView
方法:
    POST
请求:
    details              M    List<Dict>    商品相关的json数据
        [
            {
                sku_id             M    String    sku_id
                amount             M    Int       下单数量
                unit_price         M    String    含税单价
                spu_remark         O    String    商品备注
                spu_id             M    String    spu_id
                is_price_timing    M    Int       是否时价  0否 1是
            }
        ]
    address_id           M    Int           商户SID
    uid                  M    Int           商户UID
    receive_begin_time   M    String        订单收货开始时间
    receive_end_time     M    String        订单收货结束时间
    time_config_id       M    String        时间配置ID
    remark               O    String        订单备注
    force                O    Int           是否强制合单标志  0不合单,新建一个订单 1强制合单
    address              O    String        配送地址
响应:
    code                 M    Int           状态码
    msg                  M    String        状态消息
    data                 M    Dict          响应消息
        {
            detail_url                M     String          订单详情 url
            error_sku_ids             M     List<String>    订单创建失败时的 sku_id 列表
            exceed_order_time_ids     M     List<String>
            new_order_ids             M     List<String>    新建订单的 id
            not_enough_inventories    M     List
            sms_notify_status         M     Int             短信通知状态
            success_sku_ids           M     List<String>    订单创建成功时的 sku_id 列表
            update_order_ids          M     List<String>    更新订单的 id 列表
        }
示例:
    请求:
        {
             details:[
                 {
                     "sku_id":"D13523696",
                     "amount":143,
                     "unit_price":"1.00",
                     "spu_remark":"",
                     "spu_id":"C1969177",
                     "is_price_timing":0
                 }
             ]
            address_id: 266603
            uid: 280749
            receive_begin_time: 2019-09-19 04:00
            receive_end_time: 2019-09-19 06:00
            time_config_id: ST2185
            remark: daf
        }
    响应:
        code: 0,
        msg: "ok",
        data: {
            detail_url: "/station/order/edit"
            error_sku_ids: []
            exceed_order_time_ids: []
            new_order_ids: ["PL8841170"]
            not_enough_inventories: []
            sms_notify_status: 0
            success_sku_ids: ["D13523696"]
            update_order_ids: []
        }
说明:

/station/order/edit 「GET」 获取订单详情

接口:
    /station/order/edit
class:
    website/station/views/order.py/OrderEditView
方法:
    GET
请求:
    id        M    String       订单 id
响应:
    code      M    Int          状态码
    msg       M    String       状态消息
    data      M    Dict         响应消息
        {
            coupon_amount       M    Int             优惠券金额
            station_id          M    String          站点 id
            out_order_id        M    String          外部订单 id
            expire_time         M    DateTime        到期时间
            last_op_user        M    String          最后操作人 
            sort_id             M    Int             订单排列序号
            settle_way          M    Int             结算方式
            is_aggregation      M    Int             聚合方式
            details             M    List<Dict>      订单详情数据列表
                [
                    {
                        #################  本次更改涉及的字段  ##################
                        tax_rate                   M    Int        税率
                        is_set_tax                 M    Int        设置税率  0未设置 1已设置

                        std_real_quantity          M    Int        出库数(基本单位)
                        latest_quote_price         M    Int        最近询价
                        attrition_rate             M    Int        损耗率
                        outer_id                   M    String     自定义编码
                        id                         M    String     sku_id
                        real_quantity              M    Int        称重后数量
                        sale_money                 M    Int        订单金额
                        last_in_stock_price        M    Int        供应商最近入库价
                        exc_quantity               M    Int        异常数量
                        sale_unit_name             M    String     销售单位名称
                        is_print                   M    Bool       是否打印
                        salemenu_id                M    Int        报价单 id
                        imgs                       M    String     sku image url
                        category_title_2           M    String     二级分类名称
                        version                    M    Int        sku版本
                        accept_quantity            M    Int        收货数量
                        fake_item_price            M    Int        伪原价
                        category_title_1           M    String     一级分类名称
                        stock_avg_price            M    Int        库存均价
                        is_price_timing            M    Bool       是否时价
                        latest_std_unit_name       M    String     最近基本单位的名称
                        spu_remark                 M    String     商品备注
                        sorting_saleunit_weighting_quantity
                                                   M    Int        称重数据
                        real_refund_quantity       M    Int        实际退货数
                        request_refund_quantity    M    Int        请求退货数
                        latest_in_stock_price      M    Int        最近入库价
                        clean_food                 M    Bool       是否是净菜
                        purchase_quantity          M    Int        采购数量
                        origins                    M    List<Dict> 源商品信息
                            [
                                {
                                    order_id       M    String     订单ID
                                    sku_id         M    String     商品ID
                                    amount         M    Float      下单数量
                                    split_flag     M    Int        分切标识
                                    is_weigh       M    Bool       是否称重
                                },
                                ...
                            ]
                        origin_item_price          M    Int        锁价前价格
                        sale_num_least             M    Int        最小下单数
                        sync_origin                M    String     真实交易id
                        last_purchase_price        M    Int        供应商采购价
                        std_unit_name              M    String     基本单位名称
                        tax                        M    String     税金
                        name                       M    String     sku名称
                        is_weigh                   M    Int        是否称重
                        search_text                M    List<string>
                                                                   搜索关键字列表
                        std_unit_quantity          M    Int        按基本单位计算的下单数
                        sale_ratio                 M    Int        销售单位数量
                        latest_std_sale_price      M    Int        最近基本单位销售价
                        total_item_price           M    Int        商品总价格
                        quantity                   M    Int        下单数量
                        real_item_price            M    Int        真实总价
                        std_sale_price             M    Int        基本单位价格
                        spu_id                     M    String     spu_id
                        last_quote_price           M    Int        供应商最近询价
                        total_item_pay             M    Int        商品应付总价
                        out_of_stock               M    Bool       是否缺货
                        weighting_quantity         M    Int        基本单位称重数
                    },
                    ...
                ]
            refund_amount       M    Int         退货金额
            last_op_time        M    DateTime    最后操作时间
            customer            M    Dict        商户信息
                {

                    uid                  M    String     用户ID
                    address_id           M    String     店铺ID
                    address              M    String     店铺地址
                    address_sign_id      M    String     区域ID
                    receiver_name        M    String     收货人姓名
                    receiver_phone       M    String     收货人电话
                    supply_station_id    O    String     供应站点ID
                    receive_way          M    Int        收货方式         
                    extender             M    Dict       扩展信息
                        {
                            resname              M    String      商户名称
                            order_pay_method     M    Int         订单支付方式
                        }
                    pick_up_st_id        M    Int        自提点 id
                    receive_begin_time   M    String     收货开始时间(%Y-%d-%m %H:%M)
                    receive_end_time     M    String     收货结束时间(%Y-%d-%m %H:%M)
                }
            source_order_ids    M    List<String>   源订单 id 列表
            _id                 M    String         订单 id
            freight             M    Int            运费
            time_config_info    M    Dict           运营时间信息
                {
                    desc                        M  String    运营时描述
                    final_distribute_time       M  String    最晚配送时间
                    final_distribute_time_span  M  Int       [注1]
                    name                        M  String    运营时间名称
                    order_time_limit            M  Dict      下单时间限制
                        {
                            start               M  String    开始时间
                            end                 M  String    结束时间
                            e_span_time         M  Int       下单起止时间跨天数 
                        }
                    receive_time_limit          M  Dict      收货时间限制
                        {
                            start               M  String    开始时间
                            end                 M  String    结束时间
                            s_span_time         M  Int       [注2]
                            e_span_time         M  Int       [注3]
                            receiveTimeSpan     M  String    [注4]
                        }
                    service_time_creator        M  String    服务时间创建站点
                    task_begin_time             M  String    任务开始时间
                    type                        M  Int       时间配置类型[注5]
                    _id                         M  Int       运营时间id
                }
            create_time         M    DateTime       订单创建时间
            salemenu_ids        M    List<String>   订单包含的报价单 id 列表
            real_price          M    Int            真实价格  根据真实重量算出的真实价格
            client              M    Int            下单方式[注6]
            district_code       M    String         城市编码
            date_time           M    DateTime       下单时间
            time_config_id      M    String         运营时间 id
            client_desc         M    String         订单来源描述
            total_price         M    Int            订单总金额
            serials             M    List<String>   异步任务的校验serial数据
            paid_amount         M    Int            已支付金额
            freeze              M    Int            订单是否冻结
            real_pay            M    Int            订单已收金额
            fake_total_price    M    Int            伪下单金额
            total_pay           M    Int            应付总金额
            origin_total_price  M    Int            下单原价
            remark              M    String         订单备注
            modify_time         M    DateTime       订单修改时间
            close_time          M    DateTime       订单关闭时间
            district_name       M    String         城市名称
            status              M    Int            订单状态[注7]
            pay_status          M    Int            支付状态
            _lock               M    String         订单是否锁定
            exception_reason    M    Dict           订单异常原因字典 
        } 
示例:
    请求:
        {
            id: PL6142039
        }
    响应:
        {
            "code":0,
            "msg":"ok"
            "data":{
                "coupon_amount":0,
                "station_id":"T7936",
                "out_order_id":"",
                "expire_time":"2019-09-20T10:45:30",
                "last_op_user":null,
                "sort_id":0,
                "settle_way":1,
                "is_aggregation":0,
                "details":[
                    {
                        "tax_rate":4500,
                        "is_set_tax": 1
                        "std_real_quantity":1,
                        "latest_quote_price":null,
                        "attrition_rate":0,
                        "outer_id":"",
                        "id":"D11862266",
                        "real_quantity":1,
                        "sale_money":1184,
                        "last_in_stock_price":{
                            "earlier":[],
                            "newest":{
                                "purchase_supplier_id":null,
                                "purchase_supplier_name":null,
                                "price":null
                            }
                        },
                        "exc_quantity":0,
                        "is_print":false,
                        "sale_unit_name":"瓶",
                        "salemenu_id":"S17089",
                        "imgs":"",
                        "category_title_2":"蒙牛",
                        "version":3,
                        "accept_quantity":1,
                        "fake_item_price":1184,
                        "category_title_1":"蒙牛",
                        "stock_avg_price":0,
                        "is_price_timing":false,
                        "latest_std_unit_name":"瓶",
                        "spu_remark":"",
                        "sorting_saleunit_weighting_quantity":1,
                        "is_set_tax":1,
                        "real_refund_quantity":0,
                        "latest_in_stock_price":null,
                        "clean_food":false,
                        "request_refund_quantity":0,
                        "purchase_quantity":1,
                        "origins":[],
                        "origin_item_price":1184,
                        "sale_num_least":1,
                        "sync_origin":"D11862266",
                        "last_purchase_price":{
                            "earlier":[],
                            "newest":{
                                "purchase_supplier_id":null,
                                "purchase_supplier_name":null,
                                "price":null
                            }
                        },
                        "std_unit_name":"瓶",
                        "tax":"3.67",
                        "name":"测试牛奶1",
                        "is_weigh":1,
                        "search_text":[
                            "CESHINIUNAI1",
                            "CSNN1",
                            "测试牛奶1",
                            null,
                            "CESHINIUNAI1",
                            "CSNN1",
                            "测试牛奶1"
                        ],
                        "std_unit_quantity":1,
                        "sale_ratio":1,
                        "latest_std_sale_price":1184,
                        "total_item_price":1184,
                        "quantity":1,
                        "real_item_price":1184,
                        "std_sale_price":1184,
                        "spu_id":"C2473562",
                        "last_quote_price":{
                            "earlier":[],
                            "newest":{
                                "purchase_supplier_id":null,
                                "purchase_supplier_name":null,
                                "price":null
                            }
                        },
                        "total_item_pay":1184,
                        "out_of_stock":false,
                        "weighting_quantity":0,
                        "supplier_name":"蒙牛报价单",
                        "origin_sale_price":1184,
                        "sale_price":"11.84",
                        "real_is_weight":true,
                        "weighted":0
                    }
                ],
                "refund_amount":0,
                "last_op_time":null,
                "customer":{
                    "receive_way":1,
                    "uid":"231367",
                    "receiver_phone":"18809098767",
                    "address_sign_id":"30100200000",
                    "extender":{
                        "resname":"测试店铺0812分店",
                        "order_pay_method":2
                    },
                    "pick_up_st_id":0,
                    "receiver_name":"分店",
                    "supply_station_id":"T7936",
                    "receive_begin_time":"2019-09-21 06:00",
                    "receive_end_time":"2019-09-21 12:00",
                    "address":"广东省深圳市福田区华强北街道华强北路17曼哈商业广场",
                    "address_id":"217824"
                },
                "source_order_ids":[],
                "_id":"PL6142039",
                "freight":0,
                "time_config_info":{
                    "final_distribute_time_span":1,
                    "type":1,
                    "task_begin_time":"06:00",
                    "desc":"",
                    "final_distribute_time":"06:00",
                    "_id":"ST3078",
                    "order_time_limit":{
                        "start":"06:00",
                        "e_span_time":0,
                        "end":"23:00"
                    },
                    "name":"默认运营时间",
                    "service_time_creator":"T7936",
                    "receive_time_limit":{
                        "start":"06:00",
                        "e_span_time":1,
                        "end":"12:00",
                        "receiveTimeSpan":"15",
                        "s_span_time":1
                    }
                },
                "create_time":"2019-09-20T10:40:30",
                "salemenu_ids":["S17089"],
                "real_price":1184,
                "client":1,
                "district_code":"440300",
                "date_time":"2019-09-20T10:40:30",
                "time_config_id":"ST3078",
                "client_desc":"后台下单",
                "total_price":1184,
                "serials":["2734e62ef8ab453981a756b64013bd59"],
                "paid_amount":0,
                "freeze":0,
                "real_pay":0,
                "fake_total_price":1184,
                "total_pay":1184,
                "origin_total_price":1184,
                "remark":null,
                "modify_time":"2019-09-20T10:40:30",
                "close_time":null,
                "district_name":"深圳市",
                "status":1,
                "pay_status":1,
                "_lock":"no",
                "exception_reason":{
                    "1":"未按用户时间到达",
                    "5":"漏单",
                    "6":"送错货品",
                    "7":"下错单",
                    "8":"需要备注",
                    "10":"斤两不对(用户发现)",
                    "12":"质量问题",
                    "17":"规格问题",
                    "22":"司机弄丢/弄坏",
                    "25":"市场缺货(未出库)",
                    "27":"系统问题",
                    "61":"其它",
                    "153":"采购问题",
                    "176":"无法送达"
                }
            },
        }
说明:
    请求不变,响应中增加以表示是否设置税率的字段「is_set_tax」

    * 注1  final_distribute_time_span  最晚配送时间和下单时间比的跨天数  
    * 注2  s_span_time  开始时间跟下单时间相比跨几天
    * 注3  e_span_time  结束时间跟下单时间相比跨几天    
    * 注4  receiveTimeSpan  收货时间选项的时间间隔,单位分钟
    * 注5  type -> 时间配置类型
        0默认 1普通 2预售
    * 注6  client  下单方式
        1后台下单 2微信商城 3app 4微信小程序 5有赞推送 6开放平台 7后台补录 8云管家代客下单
    * 注7  status  订单状态
        -1订单已删除 1等待分拣 5正在分拣 10正在配送 15已签收

/station/order/edit 「POST」 修改订单详情

接口:
    /station/order/edit
class:
    website/station/views/order.py/OrderEditView
方法:
    POST
请求:
    order_id      M    String        待修改的订单 id
    detials       M    List<Dict>    商品数据
        [
            {
                sku_id             M    String    sku_id
                amount             M    Int       下单数量
                unit_price         M    String    含税单价
                spu_remark         O    String    商品备注
                spu_id             M    String    spu_id
                is_price_timing    M    Int       是否时价  0否 1是
            }
        ]
    order_data    M    Dict          订单数据
        {
            receive_begin_time   M    String        订单收货开始时间
            receive_end_time     M    String        订单收货结束时间
            remark               O    String        订单备注
        }
响应:
    code          M    Int           状态码
    msg           M    String        状态消息
    data          M    Dict          响应内容
        {
            order_id     M    String     订单 id
        }

示例:
    请求:
        {
            order_id: PL8882507
            details: [
                {
                    "sku_id":"D13415925",
                    "amount":3.33,
                    "unit_price":"1.00",
                    "spu_remark":"",
                    "spu_id":"C2723984",
                    "is_price_timing":0
                }
            ]
            order_data: {
                "receive_begin_time":"2019-09-21 04:00",
                "receive_end_time":"2019-09-21 06:00",
                "remark":"hello world"
            }
        }
    响应:
        {
             code: 0,
             msg: 'ok',
             data: {
                order_id: PL8882507
             }
        }
说明:
    请求和响应不变,后台逻辑增加对税率规则的判断

/station/order/edit_old 「POST」 追加修改订单详情

接口:
    /station/order/edit_old
class:
    website/station/views/order_old.py/OrderEditOldView
方法:
    POST
请求:
    order_id      M    String        待修改的订单 id
    detials       M    List<Dict>    商品数据
        [
            {
                sku_id             M    String    sku_id
                amount             M    Int       下单数量
                unit_price         M    String    含税单价
                spu_remark         O    String    商品备注
                spu_id             M    String    spu_id
                is_price_timing    M    Int       是否时价  0否 1是
            }
        ]
    order_data    M    Dict          订单数据
        {
            receive_begin_time   M    String        订单收货开始时间
            receive_end_time     M    String        订单收货结束时间
            remark               O    String        订单备注
        }
响应:
    code          M    Int           状态码
    msg           M    String        状态消息
    data          M    Dict          响应内容
        {
            order_id     M    String     订单 id
        }

示例:
    请求:
        {
            order_id: PL8882507
            details: [
                {
                    "sku_id":"D13415925",
                    "amount":4.33,
                    "unit_price":"1.00",
                    "spu_remark":"",
                    "spu_id":"C2723984",
                    "is_price_timing":0
                }
            ]
            order_data: {
                "receive_begin_time":"2019-09-21 04:00",
                "receive_end_time":"2019-09-21 06:00",
                "remark":"hello world"
            }
        }
    响应:
        {
             code: 0,
             msg: 'ok',
             data: {
                order_id: PL8882507
             }
        }
说明:
    请求和响应不变,后台逻辑增加对税率规则的判断

/station/order/order_sku_list 订单按商品查看

接口:
     /station/order/order_sku_list
class:
     website/station/views/order_sku.py/OrderSkuListView
方法:
     GET
请求:
    query_type         M    Int           查询类型  1下单时间 2运营时间 3收货时间

        部分参数跟查询类型关联,枚举如下:
        * query_type = 1 按下单时间查询,默认值为当天
            start_date             C     String      开始时间[注1]
            end_date               C     String      截止时间
        * query_type = 2 按运营时间查询
            time_config_id         C     String      运营时间id
            cycle_start_time       C     String      运营开始时间
            cycle_end_time         C     String      运营结束时间
        * query_type = 3 按收货时间查询
            receive_start_date     C     String      收货开始时间
            receive_end_date       C     String      收货结束时间

    search_text        O    String         搜索字段  支持订单号,商户和商品信息搜索
    status             O    Int            订单状态[注2]
    pay_status         O    Int            支付状态  1未支付 5部分支付 10已支付  不传默认全部
    route_id           O    Int            线路Id  不传默认全部
    is_price_timing    O    Int            是否时价  0非时价 1时价  不传默认全部
    salemenu_id        O    String         报价单id  不传默认全部
    offset             O    Int            分页 查询起点偏移条数
    limit              O    Int            分页 返回条数
    return_all         O    String         是否返回所有sku的统计信息  yes/no  默认为no
    category1_ids      O    List<String>   一级分类 id 列表
    category1_ids      O    List<String>   二级分类 id 列表
    pinlei_ids         O    List<String>   品类 id 列表
    is_weigh           O    Int            是否计重任务  0不计重任务 1计重任务  不传默认全部
    weighted           O    Int            是否称重  0未称重 1已称重  不传默认全部
    batch_remark       O    String         分拣备注
    batch_remark_is_null
                       O    Int            有无分拣备注  0有 1无 
    sort_type          O    String         排序类型[注3]     
响应: 
    code               M    Int            状态码  0成功 其他错误
    msg                M    String         状态消息
    data               M    Dict           响应消息
        {
            pagination        M    Dict          分页信息
                {
                    count     M    Int
                    offset    M    Int
                    limit     M    Int     
                 }            
            list              M    List<Dict>    订单商品数据列表
                [
                    {
                        sale_ratio                  M   float   销售规格
                        stock_avg_price             M   float   采购平均价
                        name                        M   str     名称
                        weighted                    M   int     称重商品
                        std_unit_name               M   str     基本单位名称
                        tax                         O   Float   税额
                        origins                     M   List    源 sku 信息
                            [
                                {
                                    order_id        M    String     订单ID
                                    sku_id          M    String     商品ID
                                    amount          M    Float      下单数量
                                    split_flag      M    Int        分切标识
                                    is_weigh        M    Bool       是否称重
                                },
                                ...
                            ]
                        real_quantity               M   float   称重数
                        is_weigh                    M   int     是否称重
                        order_id                    M   str     订单id
                        status                      M   int     状态
                        route_name                  M   str     路线
                        std_real_quantity           M   float   基本出库数
                        std_sale_price              M   float   基本销售价格
                        address_id                  M   str     店铺id
                        exc_quantity                M   float   异常数
                        spu_remark                  M   str     备注
                        request_refund_quantity     M   float   请求退货数
                        id                          M   str     订单id
                        salemenu_id                 M   str     销售id
                        clean_food                  M   bool    净菜
                        quantity                    M   float   数量
                        out_of_stock                M   bool    缺货
                        tax_rate                    M   float   税率
                        sale_price_without_tax      O   float   不含税销售价格
                        sale_price                  M   float   售价
                        outer_id                    M   str     对外 sku_id
                        real_item_price             M   float   出库金额
                        std_unit_quantity           M   float   基本单位
                        is_print                    M   bool    是否打印
                        is_price_timing             M   Int     是否时价
                        salemenu_name               M   str     销售单名称
                        latest_quote_price          M   Float   供应商最近询价
                        latest_in_stock_price       M   float   供应商最近库存价
                        latest_std_sale_price       M   float   最近基本单位售价
                        last_quote_price            M   dict    最近询价
                            {   
                                earlier    M     list<dict>
                                    [
                                        {
                                            price                   M  float  价格
                                            purchase_supplier_id    M  str    供应商id
                                            purchase_supplier_name  M  str    供应商名称
                                            is_priority             O  int    是否为优先供应商,true:是
                                        }
                                    ]
                                newest      M     list<dict>
                                    [
                                        price                       M       float       价格
                                        purchase_supplier_id        M       str         供应商id
                                        purchase_supplier_name      M       str         供应商名称
                                        is_priority                 O       int         是否为优先供应商,true:是
                                    ]
                        }
                last_in_stock_price M   dict        新近入库价
                        {earlier         M       list<dict>
                            [
                                price                       M       float       价格
                                purchase_supplier_id        M       str         供应商id
                                purchase_supplier_name      M       str         供应商名称
                                is_priority                 O       int         是否为优先供应商,true:是
                            ]
                        newest         M       list<dict>
                            [
                                price                       M       float       价格
                                purchase_supplier_id        M       str         供应商id
                                purchase_supplier_name      M       str         供应商名称
                                is_priority                 O       int         是否为优先供应商,true:是
                            ]
                        }
                last_purchase_price M   dict    最后采购价
                        {earlier         M       list<dict>
                            [
                                price                       M       float       价格
                                purchase_supplier_id        M       str         供应商id
                                purchase_supplier_name      M       str         供应商名称
                                is_priority                 O       int         是否为优先供应商,true:是
                            ]
                        newest         M       list<dict>
                            [
                                price                       M       float       价格
                                purchase_supplier_id        M       str         供应商id
                                purchase_supplier_name      M       str         供应商名称
                                is_priority                 O       int         是否为优先供应商,true:是
                            ]
                        }
                    },
                    ...
                ]
          }                     
示例:
     请求:

     响应:

说明:
     参数说明:
     * 注1  C  conditional  某些条件下必选
     * 注2  status  订单状态
          1待分拣 5分拣中 10 配送中 15 已签收  不传默认全部
     * 注3  sort_type  排序类型
          date_desc日期倒序(默认) date_asc日期升序  price_desc价格倒序 price_asc价格升序

/delivery/update 更新配送单

该接口的请求和响应均为发送变化,后台的更新逻辑有所变化

/delivery/print 配送单打印

接口:
    /delivery/print
class:
    website/delivery/views/edit_delivery.py/DeliveryPrintView
方法:
    POST
请求:
    ids           M    List<String>      订单 id 列表
    type          M    Int               打印类型  1未编辑过的  2编辑过的 (这里传2)
响应:
    code          M    Int               状态码
    msg           M    String            状态消息
    data          M    Dictionary        响应内容
        {
            delivery_details       M    List<Dict>     配送详情列表
                [
                    {
                        tax_number             M    Int           税号
                        refunds                M    List<Dict>    退货列表
                            [
                                {
                                    detail_id           M    String    退货商品 id
                                    type_text           M    String    退货原因
                                    text                M    String    退货备注
                                    money_delta         M    Float     退货金额
                                    amount_delta        M    Float     退货数量
                                },
                                ...
                            ]
                        refunds                M    List<Dict>    退货列表
                        sort_id                M    String        分拣单号
                        coupon_amount          M    Float         优惠金额
                        receive_begin_time     M    DateTime      收货开始时间
                        receive_end_time       M    DateTime      收货结束时间
                        sid                    M    Int           商户 id
                        receiver_phone         M    String        收货人电话
                        abnormal_money         M    Float         异常金额
                        id                     M    String        订单 id
                        area_l1                M    String        一级地区名称
                        pay_method             M    Dict          结款周期相关信息
                            {
                                pay_method     M    String        订单支付方式
                                begin_day      M    Int           起始日
                                settle_day     M    Int           结算日
                                cycle_length   M    Int           自定义周期长度
                            }
                        city                   M    String        城市名称
                        driver_name            M    String        配送司机名称
                        origin_customer        M    Dict          原始订单信息
                        total_tax              M    String        总税金
                        remark                 M    String        订单备注
                        settle_way             M    Int           订单结算方式
                        source_origin_id       M    String        原始订单号
                        total_pay              M    Float         订单总支付金额
                        total_price            M    Float         订单总金额
                        freight                M    Float         运费
                        child_sort_id          M    String        子分拣号
                        carrier                M    String        订单承运商名称
                        bill_address           M    String        账单地址
                        details                M    List<Dict>    订单详情列表
                            [
                                {
                                    ##############  本次改动涉及的字段  ##############
                                    tax_rate            M    Float       税率
                                    is_set_tax          M    Int         设置税率

                                    name                M    String      规格商品名称
                                    real_weight         M    Float       实际重量
                                    sale_price_without_tax
                                                        M    String      销售价格  
                                    salemenu_id         M    String      报价单 id
                                    remark              M    String      商品备注
                                    std_sale_price      M    Float       基本单位售价
                                    outer_id            M    String      自定义 id
                                    origin_item_price   M    Float       锁价前的价格
                                    org_item_price      M    Float       sku镜像原金额
                                    org_std_sale_price  M    Float       sku镜像原基本单位价格
                                    org_sale_price      M    Float       sku镜像原销售单位价格
                                    pinlei_title        M    String      品类名称
                                    sale_ratio          M    Int         销售规格
                                    tax                 M    Float       税金
                                    saleunit_weighting_quantity      
                                                        M    Float       销售单位称重数
                                    real_item_price_without_tax
                                                        M    Float       不含税应付金额
                                    supplier_name       M    String      供应商名称
                                    category_title_1    M    String      一级分类名称
                                    quantity            M    Float       下单数量
                                    spu_name            M    String      商品名称
                                    std_unit_name       M    String      基本单位的名称
                                    sale_price          M    Float       销售单位价格
                                    id                  M    String      sku_id
                                    real_is_weight      M    Bool        是否是称重商品
                                    category_title_2    M    String      二级分类名称
                                    total_item_price    M    Float       该商品下单总价
                                    union_dispatch      M    Bool        是否统配
                                    purchase_station_id
                                                        M    String      供应商 id
                                    specs               M    String      规格
                                    sale_unit_name      M    String      销售单位名称
                                    real_item_price     M    Float       该商品实际金额
                                    is_price_timing     M    Int         是否时价
                                    supplier_id         M    String      供应商 id
                                },
                                ...
                            ]
                        details                M    List<Dict>    订单详情列表
                        sales_name             M    String        销售经理名称
                        cname                  M    String        公司名称 
                        address                M    String        收货地址
                        receiver_name          M    String        收货人名称
                        resname                M    String        商户名称
                        template_id            M    Int           打印模板 id
                        sale_manager           M    Dict          销售经理信息
                            {
                                name           M    String        姓名
                                id             M    Int           id
                                phone          M    String        手机号码
                            }
                        bill_receiver          M    String        账单接收人名称
                        date_time              M    DateTime      下单时间
                        real_price             M    Float         订单实际金额
                        address_route_name     M    String        配送路线名称
                        refund_money           M    Float         退货金额
                        driver_phone           M    String        配送司机名称
                        abnormals              M    List<Dict>    异常信息
                            [
                                {
                                    type_text      M    String        异常原因文案
                                    money_delta    M    Float         异常金额
                                    detail_id      M    String        异常商品ID,非商品异常为0
                                    text           M    String        描述
                                    amount_delta   M    Float         异常数量
                                },
                                ...
                            ]
                    },
                    ...
                ]
        }
示例:
    请求:
        {
            "ids": ["PL8796161"],
            "type": 2
        }
    响应:
        {
            "msg": "ok",
            "data": {
                "delivery_details": [
                    {
                        "tax_number": 131459,
                        "refunds": [],
                        "sort_id": "",
                        "receive_begin_time": "2019-09-23 20:00",
                        "coupon_amount": 0,
                        "sid": "173573",
                        "receiver_phone": "10112341234",
                        "receive_end_time": "2019-09-23 20:30",
                        "id": "PL8796161",
                        "abnormal_money": 0,
                        "area_l1": "宝安区",
                        "pay_method": {
                            "settle_day": null,
                            "pay_method": 1,
                            "cycle_length": null,
                            "begin_day": null
                        },
                        "city": "深圳市",
                        "driver_name": "",
                        "origin_customer": {},
                        "total_tax": "0.00",
                        "remark": null,
                        "settle_way": 1,
                        "total_pay": 1317.92,
                        "source_origin_id": [],
                        "total_price": 1317.92,
                        "freight": 0,
                        "child_sort_id": "",
                        "carrier": "",
                        "bill_address": null,
                        "details": [
                            {
                                "std_sale_price": 23,
                                "quantity": 5.18,
                                "real_item_price": 119.14,
                                "origin_item_price": 23,
                                "outer_id": "",
                                "union_dispatch": true,
                                "org_std_sale_price": 2300,
                                "remark": "ZeBZpf",
                                "category_title_1": "海鲜",
                                "id": "D3454897",
                                "specs": "-",
                                "supplier_name": "[先进先出] 鱼肉供应商",
                                "sale_unit_name": "斤",
                                "saleunit_weighting_quantity": 5.18,
                                "real_item_price_without_tax": "119.14",
                                "std_unit_name": "斤",
                                "sale_price_without_tax": "23.00",
                                "purchase_station_id": "T10001",
                                "salemenu_id": "S7541",
                                "sale_price": 23,
                                "total_item_price": 11914,
                                "org_item_price": 23,
                                "real_weight": 5.18,
                                "category_title_2": "测试",
                                "tax": "0.00",
                                "name": "清江鱼",
                                "is_weigh": false,
                                "org_sale_price": 23,
                                "spu_name": "清江鱼",
                                "tax_rate": 0,
                                "supplier_id": "T10111",
                                "is_price_timing": 0,
                                "pinlei_title": "测试",
                                "sale_ratio": 1,
                                "real_is_weight": true
                            },
                            ...
                        ],
                        "sales_name": "",
                        "cname": "",
                        "address": "广东省深圳市南山区科技南一路1号",
                        "receiver_name": "101",
                        "resname": "101",
                        "template_id": 732,
                        "sale_manager": {
                            "phone": null,
                            "name": null,
                            "id": null
                        },
                        "bill_receiver": null,
                        "date_time": "2019-09-17T17:27:15",
                        "real_price": 1317.92,
                        "area_l2": "新安",
                        "address_route_name": "人民路",
                        "refund_money": 0,
                        "driver_phone": "",
                        "abnormals": []
                    }
                ]
            },
            "code": 0
        }       
说明:
    请求不变,响应中增加以表示是否设置税率的字段「is_set_tax」

    调用方式:供应链>配送任务>查看编辑单据>打印
            供应链>订单列表>订单详情>编辑配送单>打印单据

    从 delivery 库中的 
        tbl_delivery, 
        tbl_delivery_rules,
        tbl_delivery_sku, 
        tbl_delivery_sku_rules
    拉取数据

sorting 模块


distribute/get_order_by_id 配送单打印

接口:
    distribute/get_order_by_id
class:
    website/station/views/distribute_task.py/GetOrderByIdView
方法:
    GET
请求:
    # 非全选的情况下,传订单列表
    ids                     M    List<String>     订单 id 列表
    # 全选的情况下,传筛选条件
    order_start_time       O    date  下单开始日期,格式2019-05-01
    order_end_time         O    date  下单结束日期,格式2019-05-01
    time_config_id         O    str   运营时间id
    cycle_start_time       O    str   运营周期开始时间格式2017-01-01 09:30
    cycle_end_time         O    str   运营周期结束时间格式2017-01-01 09:30
    receive_start_time     O    date  收货开始日期格式2019-05-01
    receive_end_time       O    date  收货开始日期格式2019-05-01
    search_text            O    str   搜索关键字
    carrier_id             O    int   承运商id
    driver_id              O    int   过滤的司机id
    route_id               O    int   线路id(无线路为-1)
    area_id                O    str   区域编码
    area_level             O    int   区级
    order_status           O    int   订单状态
    is_print               O    bool  是否打印
    unassigned             O    bool  未分配
    receive_way            O    int   收货方式 1-配送 2-自提
    pick_up_st_id          O    int   自提点id
响应:
    code      M    Int              状态码
    msg       M    String           状态消息
    data      M    List<Dict>       响应消息
        [
            {   
                receiver_phone          M    String        收货人电话
                area_l2                 M    String        二级区域名称
                sale_manager            M    Dict          销售经理信息
                    {
                        name            M    String        姓名
                        id              M    Int           id
                        phone           M    String        手机号码
                    }
                abnormals               M    List<Dict>    异常信息
                    [
                        {
                            type_text       M   String     异常原因文案
                            money_delta     M   Float      异常金额
                            detail_id       M   String     异常商品ID,非商品异常为"0"
                            text            M   String     描述
                            amount_delta    M   Float      异常数量
                        },
                        ...
                    ]
                area_l2                 M    String        二级区域名称
                remark                  M    String        订单备注
                cname                   M    String        商户公司名
                address                 M    String        地理位置
                total_pay               M    String        总支付金额
                real_price              M    String        实际订单金额
                source_origin_id        M    String        原始单号
                address_route_name      M    String        线路名称
                total_tax               M    String        税金
                resname                 M    String        商户名称
                abnormal_money          M    String        异常金额
                child_sort_id           M    String        子分拣号
                coupon_amount           M    String        优惠券金额
                id                      M    String        订单 id
                area_l1                 M    String        一级区域名称
                details                 M    List<Dict>    商品详情列表
                    [
                        {
                            ##############  本次改动涉及的字段  ##############
                            tax_rate            M    Float       税率
                            is_set_tax          M    Int         设置税率

                            name                M    String      规格商品名称
                            real_weight         M    Float       实际重量
                            sale_price_without_tax
                                                M    String      销售价格  
                            salemenu_id         M    String      报价单 id
                            remark              M    String      商品备注
                            life_time           M    DateTime    保质期 
                            std_sale_price      M    Float       基本单位售价
                            outer_id            M    String      自定义 id
                            desc                M    String      商品描述
                            origin_item_price   M    Float       锁价前的价格
                            org_item_price      M    Float       sku镜像原金额
                            org_std_sale_price  M    Float       sku镜像原基本单位价格
                            org_sale_price      M    Float       sku镜像原销售单位价格
                            pinlei_title        M    String      品类名称
                            sale_ratio          M    Int         销售规格
                            tax                 M    Float       税金
                            saleunit_weighting_quantity      
                                                M    Float       销售单位称重数
                            real_item_price_without_tax
                                                M    Float       不含税应付金额
                            supplier_name       M    String      供应商名称
                            category_title_1    M    String      一级分类名称
                            quantity            M    Float       下单数量
                            spu_name            M    String      商品名称
                            std_unit_name       M    String      基本单位的名称
                            sale_price          M    Float       销售单位价格
                            id                  M    String      sku_id
                            real_is_weight      M    Bool        是否是称重商品     
                            category_title_2    M    String      二级分类名称
                            total_item_price    M    Float       该商品下单总价
                            union_dispatch      M    Bool        是否统配
                            purchase_station_id
                                                M    String      供应商 id
                            specs               M    String      规格
                            sale_unit_name      M    String      销售单位名称
                            real_item_price     M    Float       该商品实际金额
                            is_price_timing     M    Int         是否时价
                            supplier_id         M    String      供应商 id
                            production_time     M    DateTime    生产日期
                        },
                        ...
                    ]                
                freight                 M    String        运费
                sort_id                 M    String        分拣序号
                date_time               M    DateTime      下单时间
                template_id             M    Int           打印模板 id
                refund_money            M    String        订单退款金额
                bill_address            M    String        账单地址
                address_sign            M    String        地理标签名称
                receive_begin_time      M    DateTime      收货开始时间
                receive_end_time        M    DateTime      收货结束时间
                pay_status              M    Int           订单支付状态
                sales_name              M    String        销售经理名称
                sid                     M    String        帐户id
                total_price             M    String        订单总金额
                pay_method              M    Dict          结款周期相关信息
                    {
                        pay_method      M    String        订单支付方式
                        begin_day       M    Int           起始日
                        settle_day      M    Int           结算日
                        cycle_length    M    Int           自定义周期长度
                    }
                receiver_name           M    String        收货人名称
                driver_phone            M    String        配送司机电话
                refunds                 M    List<Dict>    退货列表
                    [
                        {
                            detail_id           M    String    退货商品 id
                            type_text           M    String    退货原因
                            text                M    String    退货备注
                            money_delta         M    Float     退货金额
                            amount_delta        M    Float     退货数量
                        },
                        ...
                    ]
                address_sign            M    String        地理标签名称
                address_sign_id         M    String        地理标签 id
                username                M    String        帐户名称
                create_user             M    String        订单创建人
                origin_customer         M    Dict          原始订单信息
                    {
                        address_sign               M    String     地理标签名称
                        resname                    M    String     商户名称
                        origin_order_id            M    String     原订单 id
                        child_sort_id              M    String     子分拣号
                        address_id                 M    String     店铺 id
                        origin_address             M    String     原地址
                        origin_receiver_name       M    String     原收货人名称
                        origin_receiver_phone      M    String     原收货人电话
                        origin_area                M    String     原地区
                        origin_resname             M    String     原商户名称
                    }
                receive_way             M    Int           收货方式
                carrier                 M    String        配送承运商
                driver_name             M    String        司机名称
                tax_number              M    Int           税号
                city                    M    String        城市名称
            }
        ]
示例:
    请求:
        {
            "ids": ["PL8882507"]
        }
    响应:
        {
            "code":0
            "msg":"ok",
            "data":[
                {
                    "receiver_phone":"13978889876",
                    "area_l2":"华侨城",
                    "sale_manager":{
                        "name":null,
                        "id":null,
                        "phone":null
                    },
                    "abnormals":[

                    ],
                    "remark":"hello world",
                    "cname":"测试店铺",
                    "address":"广东省深圳市福田区南园街道飞扬时代大厦",
                    "total_pay":"4.44",
                    "real_price":"4.44",
                    "source_origin_id":"",
                    "address_route_name":"人民路",
                    "total_tax":"0.00",
                    "resname":"测试店铺",
                    "abnormal_money":"0.00",
                    "child_sort_id":"",
                    "coupon_amount":"0.00",
                    "id":"PL8882507",
                    "area_l1":"南山区",
                    "details":[
                        {
                            "name":"兰花豆",
                            "real_weight":4.44,
                            "sale_price_without_tax":"1.00",
                            "salemenu_id":"S18665",
                            "remark":null,
                            "life_time":null,
                            "std_sale_price":1,
                            "outer_id":"",
                            "desc":"",
                            "org_item_price":4.44,
                            "pinlei_title":"坚果",
                            "sale_ratio":1,
                            "tax":"0.00",
                            "saleunit_weighting_quantity":4.44,
                            "real_item_price_without_tax":"4.44",
                            "supplier_name":"三只松鼠",
                            "category_title_1":"三只松鼠",
                            "origin_item_price":2.33,
                            "quantity":4.44,
                            "org_sale_price":1,
                            "spu_name":"兰花豆",
                            "std_unit_name":"包",
                            "sale_price":1,
                            "real_is_weight":true,
                            "id":"D13415925",
                            "is_weigh":false,
                            "tax_rate":0,
                            "category_title_2":"三只松鼠",
                            "total_item_price":4.44,
                            "union_dispatch":true,
                            "org_std_sale_price":1,
                            "purchase_station_id":"T10001",
                            "specs":"-",
                            "sale_unit_name":"包",
                            "production_time":null,
                            "real_item_price":4.44,
                            "is_price_timing":false,
                            "supplier_id":"T36221"
                        }
                    ],
                    "freight":"0.00",
                    "sort_id":"人民路-1-1",
                    "date_time":"2019-09-20 15:56:44",
                    "template_id":732,
                    "refund_money":"0.00",
                    "bill_address":null,
                    "address_sign":"华侨城",
                    "receive_end_time":"2019-09-21 06:00",
                    "pay_status":1,
                    "sales_name":"",
                    "sid":"266603",
                    "total_price":"4.44",
                    "receive_begin_time":"2019-09-21 04:00",
                    "pay_method":{
                        "pay_method":1,
                        "settle_day":null,
                        "cycle_length":null,
                        "begin_day":null
                    },
                    "receiver_name":"刘一一",
                    "driver_phone":"",
                    "refunds":[

                    ],
                    "address_sign_id":"30200200000",
                    "username":"test0802",
                    "create_user":"xjxc01",
                    "origin_customer":{

                    },
                    "receive_way":1,
                    "carrier":"",
                    "settle_way":1,
                    "bill_receiver":null,
                    "driver_name":"",
                    "tax_number":131472,
                    "city":"深圳市"
                }
            ],
        }
说明:
    请求不变,响应中增加以表示是否设置税率的字段「is_set_tax」

    调用方式:
    1 供应链>配送任务>单据打印图标
    2 供应链>订单列表>订单详情(点击订单号)>打印

    从 mongo>order_new 中拉取订单数据,是真实的数据

order 工程


/order/create 创建订单

接口:
    /order/create
class:
    order/views/order_new.py/OrderCreateV1View
方法:
    POST
请求:
    customer          M    Dict           商户信息
        {
            uid                  M    String     用户ID
            address_id           M    String     店铺ID
            address              M    String     店铺地址
            address_sign_id      M    String     区域ID
            receiver_name        M    String     收货人姓名
            receiver_phone       M    String     收货人电话
            settle_way           M    Int        结算方式
            district_code        M    String     城市码
            supply_station_id    O    String     供应站点ID
            extender             M    String     扩展信息[注1]
            receive_begin_time   M    String     收货开始时间(%Y-%d-%m %H:%M)
            receive_end_time     M    String     收货结束时间(%Y-%d-%m %H:%M)
        }
    station_id        M    String         站点ID
    products          M    List           商品信息
        [
            {
                sku_id             M    String 商品sku ID
                amount             M    Float 下单数量
                spu_id             O    String 商品spu id
                spu_remark         O    String 商品备注
                unit_price         O    Float 商品单价(分)
                is_price_timing    O    Int 是否时价
            }
        ]
    time_config_id    M    String         服务时间配置ID
    client            O    Int            下单客户端
    remark            O    String         订单备注
    out_order_id      O    String         外部订单ID
    coupon_dict       O    Dict           优惠券信息
        {
          coupon_id                     M    Int        优惠券id
          coupon_max_discount_percent   M    Float      最大优惠比
          coupon_amount                 M    Float      优惠金额
          coupon_min_total_price        M    Float      满减条件
        }
    reward_skus        O    List       积分商品信息
        [
            {
                reward_sku_id     M    String       积分商品
                quantity          M    Float        数量
                sku_cost_point    M    Int          花费积分
                sku_name          M    String       商品名
                sale_unit         M    String       积分商城sku的单位
                sku_cost          M    Int          成本价
            }
        ]
响应:
    code              M    Int         状态码  0为成功,其它为失败
    msg               M    String      状态消息
    data              M    String      响应消息  返回的订单ID
示例:
    请求:
        {
            customer: {
                'address_sign_id': '30100200000',
                'district_code': '440300', 
                'settle_way': 1, 
                'supply_station_id': 'T7936', 
                'address_id': '217824', 
                'extender': '{"resname": "测试店铺0812分店", "order_pay_method": 2}',
                'uid': '231367', 
                'receiver_name': '分店',
                'receiver_phone': '18809098767', 
                'receive_begin_time': '2019-09-21 06:00',
                'receive_end_time': '2019-09-21 12:00', 
                'address': '广东省深圳市福田区华强北街道华强北路17曼哈商业广场'
            },
            details:[
                {
                    'sku_id': 'D11862266', 
                    'is_price_timing': 0, 
                    'amount': 1.0, 
                    'spu_remark': '',
                    'spu_id': 'C2473562', 
                    'unit_price': 1184.0
                },
                ...
            ],
            client: (1,),
            remark: None,
            station_id: 'T7936',
            time_config_id: 'ST3078'
        }
    响应:
        {
            code: 0,
            msg: 'ok',
            data: 'PL6142039'
        }
逻辑:
    检测商品库存
    生成订单数据
    扣减库存
    创建订单
    发送消息通知

说明:
    请求和响应都不变,内部逻辑有变化,存入数据库中的数据中增加一个字段「is_set_tax」   

    *注1  extender  扩展信息
        {
            resname: 店铺名,
            order_pay_method: 付款方式
        }