Commit a88eda340b1a4a865f8f36d1452e5f8bc7571f5b

Authored by YunaiV
1 parent 3b506006

调整 price 接口,参考 taobao 的技术文档

yudao-module-mall/yudao-module-market-api/src/main/java/cn/iocoder/yudao/module/market/api/price/dto/PriceCalculateRespDTO.java
... ... @@ -9,6 +9,18 @@ import java.util.List;
9 9 /**
10 10 * 价格计算 Response DTO
11 11 *
  12 + * 整体设计,参考 taobao 的技术文档:
  13 + * 1. <a href="https://developer.alibaba.com/docs/doc.htm?treeId=1&articleId=1029&docType=1">订单管理</a>
  14 + * 2. <a href="https://open.taobao.com/docV3.htm?docId=108471&docType=1">常用订单金额说明</a>
  15 + *
  16 + * 举个例子:<a href="https://img.alicdn.com/top/i1/LB1mALAi4HI8KJjy1zbXXaxdpXa">订单图</a>
  17 + * 输入:
  18 + * 1. 订单实付: trade.payment = 198.00;订单邮费:5 元;
  19 + * 2. 商品级优惠 圣诞价: 省 29.00 元 和 圣诞价:省 150.00 元; 订单级优惠,圣诞 2:省 5.00 元;
  20 + * 分摊:
  21 + * 1. 商品 1:原价 108 元,优惠 29 元,子订单实付 79 元,分摊主订单优惠 1.99 元;
  22 + * 2. 商品 2:原价 269 元,优惠 150 元,子订单实付 119 元,分摊主订单优惠 3.01 元;
  23 + *
12 24 * @author 芋道源码
13 25 */
14 26 @Data
... ... @@ -36,33 +48,30 @@ public class PriceCalculateRespDTO {
36 48 * 商品原价(总),单位:分
37 49 *
38 50 * 基于 {@link OrderItem#getOriginalPrice()} 求和
  51 + * 对应 taobao 的 trade.total_fee 字段
39 52 */
40 53 private Integer originalPrice;
41 54 /**
42   - * 活动减免优惠(总),单位:分
  55 + * 商品优惠(总),单位:分
43 56 *
44   - * 基于 {@link OrderItem#getActivityPrice()} 求和
  57 + * 订单级优惠:对主订单的优惠,常见如:订单满 200 元减 10 元;订单满 80 包邮。
  58 + *
  59 + * 对应 taobao 的 order.discount_fee 字段
45 60 */
46   - private Integer activityPrice;
  61 + private Integer discountPrice;
47 62 /**
48 63 * 优惠劵减免金额(总),单位:分
49 64 *
50   - * 基于 {@link OrderItem#getCouponPrice()} 求和
  65 + * 对应 taobao 的 trade.coupon_fee 字段
51 66 */
52 67 private Integer couponPrice;
53 68 /**
54 69 * 积分减免金额(总),单位:分
55 70 *
56   - * 基于 {@link OrderItem#getPointPrice()} 求和
  71 + * 对应 taobao 的 trade.point_fee 字段
57 72 */
58 73 private Integer pointPrice;
59 74 /**
60   - * 会员减免金额(总),单位:分
61   - *
62   - * 基于 {@link OrderItem#getMemberPrice()} 求和
63   - */
64   - private Integer memberPrice;
65   - /**
66 75 * 运费金额,单位:分
67 76 */
68 77 private Integer deliveryPrice;
... ... @@ -70,6 +79,8 @@ public class PriceCalculateRespDTO {
70 79 * 最终购买金额(总),单位:分
71 80 *
72 81 * = {@link OrderItem#getPayPrice()} 求和
  82 + * - {@link #couponPrice}
  83 + * - {@link #pointPrice}
73 84 * + {@link #deliveryPrice}
74 85 */
75 86 private Integer payPrice;
... ... @@ -107,44 +118,40 @@ public class PriceCalculateRespDTO {
107 118 * 商品原价(单),单位:分
108 119 *
109 120 * 对应 ProductSkuDO 的 price 字段
  121 + * 对应 taobao 的 order.price 字段
110 122 */
111 123 private Integer originalUnitPrice;
112 124 /**
113   - * 活动减免优惠(总),单位:分
  125 + * 商品优惠(总),单位:分
114 126 *
115   - * 例如说,限时折扣、满减送等营销活动
116   - */
117   - private Integer activityPrice;
118   - /**
119   - * 优惠劵减免金额(总),单位:分
  127 + * 商品级优惠:对单个商品的,常见如:商品原价的 8 折;商品原价的减 50 元
120 128 *
121   - * 一个优惠劵会作用到的多个 SKU 商品,按照计算时的 {@link #payPrice} 的比例分摊
  129 + * 对应 taobao 的 order.discount_fee 字段
122 130 */
123   - private Integer couponPrice;
  131 + private Integer discountPrice;
124 132 /**
125   - * 积分减免金额(总),单位:分
126   - */
127   - private Integer pointPrice;
128   - /**
129   - * 会员减免金额(总),单位:分
130   - */
131   - private Integer memberPrice;
132   - /**
133   - * 最终购买金额(总),单位:分。
  133 + * 子订单实付金额,不算主订单分摊金额,单位:分
134 134 *
135 135 * = {@link #originalPrice}
136   - * - {@link #activityPrice}
137   - * - {@link #couponPrice}
138   - * - {@link #pointPrice}
139   - * - {@link #memberPrice}
  136 + * - {@link #discountPrice}
  137 + *
  138 + * 对应 taobao 的 order.payment 字段
140 139 */
141 140 private Integer payPrice;
  141 +
  142 + /**
  143 + * 子订单分摊金额(总),单位:分
  144 + * 需要分摊 {@link Order#discountPrice}、{@link Order#couponPrice}
  145 + *
  146 + * 对应 taobao 的 order.part_mjz_discount 字段
  147 + */
  148 + private Integer orderPartPrice;
142 149 /**
143   - * 最终购买金额(单),单位:分。
  150 + * 分摊后子订单实付金额(总),单位:分
144 151 *
145   - * = {@link #payPrice} / {@link #getCount()}
  152 + * 对应 taobao 的 divide_order_fee 字段
146 153 */
147   - private Integer payUnitPrice;
  154 + private Integer orderDividePrice;
148 155  
149 156 }
150 157  
... ... @@ -179,11 +186,11 @@ public class PriceCalculateRespDTO {
179 186 /**
180 187 * 计算时的原价(总),单位:分
181 188 */
182   - private Integer totalOriginalPrice;
  189 + private Integer beforePrice;
183 190 /**
184 191 * 计算时的优惠(总),单位:分
185 192 */
186   - private Integer totalPromotionPrice;
  193 + private Integer afterPrice;
187 194 /**
188 195 * 匹配的商品 SKU 数组
189 196 */
... ... @@ -218,11 +225,11 @@ public class PriceCalculateRespDTO {
218 225 /**
219 226 * 计算时的原价(总),单位:分
220 227 */
221   - private Integer totalOriginalPrice;
  228 + private Integer beforePrice;
222 229 /**
223 230 * 计算时的优惠(总),单位:分
224 231 */
225   - private Integer totalPromotionPrice;
  232 + private Integer afterPrice;
226 233  
227 234 }
228 235  
... ...