Skip to content

订单admin

DB改动.

mongodb:
新增 order_change
id  uid     order_id  sid    attribute  before  after  datetime
_id 用户id   订单id    商品id   修改的字段  旧数据    新数据         操作时间

mysql:
auth_permission新增raw
修改出库数    21     edit_real_quantity

/station/order/edit/{{order_id}} 拉取订单详情.

接口名:    /station/order/edit/{{order_id}}
Method:   GET

请求:
    order_id  M   string  订单ID
响应:

    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data    M   dict    订单详情数据,数据字段为订单表字段;

request:

response:
    新增字段:
    单价(基本单位)std_sale_price (std_unit_name)
    应退数  request_refund_quantity
    实退数  real_refund_quantity
    销售额  sale_money
    是否为称重商品  is_weigh  0:不称重商品,1:称重商品
    是否已称重  weighted  0:未称重,1:已称重
    按基本单位计算的下单数  std_unit_quantity
    最后出库数操作人  real_quantity_operater
    是否缺货  out_of_stock  0:不缺货,1:缺货
    基本单位出库数  std_real_quantity
    修改字段:
    异常数  exc_quantity 旧逻辑为包含异常数或退货数,现仅包含异常数
    删除字段:
    is_weight  是否已称重,现统一使用mysql中的字段weighted

备注:
    单价(基本单位)= sale_price / sale_ratio (std_unit_name)
    是否需要称重  is_weigh  (real_is_weigh  order中)
    非编辑状态下,如基本单位与销售单位不一致,下单数后增加基本单位的数值,如3箱(9斤)下单数 * sale_ratio (std_unit_name)
    已称重未称重需要查询tbl_sku_sorting表

/station/order/real_quantity/update修改出库数.

接口名:    /station/order/real_quantity/update
Method:   POST

请求:
    order_id     M  str  订单号
    sku_id       M  str  商品id
    std_real_quantity  M  str  修改后的出库数
响应:
    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data    M   dict
    {
        'std_real_quantity'   基本单位出库数
        'sale_money'    销售额
    }

/station/order/edit/{{order_id}} 修改订单详情.

接口名:    /station/order/edit/{{order_id}}
Method:   POST

请求:
    order_id  M   string  订单ID
    details   M   list[dict]  商品数据 //修改后的出库数在里面
            {
                "sku_id": "D2540923",
                "amount": "221",
                "unit_price": "8.81",
                "spu_remark": "",
                "spu_id": "C841193"
                (新增)
                "std_real_quantity": "20"   O   出库数
            },
    order_data M  dict    订单的收货时间
响应:
    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data    M   dict    订单详情数据,数据字段为订单表字段;

/station/order/edit_old/{{order_id}} 追加修改订单详情.

接口名:    /station/order/edit_old/{{order_id}}
Method:   POST

请求:
    order_id  M   string  订单ID
    details   M   list[dict]  商品数据 //修改后的出库数在里面
            {
                "sku_id": "D2540923",
                "amount": "221",
                "unit_price": "8.81",
                "spu_remark": "",
                "spu_id": "C841193"
                (新增)
                "std_real_quantity": "20"   O   出库数
            },
    order_data M  dict    订单的收货时间
响应:
    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data    M   dict    订单详情数据,数据字段为订单表字段;

/station/order/order_sku_list 获取sku列表(按商品查看).

接口名:    /station/order/order_sku_list
Method:   GET

请求:
    query_type          M int     搜索类型 [1: 按照下单时间搜索,2: 按照运营周期搜索,3: 按照收货日期搜索]
    if query_type == 1
        start_date      M date    开始下单日期(精确到天)
        end_date        M date    截止下单日期(精确到天)
    if query_type == 2
        time_config_id  M string  时间配置ID
        start_date      M date    开始周期时间(精确到分钟)
        end_date        M date    结束周期时间(精确到分钟)
    if query_type == 3
        start_date      M date    开始收货日期(精确到天)
        end_date        M date    结束收货日期(精确到天)
    search_text         O string  搜索内容,为上三个字段的合并功能
    status              O string  订单状态
    offset              O int     分页offset
    limit               O int     分页limit
    salemenu_id         O string  销售单号

    新增参数:
    category1_ids       O list   一级分类列表
    category2_ids       O list   二级分类列表
    pinlei_ids          O list   品类列表
    batch_remark        O str    分拣备注筛选
    batch_remark_is_nullO int    是否为无分拣备注  1:筛选无分拣备注的,0:字段无意义
    is_weigh            O str    任务类型筛选(记重,不记重)-1:全部,0:不记重,1:记重
    weighted            O str   完成情况筛选  -1:全部,0:未称重,1:已称重
    sort_type           O str    排序类型(quantity_desc下单数降序,quantity_asc下单数升序,
                                         real_quantity_desc记重数降序,real_quantity_asc记重数升序)


