@pisell/pisellos 2.2.186 → 2.2.187
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 +7 -3
- package/dist/solution/BaseSales/index.d.ts +1 -0
- package/dist/solution/BaseSales/index.js +24 -10
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/Order/index.js +7 -3
- package/lib/solution/BaseSales/index.d.ts +1 -0
- package/lib/solution/BaseSales/index.js +15 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1156,12 +1156,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1156
1156
|
key: "updateTempOrderPaymentStatus",
|
|
1157
1157
|
value: function updateTempOrderPaymentStatus(tempOrder) {
|
|
1158
1158
|
var paymentTotal = this.calculatePaymentTotal(tempOrder.payments || []);
|
|
1159
|
+
var targetAmount = this.getPaymentTargetAmount();
|
|
1160
|
+
if (targetAmount.lte(0)) {
|
|
1161
|
+
tempOrder.payment_status = 'paid';
|
|
1162
|
+
return;
|
|
1163
|
+
}
|
|
1159
1164
|
if (paymentTotal.lte(0)) {
|
|
1160
1165
|
tempOrder.payment_status = tempOrder.payment_status || 'payment_processing';
|
|
1161
1166
|
return;
|
|
1162
1167
|
}
|
|
1163
|
-
|
|
1164
|
-
tempOrder.payment_status = targetAmount.gt(0) && paymentTotal.gte(targetAmount) ? 'paid' : 'partially_paid';
|
|
1168
|
+
tempOrder.payment_status = paymentTotal.gte(targetAmount) ? 'paid' : 'partially_paid';
|
|
1165
1169
|
}
|
|
1166
1170
|
}, {
|
|
1167
1171
|
key: "calculatePaidPaymentSummary",
|
|
@@ -2715,7 +2719,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2715
2719
|
mappedPayments = mapPaymentItemsToOrderPayments(params.payments || []);
|
|
2716
2720
|
paymentTotal = this.calculatePaymentTotal(mappedPayments);
|
|
2717
2721
|
targetAmount = this.getPaymentTargetAmount();
|
|
2718
|
-
isFullyPaid = targetAmount.lte(0) ?
|
|
2722
|
+
isFullyPaid = targetAmount.lte(0) ? true : paymentTotal.gte(targetAmount);
|
|
2719
2723
|
paymentStatus = isFullyPaid ? params.paymentStatus || 'paid' : 'partially_paid';
|
|
2720
2724
|
tempOrder.payments = mappedPayments;
|
|
2721
2725
|
tempOrder.payment_status = paymentStatus;
|
|
@@ -180,6 +180,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
180
180
|
smallTicketDataFlag?: number;
|
|
181
181
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
182
182
|
}): Promise<T>;
|
|
183
|
+
private getSubmitPaymentStatus;
|
|
183
184
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
184
185
|
/** 读取当前 BaseSales 订单上下文中的 Sales 协议支付项。 */
|
|
185
186
|
getOrderPayments(): OrderPaymentData[];
|
|
@@ -1790,7 +1790,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1790
1790
|
value: (function () {
|
|
1791
1791
|
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
|
|
1792
1792
|
var _this$otherParams6, _this$otherParams7, _this$otherParams8;
|
|
1793
|
-
var submitParams;
|
|
1793
|
+
var inferredPaymentStatus, submitParams;
|
|
1794
1794
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1795
1795
|
while (1) switch (_context18.prev = _context18.next) {
|
|
1796
1796
|
case 0:
|
|
@@ -1801,6 +1801,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1801
1801
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
1802
1802
|
case 2:
|
|
1803
1803
|
this.store.order.persistTempOrder();
|
|
1804
|
+
inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
1804
1805
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
1805
1806
|
cacheId: this.cacheId,
|
|
1806
1807
|
platform: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.platform,
|
|
@@ -1809,8 +1810,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1809
1810
|
type: (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.type
|
|
1810
1811
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
1811
1812
|
payments: params.payments
|
|
1812
|
-
} : {}),
|
|
1813
|
-
paymentStatus:
|
|
1813
|
+
} : {}), inferredPaymentStatus !== undefined ? {
|
|
1814
|
+
paymentStatus: inferredPaymentStatus
|
|
1814
1815
|
} : {}), (params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== undefined ? {
|
|
1815
1816
|
smallTicketDataFlag: params.smallTicketDataFlag
|
|
1816
1817
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
@@ -1818,7 +1819,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1818
1819
|
} : {});
|
|
1819
1820
|
console.log(submitParams, 'submitParams123');
|
|
1820
1821
|
return _context18.abrupt("return", this.store.order.submitTempOrder(submitParams));
|
|
1821
|
-
case
|
|
1822
|
+
case 7:
|
|
1822
1823
|
case "end":
|
|
1823
1824
|
return _context18.stop();
|
|
1824
1825
|
}
|
|
@@ -1829,6 +1830,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1829
1830
|
}
|
|
1830
1831
|
return submitSalesOrder;
|
|
1831
1832
|
}())
|
|
1833
|
+
}, {
|
|
1834
|
+
key: "getSubmitPaymentStatus",
|
|
1835
|
+
value: function getSubmitPaymentStatus(paymentStatus) {
|
|
1836
|
+
var _this$store$order3, _this$store$order3$ge;
|
|
1837
|
+
if (paymentStatus !== undefined) return paymentStatus;
|
|
1838
|
+
var amountSnapshot = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getOrderAmountSnapshot) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3);
|
|
1839
|
+
if (!amountSnapshot) return undefined;
|
|
1840
|
+
try {
|
|
1841
|
+
return new Decimal(amountSnapshot.amountGap || 0).lte(0) ? 'paid' : undefined;
|
|
1842
|
+
} catch (_unused2) {
|
|
1843
|
+
return undefined;
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1832
1846
|
}, {
|
|
1833
1847
|
key: "syncPaymentsToOrder",
|
|
1834
1848
|
value: function () {
|
|
@@ -1978,8 +1992,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1978
1992
|
}, {
|
|
1979
1993
|
key: "getWalletProductList",
|
|
1980
1994
|
value: function getWalletProductList() {
|
|
1981
|
-
var _this$store$
|
|
1982
|
-
var tempOrder = (_this$store$
|
|
1995
|
+
var _this$store$order4, _tempOrder$products, _tempOrder$products2;
|
|
1996
|
+
var tempOrder = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder();
|
|
1983
1997
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return [];
|
|
1984
1998
|
// 过滤出有 product_id的商品来,如果没有代表他是自定义商品,不需要参与 wallet
|
|
1985
1999
|
var products = tempOrder === null || tempOrder === void 0 || (_tempOrder$products2 = tempOrder.products) === null || _tempOrder$products2 === void 0 ? void 0 : _tempOrder$products2.filter(function (n) {
|
|
@@ -2555,16 +2569,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2555
2569
|
}, {
|
|
2556
2570
|
key: "getUnfulfilledPromotions",
|
|
2557
2571
|
value: function getUnfulfilledPromotions() {
|
|
2558
|
-
var _this$store$
|
|
2559
|
-
return ((_this$store$
|
|
2572
|
+
var _this$store$order5;
|
|
2573
|
+
return ((_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getUnfulfilledPromotions()) || [];
|
|
2560
2574
|
}
|
|
2561
2575
|
|
|
2562
2576
|
/** 最近一次促销计算输出的赠品操作 diff。 */
|
|
2563
2577
|
}, {
|
|
2564
2578
|
key: "getLastGiftActions",
|
|
2565
2579
|
value: function getLastGiftActions() {
|
|
2566
|
-
var _this$store$
|
|
2567
|
-
return ((_this$store$
|
|
2580
|
+
var _this$store$order6;
|
|
2581
|
+
return ((_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getLastGiftActions()) || null;
|
|
2568
2582
|
}
|
|
2569
2583
|
|
|
2570
2584
|
// 获取商品列表
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 | 1 | 2 | 3 | 4 | 5
|
|
314
|
+
weekNum: 0 | 1 | 2 | 6 | 3 | 4 | 5;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -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
|
-
});
|
|
@@ -719,12 +719,16 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
719
719
|
}
|
|
720
720
|
updateTempOrderPaymentStatus(tempOrder) {
|
|
721
721
|
const paymentTotal = this.calculatePaymentTotal(tempOrder.payments || []);
|
|
722
|
+
const targetAmount = this.getPaymentTargetAmount();
|
|
723
|
+
if (targetAmount.lte(0)) {
|
|
724
|
+
tempOrder.payment_status = "paid";
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
722
727
|
if (paymentTotal.lte(0)) {
|
|
723
728
|
tempOrder.payment_status = tempOrder.payment_status || "payment_processing";
|
|
724
729
|
return;
|
|
725
730
|
}
|
|
726
|
-
|
|
727
|
-
tempOrder.payment_status = targetAmount.gt(0) && paymentTotal.gte(targetAmount) ? "paid" : "partially_paid";
|
|
731
|
+
tempOrder.payment_status = paymentTotal.gte(targetAmount) ? "paid" : "partially_paid";
|
|
728
732
|
}
|
|
729
733
|
calculatePaidPaymentSummary(payments) {
|
|
730
734
|
return (payments || []).reduce(
|
|
@@ -1945,7 +1949,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
1945
1949
|
);
|
|
1946
1950
|
const paymentTotal = this.calculatePaymentTotal(mappedPayments);
|
|
1947
1951
|
const targetAmount = this.getPaymentTargetAmount();
|
|
1948
|
-
const isFullyPaid = targetAmount.lte(0) ?
|
|
1952
|
+
const isFullyPaid = targetAmount.lte(0) ? true : paymentTotal.gte(targetAmount);
|
|
1949
1953
|
const paymentStatus = isFullyPaid ? params.paymentStatus || "paid" : "partially_paid";
|
|
1950
1954
|
tempOrder.payments = mappedPayments;
|
|
1951
1955
|
tempOrder.payment_status = paymentStatus;
|
|
@@ -180,6 +180,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
180
180
|
smallTicketDataFlag?: number;
|
|
181
181
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
182
182
|
}): Promise<T>;
|
|
183
|
+
private getSubmitPaymentStatus;
|
|
183
184
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
184
185
|
/** 读取当前 BaseSales 订单上下文中的 Sales 协议支付项。 */
|
|
185
186
|
getOrderPayments(): OrderPaymentData[];
|
|
@@ -1073,6 +1073,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1073
1073
|
throw new Error("BaseSales 解决方案需要 order 模块支持");
|
|
1074
1074
|
}
|
|
1075
1075
|
this.store.order.persistTempOrder();
|
|
1076
|
+
const inferredPaymentStatus = this.getSubmitPaymentStatus(params == null ? void 0 : params.paymentStatus);
|
|
1076
1077
|
const submitParams = {
|
|
1077
1078
|
cacheId: this.cacheId,
|
|
1078
1079
|
platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
|
|
@@ -1080,13 +1081,26 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1080
1081
|
channel: this.getSubmitOrderSalesChannel(),
|
|
1081
1082
|
type: (_c = this.otherParams) == null ? void 0 : _c.type,
|
|
1082
1083
|
...(params == null ? void 0 : params.payments) !== void 0 ? { payments: params.payments } : {},
|
|
1083
|
-
...
|
|
1084
|
+
...inferredPaymentStatus !== void 0 ? { paymentStatus: inferredPaymentStatus } : {},
|
|
1084
1085
|
...(params == null ? void 0 : params.smallTicketDataFlag) !== void 0 ? { smallTicketDataFlag: params.smallTicketDataFlag } : {},
|
|
1085
1086
|
...(params == null ? void 0 : params.enhancePayload) !== void 0 ? { enhancePayload: params.enhancePayload } : {}
|
|
1086
1087
|
};
|
|
1087
1088
|
console.log(submitParams, "submitParams123");
|
|
1088
1089
|
return this.store.order.submitTempOrder(submitParams);
|
|
1089
1090
|
}
|
|
1091
|
+
getSubmitPaymentStatus(paymentStatus) {
|
|
1092
|
+
var _a, _b;
|
|
1093
|
+
if (paymentStatus !== void 0)
|
|
1094
|
+
return paymentStatus;
|
|
1095
|
+
const amountSnapshot = (_b = (_a = this.store.order) == null ? void 0 : _a.getOrderAmountSnapshot) == null ? void 0 : _b.call(_a);
|
|
1096
|
+
if (!amountSnapshot)
|
|
1097
|
+
return void 0;
|
|
1098
|
+
try {
|
|
1099
|
+
return new import_decimal.default(amountSnapshot.amountGap || 0).lte(0) ? "paid" : void 0;
|
|
1100
|
+
} catch {
|
|
1101
|
+
return void 0;
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1090
1104
|
async syncPaymentsToOrder(params) {
|
|
1091
1105
|
if (!this.store.order)
|
|
1092
1106
|
throw new Error("order 模块未初始化");
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 | 1 | 2 | 3 | 4 | 5
|
|
314
|
+
weekNum: 0 | 1 | 2 | 6 | 3 | 4 | 5;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|