@pisell/pisellos 2.2.251 → 2.2.253
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/Order/index.js +5 -0
- package/dist/modules/Rules/index.js +6 -4
- package/dist/server/modules/order/index.d.ts +4 -4
- package/dist/server/modules/order/index.js +4 -4
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/Order/index.js +5 -0
- package/lib/modules/Rules/index.js +6 -4
- package/lib/server/modules/order/index.d.ts +4 -4
- package/lib/server/modules/order/index.js +4 -4
- package/package.json +1 -1
|
@@ -1369,6 +1369,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1369
1369
|
if (normalizedStatus !== 'refunded' && normalizedStatus !== 'partially_refunded') {
|
|
1370
1370
|
return false;
|
|
1371
1371
|
}
|
|
1372
|
+
if (normalizedStatus === 'refunded' && params.paymentTotal.gt(0) && params.refundAmount.gte(params.paymentTotal)) {
|
|
1373
|
+
return true;
|
|
1374
|
+
}
|
|
1372
1375
|
if (params.previousSummary) {
|
|
1373
1376
|
var previousTargetAmount = this.calculatePaymentTargetAmount(params.tempOrder, params.previousSummary, params.netPaymentTotal);
|
|
1374
1377
|
if (!previousTargetAmount.eq(params.targetAmount)) return false;
|
|
@@ -5303,6 +5306,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5303
5306
|
_context42.next = 2;
|
|
5304
5307
|
return this.request.get("/order/sales/".concat(order_id), {
|
|
5305
5308
|
with: ['products', 'bookings']
|
|
5309
|
+
}, {
|
|
5310
|
+
osServer: true
|
|
5306
5311
|
});
|
|
5307
5312
|
case 2:
|
|
5308
5313
|
res = _context42.sent;
|
|
@@ -928,7 +928,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
928
928
|
title: discount.format_title,
|
|
929
929
|
original_amount: product.price || product.origin_total,
|
|
930
930
|
pre_value: discount.par_value,
|
|
931
|
-
product_id: originProduct.id,
|
|
931
|
+
product_id: originProduct.id || originProduct.product_id,
|
|
932
932
|
discount_product_id: discount.product_id
|
|
933
933
|
},
|
|
934
934
|
metadata: {
|
|
@@ -1394,7 +1394,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1394
1394
|
resource_id: _selectedDiscount.id,
|
|
1395
1395
|
title: _selectedDiscount.format_title,
|
|
1396
1396
|
original_amount: product.price,
|
|
1397
|
-
product_id: originProduct.id,
|
|
1397
|
+
product_id: originProduct.id || originProduct.product_id,
|
|
1398
1398
|
percent: _selectedDiscount.par_value,
|
|
1399
1399
|
discount_product_id: _selectedDiscount.product_id
|
|
1400
1400
|
},
|
|
@@ -1473,6 +1473,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1473
1473
|
// 计算折扣后的价格(使用 getDiscountAmount,内部已处理 maxDeductionAmount)
|
|
1474
1474
|
var discountedPrice = getDiscountAmount(_selectedDiscount2, product.origin_total, product.origin_total);
|
|
1475
1475
|
var bundleDiscountAmount = new Decimal(product.origin_total || 0).minus(discountedPrice).toNumber();
|
|
1476
|
+
debugger;
|
|
1476
1477
|
var _discountDetail = {
|
|
1477
1478
|
amount: bundleDiscountAmount,
|
|
1478
1479
|
type: 'good_pass',
|
|
@@ -1482,7 +1483,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1482
1483
|
resource_id: _selectedDiscount2.id,
|
|
1483
1484
|
title: _selectedDiscount2.format_title,
|
|
1484
1485
|
original_amount: product.origin_total,
|
|
1485
|
-
product_id: product.id,
|
|
1486
|
+
product_id: product.id || product.product_id,
|
|
1486
1487
|
discount_product_id: _selectedDiscount2.product_id
|
|
1487
1488
|
},
|
|
1488
1489
|
metadata: {
|
|
@@ -1555,6 +1556,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1555
1556
|
|
|
1556
1557
|
// 🔥 使用当前的 _id 作为唯一标识
|
|
1557
1558
|
var _uniqueId = flatItem._id;
|
|
1559
|
+
debugger;
|
|
1558
1560
|
var _discountDetail2 = {
|
|
1559
1561
|
amount: fixedAmountPerItem * (product.num || 1),
|
|
1560
1562
|
type: _selectedDiscount3.tag === 'product_discount_card' ? 'discount_card' : _selectedDiscount3.tag,
|
|
@@ -1565,7 +1567,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1565
1567
|
resource_id: _selectedDiscount3.id,
|
|
1566
1568
|
title: _selectedDiscount3.format_title,
|
|
1567
1569
|
original_amount: product.original_price,
|
|
1568
|
-
product_id: product.id,
|
|
1570
|
+
product_id: product.id || product.product_id,
|
|
1569
1571
|
percent: _selectedDiscount3.par_value,
|
|
1570
1572
|
discount_product_id: _selectedDiscount3.product_id
|
|
1571
1573
|
},
|
|
@@ -32,10 +32,10 @@ export declare class OrderModule extends BaseModule implements Module {
|
|
|
32
32
|
private emitOrdersChanged;
|
|
33
33
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
34
34
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
* 记录信息日志
|
|
36
|
+
* @param title 日志标题
|
|
37
|
+
* @param metadata 日志元数据
|
|
38
|
+
*/
|
|
39
39
|
private logInfo;
|
|
40
40
|
/**
|
|
41
41
|
* 记录错误日志
|
|
@@ -172,10 +172,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
172
172
|
return initialize;
|
|
173
173
|
}()
|
|
174
174
|
/**
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
175
|
+
* 记录信息日志
|
|
176
|
+
* @param title 日志标题
|
|
177
|
+
* @param metadata 日志元数据
|
|
178
|
+
*/
|
|
179
179
|
}, {
|
|
180
180
|
key: "logInfo",
|
|
181
181
|
value: function logInfo(title, metadata) {
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
-
var promotion_exports = {};
|
|
31
|
-
__export(promotion_exports, {
|
|
32
|
-
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
-
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
34
|
-
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
35
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
36
|
-
default: () => import_adapter2.default
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(promotion_exports);
|
|
39
|
-
var import_evaluator = require("./evaluator");
|
|
40
|
-
var import_adapter = require("./adapter");
|
|
41
|
-
var import_adapter2 = __toESM(require("./adapter"));
|
|
42
|
-
var import_examples = require("./examples");
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
BUY_X_GET_Y_FREE_STRATEGY,
|
|
46
|
-
PromotionAdapter,
|
|
47
|
-
PromotionEvaluator,
|
|
48
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
49
|
-
});
|
|
@@ -934,6 +934,9 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
934
934
|
if (normalizedStatus !== "refunded" && normalizedStatus !== "partially_refunded") {
|
|
935
935
|
return false;
|
|
936
936
|
}
|
|
937
|
+
if (normalizedStatus === "refunded" && params.paymentTotal.gt(0) && params.refundAmount.gte(params.paymentTotal)) {
|
|
938
|
+
return true;
|
|
939
|
+
}
|
|
937
940
|
if (params.previousSummary) {
|
|
938
941
|
const previousTargetAmount = this.calculatePaymentTargetAmount(
|
|
939
942
|
params.tempOrder,
|
|
@@ -3848,6 +3851,8 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3848
3851
|
async getOrderInfo(order_id) {
|
|
3849
3852
|
const res = await this.request.get(`/order/sales/${order_id}`, {
|
|
3850
3853
|
with: ["products", "bookings"]
|
|
3854
|
+
}, {
|
|
3855
|
+
osServer: true
|
|
3851
3856
|
});
|
|
3852
3857
|
return res;
|
|
3853
3858
|
}
|
|
@@ -630,7 +630,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
630
630
|
title: discount.format_title,
|
|
631
631
|
original_amount: product.price || product.origin_total,
|
|
632
632
|
pre_value: discount.par_value,
|
|
633
|
-
product_id: originProduct.id,
|
|
633
|
+
product_id: originProduct.id || originProduct.product_id,
|
|
634
634
|
discount_product_id: discount.product_id
|
|
635
635
|
},
|
|
636
636
|
metadata: {
|
|
@@ -1047,7 +1047,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1047
1047
|
resource_id: selectedDiscount2.id,
|
|
1048
1048
|
title: selectedDiscount2.format_title,
|
|
1049
1049
|
original_amount: product.price,
|
|
1050
|
-
product_id: originProduct.id,
|
|
1050
|
+
product_id: originProduct.id || originProduct.product_id,
|
|
1051
1051
|
percent: selectedDiscount2.par_value,
|
|
1052
1052
|
discount_product_id: selectedDiscount2.product_id
|
|
1053
1053
|
},
|
|
@@ -1120,6 +1120,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1120
1120
|
product.origin_total
|
|
1121
1121
|
);
|
|
1122
1122
|
const bundleDiscountAmount = new import_decimal.default(product.origin_total || 0).minus(discountedPrice).toNumber();
|
|
1123
|
+
debugger;
|
|
1123
1124
|
const discountDetail = {
|
|
1124
1125
|
amount: bundleDiscountAmount,
|
|
1125
1126
|
type: "good_pass",
|
|
@@ -1129,7 +1130,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1129
1130
|
resource_id: selectedDiscount2.id,
|
|
1130
1131
|
title: selectedDiscount2.format_title,
|
|
1131
1132
|
original_amount: product.origin_total,
|
|
1132
|
-
product_id: product.id,
|
|
1133
|
+
product_id: product.id || product.product_id,
|
|
1133
1134
|
discount_product_id: selectedDiscount2.product_id
|
|
1134
1135
|
},
|
|
1135
1136
|
metadata: {
|
|
@@ -1195,6 +1196,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1195
1196
|
fixedAmountPerItem = new import_decimal.default(productOriginTotal).minus(targetProductTotal).toNumber();
|
|
1196
1197
|
}
|
|
1197
1198
|
const uniqueId = flatItem._id;
|
|
1199
|
+
debugger;
|
|
1198
1200
|
const discountDetail = {
|
|
1199
1201
|
amount: fixedAmountPerItem * (product.num || 1),
|
|
1200
1202
|
type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag,
|
|
@@ -1205,7 +1207,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1205
1207
|
resource_id: selectedDiscount2.id,
|
|
1206
1208
|
title: selectedDiscount2.format_title,
|
|
1207
1209
|
original_amount: product.original_price,
|
|
1208
|
-
product_id: product.id,
|
|
1210
|
+
product_id: product.id || product.product_id,
|
|
1209
1211
|
percent: selectedDiscount2.par_value,
|
|
1210
1212
|
discount_product_id: selectedDiscount2.product_id
|
|
1211
1213
|
},
|
|
@@ -32,10 +32,10 @@ export declare class OrderModule extends BaseModule implements Module {
|
|
|
32
32
|
private emitOrdersChanged;
|
|
33
33
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
34
34
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
* 记录信息日志
|
|
36
|
+
* @param title 日志标题
|
|
37
|
+
* @param metadata 日志元数据
|
|
38
|
+
*/
|
|
39
39
|
private logInfo;
|
|
40
40
|
/**
|
|
41
41
|
* 记录错误日志
|
|
@@ -110,10 +110,10 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
* 记录信息日志
|
|
114
|
+
* @param title 日志标题
|
|
115
|
+
* @param metadata 日志元数据
|
|
116
|
+
*/
|
|
117
117
|
logInfo(title, metadata) {
|
|
118
118
|
try {
|
|
119
119
|
if (this.logger) {
|