响应:

    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data    M   dict    商户的销售单信息

response:
    新增返回字段:
        下单金额 real_item_price
        下单数  quantity
        出库数  real_quantity
        异常数  exc_quantity
        应退数  request_refund_quantity
        实退数  real_refund_quantity
        销售额  sale_money
        订单状态 status
        是否已称重    weighted
        是否缺货  out_of_stock  0:不缺货,1:缺货
        基本单位出库数  std_real_quantity

获取sku列表新增的筛选条件所需的历史接口

/merchandise/category1/get 获取一级商品分类
/merchandise/category2/get 获取二级商品分类
/merchandise/pinlei/get    获取品类

/station/order/remark/get 获取所选周期内订单的分拣备注.

接口名:/station/order/remark/get
Method:   GET
请求:
    query_type          M int     搜索类型 [1: 按照下单时间搜索,2: 按照运营周期搜索,3: 按照收货日期搜索]
    if query_type == 1
        start_date            M string  开始下单日期(精确到天)
        end_date              M string  截止下单日期(精确到天)
    if query_type == 2
        time_config_id        M string  时间配置ID
        cycle_start_time      M string  开始周期时间(精确到分钟)
        cycle_end_time        M string  结束周期时间(精确到分钟)
    if query_type == 3
        receive_start_date    M string  开始收货日期(精确到天)
        receive_end_date      M string  结束收货日期(精确到天)

响应:
    响应:
    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data    M   dict    分拣备注列表

/station/order/batch_out_of_stock/update 批量设置缺货.

接口名:/station/order/batch_out_of_stock/update
Method:   POST
请求:
    sku_info  M  list 缺货sku信息  [{'order_id': '', 'sku_id': ''}, {}]
响应:
    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data    M   dict    null

备注

出库数+(不记重任务)/ 出库数+(未称重)
修改 --> 判断修改出库数 --> 非0 --> 判断是否为称重商品--> 非称重 --> 不修改称重,打印状态 出库数+(不记重任务)  ---
            |                    |                                                                  |
            |                    称重 --> 修改称重状态  出库数+(已称重)   ------------------------------|--> 保存记录
            0 ---                                                                                   |
                |-->   设置缺货  ---------------------------------------------------------------------
批量设置缺货 ------

时价

/product/sku_sale/create 创建sku.

接口名: /product/sku_sale/create
Method:   POST

request:
    name M string sku名称
    desc O string sku描述
    std_sale_price M int 采购单价
    sale_price M int 采购价格
    sale_unit_name M 采购单位
    sale_ratio M float 采购规格
    state M int 供应状态
    image O string 图片ID(没有则默认为spu的图片)
    salemenu_id M string 销售单ID
    spu_id M string spu ID
    新增参数:
    is_price_timing M bool 修改是否为时价商品 true:时价商品,false:非实价商品

response:
    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  'ok' 或错误信息
    data    M   dict    新建的sku_id

/product/sku/update 修改sku.

接口名: /product/sku/update
Method:   POST

request:
    id M string sku ID
    name O string spu名称
    desc O string spu描述
    std_sale_price O float 销售单价(分)
    sale_price O float 销售价格(分)
    sale_unit_name O 销售单位
    sale_ratio O float 销售规格
    sale_num_least O int 最小下单数
    attrition_rate O float 损耗率
    state O int 销售状态
    is_weigh O bool 是否称重
    slitting M bool 能否分切
    partframe M bool 能否投筐
    stock_type O int 设置库存(0:读取上游库存;1:不设置库存;2:设置库存)
    stocks O int 库存数量
    image O string 图片名称
    salemenu_id O string 销售单ID
    supply_sku_id O string 采购来源
    新增参数:
    is_price_timing O bool 修改是否为时价商品 true:时价商品,false:非实价商品

response:
    code    M   int 0为成功,其它为失败
    msg     M   string 错误提示信息
    data    M   dict    新建的sku_id

/station/order/edit/{{order_id}} 拉取订单详情.

接口名:    /station/order/edit/{{order_id}}
Method:   GET

