优惠券
数据库
Mysql
新增 tbl_coupon_info 优惠券信息
优惠券的定义信息
use management;
-- 优惠券
CREATE TABLE `tbl_coupon_info` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '优惠券活动id',
`name` varchar(30) NOT NULL COMMENT '券名',
`type` int(11) NOT NULL COMMENT '类型 1:满减券',
`price_value` decimal(15,4) NOT NULL COMMENT '单张面值',
`audience_type` int(11) COMMENT '发放用户 1:全部 2.新用户',
`collect_limit` int(11) COMMENT '单个kid限领',
`description` varchar(64) NOT NULL DEFAULT '' COMMENT '使用说明',
`is_active` tinyint(1) NOT NULL COMMENT '状态 0:无效 1:有效',
`validity_day` int(11) NOT NULL COMMENT '有效期天数',
`max_discount_percent` decimal(15,4) NOT NULL COMMENT '最大优惠比例',
`min_total_price` decimal(15,4) NOT NULL COMMENT '满减条件',
`register_after` datetime NOT NULL COMMENT '新用户判定时间(绑定时间在此之后为新用户)',
`station_id` varchar(16) NOT NULL COMMENT '所属station',
`cms_key` varchar(16) NOT NULL COMMENT '所属station cms_key',
`group_id` int(11) NOT NULL DEFAULT 0 COMMENT '所属group',
`give_out_num` int(11) NOT NULL DEFAULT 0 COMMENT '被领取数',
`used_num` int(11) NOT NULL COMMENT '被使用数',
`creator` varchar(30) NOT NULL DEFAULT '' COMMENT '创建者的username',
`create_time` datetime NOT NULL COMMENT '创建时间',
`delete_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '删除时间,未删除为 1-1-1 00:00:00',
`modify_time` datetime NOT NULL COMMENT '最后修改时间',
`pstatus` tinyint(1) NOT NULL DEFAULT '0' COMMENT '物理状态,0:正常--默认,1:已删除',
`extra1` int(11) NOT NULL DEFAULT '0',
`extra2` int(11) NOT NULL DEFAULT '0',
`extra3` int(11) NOT NULL DEFAULT '0',
`extra4` varchar(128) NOT NULL DEFAULT '',
`extra5` varchar(128) NOT NULL DEFAULT '',
`extra6` varchar(128) NOT NULL DEFAULT '',
`extra7` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra8` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra9` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra10` decimal(15,4) NOT NULL DEFAULT '0.0000',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10000;
新增 优惠券 tbl_coupon
实际领取的优惠券,商户领取一条,增加一条
use management;
CREATE TABLE `tbl_coupon` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '优惠券id',
`name` varchar(30) NOT NULL COMMENT '券名',
`type` int(11) NOT NULL COMMENT '类型 1:满减券',
`price_value` decimal(15,4) NOT NULL COMMENT '单张面值',
`description` varchar(64) NOT NULL DEFAULT '' COMMENT '使用说明',
`max_discount_percent` decimal(15,4) NOT NULL COMMENT '最大优惠比例',
`min_total_price` decimal(15,4) NOT NULL COMMENT '满减条件',
`coupon_info_id` int(11) NOT NULL COMMENT '优惠券id tbl_coupon_info.id',
`user_id` int(11) NOT NULL COMMENT 'kid 领取优惠券的商户id tbl_user.id',
`user_name` varchar(30) NOT NULL COMMENT '领取优惠券的商户名',
`address_id` int(11) NOT NULL COMMENT 'sid 领取优惠券商铺id tbl_addres.id',
`address_name` varchar(30) NOT NULL COMMENT '领取优惠券商铺名',
`order_id` varchar(32) NOT NULL DEFAULT '' COMMENT '使用该优惠券的订单号',
`status` int(11) NOT NULL COMMENT '状态 1:待使用 2:已使用',
`is_new_user` tinyint(1) NOT NULL COMMENT '是否是新人券',
`notify_return_order_id` varchar(32) NOT NULL DEFAULT '' COMMENT '提示退券订单id',
`notify_new_user` tinyint(1) NOT NULL COMMENT '是否提示新人券',
`expiring_time` datetime NOT NULL COMMENT '使用时限(配合status得出优惠券状态)',
`last_use_time` datetime NOT NULL COMMENT '使用时间',
`collect_time` datetime NOT NULL COMMENT '领取时间',
`create_time` datetime NOT NULL COMMENT '创建时间',
`delete_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '删除时间,未删除为 1-1-1 00:00:00',
`modify_time` datetime NOT NULL COMMENT '最后修改时间',
`pstatus` tinyint(1) NOT NULL DEFAULT '0' COMMENT '物理状态,0:正常--默认,1:已删除',
`station_id` varchar(16) NOT NULL COMMENT '所属station',
`group_id` int(11) NOT NULL COMMENT '所属group',
`cms_key` varchar(16) NOT NULL COMMENT '所属优惠券info cms_key',
`extra1` int(11) NOT NULL DEFAULT '0',
`extra2` int(11) NOT NULL DEFAULT '0',
`extra3` int(11) NOT NULL DEFAULT '0',
`extra4` varchar(128) NOT NULL DEFAULT '',
`extra5` varchar(128) NOT NULL DEFAULT '',
`extra6` varchar(128) NOT NULL DEFAULT '',
`extra7` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra8` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra9` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra10` decimal(15,4) NOT NULL DEFAULT '0.0000',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10000;
新增 tbl_coupon_use_log
优惠券使用记录
use management;
CREATE TABLE `tbl_coupon_use_log` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '优惠券使用记录',
`coupon_id` int(11) NOT NULL COMMENT '优惠券领取记录 tbl_coupon.id',
`order_id` varchar(32) NOT NULL DEFAULT '' COMMENT '使用该优惠券的订单号',
`use_time` datetime NOT NULL COMMENT '使用时间',
`return_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '退回时间',
`return_reason_code` int NOT NULL DEFAULT 0 COMMENT '退回原因码',
`create_time` datetime NOT NULL COMMENT '创建时间',
`delete_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '删除时间,未删除为 1-1-1 00:00:00',
`modify_time` datetime NOT NULL COMMENT '最后修改时间',
`pstatus` tinyint(1) NOT NULL DEFAULT '0' COMMENT '物理状态,0:正常--默认,1:已删除',
`station_id` varchar(16) NOT NULL COMMENT '所属station',
`group_id` int(11) NOT NULL COMMENT '所属group',
`extra1` int(11) NOT NULL DEFAULT '0',
`extra2` int(11) NOT NULL DEFAULT '0',
`extra3` int(11) NOT NULL DEFAULT '0',
`extra4` varchar(128) NOT NULL DEFAULT '',
`extra5` varchar(128) NOT NULL DEFAULT '',
`extra6` varchar(128) NOT NULL DEFAULT '',
`extra7` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra8` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra9` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra10` decimal(15,4) NOT NULL DEFAULT '0.0000',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1;
mongo
order_new
+ coupon_amount O f float 订单的优惠券金额(正数)
+ coupon_max_discount_percent O f float 最大优惠比
+ coupon_id O f float 优惠券id
新权限
use xnn_core_product_2;
INSERT INTO xnn_core_product_2.auth_permission
(name, name_en, content_type_id, codename, level2_id)
VALUES('查看优惠券', 'Get Coupon', 20, 'get_coupon', (select id from tbl_permission_class where name ='营销'));
INSERT INTO xnn_core_product_2.auth_permission
(name, name_en, content_type_id, codename, level2_id)
VALUES('编辑优惠券', 'Edit Coupon', 20, 'edit_coupon', (select id from tbl_permission_class where name ='营销'));
异步推送
INSERT INTO mq.subscription_new
(`trigger`, topic, endpoint, check_url, `method`, name, create_time, modify_time, status)
VALUES('edit_order', 'order', 'http://mq.station.cluster.gm/coupon/async_return_coupon', 'http://mq.station.cluster.gm/station/order/check_serial', 'POST', 'return_coupon', '2018-10-29 16:00:00.000', '2018-10-29 16:00:00.000', 2);
INSERT INTO mq.subscription_new
(`trigger`, topic, endpoint, check_url, `method`, name, create_time, modify_time, status)
VALUES('delete_order', 'order', 'http://mq.station.cluster.gm/coupon/async_return_coupon', 'http://mq.station.cluster.gm/station/order/check_serial', 'POST', 'return_coupon', '2018-10-29 16:00:00.000', '2018-10-29 16:00:00.000', 2);
INSERT INTO mq.subscription_new
(`trigger`, topic, endpoint, check_url, `method`, name, create_time, modify_time, status)
VALUES('return_coupon', 'order', 'http://mq.station.cluster.gm/coupon/async_return_coupon', 'http://mq.station.cluster.gm/station/order/check_serial', 'POST', 'return_coupon', '2018-10-29 16:00:00.000', '2018-10-29 16:00:00.000', 2);
station
[新增] 优惠券搜索 GET /coupon/list
request:
is_active O int 状态 0:无效 1:有效 全部:不传
q O str 关键字
sort_type O int 排序字段 1:使用数 2:领取数 不传不排序
reverse O int 排序倒序 0:否 1:是 不传默认为否
page_obj O string 起始页(不包含),默认第0页
reverse O bool 是否反向查询。1:是,0:不是。默认为否。
limit O int 返回条数,默认10。传0表示返回所有数据。
offset O int 查询起点偏移条数,默认 0 [注1]
peek O int 是否需要 peek,默认不需要 peek。peek 必须大于 limit。
count O bool 是否需要 count,默认不需要 count。(部分接口可能不实现本功能, 因为如果数据量极大,count 会很耗时)
response:
{
"code": 0,
"msg": "ok",
"data": [
{
id M int, 优惠券id
name M str, 优惠券名称
price_value M float 面值(元)
audience_type M int 可见范围 1:全部 2.新用户
collect_limit M int 限领(张)
validity_day M int 有效时间(天)
min_total_price M float 使用最低额度
give_out_num M int 领取数
used_num M int 使用数
create_time M datetime 创建时间
creator M str 创建人
is_active M int 状态 0:无效 1:有效
type M int 类型 1:满减券
}
],
"pagination": { M dict
"peek": 100, O int 前端传 peek 的话,后端就会返回这个字段
"more": true, M bool 是否有更多数据
"page_obj": "gtyuhbgyhbvgyhgvgy", M string
"count": 2000 O int 前端传 count 的话,后端就会返回这个字段
}
}
[新增] 优惠券详情 GET /coupon/get
request:
id M int 优惠券id
response:
{
"code": 0,
"msg": "ok",
"data":{
id M int, 优惠券id
name M str, 优惠券名称
type M int 类型 1满减券
price_value M float 面值(元)
audience_type M int 可见范围 1:全部 2.新用户
collect_limit M int 限领(张)
validity_day M int 有效时间(天)
description M str 使用说明
min_total_price M float 满减条件
is_active M int 状态 0:无效 1:有效
max_discount_percent M float 最大优惠比例(用户创建时输入多少就返回多少)
register_after M date 新用户加入时间
}
}
[新增] 优惠券创建 POST /coupon/create
request:
{
name M str, 优惠券名称
type M int 类型 1满减券
price_value M float 面值(元)
audience_type M int 可见范围 1:全部 2.新用户
collect_limit M int 限领(张)
validity_day M int 有效时间(天)
min_total_price M float 满减条件
is_active M int 状态 0:无效 1:有效
max_discount_percent M float 最大优惠比例
register_after O date 新用户时间(新用户券必填)
description O str 使用说明
}
response:
{
"code": 0,
"msg": "ok",
"data":{
'id' M int 采购券id
}
[新增] 优惠券修改 POST /coupon/edit
request:
{
id M int 优惠券id
is_active O int 状态 0:无效 1:有效
}
response:
{
"code": 0,
"msg": "ok",
"data":''
[新增] 优惠券使用概览搜索 GET /coupon/usage/list
request:
collect_begin_time M datetime 领取日期(起)
collect_end_time M datetime 领取日期(终)
q O str 搜索关键字
status O int 状态 1:待使用,2:已使用,3:已过期 不传不过滤
page_obj O string 起始页(不包含),默认第0页
reverse O bool 是否反向查询。1:是,0:不是。默认为否。
limit O int 返回条数,默认10。传0表示返回所有数据。
offset O int 查询起点偏移条数,默认 0 [注1]
peek O int 是否需要 peek,默认不需要 peek。peek 必须大于 limit。
count O bool 是否需要 count,默认不需要 count。(部分接口可能不实现本功能, 因为如果数据量极大,count 会很耗时)
response:
{
"code": 0,
"msg": "ok",
"data":[
{
collect_time M datetime 领取日期
name M str 券名
price_value M float 面值
min_total_price M float 满减条件
user_name M str 领券用户公司名
user_id M int 领券用户kid
status M int 状态 1:待使用 2:已使用 3:已过期
last_use_time M datetime 使用时间
order_id M str 订单号
address_name M str 用券商铺名
address_id M str 用券商铺id
}
],
"pagination": { M dict
"peek": 100, O int 前端传 peek 的话,后端就会返回这个字段
"more": true, M bool 是否有更多数据
"page_obj": "gtyuhbgyhbvgyhgvgy", M string
"count": 2000 O int 前端传 count 的话,后端就会返回这个字段
}
}
[新增] 优惠券使用概览导出 GET /coupon/usage/export
request:
{
collect_begin_time M datetime 领取日期(起)
collect_end_time M datetime 领取日期(终)
q O str 搜索关键字
status O int 状态 1:待使用 2:已使用 3:已过期 ,全部状态不传
}
response[返回文件]
[修改] 订单搜索 GET /station/orders
添加"优惠金额" 展示字段
request [不变]:
response:
in_query: false
list: [
{
...
[新增] coupon_amount M float 优惠金额
...
},…
]
pagination: {offset: 0, count: 8, limit: 20}
[修改] 订单导出 GET /station/sales_analysis/orderdetail
添加"优惠金额" 展示字段
request [不变]:
response[导出文件变化]
[修改] 订单详情 GET /station/order/edit
添加"优惠金额" 展示字段
该接口也是 异常 界面的数据源
request [不变]:
response:
{
code: 0
data: {
[新增] coupon_amount M float 优惠金额
[新增] min_total_price M float 满减条件
freeze: 0,
expire_time: "2018-11-27T16:27:51.807",
client: 1,
date_time: "2018-11-27T16:22:51.807",
…
}
msg: "ok"
}
[新增] 判断是否需要退券 POST /coupon/check_return
在请求
/station/order/edit 修改订单
/station/order/edit_old 追加修改
/station/order/exception station售后
之前
如果待修改订单使用了优惠券,
调用本接口判断本次订单修改是否需要退券
如果需要退券,由前端弹窗提示用户二次确认操作
用户确认退券时,再去请求原上述接口
请求字段中
details 同 POST /station/order/edit 和 /station/order/edit_old 的 details 是一样的
exception 同 POST /station/order/exception (station售后) exception 是一样的
refund 同 POST /station/order/exception(station售后) 的 refund 是一样的
request
order_id M str
detials O list []
exception O [
{
"final_amount":2,
"sku_id":"D4221541",
"exception_reason":1,
"exception_info":1,
"solution":2
}
...
]
refund O [
{
"request_amount":0,
"sku_id":"D6004848",
"station_store_id":"T7936",
"exception_reason":1,
"exception_info":1
}
]
response:
code: 0
data: {
max_discount_percent O float 最大优惠比,没返回就不退群
}
msg: "ok"
[修改] 分拣称重 GET /station/weigh/set_weight
称重时,如果商品所属订单使用了优惠券,
且金额变动不符合优惠券设置的预期值,则退回优惠券
选择最初的方案,即
每次称重都计算订单总销售额,
若超出用户设定优惠券预警,
则退回优惠券
request[不变]
response[不变]
[修改] 打印配送单数据接口 GET /station/distribute/get_order_by_id
request[不变]
response
[
{
[新增] coupon_amount M float 优惠金额
...
},
...
]
司机app接口
[修改] 全部任务接口 GET /driver/delivery/list
request [不变]:
response:
{
"code": 0,
"msg": "ok",
"data": [
{
[新增] coupon_amount M float 优惠金额
...
},
...
]
}
[修改] 任务详情接口 GET /driver/delivery/detail
request [不变]:
response:
{
"code": 0,
"msg": "ok",
"data": {
[新增] coupon_amount M float 优惠金额
...
}
}
[新增] 判断是否需要退券 POST /driver/delivery/order/check_return
在请求
/driver/delivery/order/exception/update 司机app售后
之前
如果待修改订单使用了优惠券,
调用本接口判断本次订单修改是否需要退券
如果需要退券,由前端弹窗提示用户二次确认操作
用户确认退券时,再去请求原上述接口
请求字段中
exception 同 POST /driver/delivery/order/exception/update (司机app售后)的 exception 是一样的
refund 同 POST /driver/delivery/order/exception/update (司机app售后) 的 refund 是一样的
request
order_no M str
exception O [
{
"final_amount":2,
"sku_id":"D4221541",
"exception_reason":1,
"exception_info":1,
"solution":2
}
...
]
refund O [
{
"request_amount":0,
"sku_id":"D6004848",
"station_store_id":"T7936",
"exception_reason":1,
"exception_info":1
}
]
response:
code: 0
data: {
max_discount_percent O float 最大优惠比,没返回就不退群
}
msg: "ok"
bshop
[新增] 优惠券搜索 GET /coupon/visible_coupon
bshop首页请求这个接口,如果返回数据则是有相关的优惠券可领取,
没有优惠券则为空
request[无]:
response:
{
"code": 0,
"msg": "ok",
"data": [
{
id M int, 优惠券id
name M str, 优惠券名称
price_value M float 面值(元)
collect_limit M int 优惠活动中优惠券发放数量(张)
pending_collecte_num M int 优惠券待领取的数量(张)
min_total_price M float 满减条件
audience_type M int 优惠券类型。1:全部券 2.新用户
notify_status M int 是否需要通知。0 无需通知 1 需通知退回 2 需通知新人券'
}
]
}
[新增] 优惠券详情 GET /coupon/get
推广链接请求这个接口获取对应的优惠券信息
request:
id M int 优惠券id
cms_key M str
response:
{
"code": 0,
"msg": "ok",
"data": [
{
id M int 优惠券id
name M str 优惠券名称
price_value M float 面值(元)
collect_limit M int 限领(张)
collect_num M int 已领 (张)
min_total_price M float 满减条件
}
]
}
[新增] 查看已领取的优惠券 GET /coupon/avail_coupon/list
request:
status O int 状态 1:待使用 2:已使用 3:已过期
response:
成功:
{
"code": 0,
"msg": "ok",
"data": [
{
id M int, 优惠券id
name M str, 优惠券名称
price_value M float 面值(元)
min_total_price M float 满减条件
expiring_time M datetime 到期时间
description M str 使用说明
days_remaining M int 剩余天数
status M int 状态 1:待使用 2:已使用 3:已过期
}
]
}
[新增] 领取优惠券 POST /coupon/collect
request:
id M int 优惠券id
response:
{
"code": 0,
"msg": "ok",
"data": ''
}
[修改] 订单列表 GET /order/list
对使用了优惠券的订单返回优惠券额
request[不变]:
response:
{
code: 0
data: [
{
[新增]coupon_amount O float 如果订单已支付且使用了优惠券,则返回优惠减额
[新增]coupon_id O float 如果订单已支付且使用了优惠券,返回对应的优惠券id
[新增]sation_id M str 站点信息
...
}
]
msg: "ok"
pagination: {count: 2, limit: 5, offset: 0}
[修改] 订单详情 GET /order/detail
对使用了优惠券的订单返回优惠券额
request[不变]:
response:
{
code: 0
data: {
[新增]coupon_amount M float 优惠券金额
[新增]coupon_id M int 优惠券金额
[新增]is_return_coupon M bool 优惠券是否退券
[新增]coupon O dict {
id M int 优惠券id
name M str 优惠券名称
price_value M float 面额
min_total_price M float 满减条件
days_remaining M int 剩余天数
},
[新增]station_id M str 站点信息
…
}
msg: "ok"
}
[修改] 确认下单 POST /order/submit
如果商户是先款后货,可以在下单时选择优惠券并提交
request:
orders: [
{
[新增]coupon_id O int 先款后货时,可以选择优惠券
},
...
]
response[不变]
[修改] 支付接口 POST /pay/order
通用支付接口 单订单,多订单,差额订单,都是这个接口
仅 "从未支付" 的订单可以使用优惠券
request:
[新增]coupon_use O list [
{
'order_id' M str
'coupon_id' M int
},
...
]
order_ids: ["PL3817924"]
pay_method: 1
response[不变]
[新增] 通知确认接口 POST /coupon/notify_confirm
点击通知的去使用或者关闭键时调用,
传优惠券id
request:
new_user O list 如果是新人通知,就传这个
return_coupon O list 如果是退券通知,就传这个
response
{
"code": 0,
"msg": "ok",
"data": ''
}
manage
[修改]商户报表按 站点|人员 统计 搜索|导出 GET /custommanage/report/search
搜索和导出是同一个接口,
搜索返回数据没有变动,
导出文件由后端生成
request[不变]:
response[导出文件变化]:
[修改] 商户报表 详情|导出 GET /custommanage/report/detail
总计 新商户为同一接口
搜索返回结果有新增字段,
导出为同一接口,文件由后端生成
request[不变]:
response:
{
"data": {
"saleEmployeeInfo": {
[新增]"coupon_amount" M float 优惠总金额,
...
},
"customerInfo": {
"113235": {
[新增]"coupon_amount" M float 优惠金额
...
},
...
},
"noOrderCustomerInfo": [
{
[新增]"coupon_amount" M float 优惠金额
...
},
...
],
...
},
"msg": "ok",
"code": 0
}
[修改] 异常详情 GET /ordermanage/get
这个接口实际上获取的是订单详情
加新字段
request[不变]:
response:
{
"data": {
[新增]"coupon_amount" M float 优惠金额
...
},
"msg": "ok",
"code": 0
}
[修改] 商户结算搜索 GET /finance/order/search
若返回的coupon_id为0,则说明该订单已退券,但仍展示优惠金额
request[不变]:
response:
{
"data": {
"orders": [
{
[新增]"coupon_amount" M float 优惠金额
[新增]"coupon_id" M 优惠券id
...
},
...
"msg": "ok",
"code": 0
}
[修改] 商户结算导出 GET /finance/order/export
request[不变]:
response[导出文件变化]
[修改] 到账凭证>结算列表 GET /finance/order/can_strike_balance
request[不变]:
response:
{
"data": {
orders:[
{
[新增]"coupon_amount" M float 优惠金额
...
},
...
]
...
},
"msg": "ok",
"code": 0
}
[修改] 商户对账单 搜索|导出 GET /custommanage/bill/search
request[不变]:
response[导出文件变化]
[修改] 商户对账单打印明细 GET /custommanage/bill/detail
打印接口,后端只提供数据
request[不变]:
response:
{
"data": {
[新增]"coupon_amount" M float 优惠金额
...
},
"msg": "ok",
"code": 0
}
[修改] 运营数据-订单分析 搜索+导出 GET /report/customer_order
导出文件由前端拼凑,数据来源同搜索
request[不变]:
response:
{
"data": [{
[新增]"coupon_amount" M float 优惠金额
...
},
...
]
"msg": "ok",
"code": 0
}
[修改] 运营数据-订单异常 搜索+导出 GET /report/customer_order_abnormal
导出文件由前端拼凑,数据来源同搜索
request[不变]:
response:
{
"data": [
{
[新增]"coupon_amount" M float 优惠金额
...
}
...
],
"msg": "ok",
"code": 0
}
[新增] 判断是否需要退券 POST /ordermanage/coupon/check_return
在请求
POST /ordermanage/exception ma售后
之前
如果待修改订单使用了优惠券,
调用本接口判断本次订单修改是否需要退券
如果需要退券,由前端弹窗提示用户二次确认操作
用户确认退券时,再去请求原上述接口
请求字段中
exception 同 POST /ordermanage/exception的 exception 是一样的
refund 同 POST /ordermanage/exception 的 refund 是一样的
request
order_id M str
details O [
{
"sku_id":"D4221541",
"amount":"2",
"unit_price":"13.02",
"spu_id":"C1376686",
"is_price_timing":0},
...
] 传了该字段则认为是修改订单
exception O [
{
"final_amount":2,
"sku_id":"D4221541",
"exception_reason":1,
"exception_info":1,
"solution":2
}
...
] 传了该字字段认为是设置售后异常
refund O [
{
"request_amount":0,
"sku_id":"D6004848",
"station_store_id":"T7936",
"exception_reason":1,
"exception_info":1
}
] 传了该字字段认为是设置售后退货
response:
code: 0
data: {
max_discount_percent O float 最大优惠比,没返回就不退群
}
msg: "ok"
[修改] 售后 POST /ordermanage/exception
判断金额并执行退券操作
如果请求没有 return_coupon 且金额变动导致退券,
则返回max_discount_percent,用户确认 "继续保存时" 请求带上 return_coupon
无max_discount_percent返回则认为优惠在预算内
request
[新增] return_coupon O int 是否退回优惠券 1:确定
response:
code: 0
data: {
[新增]max_discount_percent O float 最大优惠比例
}
msg: "ok"