Skip to content

智能定价

db改动

station表 增加suggest_price 表示是否开启建议价格区间
权限   增加edit_smart_pricing 表示是否展示智能定价按钮

/station/profile/update 修改站点配置

method
    post
request
    show_sku_outer_id
    default_settle_way
    show_tax_rate
    allow_order_remark
    show_order_remark
    新增
    suggest_price O int 0/1(关闭/开启)建议价格,默认0

response
    {
        "data": null,
        "msg": "ok",
        "code": 0
    }

/product/sku_sale/list 拉取spu下sku信息

method
    GET
request

response
    {
        "data": [{
            新增
            suggest_price_min  建议价格区间下限 未设置传-1
            suggest_price_max  建议价格区间上限 未设置传-1
        }],
        "msg": "ok",
        "code": 0
    }

/product/sku/update 修改sku

method
    post
request
    新增
    suggest_price_min O float 建议价格区间下限 不填该字段不传 应大于0    重置传-1
    suggest_price_max O float 建议价格区间上限  不填该字段不传 应大于0,大于等于下限    重置传-1
response
    {
        "data": null,
        "msg": "ok",
        "code": 0
    }

/product/sku_sale/create 新建sku

method
    post
request
    新增
    suggest_price_min O float 建议价格区间下限 不填该字段不传 应大于0
    suggest_price_max O float 建议价格区间上限  不填该字段不传 应大于0,大于等于下限
response
    {
        "data": sku_id,
        "msg": "ok",
        "code": 0
    }

/merchandise/spu/index 商品库索引拉取spu信息

method
    GET
request

response
    {
        "data": [{
            'skus': [
                新增
                over_suggest_price  bool   价格是否超出建议价格区间
                suggest_price_min str  建议价格区间下限 未设置传-1
                suggest_price_max  str   建议价格区间上限 未设置传-1
            ]
        }],
        "msg": "ok",
        "code": 0
    }

/product/sku_salemenu/list 我出售的商品报价单详情

method
    GET
request

response
    {
        "data": [
            新增
            over_suggest_price  bool   价格是否超出建议价格区间
            suggest_price_min str  建议价格区间下限  未设置传-1
            suggest_price_max  str   建议价格区间上限  未设置传-1
        ],
        "msg": "ok",
        "code": 0
    }

新增接口

/product/sku/smart_pricing/list 获取所选sku的智能定价信息

method
    post