请求:
    order_id  M   string  订单ID
响应:

    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data    M   dict    订单详情数据,数据字段为订单表字段;

request:

response:
    新增字段:
    details 下的sku增加 is_price_timing 字段 是否为时价商品 true:时价商品,false:非实价商品

/station/order/order_sku_list 获取sku列表(按商品查看).

接口名:    /station/order/order_sku_list
Method:   GET

请求:
    query_type          M int     搜索类型 [1: 按照下单时间搜索,2: 按照运营周期搜索,3: 按照收货日期搜索]
    if query_type == 1
        start_date      M date    开始下单日期(精确到天)
        end_date        M date    截止下单日期(精确到天)
    if query_type == 2
        time_config_id  M string  时间配置ID
        start_date      M date    开始周期时间(精确到分钟)
        end_date        M date    结束周期时间(精确到分钟)
    if query_type == 3
        start_date      M date    开始收货日期(精确到天)
        end_date        M date    结束收货日期(精确到天)
    search_text         O string  搜索内容,为上三个字段的合并功能
    status              O string  订单状态
    offset              O int     分页offset
    limit               O int     分页limit
    salemenu_id         O string  销售单号
    category1_ids       O list   一级分类列表
    category2_ids       O list   二级分类列表
    pinlei_ids          O list   品类列表
    batch_remark        O str    分拣备注筛选
    is_weigh            O str    任务类型筛选(记重,不记重)
    weighted            O str    完成情况筛选
    sort_type           O str    排序类型(quantity_desc下单数降序,quantity_asc下单数升序,
                                         real_quantity_desc记重数降序,real_quantity_asc记重数升序)

响应:

    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data    M   dict    商户的销售单信息

response:
    新增返回字段:
    details 下的sku增加 is_price_timing 字段 是否为时价商品 true:时价商品,false:非实价商品

/station/skus/addr 搜索商品.

接口名:/station/skus/addr
Method:GET
请求:
    address_id   M   int     商户ID
    search_text  M   string  商品sku_id或者商品名称
    time_config_id M string  时间配置ID
    fetch_category O int     0-表示不拉取分类;1-表示拉取分类;
    active       O   int     0-表示拉取全部状态商品;1-表示只拉取有效的商品;
    offset       O   int     分页offset
    limit        O   int     分页limit

响应:

    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data    M   dict    sku信息

response:
    新增返回字段:
    is_price_timing 字段 是否为时价商品 true:时价商品,false:非实价商品

/station/order/create 创建订单.

接口名:    /station/order/create
Method:   POST

请求:
    details     M  string  商品相关的json数据
        [
            {
                "sku_id": "D2540923",
                "amount": "221",
                "unit_price": "8.81",
                "spu_remark": "",
                "spu_id": "C841193"
                (新增)
                "is_price_timing": "0"   M   时价 非时价传0,时价传1
            },
        ]
    address_id  M  int     商户SID
    uid         M  int     商户UID
    receive_begin_time M string 订单收货开始时间
    receive_end_time   M string 订单收货结束时间
    time_config_id  string  时间配置ID
    force  O int 是否强制合单标志,0-不合单,新建一个订单;1-强制合单;

响应:

    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data    M   dict    新建的订单ID或者更改的订单ID数据
示例:
    request
        http://station.guanmai.cn/station/order/create
        POST参数:
                details: [{"sku_id":"D804813","amount":1,"unit_price":123,"spu_remark":"666","spu_id":"C00035","is_price_timing": "0"}]
                address_id: 20508
                uid: 25512
                receive_begin_time: 2016-10-16 06:00
                receive_end_time: 2016-10-16 23:30
                time_config_id: ST001

    response
        {
                "data": {
                    "exceed_order_time_ids": [],
                    "not_enough_inventories": [],
                    "update_order_ids": [],
                    "error_sku_ids": [],
                    "new_order_ids": ["PL316101"],
                    "detail_url": "/station/order/edit/PL316101"
                },
                "msg": "ok",
                "code": 0
        }

/station/order/create_old 补录订单.

接口名:    /station/order/create_old
Method:   POST

请求:
    details     M  string  商品相关的json数据
        [
            {
                "sku_id": "D2540923",
                "amount": "221",
                "unit_price": "8.81",
                "spu_remark": "",
                "spu_id": "C841193"
                (新增)
                "is_price_timing": "0"   M   时价 非时价传0,时价传1
            },
        ]
    address_id  M  int     商户SID
    uid         M  int     商户UID
    receive_begin_time M string 订单收货开始时间
    receive_end_time   M string 订单收货结束时间
    time_config_id  string  时间配置ID
    force  O int 是否强制合单标志,0-不合单,新建一个订单;1-强制合单;

