@pisell/pisellos 2.2.177 → 2.2.178
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.d.ts +1 -0
- package/dist/modules/Order/index.js +73 -23
- package/dist/modules/SalesSummary/utils.js +3 -2
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/Order/index.d.ts +1 -0
- package/lib/modules/Order/index.js +44 -3
- package/lib/modules/SalesSummary/utils.js +3 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -129,6 +129,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
129
129
|
private calculatePaymentServiceFee;
|
|
130
130
|
private formatSummaryMetadataMoney;
|
|
131
131
|
private syncSummaryProductMetadata;
|
|
132
|
+
private calculateSummaryPaymentBalance;
|
|
132
133
|
private getPaymentTargetAmount;
|
|
133
134
|
ensureTempOrder(): OrderTempOrder;
|
|
134
135
|
restoreOrder(): OrderTempOrder;
|
|
@@ -1173,6 +1173,31 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1173
1173
|
hasMetadataPatch = true;
|
|
1174
1174
|
}
|
|
1175
1175
|
if (hasMetadataPatch) productRecord.metadata = metadata;
|
|
1176
|
+
if (!Array.isArray(productRecord.product_bundle)) continue;
|
|
1177
|
+
var _iterator7 = _createForOfIteratorHelper(productRecord.product_bundle),
|
|
1178
|
+
_step7;
|
|
1179
|
+
try {
|
|
1180
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
1181
|
+
var bundle = _step7.value;
|
|
1182
|
+
var bundleRecord = bundle;
|
|
1183
|
+
var bundleMetadata = bundleRecord.metadata && _typeof(bundleRecord.metadata) === 'object' ? _objectSpread({}, bundleRecord.metadata) : {};
|
|
1184
|
+
var hasBundleMetadataPatch = false;
|
|
1185
|
+
var bundleSurchargeFee = this.formatSummaryMetadataMoney(bundleRecord.surcharge_fee);
|
|
1186
|
+
if (bundleSurchargeFee !== undefined) {
|
|
1187
|
+
bundleMetadata.surcharge_fee = bundleSurchargeFee;
|
|
1188
|
+
hasBundleMetadataPatch = true;
|
|
1189
|
+
}
|
|
1190
|
+
if (Array.isArray(bundleRecord.relation_surcharge_ids)) {
|
|
1191
|
+
bundleMetadata.relation_surcharge_ids = bundleRecord.relation_surcharge_ids;
|
|
1192
|
+
hasBundleMetadataPatch = true;
|
|
1193
|
+
}
|
|
1194
|
+
if (hasBundleMetadataPatch) bundleRecord.metadata = bundleMetadata;
|
|
1195
|
+
}
|
|
1196
|
+
} catch (err) {
|
|
1197
|
+
_iterator7.e(err);
|
|
1198
|
+
} finally {
|
|
1199
|
+
_iterator7.f();
|
|
1200
|
+
}
|
|
1176
1201
|
}
|
|
1177
1202
|
} catch (err) {
|
|
1178
1203
|
_iterator5.e(err);
|
|
@@ -1180,6 +1205,20 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1180
1205
|
_iterator5.f();
|
|
1181
1206
|
}
|
|
1182
1207
|
}
|
|
1208
|
+
}, {
|
|
1209
|
+
key: "calculateSummaryPaymentBalance",
|
|
1210
|
+
value: function calculateSummaryPaymentBalance(params) {
|
|
1211
|
+
var tempOrder = params.tempOrder,
|
|
1212
|
+
summary = params.summary,
|
|
1213
|
+
orderPaidAmount = params.orderPaidAmount;
|
|
1214
|
+
var depositAmount = summary.deposit_amount || tempOrder.deposit_amount || '0.00';
|
|
1215
|
+
var isDeposit = tempOrder.is_deposit === 1 || new Decimal(depositAmount || 0).gt(0);
|
|
1216
|
+
var targetAmount = isDeposit ? new Decimal(depositAmount || 0) : new Decimal(summary.total_amount || summary.expect_amount || 0);
|
|
1217
|
+
return {
|
|
1218
|
+
amountGap: Decimal.max(0, targetAmount.minus(orderPaidAmount)).toFixed(2),
|
|
1219
|
+
totalRefundAmount: Decimal.max(0, orderPaidAmount.minus(targetAmount)).toFixed(2)
|
|
1220
|
+
};
|
|
1221
|
+
}
|
|
1183
1222
|
}, {
|
|
1184
1223
|
key: "getPaymentTargetAmount",
|
|
1185
1224
|
value: function getPaymentTargetAmount() {
|
|
@@ -1496,7 +1535,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1496
1535
|
key: "recalculateSummary",
|
|
1497
1536
|
value: function () {
|
|
1498
1537
|
var _recalculateSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(options) {
|
|
1499
|
-
var tempOrder, salesSummary,
|
|
1538
|
+
var tempOrder, salesSummary, paidPaymentSummary, _paymentBalance, emptySummary, salesSummaryResult, paymentBalance, summary;
|
|
1500
1539
|
return _regeneratorRuntime().wrap(function _callee12$(_context14) {
|
|
1501
1540
|
while (1) switch (_context14.prev = _context14.next) {
|
|
1502
1541
|
case 0:
|
|
@@ -1508,16 +1547,21 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1508
1547
|
return _context14.abrupt("return", null);
|
|
1509
1548
|
case 3:
|
|
1510
1549
|
salesSummary = this.getSalesSummary();
|
|
1511
|
-
existedSummary = this.store.summary || createEmptySummary();
|
|
1512
1550
|
paidPaymentSummary = this.calculatePaidPaymentSummary(tempOrder.payments || []);
|
|
1513
1551
|
if (salesSummary) {
|
|
1514
1552
|
_context14.next = 11;
|
|
1515
1553
|
break;
|
|
1516
1554
|
}
|
|
1555
|
+
_paymentBalance = this.calculateSummaryPaymentBalance({
|
|
1556
|
+
tempOrder: tempOrder,
|
|
1557
|
+
summary: createEmptySummary(),
|
|
1558
|
+
orderPaidAmount: paidPaymentSummary.orderPaidAmount
|
|
1559
|
+
});
|
|
1517
1560
|
emptySummary = _objectSpread(_objectSpread({}, createEmptySummary()), {}, {
|
|
1518
|
-
total_refund_amount:
|
|
1561
|
+
total_refund_amount: _paymentBalance.totalRefundAmount,
|
|
1519
1562
|
customer_paid_amount: paidPaymentSummary.customerPaidAmount.toFixed(2),
|
|
1520
1563
|
order_paid_amount: paidPaymentSummary.orderPaidAmount.toFixed(2),
|
|
1564
|
+
amount_gap: _paymentBalance.amountGap,
|
|
1521
1565
|
pay_service_charge_amount: paidPaymentSummary.payServiceChargeAmount.toFixed(2)
|
|
1522
1566
|
});
|
|
1523
1567
|
this.store.summary = emptySummary;
|
|
@@ -1533,10 +1577,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1533
1577
|
case 13:
|
|
1534
1578
|
salesSummaryResult = _context14.sent;
|
|
1535
1579
|
this.syncSummaryProductMetadata(tempOrder.products || []);
|
|
1580
|
+
paymentBalance = this.calculateSummaryPaymentBalance({
|
|
1581
|
+
tempOrder: tempOrder,
|
|
1582
|
+
summary: salesSummaryResult,
|
|
1583
|
+
orderPaidAmount: paidPaymentSummary.orderPaidAmount
|
|
1584
|
+
});
|
|
1536
1585
|
summary = _objectSpread(_objectSpread({}, salesSummaryResult), {}, {
|
|
1537
|
-
total_refund_amount:
|
|
1586
|
+
total_refund_amount: paymentBalance.totalRefundAmount,
|
|
1538
1587
|
customer_paid_amount: paidPaymentSummary.customerPaidAmount.toFixed(2),
|
|
1539
1588
|
order_paid_amount: paidPaymentSummary.orderPaidAmount.toFixed(2),
|
|
1589
|
+
amount_gap: paymentBalance.amountGap,
|
|
1540
1590
|
pay_service_charge_amount: paidPaymentSummary.payServiceChargeAmount.toFixed(2)
|
|
1541
1591
|
});
|
|
1542
1592
|
this.store.summary = summary;
|
|
@@ -1551,7 +1601,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1551
1601
|
tempOrder.deposit_amount = summary.deposit_amount || '0.00';
|
|
1552
1602
|
tempOrder.is_deposit = summary.deposit_amount !== '0.00' ? 1 : 0;
|
|
1553
1603
|
return _context14.abrupt("return", this.store.summary);
|
|
1554
|
-
case
|
|
1604
|
+
case 25:
|
|
1555
1605
|
case "end":
|
|
1556
1606
|
return _context14.stop();
|
|
1557
1607
|
}
|
|
@@ -3249,46 +3299,46 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3249
3299
|
*/
|
|
3250
3300
|
function populateSavedAmounts(productList, discountList) {
|
|
3251
3301
|
var savedMap = new Map();
|
|
3252
|
-
var
|
|
3253
|
-
|
|
3302
|
+
var _iterator8 = _createForOfIteratorHelper(productList),
|
|
3303
|
+
_step8;
|
|
3254
3304
|
try {
|
|
3255
|
-
for (
|
|
3256
|
-
var product =
|
|
3305
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
3306
|
+
var product = _step8.value;
|
|
3257
3307
|
var qty = product.num || 1;
|
|
3258
|
-
var
|
|
3259
|
-
|
|
3308
|
+
var _iterator10 = _createForOfIteratorHelper(product.discount_list || []),
|
|
3309
|
+
_step10;
|
|
3260
3310
|
try {
|
|
3261
|
-
for (
|
|
3311
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
3262
3312
|
var _pd$discount, _pd$metadata;
|
|
3263
|
-
var pd =
|
|
3313
|
+
var pd = _step10.value;
|
|
3264
3314
|
var discountKey = ((_pd$discount = pd.discount) === null || _pd$discount === void 0 ? void 0 : _pd$discount.resource_id) || pd.id;
|
|
3265
3315
|
if (discountKey == null) continue;
|
|
3266
3316
|
var amount = new Decimal(pd.amount || 0).times(qty).plus(((_pd$metadata = pd.metadata) === null || _pd$metadata === void 0 ? void 0 : _pd$metadata.product_discount_difference) || 0);
|
|
3267
3317
|
savedMap.set(discountKey, (savedMap.get(discountKey) || new Decimal(0)).plus(amount));
|
|
3268
3318
|
}
|
|
3269
3319
|
} catch (err) {
|
|
3270
|
-
|
|
3320
|
+
_iterator10.e(err);
|
|
3271
3321
|
} finally {
|
|
3272
|
-
|
|
3322
|
+
_iterator10.f();
|
|
3273
3323
|
}
|
|
3274
3324
|
}
|
|
3275
3325
|
} catch (err) {
|
|
3276
|
-
|
|
3326
|
+
_iterator8.e(err);
|
|
3277
3327
|
} finally {
|
|
3278
|
-
|
|
3328
|
+
_iterator8.f();
|
|
3279
3329
|
}
|
|
3280
|
-
var
|
|
3281
|
-
|
|
3330
|
+
var _iterator9 = _createForOfIteratorHelper(discountList),
|
|
3331
|
+
_step9;
|
|
3282
3332
|
try {
|
|
3283
|
-
for (
|
|
3284
|
-
var d =
|
|
3333
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
3334
|
+
var d = _step9.value;
|
|
3285
3335
|
var key = d.id;
|
|
3286
3336
|
d.savedAmount = d.isSelected && key != null && savedMap.has(key) ? savedMap.get(key).toNumber() : 0;
|
|
3287
3337
|
}
|
|
3288
3338
|
} catch (err) {
|
|
3289
|
-
|
|
3339
|
+
_iterator9.e(err);
|
|
3290
3340
|
} finally {
|
|
3291
|
-
|
|
3341
|
+
_iterator9.f();
|
|
3292
3342
|
}
|
|
3293
3343
|
}
|
|
3294
3344
|
}]);
|
|
@@ -314,15 +314,16 @@ function calculateProductsTax(products, taxRate, isPriceIncludeTax) {
|
|
|
314
314
|
var bundleQuantity = new Decimal(getSafeNum((_bundleItem$num2 = bundleItem.num) !== null && _bundleItem$num2 !== void 0 ? _bundleItem$num2 : bundleItem.quantity));
|
|
315
315
|
var bundlePrice = toDecimal((_ref4 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref4 !== void 0 ? _ref4 : 0);
|
|
316
316
|
var bundleOriginalPrice = toDecimal((_ref5 = (_ref6 = (_bundleItem$original_ = bundleItem.original_price) !== null && _bundleItem$original_ !== void 0 ? _bundleItem$original_ : bundleItem.product_price) !== null && _ref6 !== void 0 ? _ref6 : bundleItem.price) !== null && _ref5 !== void 0 ? _ref5 : 0);
|
|
317
|
+
var bundleSurchargeFee = toDecimal(bundleItem.surcharge_fee);
|
|
317
318
|
var bundleTaxPrecise = calculateSingleItemTax({
|
|
318
|
-
price: bundlePrice,
|
|
319
|
+
price: bundlePrice.plus(bundleSurchargeFee),
|
|
319
320
|
taxRate: rate,
|
|
320
321
|
isPriceIncludeTax: isPriceIncludeTax,
|
|
321
322
|
isChargeTax: (_ref7 = (_bundleItem$is_charge = bundleItem.is_charge_tax) !== null && _bundleItem$is_charge !== void 0 ? _bundleItem$is_charge : product.is_charge_tax) !== null && _ref7 !== void 0 ? _ref7 : 0
|
|
322
323
|
});
|
|
323
324
|
var bundleTaxRounded = bundleTaxPrecise.toDecimalPlaces(2, Decimal.ROUND_HALF_UP);
|
|
324
325
|
var bundleOrigTaxPrecise = calculateSingleItemTax({
|
|
325
|
-
price: bundleOriginalPrice,
|
|
326
|
+
price: bundleOriginalPrice.plus(bundleSurchargeFee),
|
|
326
327
|
taxRate: rate,
|
|
327
328
|
isPriceIncludeTax: isPriceIncludeTax,
|
|
328
329
|
isChargeTax: (_ref8 = (_bundleItem$is_charge2 = bundleItem.is_charge_tax) !== null && _bundleItem$is_charge2 !== void 0 ? _bundleItem$is_charge2 : product.is_charge_tax) !== null && _ref8 !== void 0 ? _ref8 : 0
|
|
@@ -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 |
|
|
314
|
+
weekNum: 0 | 1 | 2 | 6 | 3 | 5 | 4;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
});
|
|
@@ -129,6 +129,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
129
129
|
private calculatePaymentServiceFee;
|
|
130
130
|
private formatSummaryMetadataMoney;
|
|
131
131
|
private syncSummaryProductMetadata;
|
|
132
|
+
private calculateSummaryPaymentBalance;
|
|
132
133
|
private getPaymentTargetAmount;
|
|
133
134
|
ensureTempOrder(): OrderTempOrder;
|
|
134
135
|
restoreOrder(): OrderTempOrder;
|
|
@@ -727,8 +727,38 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
727
727
|
}
|
|
728
728
|
if (hasMetadataPatch)
|
|
729
729
|
productRecord.metadata = metadata;
|
|
730
|
+
if (!Array.isArray(productRecord.product_bundle))
|
|
731
|
+
continue;
|
|
732
|
+
for (const bundle of productRecord.product_bundle) {
|
|
733
|
+
const bundleRecord = bundle;
|
|
734
|
+
const bundleMetadata = bundleRecord.metadata && typeof bundleRecord.metadata === "object" ? { ...bundleRecord.metadata } : {};
|
|
735
|
+
let hasBundleMetadataPatch = false;
|
|
736
|
+
const bundleSurchargeFee = this.formatSummaryMetadataMoney(
|
|
737
|
+
bundleRecord.surcharge_fee
|
|
738
|
+
);
|
|
739
|
+
if (bundleSurchargeFee !== void 0) {
|
|
740
|
+
bundleMetadata.surcharge_fee = bundleSurchargeFee;
|
|
741
|
+
hasBundleMetadataPatch = true;
|
|
742
|
+
}
|
|
743
|
+
if (Array.isArray(bundleRecord.relation_surcharge_ids)) {
|
|
744
|
+
bundleMetadata.relation_surcharge_ids = bundleRecord.relation_surcharge_ids;
|
|
745
|
+
hasBundleMetadataPatch = true;
|
|
746
|
+
}
|
|
747
|
+
if (hasBundleMetadataPatch)
|
|
748
|
+
bundleRecord.metadata = bundleMetadata;
|
|
749
|
+
}
|
|
730
750
|
}
|
|
731
751
|
}
|
|
752
|
+
calculateSummaryPaymentBalance(params) {
|
|
753
|
+
const { tempOrder, summary, orderPaidAmount } = params;
|
|
754
|
+
const depositAmount = summary.deposit_amount || tempOrder.deposit_amount || "0.00";
|
|
755
|
+
const isDeposit = tempOrder.is_deposit === 1 || new import_decimal.default(depositAmount || 0).gt(0);
|
|
756
|
+
const targetAmount = isDeposit ? new import_decimal.default(depositAmount || 0) : new import_decimal.default(summary.total_amount || summary.expect_amount || 0);
|
|
757
|
+
return {
|
|
758
|
+
amountGap: import_decimal.default.max(0, targetAmount.minus(orderPaidAmount)).toFixed(2),
|
|
759
|
+
totalRefundAmount: import_decimal.default.max(0, orderPaidAmount.minus(targetAmount)).toFixed(2)
|
|
760
|
+
};
|
|
761
|
+
}
|
|
732
762
|
getPaymentTargetAmount() {
|
|
733
763
|
const tempOrder = this.ensureTempOrder();
|
|
734
764
|
const summary = this.store.summary || (0, import_utils.createEmptySummary)();
|
|
@@ -974,16 +1004,21 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
974
1004
|
if (!tempOrder)
|
|
975
1005
|
return null;
|
|
976
1006
|
const salesSummary = this.getSalesSummary();
|
|
977
|
-
const existedSummary = this.store.summary || (0, import_utils.createEmptySummary)();
|
|
978
1007
|
const paidPaymentSummary = this.calculatePaidPaymentSummary(
|
|
979
1008
|
tempOrder.payments || []
|
|
980
1009
|
);
|
|
981
1010
|
if (!salesSummary) {
|
|
1011
|
+
const paymentBalance2 = this.calculateSummaryPaymentBalance({
|
|
1012
|
+
tempOrder,
|
|
1013
|
+
summary: (0, import_utils.createEmptySummary)(),
|
|
1014
|
+
orderPaidAmount: paidPaymentSummary.orderPaidAmount
|
|
1015
|
+
});
|
|
982
1016
|
const emptySummary = {
|
|
983
1017
|
...(0, import_utils.createEmptySummary)(),
|
|
984
|
-
total_refund_amount:
|
|
1018
|
+
total_refund_amount: paymentBalance2.totalRefundAmount,
|
|
985
1019
|
customer_paid_amount: paidPaymentSummary.customerPaidAmount.toFixed(2),
|
|
986
1020
|
order_paid_amount: paidPaymentSummary.orderPaidAmount.toFixed(2),
|
|
1021
|
+
amount_gap: paymentBalance2.amountGap,
|
|
987
1022
|
pay_service_charge_amount: paidPaymentSummary.payServiceChargeAmount.toFixed(2)
|
|
988
1023
|
};
|
|
989
1024
|
this.store.summary = emptySummary;
|
|
@@ -996,11 +1031,17 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
996
1031
|
shopDiscount: tempOrder.shop_discount
|
|
997
1032
|
});
|
|
998
1033
|
this.syncSummaryProductMetadata(tempOrder.products || []);
|
|
1034
|
+
const paymentBalance = this.calculateSummaryPaymentBalance({
|
|
1035
|
+
tempOrder,
|
|
1036
|
+
summary: salesSummaryResult,
|
|
1037
|
+
orderPaidAmount: paidPaymentSummary.orderPaidAmount
|
|
1038
|
+
});
|
|
999
1039
|
const summary = {
|
|
1000
1040
|
...salesSummaryResult,
|
|
1001
|
-
total_refund_amount:
|
|
1041
|
+
total_refund_amount: paymentBalance.totalRefundAmount,
|
|
1002
1042
|
customer_paid_amount: paidPaymentSummary.customerPaidAmount.toFixed(2),
|
|
1003
1043
|
order_paid_amount: paidPaymentSummary.orderPaidAmount.toFixed(2),
|
|
1044
|
+
amount_gap: paymentBalance.amountGap,
|
|
1004
1045
|
pay_service_charge_amount: paidPaymentSummary.payServiceChargeAmount.toFixed(2)
|
|
1005
1046
|
};
|
|
1006
1047
|
this.store.summary = summary;
|
|
@@ -259,15 +259,16 @@ function calculateProductsTax(products, taxRate, isPriceIncludeTax) {
|
|
|
259
259
|
const bundleQuantity = new import_decimal.default(getSafeNum(bundleItem.num ?? bundleItem.quantity));
|
|
260
260
|
const bundlePrice = toDecimal(bundleItem.bundle_selling_price ?? bundleItem.price ?? 0);
|
|
261
261
|
const bundleOriginalPrice = toDecimal(bundleItem.original_price ?? bundleItem.product_price ?? bundleItem.price ?? 0);
|
|
262
|
+
const bundleSurchargeFee = toDecimal(bundleItem.surcharge_fee);
|
|
262
263
|
const bundleTaxPrecise = calculateSingleItemTax({
|
|
263
|
-
price: bundlePrice,
|
|
264
|
+
price: bundlePrice.plus(bundleSurchargeFee),
|
|
264
265
|
taxRate: rate,
|
|
265
266
|
isPriceIncludeTax,
|
|
266
267
|
isChargeTax: bundleItem.is_charge_tax ?? product.is_charge_tax ?? 0
|
|
267
268
|
});
|
|
268
269
|
const bundleTaxRounded = bundleTaxPrecise.toDecimalPlaces(2, import_decimal.default.ROUND_HALF_UP);
|
|
269
270
|
const bundleOrigTaxPrecise = calculateSingleItemTax({
|
|
270
|
-
price: bundleOriginalPrice,
|
|
271
|
+
price: bundleOriginalPrice.plus(bundleSurchargeFee),
|
|
271
272
|
taxRate: rate,
|
|
272
273
|
isPriceIncludeTax,
|
|
273
274
|
isChargeTax: bundleItem.is_charge_tax ?? product.is_charge_tax ?? 0
|
|
@@ -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 |
|
|
314
|
+
weekNum: 0 | 1 | 2 | 6 | 3 | 5 | 4;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|