@pisell/pisellos 2.2.192 → 2.2.193
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/model/strategy/adapter/walletPass/utils.js +7 -4
- package/dist/modules/Order/index.d.ts +12 -10
- package/dist/modules/Order/index.js +462 -571
- package/dist/modules/Order/types.d.ts +5 -5
- package/dist/modules/Order/utils.js +3 -3
- package/dist/modules/Payment/utils.js +2 -1
- package/dist/modules/SalesSummary/utils.js +1 -1
- package/dist/server/index.d.ts +8 -1
- package/dist/server/index.js +651 -464
- package/dist/server/modules/order/index.d.ts +3 -2
- package/dist/server/modules/order/index.js +68 -52
- package/dist/solution/BaseSales/index.d.ts +2 -1
- package/dist/solution/BaseSales/index.js +116 -122
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +0 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/ScanOrder/index.js +3 -1
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +3 -2
- package/lib/modules/Order/index.d.ts +12 -10
- package/lib/modules/Order/index.js +94 -118
- package/lib/modules/Order/types.d.ts +5 -5
- package/lib/modules/Order/utils.js +4 -4
- package/lib/modules/Payment/utils.js +2 -1
- package/lib/modules/SalesSummary/utils.js +1 -3
- package/lib/server/index.d.ts +8 -1
- package/lib/server/index.js +143 -24
- package/lib/server/modules/order/index.d.ts +3 -2
- package/lib/server/modules/order/index.js +25 -15
- package/lib/solution/BaseSales/index.d.ts +2 -1
- package/lib/solution/BaseSales/index.js +53 -16
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +0 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/ScanOrder/index.js +3 -1
- package/package.json +1 -1
|
@@ -589,7 +589,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
589
589
|
}()
|
|
590
590
|
/**
|
|
591
591
|
* 加载销售订单到统一 tempOrder 工作区。
|
|
592
|
-
*
|
|
592
|
+
* 统一通过 OrderModule 的 sales detail lookup 加载订单详情。
|
|
593
593
|
*
|
|
594
594
|
* 子类可在 `super.loadSalesDetail` 之后基于返回的 `sales` 做业务侧装配
|
|
595
595
|
* (比如把 `sales.customer` 写入 CustomerModule、emit 业务 hook 等)。
|
|
@@ -598,7 +598,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
598
598
|
key: "loadSalesDetail",
|
|
599
599
|
value: (function () {
|
|
600
600
|
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(orderIdOrParams) {
|
|
601
|
-
var
|
|
601
|
+
var _ref9, _params$orderId;
|
|
602
|
+
var params, externalSaleNumber, lookup, res, message, sales;
|
|
602
603
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
603
604
|
while (1) switch (_context5.prev = _context5.next) {
|
|
604
605
|
case 0:
|
|
@@ -612,102 +613,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
612
613
|
orderId: orderIdOrParams
|
|
613
614
|
};
|
|
614
615
|
externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
|
|
615
|
-
|
|
616
|
-
|
|
616
|
+
lookup = (_ref9 = (_params$orderId = params.orderId) !== null && _params$orderId !== void 0 ? _params$orderId : externalSaleNumber) !== null && _ref9 !== void 0 ? _ref9 : params.orderNumber;
|
|
617
|
+
if (!(lookup === undefined || lookup === null || lookup === '')) {
|
|
618
|
+
_context5.next = 7;
|
|
617
619
|
break;
|
|
618
620
|
}
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
case 8:
|
|
626
|
-
_context5.t0 = _context5.sent;
|
|
627
|
-
_context5.next = 26;
|
|
628
|
-
break;
|
|
629
|
-
case 11:
|
|
630
|
-
if (!externalSaleNumber) {
|
|
631
|
-
_context5.next = 17;
|
|
632
|
-
break;
|
|
633
|
-
}
|
|
634
|
-
_context5.next = 14;
|
|
635
|
-
return this.store.order.getLocalOrderByExternalSaleNumber(externalSaleNumber);
|
|
636
|
-
case 14:
|
|
637
|
-
_context5.t1 = _context5.sent;
|
|
638
|
-
_context5.next = 25;
|
|
639
|
-
break;
|
|
640
|
-
case 17:
|
|
641
|
-
if (!params.orderNumber) {
|
|
642
|
-
_context5.next = 23;
|
|
643
|
-
break;
|
|
644
|
-
}
|
|
645
|
-
_context5.next = 20;
|
|
646
|
-
return this.store.order.getLocalOrderByOrderNumber(params.orderNumber);
|
|
647
|
-
case 20:
|
|
648
|
-
_context5.t2 = _context5.sent;
|
|
649
|
-
_context5.next = 24;
|
|
650
|
-
break;
|
|
651
|
-
case 23:
|
|
652
|
-
_context5.t2 = null;
|
|
653
|
-
case 24:
|
|
654
|
-
_context5.t1 = _context5.t2;
|
|
655
|
-
case 25:
|
|
656
|
-
_context5.t0 = _context5.t1;
|
|
657
|
-
case 26:
|
|
658
|
-
localRecord = _context5.t0;
|
|
659
|
-
if (!localRecord) {
|
|
660
|
-
_context5.next = 35;
|
|
661
|
-
break;
|
|
662
|
-
}
|
|
663
|
-
_context5.next = 30;
|
|
664
|
-
return this.store.order.hydrateTempOrderFromRecord(localRecord, {
|
|
665
|
-
recalcOnHydrate: false
|
|
666
|
-
});
|
|
667
|
-
case 30:
|
|
668
|
-
_sales = _context5.sent;
|
|
669
|
-
this.currentSalesDetail = _sales;
|
|
670
|
-
_context5.next = 34;
|
|
671
|
-
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
672
|
-
sales: _sales
|
|
621
|
+
throw new Error('加载销售详情需要 orderId、externalSaleNumber 或 orderNumber');
|
|
622
|
+
case 7:
|
|
623
|
+
_context5.next = 9;
|
|
624
|
+
return this.store.order.getSalesOrderByLookup({
|
|
625
|
+
lookup: lookup,
|
|
626
|
+
forceRemote: params.forceRemote
|
|
673
627
|
});
|
|
674
|
-
case
|
|
675
|
-
return _context5.abrupt("return", _sales);
|
|
676
|
-
case 35:
|
|
677
|
-
if (!(params.orderId === undefined || params.orderId === null)) {
|
|
678
|
-
_context5.next = 37;
|
|
679
|
-
break;
|
|
680
|
-
}
|
|
681
|
-
throw new Error('加载销售详情需要 orderId,或本地库中存在对应 externalSaleNumber/orderNumber');
|
|
682
|
-
case 37:
|
|
683
|
-
_context5.next = 39;
|
|
684
|
-
return this.store.order.getOrderInfoByRemote(Number(params.orderId));
|
|
685
|
-
case 39:
|
|
628
|
+
case 9:
|
|
686
629
|
res = _context5.sent;
|
|
687
630
|
if (!(!res || res.code !== 200)) {
|
|
688
|
-
_context5.next =
|
|
631
|
+
_context5.next = 13;
|
|
689
632
|
break;
|
|
690
633
|
}
|
|
691
|
-
message = res && (res.message || res.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(
|
|
634
|
+
message = res && (res.message || res.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(lookup);
|
|
692
635
|
throw new Error(message);
|
|
693
|
-
case
|
|
694
|
-
_context5.next =
|
|
636
|
+
case 13:
|
|
637
|
+
_context5.next = 15;
|
|
695
638
|
return this.store.order.hydrateTempOrderFromRecord(res.data, {
|
|
696
639
|
recalcOnHydrate: false
|
|
697
640
|
});
|
|
698
|
-
case
|
|
641
|
+
case 15:
|
|
699
642
|
sales = _context5.sent;
|
|
700
|
-
_context5.next = 48;
|
|
701
|
-
return this.store.order.saveDraft();
|
|
702
|
-
case 48:
|
|
703
643
|
this.currentSalesDetail = sales;
|
|
704
|
-
_context5.next =
|
|
644
|
+
_context5.next = 19;
|
|
705
645
|
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
706
646
|
sales: sales
|
|
707
647
|
});
|
|
708
|
-
case
|
|
648
|
+
case 19:
|
|
709
649
|
return _context5.abrupt("return", sales);
|
|
710
|
-
case
|
|
650
|
+
case 20:
|
|
711
651
|
case "end":
|
|
712
652
|
return _context5.stop();
|
|
713
653
|
}
|
|
@@ -1192,6 +1132,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1192
1132
|
return !historyIds.has(discount.id);
|
|
1193
1133
|
})));
|
|
1194
1134
|
}
|
|
1135
|
+
}, {
|
|
1136
|
+
key: "shouldSkipAutoApplyFetchedDiscountsInEditMode",
|
|
1137
|
+
value: function shouldSkipAutoApplyFetchedDiscountsInEditMode(params) {
|
|
1138
|
+
var _this6 = this;
|
|
1139
|
+
if (params.discountAction !== 'edit') return false;
|
|
1140
|
+
if (!params.products.length) return false;
|
|
1141
|
+
var hasDraftProduct = params.products.some(function (product) {
|
|
1142
|
+
return !_this6.isPersistedOrderProduct(product);
|
|
1143
|
+
});
|
|
1144
|
+
if (hasDraftProduct) return false;
|
|
1145
|
+
var hasSelectedDiscount = params.currentDiscountList.some(function (discount) {
|
|
1146
|
+
return discount.isSelected || discount.isEditMode || discount.isManualSelect;
|
|
1147
|
+
});
|
|
1148
|
+
if (hasSelectedDiscount) return false;
|
|
1149
|
+
return !params.nextDiscountList.some(function (discount) {
|
|
1150
|
+
return discount.isSelected || discount.isEditMode || discount.isManualSelect;
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1195
1153
|
}, {
|
|
1196
1154
|
key: "mergeCurrentDiscountSelectionState",
|
|
1197
1155
|
value: function mergeCurrentDiscountSelectionState(discountList, currentDiscountList) {
|
|
@@ -1222,7 +1180,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1222
1180
|
value: function () {
|
|
1223
1181
|
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(params) {
|
|
1224
1182
|
var _this$getOrderIdentit, _tempOrder$customer, _tempOrder$_extend, _tempOrder$_extend2, _discountModule$getDi, _discountModule$getOr, _discountModule$getDi2;
|
|
1225
|
-
var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, nextDiscountList, _tempOrder$holder, _tempOrder$holder2, _orderStore$summary, holders, result, _iterator, _step, _product$metadata2, _tempOrder$_extend3, _product$metadata3, _product$metadata$sou, _product$metadata4, _product$metadata5, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, summary;
|
|
1183
|
+
var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _summary, _tempOrder$holder, _tempOrder$holder2, _orderStore$summary, holders, result, _iterator, _step, _product$metadata2, _tempOrder$_extend3, _product$metadata3, _product$metadata$sou, _product$metadata4, _product$metadata5, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, summary;
|
|
1226
1184
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1227
1185
|
while (1) switch (_context12.prev = _context12.next) {
|
|
1228
1186
|
case 0:
|
|
@@ -1285,8 +1243,38 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1285
1243
|
_context12.next = 31;
|
|
1286
1244
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1287
1245
|
case 31:
|
|
1246
|
+
shouldSkipAutoApplyFetchedDiscounts = this.shouldSkipAutoApplyFetchedDiscountsInEditMode({
|
|
1247
|
+
discountAction: discountAction,
|
|
1248
|
+
products: tempOrder.products || [],
|
|
1249
|
+
currentDiscountList: currentDiscountList,
|
|
1250
|
+
nextDiscountList: nextDiscountList
|
|
1251
|
+
});
|
|
1252
|
+
if (!shouldSkipAutoApplyFetchedDiscounts) {
|
|
1253
|
+
_context12.next = 40;
|
|
1254
|
+
break;
|
|
1255
|
+
}
|
|
1256
|
+
_context12.next = 35;
|
|
1257
|
+
return this.store.order.recalculateSummary({
|
|
1258
|
+
createIfMissing: true
|
|
1259
|
+
});
|
|
1260
|
+
case 35:
|
|
1261
|
+
_summary = _context12.sent;
|
|
1262
|
+
this.store.order.persistTempOrder();
|
|
1263
|
+
_context12.next = 39;
|
|
1264
|
+
return this.effectsEmit('onDiscountApplied', {
|
|
1265
|
+
productList: tempOrder.products || [],
|
|
1266
|
+
discountList: nextDiscountList,
|
|
1267
|
+
selectedDiscountList: tempOrder.discount_list || [],
|
|
1268
|
+
tempOrder: tempOrder
|
|
1269
|
+
});
|
|
1270
|
+
case 39:
|
|
1271
|
+
return _context12.abrupt("return", {
|
|
1272
|
+
productList: tempOrder.products || [],
|
|
1273
|
+
discountList: nextDiscountList
|
|
1274
|
+
});
|
|
1275
|
+
case 40:
|
|
1288
1276
|
if (!rulesModule) {
|
|
1289
|
-
_context12.next =
|
|
1277
|
+
_context12.next = 76;
|
|
1290
1278
|
break;
|
|
1291
1279
|
}
|
|
1292
1280
|
holders = (_tempOrder$holder = tempOrder.holder) !== null && _tempOrder$holder !== void 0 && _tempOrder$holder.form_record_id ? [{
|
|
@@ -1306,22 +1294,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1306
1294
|
tempOrder.products = result.productList;
|
|
1307
1295
|
}
|
|
1308
1296
|
_iterator = _createForOfIteratorHelper(tempOrder.products || []);
|
|
1309
|
-
_context12.prev =
|
|
1297
|
+
_context12.prev = 45;
|
|
1310
1298
|
_iterator.s();
|
|
1311
|
-
case
|
|
1299
|
+
case 47:
|
|
1312
1300
|
if ((_step = _iterator.n()).done) {
|
|
1313
|
-
_context12.next =
|
|
1301
|
+
_context12.next = 62;
|
|
1314
1302
|
break;
|
|
1315
1303
|
}
|
|
1316
1304
|
product = _step.value;
|
|
1317
1305
|
productUid = (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.unique_identification_number;
|
|
1318
1306
|
runtimeOrigin = productUid ? (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3[productUid]) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.origin : undefined;
|
|
1319
1307
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || (_product$metadata3 = product.metadata) !== null && _product$metadata3 !== void 0 && _product$metadata3.is_manual_discount)) {
|
|
1320
|
-
_context12.next =
|
|
1308
|
+
_context12.next = 53;
|
|
1321
1309
|
break;
|
|
1322
1310
|
}
|
|
1323
|
-
return _context12.abrupt("continue",
|
|
1324
|
-
case
|
|
1311
|
+
return _context12.abrupt("continue", 60);
|
|
1312
|
+
case 53:
|
|
1325
1313
|
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
1326
1314
|
return sum + Number(pd.amount || 0);
|
|
1327
1315
|
}, 0);
|
|
@@ -1337,58 +1325,58 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1337
1325
|
mainPrice: newMainSellingPrice,
|
|
1338
1326
|
bundle: product.product_bundle
|
|
1339
1327
|
});
|
|
1340
|
-
case
|
|
1341
|
-
_context12.next =
|
|
1328
|
+
case 60:
|
|
1329
|
+
_context12.next = 47;
|
|
1342
1330
|
break;
|
|
1343
|
-
case
|
|
1344
|
-
_context12.next =
|
|
1331
|
+
case 62:
|
|
1332
|
+
_context12.next = 67;
|
|
1345
1333
|
break;
|
|
1346
|
-
case
|
|
1347
|
-
_context12.prev =
|
|
1348
|
-
_context12.t0 = _context12["catch"](
|
|
1334
|
+
case 64:
|
|
1335
|
+
_context12.prev = 64;
|
|
1336
|
+
_context12.t0 = _context12["catch"](45);
|
|
1349
1337
|
_iterator.e(_context12.t0);
|
|
1350
|
-
case
|
|
1351
|
-
_context12.prev =
|
|
1338
|
+
case 67:
|
|
1339
|
+
_context12.prev = 67;
|
|
1352
1340
|
_iterator.f();
|
|
1353
|
-
return _context12.finish(
|
|
1354
|
-
case
|
|
1341
|
+
return _context12.finish(67);
|
|
1342
|
+
case 70:
|
|
1355
1343
|
if (!result.discountList) {
|
|
1356
|
-
_context12.next =
|
|
1344
|
+
_context12.next = 76;
|
|
1357
1345
|
break;
|
|
1358
1346
|
}
|
|
1359
1347
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
1360
1348
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1361
|
-
_context12.next =
|
|
1349
|
+
_context12.next = 75;
|
|
1362
1350
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1363
|
-
case
|
|
1351
|
+
case 75:
|
|
1364
1352
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
1365
1353
|
return discount.isSelected;
|
|
1366
1354
|
});
|
|
1367
|
-
case
|
|
1368
|
-
_context12.next =
|
|
1355
|
+
case 76:
|
|
1356
|
+
_context12.next = 78;
|
|
1369
1357
|
return this.store.order.recalculateSummary({
|
|
1370
1358
|
createIfMissing: true
|
|
1371
1359
|
});
|
|
1372
|
-
case
|
|
1360
|
+
case 78:
|
|
1373
1361
|
summary = _context12.sent;
|
|
1374
1362
|
this.store.order.persistTempOrder();
|
|
1375
|
-
_context12.next =
|
|
1363
|
+
_context12.next = 82;
|
|
1376
1364
|
return this.effectsEmit('onDiscountApplied', {
|
|
1377
1365
|
productList: tempOrder.products || [],
|
|
1378
1366
|
discountList: nextDiscountList,
|
|
1379
1367
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
1380
1368
|
tempOrder: tempOrder
|
|
1381
1369
|
});
|
|
1382
|
-
case
|
|
1370
|
+
case 82:
|
|
1383
1371
|
return _context12.abrupt("return", {
|
|
1384
1372
|
productList: tempOrder.products || [],
|
|
1385
1373
|
discountList: nextDiscountList
|
|
1386
1374
|
});
|
|
1387
|
-
case
|
|
1375
|
+
case 83:
|
|
1388
1376
|
case "end":
|
|
1389
1377
|
return _context12.stop();
|
|
1390
1378
|
}
|
|
1391
|
-
}, _callee12, this, [[
|
|
1379
|
+
}, _callee12, this, [[45, 64, 67, 70]]);
|
|
1392
1380
|
}));
|
|
1393
1381
|
function loadDiscountConfig(_x7) {
|
|
1394
1382
|
return _loadDiscountConfig.apply(this, arguments);
|
|
@@ -1853,7 +1841,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1853
1841
|
key: "syncPaymentsToOrder",
|
|
1854
1842
|
value: function () {
|
|
1855
1843
|
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
|
|
1856
|
-
var
|
|
1844
|
+
var _ref10, _params$businessCode, _this$otherParams10, _this$otherParams11, _params$channel;
|
|
1857
1845
|
var businessCode, channel, syncParams, syncState, payments, syncResult;
|
|
1858
1846
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1859
1847
|
while (1) switch (_context19.prev = _context19.next) {
|
|
@@ -1864,7 +1852,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1864
1852
|
}
|
|
1865
1853
|
throw new Error('order 模块未初始化');
|
|
1866
1854
|
case 2:
|
|
1867
|
-
businessCode = (
|
|
1855
|
+
businessCode = (_ref10 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.businessCode) !== null && _ref10 !== void 0 ? _ref10 : (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.business_code;
|
|
1868
1856
|
channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
|
|
1869
1857
|
syncParams = _objectSpread(_objectSpread(_objectSpread({}, params), businessCode !== undefined ? {
|
|
1870
1858
|
businessCode: businessCode
|
|
@@ -1948,11 +1936,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1948
1936
|
key: "addOrderPayment",
|
|
1949
1937
|
value: function addOrderPayment(payment) {
|
|
1950
1938
|
var _this$otherParams12,
|
|
1951
|
-
|
|
1939
|
+
_this7 = this;
|
|
1952
1940
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
1953
1941
|
var paymentRecord = payment;
|
|
1942
|
+
var paymentAmount = new Decimal(paymentRecord.amount || 0);
|
|
1943
|
+
if (paymentAmount.isZero()) {
|
|
1944
|
+
this.logWarning('addOrderPayment: 支付金额为 0,跳过添加支付项', {
|
|
1945
|
+
payment: paymentRecord
|
|
1946
|
+
});
|
|
1947
|
+
return this.store.order.getOrderPayments();
|
|
1948
|
+
}
|
|
1954
1949
|
var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
|
|
1955
|
-
debugger;
|
|
1956
1950
|
var shopWalletPassId = (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.shop_wallet_pass_id;
|
|
1957
1951
|
if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
|
|
1958
1952
|
metadata.shop_wallet_pass_id = shopWalletPassId;
|
|
@@ -1973,7 +1967,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1973
1967
|
submitWhenPaid: true,
|
|
1974
1968
|
smallTicketDataFlag: 1
|
|
1975
1969
|
}).catch(function (error) {
|
|
1976
|
-
|
|
1970
|
+
_this7.logError('auto sync payments failed', {
|
|
1977
1971
|
error: error instanceof Error ? error.message : String(error)
|
|
1978
1972
|
});
|
|
1979
1973
|
});
|
|
@@ -2065,7 +2059,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2065
2059
|
key: "initWalletData",
|
|
2066
2060
|
value: function () {
|
|
2067
2061
|
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
2068
|
-
var _params$order_wait_pa,
|
|
2062
|
+
var _params$order_wait_pa, _ref11, _tempOrder$is_price_i;
|
|
2069
2063
|
var snapshot, tempOrder, amount, walletBusinessData, result;
|
|
2070
2064
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
2071
2065
|
while (1) switch (_context20.prev = _context20.next) {
|
|
@@ -2108,7 +2102,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2108
2102
|
},
|
|
2109
2103
|
products: this.getWalletProductList(),
|
|
2110
2104
|
order_wait_pay_amount: (_params$order_wait_pa = params === null || params === void 0 ? void 0 : params.order_wait_pay_amount) !== null && _params$order_wait_pa !== void 0 ? _params$order_wait_pa : Number(amount.amountGap || 0),
|
|
2111
|
-
is_price_include_tax: (
|
|
2105
|
+
is_price_include_tax: (_ref11 = (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : this.otherParams.is_price_include_tax) !== null && _ref11 !== void 0 ? _ref11 : 1
|
|
2112
2106
|
}, snapshot.identity.orderId ? {
|
|
2113
2107
|
payment_order_id: String(snapshot.identity.orderId)
|
|
2114
2108
|
} : {});
|
|
@@ -2224,7 +2218,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2224
2218
|
key: "sendCustomerPayLink",
|
|
2225
2219
|
value: (function () {
|
|
2226
2220
|
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
2227
|
-
var orderIds,
|
|
2221
|
+
var orderIds, _ref12, _ref13, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
2228
2222
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2229
2223
|
while (1) switch (_context22.prev = _context22.next) {
|
|
2230
2224
|
case 0:
|
|
@@ -2245,7 +2239,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2245
2239
|
});
|
|
2246
2240
|
case 6:
|
|
2247
2241
|
submitResult = _context22.sent;
|
|
2248
|
-
orderId = (
|
|
2242
|
+
orderId = (_ref12 = (_ref13 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref13 !== void 0 ? _ref13 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref12 !== void 0 ? _ref12 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
2249
2243
|
if (orderId) {
|
|
2250
2244
|
_context22.next = 10;
|
|
2251
2245
|
break;
|
|
@@ -2646,14 +2640,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2646
2640
|
key: "setOtherParams",
|
|
2647
2641
|
value: function () {
|
|
2648
2642
|
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
2649
|
-
var
|
|
2650
|
-
|
|
2643
|
+
var _ref14,
|
|
2644
|
+
_ref14$cover,
|
|
2651
2645
|
cover,
|
|
2652
2646
|
_args31 = arguments;
|
|
2653
2647
|
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2654
2648
|
while (1) switch (_context31.prev = _context31.next) {
|
|
2655
2649
|
case 0:
|
|
2656
|
-
|
|
2650
|
+
_ref14 = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : {}, _ref14$cover = _ref14.cover, cover = _ref14$cover === void 0 ? false : _ref14$cover;
|
|
2657
2651
|
if (cover) {
|
|
2658
2652
|
this.otherParams = params;
|
|
2659
2653
|
} else {
|
|
@@ -145,7 +145,6 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
145
145
|
duration: payload.duration,
|
|
146
146
|
policy_id: payload.policy_id,
|
|
147
147
|
source_shop_id: payload.source_shop_id,
|
|
148
|
-
origin: origin,
|
|
149
148
|
source_product_price: sourceProductPrice,
|
|
150
149
|
main_product_selling_price: mainProductSellingPrice,
|
|
151
150
|
main_product_original_price: mainProductOriginalPrice,
|
|
@@ -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;
|
|
@@ -279,7 +279,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
279
279
|
* 获取当前的客户搜索条件
|
|
280
280
|
* @returns 当前搜索条件
|
|
281
281
|
*/
|
|
282
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
282
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
283
283
|
/**
|
|
284
284
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
285
285
|
* @returns 客户状态
|
|
@@ -2760,7 +2760,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2760
2760
|
break;
|
|
2761
2761
|
}
|
|
2762
2762
|
_context36.next = 67;
|
|
2763
|
-
return (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.
|
|
2763
|
+
return (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getSalesOrderByLookup({
|
|
2764
|
+
lookup: tempOrder.order_id
|
|
2765
|
+
});
|
|
2764
2766
|
case 67:
|
|
2765
2767
|
res = _context36.sent;
|
|
2766
2768
|
// 找到下单的时候输入的 entryPaxNumber
|
|
@@ -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
|
+
});
|
|
@@ -346,7 +346,8 @@ function processVouchers(applicableVouchers, orderTotalAmount, products) {
|
|
|
346
346
|
);
|
|
347
347
|
const maxDeduction = import_decimal.default.min(
|
|
348
348
|
new import_decimal.default(usageAmount),
|
|
349
|
-
new import_decimal.default(maxDeductionAmount)
|
|
349
|
+
new import_decimal.default(maxDeductionAmount),
|
|
350
|
+
remainingOrderAmount
|
|
350
351
|
);
|
|
351
352
|
let deductionLeft = maxDeduction;
|
|
352
353
|
const deductionDetails = [];
|
|
@@ -488,7 +489,7 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
|
|
|
488
489
|
});
|
|
489
490
|
return;
|
|
490
491
|
}
|
|
491
|
-
const usageAmount = typeof selectedVoucher.edit_current_amount === "number" ? selectedVoucher.edit_current_amount : getRecommendedAmount(selectedVoucher);
|
|
492
|
+
const usageAmount = typeof selectedVoucher.edit_current_amount === "number" ? selectedVoucher.edit_current_amount : selectedVoucher._available_max_amount ?? getRecommendedAmount(selectedVoucher);
|
|
492
493
|
const maxDeduction = import_decimal.default.min(
|
|
493
494
|
new import_decimal.default(usageAmount),
|
|
494
495
|
new import_decimal.default(maxDeductionAmount),
|
|
@@ -13,7 +13,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
13
13
|
private store;
|
|
14
14
|
private request;
|
|
15
15
|
private logger;
|
|
16
|
-
private dbManager;
|
|
17
16
|
private window;
|
|
18
17
|
private cacheId;
|
|
19
18
|
private salesSummaryModuleName;
|
|
@@ -134,11 +133,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
134
133
|
private ensureExternalSaleNumber;
|
|
135
134
|
private ensureRequestUniqueIdempotencyToken;
|
|
136
135
|
private buildPaymentSyncIdempotencyToken;
|
|
137
|
-
hasLocalDatabase(): boolean;
|
|
138
|
-
private buildLocalOrderRecord;
|
|
139
|
-
getLocalOrderByOrderId(orderId: number | string): Promise<Record<string, any> | null>;
|
|
140
|
-
getLocalOrderByOrderNumber(orderNumber: string): Promise<Record<string, any> | null>;
|
|
141
|
-
getLocalOrderByExternalSaleNumber(externalSaleNumber: string): Promise<Record<string, any> | null>;
|
|
142
136
|
saveDraft(): Promise<void>;
|
|
143
137
|
private saveDraftInBackground;
|
|
144
138
|
private hydrateTempOrderFromLocalRecord;
|
|
@@ -147,8 +141,11 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
147
141
|
private calculatePaymentTotal;
|
|
148
142
|
private normalizePaymentSource;
|
|
149
143
|
private updateTempOrderPaymentStatus;
|
|
144
|
+
private resolveWalletPassUseValue;
|
|
145
|
+
private capVoucherPaymentsByRemainingAmount;
|
|
150
146
|
private calculatePaidPaymentSummary;
|
|
151
147
|
private calculatePaymentServiceFee;
|
|
148
|
+
private calculatePaymentGapAmount;
|
|
152
149
|
private formatSummaryMetadataMoney;
|
|
153
150
|
private syncSummaryProductMetadata;
|
|
154
151
|
private calculateSummaryAmountGap;
|
|
@@ -164,6 +161,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
164
161
|
addNewOrder(): Promise<OrderTempOrder>;
|
|
165
162
|
getOrderProducts(): OrderProduct[];
|
|
166
163
|
private getProductUid;
|
|
164
|
+
private sanitizeOrderProductForTempOrder;
|
|
165
|
+
private sanitizeTempOrderProducts;
|
|
167
166
|
private ensureExtend;
|
|
168
167
|
private captureProductRuntime;
|
|
169
168
|
private createLinkedProductAndBooking;
|
|
@@ -245,7 +244,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
245
244
|
* 提交当前 Sales tempOrder。
|
|
246
245
|
*
|
|
247
246
|
* smallTicketDataFlag 用于 B 端 checkout 小票数据返回。PaymentModal 在支付提交时
|
|
248
|
-
* 应传 1,确保 /order/sales/checkout 返回打印所需数据。
|
|
247
|
+
* 应传 1,确保 /shop/order/sales/checkout 返回打印所需数据。
|
|
249
248
|
*/
|
|
250
249
|
submitTempOrder<T = any>(params?: {
|
|
251
250
|
cacheId?: string;
|
|
@@ -265,7 +264,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
265
264
|
private logSubmitBackendRejected;
|
|
266
265
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
267
266
|
createOrder(params: CommitOrderParams['query']): {
|
|
268
|
-
type: "
|
|
267
|
+
type: "virtual" | "appointment_booking";
|
|
269
268
|
platform: string;
|
|
270
269
|
sales_channel: string;
|
|
271
270
|
order_sales_channel: string;
|
|
@@ -287,7 +286,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
287
286
|
* Checkout 专用:创建订单到后端
|
|
288
287
|
*
|
|
289
288
|
* 专门为 Checkout 模块设计的订单创建方法,
|
|
290
|
-
*
|
|
289
|
+
* 通过 OS Server 调用 checkout 接口创建订单
|
|
291
290
|
* 接收已经处理好的订单数据,无需再处理购物车
|
|
292
291
|
*
|
|
293
292
|
* @param params Checkout 订单参数(已处理的订单数据)
|
|
@@ -302,7 +301,10 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
302
301
|
* OrderModule 只负责校验 order_ids 并调用 /order/batch-email。
|
|
303
302
|
*/
|
|
304
303
|
sendCustomerPayLink<T = any>(params: SendCustomerPayLinkParams): Promise<T>;
|
|
305
|
-
|
|
304
|
+
getSalesOrderByLookup(params: {
|
|
305
|
+
lookup: number | string;
|
|
306
|
+
forceRemote?: boolean;
|
|
307
|
+
}): Promise<any>;
|
|
306
308
|
/**
|
|
307
309
|
* 把 sqlite / 后端返回的订单记录直接恢复为 tempOrder。
|
|
308
310
|
*
|