响应:

    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data    M   dict    新建的订单ID或者更改的订单ID数据
示例:
    request
        http://station.guanmai.cn/station/order/create
        POST参数:
                details: [{"sku_id":"D804813","amount":1,"unit_price":123,"spu_remark":"666","spu_id":"C00035","is_price_timing": "0"}]
                address_id: 20508
                uid: 25512
                receive_begin_time: 2016-10-16 06:00
                receive_end_time: 2016-10-16 23:30
                time_config_id: ST001

    response
        {
                "data": {
                    "exceed_order_time_ids": [],
                    "not_enough_inventories": [],
                    "update_order_ids": [],
                    "error_sku_ids": [],
                    "new_order_ids": ["PL316101"],
                    "detail_url": "/station/order/edit/PL316101"
                },
                "msg": "ok",
                "code": 0
        }

/station/order/edit/{{order_id}} 修改订单详情.

接口名:    /station/order/edit/{{order_id}}
Method:   POST

请求:
    order_id  M   string  订单ID
    details   M   list[dict]  商品数据
        [
            {
                "sku_id": "D2540923",
                "amount": "221",
                "unit_price": "8.81",
                "spu_remark": "",
                "spu_id": "C841193"
                "std_real_quantity": "20"   O   出库数
                (新增)
                "is_price_timing": "0"   M   时价 非时价传0,时价传1
            },
        ]
    order_data M  dict    订单的收货时间
响应:
    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data    M   dict    订单详情数据,数据字段为订单表字段;

新增逻辑:
    如果原来为时价商品,修改is_price_timing为false

/station/order/edit_old/{{order_id}} 追加修改订单详情.

接口名:    /station/order/edit_old/{{order_id}}
Method:   POST

请求:
    order_id  M   string  订单ID
    details   M   list[dict]  商品数据
        [
            {
                "sku_id": "D2540923",
                "amount": "221",
                "unit_price": "8.81",
                "spu_remark": "",
                "spu_id": "C841193"
                "std_real_quantity": "20"   O   出库数
                (新增)
                "is_price_timing": "0"   M   时价 非时价传0,时价传1
            },
        ]
    order_data M  dict    订单的收货时间
响应:
    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data    M   dict    订单详情数据,数据字段为订单表字段;

新增逻辑:
    如果原来为时价商品,修改is_price_timing为false

/station/transport/get_order_by_id_new 获取订单打印信息.

接口名:/station/transport/get_order_by_id_new
Method:   GET

request:
    ids   M   list   要获取的订单id列表
response:
    新增:
        details中每一项新增is_price_timing字段
    [
        {
            "sort_id": 1,
            "address_sign_id": "30400100000",
            "refund_money": 0,
            "receive_end_time": "2017-12-26 12:00",
            "receiver_name": "周",
            "freight": 0,
            "origin_customer": {},
            "child_sort_id": "",
            "receiver_phone": "15111111111",
            "details": [
                {
                    "union_dispatch": true,
                    "std_unit_name": "件",
                    "sale_unit_name": "件",
                    "specs": "-",
                    "total_item_price": 154,
                    "real_item_price": 149.6,
                    "purchase_station_id": "T8521",
                    "category_title_1": "水果",
                    "id": "D2734104",
                    "sale_price": 11,
                    "remark": null,
                    "name": "帝王蕉",
                    "quantity": 14,
                    "salemenu_id": "S6977",
                    "real_weight": 13.6,
                    "sale_ratio": 1,
                    "outer_id": "",
                    "std_sale_price": 11,
                    "is_price_timing": false
                }
            ],
            "sales_name": "",
            "abnormal_money": 0,
            "address_sign": "宝安中心区",
            "sid": "53681",
            "id": "PL1053242",
            "refunds": [],
            "resname": "zhoumin1",
            "total_price": 535,
            "real_price": 279.3,
            "source_origin_id": "",
            "date_time": "2017-12-25 19:13:22",
            "total_pay": 279.3,
            "abnormals": [],
            "address": "宝安中心",
            "receive_begin_time": "2017-12-26 06:00"
        }
    ]

测试环境

station 7892
ma 7893
order 7894
mer 7895
db  1229