锁价规则
锁价规则
/station/price_rule/index 索引页(返回html)
接口名: /station/price_rule/index
Method: GET
请求:
无
响应:
返回html文件
/station/price_rule/search -- 搜索锁价规则
接口名
/station/price_rule/search
Method
GET
请求
price_rule_id O string 锁价规则ID
salemenu_id O string 销售单ID
salemenu_name O string 销售单名称
station_id O string 站点ID
status O int 规则状态
cur_page O int 当前页 默认0
cnt_per_page O int 每页显示数 默认10
响应
code M int 错误码。0为成功、其他为错误。
data M int 返回信息
示例
request
http://localhost:8570/station/price_rule/search?price_rule_id=&salemenu_id=&salemenu_name=&station_id=&status=3&cur_page=0&cnt_per_page=10
response
{
code: 0,
data: {
list: [{ #锁价规则列表
salemenu_id: "S0520",
begin: "2016-09-20T00:00:00",
modify_time: "2016-12-05T11:41:10.015",
address_num: 36,
salemenu_name: "深圳餐厅售卖单",
status: 3,
name: "开平锁价(12-05)",
creator: "huangbiyu",
create_time: "2016-09-19T19:48:10.473",
type: "station",
modifier: "linliduan",
end: "2016-12-30T00:00:00",
skus: [{
id: "D805207",
yx_price: 1.7,
name: "磨芋(魔芋)|斤"
}]
}],
pagination: { # 分页信息
count: 4,
offset: 0,
limit: 10
}
}
}
逻辑
获取请求参数
查询锁价规则
返回结果
/station/price_rule/create -- 创建锁价规则
接口名
/station/price_rule/create
Method
POST
请求
begin M date 开始日期
end M date 结束日期
salemenu_id M string 销售单ID
address_ids M list 商户ID列表
skus M list 商品信息 {'sku_id': 商品ID, 'yx_price': 限价}
name O string 规则名
type O string 锁价类型
响应
code M int 错误码。0为成功、其他为错误。
msg M string 提示信息
data M string 锁价规则ID
示例
request
http://localhost:8570/station/price_rule/create
response
{code: 0, data: "XSSJ20161228003207", msg: "ok"}
逻辑
获取请求参数
生成sku数据
验证商户数据
插入锁价规则
将在生效时间内的锁价规则加入redis
返回结果
/station/price_rule/edit GET -- 获取锁价规则
接口名
/station/price_rule/edit
Method
GET
请求
price_rule_id M string 锁价规则ID
station_id O string 站点ID
响应
code M int 错误码。0为成功、其他为错误。
msg M string 提示信息
data M string 锁价规则信息
示例
request
http://localhost:8570/station/price_rule/edit?price_rule_id=XSSJ20161229003210
response
{
code: 0,
data: {
skus: [{
sku_cost: 8,
std_unit_name: "斤",
id: "D805677",
rule_type: 0,
sale_price: 10.52,
sale_unit_name: "斤",
outer_id: "",
sale_ratio: 1,
yx_price: 1000,
name: "白菜干|斤"
}],
creator: "k10admin",
addresses: [{
id: "4078",
name: "产品技术测试9"
}, {
id: "3386",
name: "产品技术测试餐厅1"
}],
sku_num: 1,
end: "2017-01-01T00:00:00",
create_time: "2016-12-29T16:51:00.612",
district_code: "440300",
station_id: "T002",
type: "customer",
salemenu_name: "深圳餐厅售卖单",
_id: "XSSJ20161229003210",
status: 3,
salemenu_id: "S0520",
address_num: 2,
begin: "2016-12-29T00:00:00",
name: "测试"
}
msg: "ok"
}
/station/price_rule/edit POST -- 修改锁价规则
接口名
/station/price_rule/edit
Method
POST
请求
price_rule_id M string 锁价规则ID
begin M date 开始日期
end M date 结束日期
status M string 销售单ID
address_ids O list 商户ID列表
skus O list 商品信息 {'sku_id': 商品ID, 'yx_price': 限价}
name O string 规则名
响应
code M int 错误码。0为成功、其他为错误。
msg M string 提示信息
示例
request
http://localhost:8570/station/price_rule/edit
response
{code: 0, msg: "ok"}
逻辑
获取请求参数
生成sku数据
验证商户数据
更新锁价规则
将在生效时间内的锁价规则加入redis, 将关闭、失效的规则从redis中删除
返回结果
/station/price_rule/sku_search -- 按商户商品搜索锁价规则
接口名
/station/price_rule/sku_search
Method
GET
请求
rule_type_id O string 商户ID或站点ID
rule_type_name O string 商户名或者站点名
sku_id O string 商品ID
sku_name O string 商品名
outer_id O string 商品自定义编码
station_id O string 站点ID
status O int 状态
type O string 锁价类型 默认customer
cur_page O int 当前页 默认0
cnt_per_page O int 每页显示数 默认10
响应
code M int 错误码。0为成功、其他为错误。
data M int 返回信息
示例
request
http://localhost:8570/station/price_rule/sku_search?rule_type_id=&rule_type_name=&sku_id=&sku_name=萝卜干&outer_id=&station_id=&status=3&cur_page=0&cnt_per_page=10&type=customer
response
{
code: 0,
data: {
list: {
status: 3,
addresses: "4078",
object_name: "产品技术测试9",
station_name: "SZ-总仓-K10",
station_id: "T002",
sku_num: 2,
name: "测试",
end: "2017-01-01T00:00:00",
begin: "2016-12-29T00:00:00",
create_time: "2016-12-29T17:41:11.911",
type: "customer",
salemenu_name: "深圳餐厅售卖单",
_id: "XSSJ20161229003211",
creator: "k10admin",
modify_time: "2016-12-29T18:17:39.338",
address_num: 2,
skus: {
std_unit_name: "斤",
rule_type: 0,
outer_id: "",
id: "D805892",
sale_price: 3.29,
name: "萝卜干(菜脯)",
yx_price: 3,
sale_ratio: 1,
sale_unit_name: "斤"
},
salemenu_id: "S0520",
modifier: "k10admin",
district_code: "440300"
},
pagination: { # 分页信息
count: 4,
offset: 0,
limit: 10
}
}
}
逻辑
获取请求参数
查询锁价规则
返回结果
/station/price_rule/upload 上传站点/商户、商品
接口名: /station/price_rule/upload
Method: POST
请求:
'upload_type' M string 数据类型(customer、sku)
'salemenu_id' M string 销售单ID
'rule_type' O string 锁价类型(customer/station 默认customer)
'upload_file' M file 上传的Excel文件
响应:
code M int 0为成功,其它为失败
msg M string 错误提示信息
/station/price_rule/download 导出锁价的站点/商户、商品信息
接口名: /station/price_rule/download
Method: GET
请求:
'rule_id' M string 规则ID
'download_type' M string 数据类型(customer、sku)
响应:
code M int 0为成功,其它为失败
msg M string 错误提示信息
/station/price_rule/station/search 根据名称拉取绑定特定销售单的站点
接口名: /station/price_rule/station/search
Method: GET
请求:
'salemenu_id' O string 销售单ID
'search_text' O string 站点ID或名称
响应:
code M int 0为成功,其它为失败
msg M string 错误提示信息