@pisell/pisellos 2.2.180 → 2.2.182
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/promotion/index.js +9 -0
- package/dist/modules/BookingContext/index.d.ts +37 -0
- package/dist/modules/BookingContext/index.js +436 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +276 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +137 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +75 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +215 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Customer/index.d.ts +6 -0
- package/dist/modules/Customer/index.js +129 -83
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.js +4 -3
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/Order/index.d.ts +101 -10
- package/dist/modules/Order/index.js +1444 -490
- package/dist/modules/Order/types.d.ts +201 -18
- package/dist/modules/Order/types.js +31 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
- package/dist/modules/Order/utils.d.ts +83 -1
- package/dist/modules/Order/utils.js +405 -61
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Quotation/index.d.ts +0 -1
- package/dist/modules/Quotation/index.js +23 -21
- package/dist/modules/Rules/index.d.ts +4 -0
- package/dist/modules/Rules/index.js +43 -39
- package/dist/modules/Rules/types.d.ts +1 -0
- package/dist/modules/SalesSummary/index.js +4 -2
- package/dist/modules/SalesSummary/utils.js +21 -7
- package/dist/modules/Schedule/index.js +6 -2
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +2 -1
- package/dist/server/index.js +87 -29
- package/dist/server/modules/order/index.d.ts +23 -0
- package/dist/server/modules/order/index.js +123 -46
- package/dist/server/modules/order/utils/filterOrders.js +20 -6
- package/dist/server/modules/products/index.d.ts +1 -1
- package/dist/server/modules/products/index.js +130 -113
- package/dist/server/modules/schedule/index.js +13 -6
- package/dist/solution/BaseSales/index.d.ts +89 -7
- package/dist/solution/BaseSales/index.js +1489 -366
- package/dist/solution/BaseSales/types.d.ts +67 -1
- package/dist/solution/BaseSales/types.js +3 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +275 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +1258 -0
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +68 -16
- package/dist/solution/BaseSales/utils.js +46 -8
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +152 -2
- package/dist/solution/BookingTicket/index.js +848 -184
- package/dist/solution/BookingTicket/types.d.ts +2 -0
- package/dist/solution/BookingTicket/types.js +3 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +113 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
- package/dist/solution/BookingTicket/utils/cartView.js +4 -2
- package/dist/solution/ScanOrder/index.d.ts +9 -3
- package/dist/solution/ScanOrder/index.js +231 -128
- package/dist/solution/ScanOrder/utils.js +46 -8
- package/dist/solution/VenueBooking/index.d.ts +5 -2
- package/dist/solution/VenueBooking/index.js +103 -55
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/BookingContext/index.d.ts +37 -0
- package/lib/modules/BookingContext/index.js +297 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +34 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +271 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +141 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +75 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +198 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +80 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +43 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +90 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +283 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +377 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
- package/lib/modules/Customer/index.d.ts +6 -0
- package/lib/modules/Customer/index.js +26 -11
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.js +5 -1
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Order/index.d.ts +101 -10
- package/lib/modules/Order/index.js +751 -114
- package/lib/modules/Order/types.d.ts +201 -18
- package/lib/modules/Order/types.js +1 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
- package/lib/modules/Order/utils.d.ts +83 -1
- package/lib/modules/Order/utils.js +340 -22
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Quotation/index.d.ts +0 -1
- package/lib/modules/Quotation/index.js +18 -15
- package/lib/modules/Rules/index.d.ts +4 -0
- package/lib/modules/Rules/index.js +26 -27
- package/lib/modules/Rules/types.d.ts +1 -0
- package/lib/modules/SalesSummary/index.js +4 -2
- package/lib/modules/SalesSummary/utils.js +21 -7
- package/lib/modules/Schedule/index.js +3 -1
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +3 -1
- package/lib/server/index.js +41 -4
- package/lib/server/modules/order/index.d.ts +23 -0
- package/lib/server/modules/order/index.js +46 -14
- package/lib/server/modules/order/utils/filterOrders.js +12 -4
- package/lib/server/modules/products/index.d.ts +1 -1
- package/lib/server/modules/products/index.js +30 -20
- package/lib/server/modules/schedule/index.js +2 -1
- package/lib/solution/BaseSales/index.d.ts +89 -7
- package/lib/solution/BaseSales/index.js +742 -23
- package/lib/solution/BaseSales/types.d.ts +67 -1
- package/lib/solution/BaseSales/types.js +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +275 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +836 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +71 -12
- package/lib/solution/BaseSales/utils.js +46 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +152 -2
- package/lib/solution/BookingTicket/index.js +389 -9
- package/lib/solution/BookingTicket/types.d.ts +2 -0
- package/lib/solution/BookingTicket/types.js +6 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +113 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
- package/lib/solution/BookingTicket/utils/cartView.js +4 -2
- package/lib/solution/ScanOrder/index.d.ts +9 -3
- package/lib/solution/ScanOrder/index.js +147 -66
- package/lib/solution/ScanOrder/utils.js +46 -6
- package/lib/solution/VenueBooking/index.d.ts +5 -2
- package/lib/solution/VenueBooking/index.js +50 -14
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@ export declare class OrderModule extends BaseModule implements Module {
|
|
|
18
18
|
private resourceIdIndex;
|
|
19
19
|
private logger;
|
|
20
20
|
private storage;
|
|
21
|
+
private orderSQLiteSaveQueue;
|
|
21
22
|
constructor(name?: string, version?: string);
|
|
22
23
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
23
24
|
/**
|
|
@@ -130,6 +131,28 @@ export declare class OrderModule extends BaseModule implements Module {
|
|
|
130
131
|
private getStorageItem;
|
|
131
132
|
private setStorageItem;
|
|
132
133
|
private loadOrdersFromSQLite;
|
|
134
|
+
/**
|
|
135
|
+
* 串行执行订单 SQLite 保存任务,保证 clear + bulkAdd 组合不会被其它订单保存插入。
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* await this.runInOrderSQLiteSaveQueue(async () => {
|
|
139
|
+
* await this.dbManager.clear(INDEXDB_STORE_NAME)
|
|
140
|
+
* await this.dbManager.bulkAdd(INDEXDB_STORE_NAME, orders)
|
|
141
|
+
* })
|
|
142
|
+
*/
|
|
143
|
+
private runInOrderSQLiteSaveQueue;
|
|
144
|
+
/**
|
|
145
|
+
* 保存订单列表到 SQLite,内部会先清空 orders 表再批量写入当前快照。
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* await this.saveOrdersToSQLite(this.store.list)
|
|
149
|
+
*/
|
|
133
150
|
private saveOrdersToSQLite;
|
|
151
|
+
/**
|
|
152
|
+
* 清空订单模块的内存数据和本地 SQLite 订单表。
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* await orderModule.clear()
|
|
156
|
+
*/
|
|
134
157
|
clear(): Promise<void>;
|
|
135
158
|
}
|
|
@@ -63,6 +63,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
63
63
|
_defineProperty(_assertThisInitialized(_this), "logger", void 0);
|
|
64
64
|
// LoggerManager 实例
|
|
65
65
|
_defineProperty(_assertThisInitialized(_this), "storage", void 0);
|
|
66
|
+
_defineProperty(_assertThisInitialized(_this), "orderSQLiteSaveQueue", Promise.resolve());
|
|
66
67
|
return _this;
|
|
67
68
|
}
|
|
68
69
|
_createClass(OrderModule, [{
|
|
@@ -1276,92 +1277,168 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1276
1277
|
}
|
|
1277
1278
|
return loadOrdersFromSQLite;
|
|
1278
1279
|
}()
|
|
1280
|
+
/**
|
|
1281
|
+
* 串行执行订单 SQLite 保存任务,保证 clear + bulkAdd 组合不会被其它订单保存插入。
|
|
1282
|
+
*
|
|
1283
|
+
* @example
|
|
1284
|
+
* await this.runInOrderSQLiteSaveQueue(async () => {
|
|
1285
|
+
* await this.dbManager.clear(INDEXDB_STORE_NAME)
|
|
1286
|
+
* await this.dbManager.bulkAdd(INDEXDB_STORE_NAME, orders)
|
|
1287
|
+
* })
|
|
1288
|
+
*/
|
|
1279
1289
|
}, {
|
|
1280
|
-
key: "
|
|
1281
|
-
value: function () {
|
|
1282
|
-
var
|
|
1290
|
+
key: "runInOrderSQLiteSaveQueue",
|
|
1291
|
+
value: (function () {
|
|
1292
|
+
var _runInOrderSQLiteSaveQueue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(task) {
|
|
1293
|
+
var queuedTask;
|
|
1283
1294
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1284
1295
|
while (1) switch (_context15.prev = _context15.next) {
|
|
1296
|
+
case 0:
|
|
1297
|
+
queuedTask = this.orderSQLiteSaveQueue.then(task, task);
|
|
1298
|
+
this.orderSQLiteSaveQueue = queuedTask.then(function () {
|
|
1299
|
+
return undefined;
|
|
1300
|
+
}, function () {
|
|
1301
|
+
return undefined;
|
|
1302
|
+
});
|
|
1303
|
+
return _context15.abrupt("return", queuedTask);
|
|
1304
|
+
case 3:
|
|
1305
|
+
case "end":
|
|
1306
|
+
return _context15.stop();
|
|
1307
|
+
}
|
|
1308
|
+
}, _callee15, this);
|
|
1309
|
+
}));
|
|
1310
|
+
function runInOrderSQLiteSaveQueue(_x8) {
|
|
1311
|
+
return _runInOrderSQLiteSaveQueue.apply(this, arguments);
|
|
1312
|
+
}
|
|
1313
|
+
return runInOrderSQLiteSaveQueue;
|
|
1314
|
+
}()
|
|
1315
|
+
/**
|
|
1316
|
+
* 保存订单列表到 SQLite,内部会先清空 orders 表再批量写入当前快照。
|
|
1317
|
+
*
|
|
1318
|
+
* @example
|
|
1319
|
+
* await this.saveOrdersToSQLite(this.store.list)
|
|
1320
|
+
*/
|
|
1321
|
+
)
|
|
1322
|
+
}, {
|
|
1323
|
+
key: "saveOrdersToSQLite",
|
|
1324
|
+
value: (function () {
|
|
1325
|
+
var _saveOrdersToSQLite = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(orderList) {
|
|
1326
|
+
var _this10 = this;
|
|
1327
|
+
var orderListSnapshot;
|
|
1328
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1329
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1285
1330
|
case 0:
|
|
1286
1331
|
if (this.dbManager) {
|
|
1287
|
-
|
|
1332
|
+
_context17.next = 2;
|
|
1288
1333
|
break;
|
|
1289
1334
|
}
|
|
1290
|
-
return
|
|
1335
|
+
return _context17.abrupt("return");
|
|
1291
1336
|
case 2:
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1337
|
+
orderListSnapshot = cloneDeep(orderList);
|
|
1338
|
+
_context17.prev = 3;
|
|
1339
|
+
_context17.next = 6;
|
|
1340
|
+
return this.runInOrderSQLiteSaveQueue( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1341
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1342
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1343
|
+
case 0:
|
|
1344
|
+
_this10.logInfo('saveOrdersToSQLite-开始', {
|
|
1345
|
+
count: orderListSnapshot.length
|
|
1346
|
+
});
|
|
1347
|
+
_context16.next = 3;
|
|
1348
|
+
return _this10.dbManager.clear(INDEXDB_STORE_NAME);
|
|
1349
|
+
case 3:
|
|
1350
|
+
_this10.logInfo('saveOrdersToSQLite-clear完成', {
|
|
1351
|
+
count: orderListSnapshot.length
|
|
1352
|
+
});
|
|
1353
|
+
if (!(orderListSnapshot.length === 0)) {
|
|
1354
|
+
_context16.next = 6;
|
|
1355
|
+
break;
|
|
1356
|
+
}
|
|
1357
|
+
return _context16.abrupt("return");
|
|
1358
|
+
case 6:
|
|
1359
|
+
_context16.next = 8;
|
|
1360
|
+
return _this10.dbManager.bulkAdd(INDEXDB_STORE_NAME, orderListSnapshot);
|
|
1361
|
+
case 8:
|
|
1362
|
+
_this10.logInfo('saveOrdersToSQLite-bulkAdd完成', {
|
|
1363
|
+
count: orderListSnapshot.length
|
|
1364
|
+
});
|
|
1365
|
+
case 9:
|
|
1366
|
+
case "end":
|
|
1367
|
+
return _context16.stop();
|
|
1368
|
+
}
|
|
1369
|
+
}, _callee16);
|
|
1370
|
+
})));
|
|
1298
1371
|
case 6:
|
|
1299
|
-
|
|
1300
|
-
count: orderList.length
|
|
1301
|
-
});
|
|
1302
|
-
if (!(orderList.length === 0)) {
|
|
1303
|
-
_context15.next = 9;
|
|
1304
|
-
break;
|
|
1305
|
-
}
|
|
1306
|
-
return _context15.abrupt("return");
|
|
1307
|
-
case 9:
|
|
1308
|
-
_context15.next = 11;
|
|
1309
|
-
return this.dbManager.bulkAdd(INDEXDB_STORE_NAME, orderList);
|
|
1310
|
-
case 11:
|
|
1311
|
-
this.logInfo('saveOrdersToSQLite-bulkAdd完成', {
|
|
1312
|
-
count: orderList.length
|
|
1313
|
-
});
|
|
1314
|
-
_context15.next = 17;
|
|
1372
|
+
_context17.next = 11;
|
|
1315
1373
|
break;
|
|
1316
|
-
case
|
|
1317
|
-
|
|
1318
|
-
|
|
1374
|
+
case 8:
|
|
1375
|
+
_context17.prev = 8;
|
|
1376
|
+
_context17.t0 = _context17["catch"](3);
|
|
1319
1377
|
// SQLite 异常,避免影响主流程
|
|
1320
1378
|
this.logError('保存订单到 SQLite 失败', {
|
|
1321
|
-
error:
|
|
1322
|
-
orderList:
|
|
1379
|
+
error: _context17.t0 instanceof Error ? _context17.t0.message : String(_context17.t0),
|
|
1380
|
+
orderList: orderListSnapshot.length
|
|
1323
1381
|
});
|
|
1324
|
-
case
|
|
1382
|
+
case 11:
|
|
1325
1383
|
case "end":
|
|
1326
|
-
return
|
|
1384
|
+
return _context17.stop();
|
|
1327
1385
|
}
|
|
1328
|
-
},
|
|
1386
|
+
}, _callee17, this, [[3, 8]]);
|
|
1329
1387
|
}));
|
|
1330
|
-
function saveOrdersToSQLite(
|
|
1388
|
+
function saveOrdersToSQLite(_x9) {
|
|
1331
1389
|
return _saveOrdersToSQLite.apply(this, arguments);
|
|
1332
1390
|
}
|
|
1333
1391
|
return saveOrdersToSQLite;
|
|
1334
1392
|
}()
|
|
1393
|
+
/**
|
|
1394
|
+
* 清空订单模块的内存数据和本地 SQLite 订单表。
|
|
1395
|
+
*
|
|
1396
|
+
* @example
|
|
1397
|
+
* await orderModule.clear()
|
|
1398
|
+
*/
|
|
1399
|
+
)
|
|
1335
1400
|
}, {
|
|
1336
1401
|
key: "clear",
|
|
1337
|
-
value: function () {
|
|
1338
|
-
var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1339
|
-
|
|
1340
|
-
|
|
1402
|
+
value: (function () {
|
|
1403
|
+
var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1404
|
+
var _this11 = this;
|
|
1405
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1406
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1341
1407
|
case 0:
|
|
1342
1408
|
this.store.list = [];
|
|
1343
1409
|
this.store.map = new Map();
|
|
1344
1410
|
this.resourceIdIndex.clear();
|
|
1345
1411
|
if (!this.dbManager) {
|
|
1346
|
-
|
|
1412
|
+
_context19.next = 6;
|
|
1347
1413
|
break;
|
|
1348
1414
|
}
|
|
1349
|
-
|
|
1350
|
-
return this.
|
|
1415
|
+
_context19.next = 6;
|
|
1416
|
+
return this.runInOrderSQLiteSaveQueue( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1417
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1418
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1419
|
+
case 0:
|
|
1420
|
+
_context18.next = 2;
|
|
1421
|
+
return _this11.dbManager.clear(INDEXDB_STORE_NAME);
|
|
1422
|
+
case 2:
|
|
1423
|
+
case "end":
|
|
1424
|
+
return _context18.stop();
|
|
1425
|
+
}
|
|
1426
|
+
}, _callee18);
|
|
1427
|
+
})));
|
|
1351
1428
|
case 6:
|
|
1352
1429
|
this.setStorageItem(ORDER_LAST_FULL_FETCH_AT_STORAGE_KEY, '');
|
|
1353
1430
|
this.core.effects.emit(OrderHooks.onOrdersChanged, this.store.list);
|
|
1354
1431
|
case 8:
|
|
1355
1432
|
case "end":
|
|
1356
|
-
return
|
|
1433
|
+
return _context19.stop();
|
|
1357
1434
|
}
|
|
1358
|
-
},
|
|
1435
|
+
}, _callee19, this);
|
|
1359
1436
|
}));
|
|
1360
1437
|
function clear() {
|
|
1361
1438
|
return _clear.apply(this, arguments);
|
|
1362
1439
|
}
|
|
1363
1440
|
return clear;
|
|
1364
|
-
}()
|
|
1441
|
+
}())
|
|
1365
1442
|
}]);
|
|
1366
1443
|
return OrderModule;
|
|
1367
1444
|
}(BaseModule);
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
|
+
/** 从订单 payments 提取支付方式 code,与 UI 筛选选项及 filterBookings 一致 */
|
|
3
|
+
function getOrderPaymentCodes(order) {
|
|
4
|
+
var payments = order.payments;
|
|
5
|
+
if (!Array.isArray(payments) || payments.length === 0) {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
return payments.map(function (item) {
|
|
9
|
+
return item === null || item === void 0 ? void 0 : item.code;
|
|
10
|
+
}).filter(function (code) {
|
|
11
|
+
return typeof code === 'string' && code.length > 0;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
2
15
|
/**
|
|
3
16
|
* 订单过滤函数
|
|
4
17
|
* @param orders 原始订单列表
|
|
@@ -126,22 +139,23 @@ export function filterOrders(orders, filters) {
|
|
|
126
139
|
}
|
|
127
140
|
}
|
|
128
141
|
|
|
129
|
-
// payment_methods -
|
|
142
|
+
// payment_methods - 支付方式(按 payments[].code 匹配,不再使用 order.payment_methods)
|
|
130
143
|
if (safeFilters.payment_methods && safeFilters.payment_methods.length > 0) {
|
|
131
|
-
|
|
144
|
+
var orderPaymentCodes = getOrderPaymentCodes(order);
|
|
145
|
+
if (orderPaymentCodes.length === 0) {
|
|
132
146
|
rejected.push({
|
|
133
147
|
order_id: order.order_id,
|
|
134
148
|
order_number: order.order_number,
|
|
135
149
|
reason: {
|
|
136
150
|
field: 'payment_methods',
|
|
137
|
-
actual: order.
|
|
151
|
+
actual: order.payments,
|
|
138
152
|
expected: safeFilters.payment_methods
|
|
139
153
|
}
|
|
140
154
|
});
|
|
141
155
|
return false;
|
|
142
156
|
}
|
|
143
|
-
var hasMatch =
|
|
144
|
-
return safeFilters.payment_methods.includes(
|
|
157
|
+
var hasMatch = orderPaymentCodes.some(function (code) {
|
|
158
|
+
return safeFilters.payment_methods.includes(code);
|
|
145
159
|
});
|
|
146
160
|
if (!hasMatch) {
|
|
147
161
|
rejected.push({
|
|
@@ -149,7 +163,7 @@ export function filterOrders(orders, filters) {
|
|
|
149
163
|
order_number: order.order_number,
|
|
150
164
|
reason: {
|
|
151
165
|
field: 'payment_methods',
|
|
152
|
-
actual:
|
|
166
|
+
actual: orderPaymentCodes,
|
|
153
167
|
expected: safeFilters.payment_methods
|
|
154
168
|
}
|
|
155
169
|
});
|
|
@@ -21,7 +21,7 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
21
21
|
private isPriceFormatterRegistered;
|
|
22
22
|
private quotationPriceBridge?;
|
|
23
23
|
private quotationBridgeChannel?;
|
|
24
|
-
private
|
|
24
|
+
private quotationBridgeLoadedKey?;
|
|
25
25
|
private quotationBridgeRefreshPromise?;
|
|
26
26
|
private quotationBridgeRefreshKey?;
|
|
27
27
|
private productDataSource;
|