request
    # 筛选部分
    all                      M  int   0/1 是否修改全部商品价格,传1时category1_ids,category2_ids,pinlei_ids,q 必传
                                                             传0时smart_price_sku_list 必传
    category1_ids            O  list  一级分类ids 仅更新全部时有效 同merchandise/spu/index搜索条件
    category2_ids            O  list  二级分类ids 仅更新全部时有效 同merchandise/spu/index搜索条件
    pinlei_ids               O  list  品类ids    仅更新全部时有效 同merchandise/spu/index搜索条件
    q                        O  str   查询字符串  仅更新全部时有效 同merchandise/spu/index搜索条件
    state                    O  int   0/1/NULL(上架中/已下架/全部)
    salemenu_id              O  str   销售单id
    sku_list                 O  list  部分智能定价商品sku_id列表 仅all为0时有效,不能超过100个(待定
    filter_price_region      O  int   定价范围筛选类型 0/1(默认/增加区间筛选)默认0
    filter_price_type        O  int   定价区间筛选类型 0/1/2/3/4(现单价/最近询价/最近采购价/最近入库价/库存均价)默认0
    price_region_min         O  float 定价价格筛选区间下限 不填该字段不传 应大于0
    price_region_max         O  float 定价价格筛选区间上限 不填该字段不传 应大于0,大于等于下限
    # 定价规则部分
    price_type               O  int   定价价格类型 0/1/2/3/4(现单价/最近询价/最近采购价/最近入库价/库存均价)默认0
    cal_type                 M  int   计算类型 0/1(加/乘)
    cal_num                  M  float 计算因子 加: 正负六位,小数两位; 乘: 大于0,小数两位
    # 确认页面
    re_category1_ids         O  int   一级分类ids 二次搜索
    re_category2_ids         O  int   二级分类ids 二次搜索
    re_pinlei_ids            O  int   品类ids     二次搜索
    re_q                     O  str   查询字符串   二次搜索
    offset                   O  int   二次确认分页用 默认0
    limit                    O  int   二次确认分页用 默认10

request参数使用指南
+---------------------------------------------------------------------------+
|             1--------------------all--------------------------0           |
|             |                                                 |           |
|         category1_ids                                      sku_list       |
|         category2_ids                             必传,同级filter参数无效   |
|         pinlei_ids                                            |           |
|         q(对应搜索接口中的text)                                 |           |
|         state                                                 |           |
|         salemenu_id                                           |           |
|             |                                                 |           |
|             +---------------------+---------------------------+           |
|                                   |                                       |
|         1(增加区间筛选)----filter_price_region---------------0(默认)        |
|             |                                                 |           |
|         filter_price_type                                     |           |
|         price_region_min                                      |           |
|         price_region_max                                      |           |
|             |                                                 |           |
|             +-------------------------------------------------+           |
|                                   |                                       |
|                                cal_type                                   |
|                                cal_num                                    |
|                                offset                                     |
|                                limit                                      |
|                                reverse                                    |
|                                page_obj                                   |
|                                 peek                                      |
|                                   |                                       |
|                             re_category1_ids                              |
|                             re_category2_ids                              |
|                              re_pinlei_ids                                |
|                                  re_q                                     |
|                                   |                                       |
|                                   |                                       |
|                                   +----------->request                    |
+---------------------------------------------------------------------------+

# re_开头字段使用逻辑:
    最终筛选条件为 category_ids_1 = category1_ids ∩ re_category1_ids

response
    # 二次确认返回数据
    {
        "data": {
            'count':   商品数
            'sku_list': [{
                'sku_id'             sku_id
                'name'               商品名
                'salemenu_name'      销售单名
                'old_price'          现单价
                'new_price'          更新后单价
                'ratio'              销售系数
                'std_unit_name'      基本单位
                'sale_unit_name'     销售单位  (规格 = 销售系数 基本单位/销售单位)
                'sale_price'         销售价
                'over_suggest_price' 价格是否超出建议价格区间 bool
                'suggest_price_min'  建议价格区间下限  未设置传-1
                'suggest_price_max'  建议价格区间上限  未设置传-1
                'last_in_stock_price'最近入库价
                'last_purchase_price'最近采购价
                'last_qoute_price'   最近询价
                'stock_avg_price'    库存均价
            },],

        },
        "msg": "ok",
        "code": 0,
        'pagination':{
            'peek',
            'page_obj',
            'more',
            'reverse'
        }
    }

/product/sku/smart_pricing/update 智能定价

method
    post
request
    # 筛选部分
    all                      M  int   0/1 是否修改全部商品价格,传1时category1_ids,category2_ids,pinlei_ids,q 必传
                                                             传0时smart_price_sku_list 必传
    category1_ids            O  list  一级分类ids 仅更新全部时有效 同merchandise/spu/index搜索条件
    category2_ids            O  list  二级分类ids 仅更新全部时有效 同merchandise/spu/index搜索条件
    pinlei_ids               O  list  品类ids    仅更新全部时有效 同merchandise/spu/index搜索条件
    q                        O  str   查询字符串  仅更新全部时有效 同merchandise/spu/index搜索条件
    state                    O  int   0/1/NUll(上架中/已下架/全部)
    salemenu_id              O  str   销售单id
    sku_list                 O  list  部分智能定价商品sku_id列表 仅all为0时有效,不能超过100个(待定
    filter_price_region      M  int   定价范围筛选类型 0/1(默认/增加区间筛选)默认0
    filter_price_type        O  int   定价区间筛选类型 0/1/2/3/4(现单价/最近询价/最近采购价/最近入库价/库存均价)默认0
    price_region_min         O  float 定价价格筛选区间下限 不填该字段不传 应大于0
    price_region_max         O  float 定价价格筛选区间上限 不填该字段不传 应大于0,大于等于下限
    # 定价规则部分
    price_region             O  int   定价价格类型 0/1/2/3/4(现单价/最近询价/最近采购价/最近入库价/库存均价)默认0
    cal_type                 M  int   计算类型 0/1(加/乘)
    cal_num                  M  float 计算因子 加: 正负六位,小数两位; 乘: 大于0,小数两位
    re_category1_ids         O  int   一级分类ids 二次搜索
    re_category2_ids         O  int   二级分类ids 二次搜索
    re_pinlei_ids            O  int   品类ids     二次搜索
    re_q                     O  str   查询字符串   二次搜索
    modify_sku_list          O  list  有改动的sku列表 内部结构如下[{'sku_id': sku_id, 'price': 更新后单价, 'status': 0/1(未删除/已删除)},]

request参数使用指南
+---------------------------------------------------------------------------+
|             1--------------------all--------------------------0           |
|             |                                                 |           |
|         category1_ids                                      sku_list       |
|         category2_ids                             必传,同级filter参数无效   |
|         pinlei_ids                                            |           |
|         q(对应搜索接口中的text)                                 |           |
|         state                                                 |           |
|         salemenu_id                                           |           |
|             |                                                 |           |
|             +---------------------+---------------------------+           |
|                                   |                                       |
|         1(增加区间筛选)----filter_price_region---------------0(默认)        |
|             |                                                 |           |
|         filter_price_type                                     |           |
|         price_region_min                                      |           |
|         price_region_max                                      |           |
|             |                                                 |           |
|             +-------------------------------------------------+           |
|                                   |                                       |
|                                cal_type                                   |
|                                cal_num                                    |
|                                   |                                       |
|                             re_category1_ids                              |
|                             re_category2_ids                              |
|                              re_pinlei_ids                                |
|                                  re_q                                     |
|                                   |                                       |
|                             modify_sku_list                               |
|                                   |                                       |
|                                   +--------------------->request          |
+---------------------------------------------------------------------------+

response
    {
        "data": task_id,  异步任务id
        "msg": "ok",
        "code": 0
    }