@pisell/pisellos 2.3.62 → 2.3.64
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/core/index.d.ts +0 -7
- package/dist/core/index.js +65 -109
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -1
- package/dist/model/strategy/adapter/walletPass/utils.js +0 -2
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +7 -3
- package/dist/modules/Customer/index.d.ts +4 -0
- package/dist/modules/Customer/index.js +91 -59
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Order/index.js +4 -1
- package/dist/modules/Order/utils.js +36 -30
- package/dist/modules/Payment/walletpass.js +4 -5
- package/dist/modules/Quotation/index.d.ts +0 -6
- package/dist/modules/Quotation/index.js +19 -75
- package/dist/plugins/request.d.ts +0 -1
- package/dist/server/index.d.ts +2 -6
- package/dist/server/index.js +92 -133
- package/dist/server/modules/floor-plan/index.d.ts +0 -4
- package/dist/server/modules/floor-plan/index.js +98 -240
- package/dist/server/modules/menu/index.js +23 -48
- package/dist/server/modules/order/index.d.ts +8 -12
- package/dist/server/modules/order/index.js +348 -342
- package/dist/server/modules/products/index.d.ts +2 -8
- package/dist/server/modules/products/index.js +75 -167
- package/dist/server/modules/resource/index.js +13 -21
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
- package/dist/solution/BookingTicket/index.d.ts +2 -0
- package/dist/solution/BookingTicket/index.js +34 -10
- package/lib/core/index.d.ts +0 -7
- package/lib/core/index.js +2 -20
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -1
- package/lib/model/strategy/adapter/walletPass/utils.js +0 -1
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -0
- package/lib/modules/Customer/index.d.ts +4 -0
- package/lib/modules/Customer/index.js +11 -0
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Order/index.js +3 -2
- package/lib/modules/Order/utils.js +3 -0
- package/lib/modules/Payment/walletpass.js +0 -1
- package/lib/modules/Quotation/index.d.ts +0 -6
- package/lib/modules/Quotation/index.js +5 -49
- package/lib/plugins/request.d.ts +0 -1
- package/lib/server/index.d.ts +2 -6
- package/lib/server/index.js +12 -34
- package/lib/server/modules/floor-plan/index.d.ts +0 -4
- package/lib/server/modules/floor-plan/index.js +6 -54
- package/lib/server/modules/menu/index.js +5 -31
- package/lib/server/modules/order/index.d.ts +8 -12
- package/lib/server/modules/order/index.js +94 -145
- package/lib/server/modules/products/index.d.ts +2 -8
- package/lib/server/modules/products/index.js +24 -97
- package/lib/server/modules/resource/index.js +2 -7
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -0
- package/lib/solution/BookingTicket/index.d.ts +2 -0
- package/lib/solution/BookingTicket/index.js +18 -2
- package/package.json +1 -1
|
@@ -688,11 +688,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
688
688
|
return null;
|
|
689
689
|
}
|
|
690
690
|
}, {
|
|
691
|
-
key: "
|
|
691
|
+
key: "resolveCustomerById",
|
|
692
692
|
value: function () {
|
|
693
|
-
var
|
|
693
|
+
var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(customerId) {
|
|
694
694
|
var _result$list;
|
|
695
|
-
var localCustomers, localCustomer, normalizedLocalCustomer, result, remoteCustomer;
|
|
695
|
+
var localCustomers, localCustomer, normalizedLocalCustomer, result, remoteCustomer, detailCustomer;
|
|
696
696
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
697
697
|
while (1) switch (_context9.prev = _context9.next) {
|
|
698
698
|
case 0:
|
|
@@ -714,18 +714,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
714
714
|
case 7:
|
|
715
715
|
result = _context9.sent;
|
|
716
716
|
remoteCustomer = this.findCustomerById((result === null || result === void 0 ? void 0 : result.list) || [], customerId) || (result === null || result === void 0 || (_result$list = result.list) === null || _result$list === void 0 ? void 0 : _result$list[0]) || null;
|
|
717
|
-
|
|
718
|
-
|
|
717
|
+
if (!remoteCustomer) {
|
|
718
|
+
_context9.next = 11;
|
|
719
|
+
break;
|
|
720
|
+
}
|
|
721
|
+
return _context9.abrupt("return", this.normalizeCustomer(remoteCustomer));
|
|
722
|
+
case 11:
|
|
723
|
+
_context9.prev = 11;
|
|
724
|
+
_context9.next = 14;
|
|
725
|
+
return this.store.customer.queryCustomerDetail(customerId);
|
|
726
|
+
case 14:
|
|
727
|
+
detailCustomer = _context9.sent;
|
|
728
|
+
return _context9.abrupt("return", detailCustomer ? this.normalizeCustomer(detailCustomer) : null);
|
|
729
|
+
case 18:
|
|
730
|
+
_context9.prev = 18;
|
|
731
|
+
_context9.t0 = _context9["catch"](11);
|
|
732
|
+
console.warn('[BookingTicket] resolveCustomerById detail request failed', {
|
|
733
|
+
customerId: customerId,
|
|
734
|
+
error: _context9.t0
|
|
735
|
+
});
|
|
736
|
+
return _context9.abrupt("return", null);
|
|
737
|
+
case 22:
|
|
719
738
|
case "end":
|
|
720
739
|
return _context9.stop();
|
|
721
740
|
}
|
|
722
|
-
}, _callee9, this);
|
|
741
|
+
}, _callee9, this, [[11, 18]]);
|
|
723
742
|
}));
|
|
724
|
-
function
|
|
725
|
-
return
|
|
743
|
+
function resolveCustomerById(_x6) {
|
|
744
|
+
return _resolveCustomerById.apply(this, arguments);
|
|
726
745
|
}
|
|
727
|
-
return
|
|
728
|
-
}()
|
|
746
|
+
return resolveCustomerById;
|
|
747
|
+
}() /** 兼容既有优惠码扫码逻辑。 */
|
|
748
|
+
}, {
|
|
749
|
+
key: "resolveCustomerByDiscountCustomerId",
|
|
750
|
+
value: function resolveCustomerByDiscountCustomerId(customerId) {
|
|
751
|
+
return this.resolveCustomerById(customerId);
|
|
752
|
+
}
|
|
729
753
|
}, {
|
|
730
754
|
key: "findCustomerById",
|
|
731
755
|
value: function findCustomerById() {
|
package/lib/core/index.d.ts
CHANGED
|
@@ -12,15 +12,8 @@ declare class PisellOSCore implements PisellCore {
|
|
|
12
12
|
context: BusinessContext;
|
|
13
13
|
server: any;
|
|
14
14
|
serverOptions?: ServerOptions;
|
|
15
|
-
private serverModulePromise?;
|
|
16
15
|
constructor(options?: PisellOSOptions);
|
|
17
16
|
private initialize;
|
|
18
|
-
/**
|
|
19
|
-
* 仅预加载 Server 模块代码,不创建实例、不注册模块、不请求业务数据。
|
|
20
|
-
* 导入失败会清空 Promise,正式 initializeServer 时仍可重新尝试。
|
|
21
|
-
*/
|
|
22
|
-
preloadServerModule(): Promise<void>;
|
|
23
|
-
private loadServerModule;
|
|
24
17
|
/**
|
|
25
18
|
* 初始化 Server(公开方法,需要外部显式调用并等待)
|
|
26
19
|
* Server 配置从构造函数传入的 options.server 中获取
|
package/lib/core/index.js
CHANGED
|
@@ -36,6 +36,7 @@ module.exports = __toCommonJS(core_exports);
|
|
|
36
36
|
var import_createStore = require("../store/createStore");
|
|
37
37
|
var import_effects = require("../effects");
|
|
38
38
|
var PisellOSCore = class {
|
|
39
|
+
// 保存 Server 配置
|
|
39
40
|
constructor(options) {
|
|
40
41
|
this.plugins = /* @__PURE__ */ new Map();
|
|
41
42
|
this.modules = /* @__PURE__ */ new Map();
|
|
@@ -49,7 +50,6 @@ var PisellOSCore = class {
|
|
|
49
50
|
this.serverOptions = options.server;
|
|
50
51
|
}
|
|
51
52
|
this.initialize(options);
|
|
52
|
-
console.log("constructor123456");
|
|
53
53
|
}
|
|
54
54
|
initialize(options) {
|
|
55
55
|
if (options == null ? void 0 : options.plugins) {
|
|
@@ -64,24 +64,6 @@ var PisellOSCore = class {
|
|
|
64
64
|
}
|
|
65
65
|
this.log("[PisellOS] 核心初始化完成");
|
|
66
66
|
}
|
|
67
|
-
/**
|
|
68
|
-
* 仅预加载 Server 模块代码,不创建实例、不注册模块、不请求业务数据。
|
|
69
|
-
* 导入失败会清空 Promise,正式 initializeServer 时仍可重新尝试。
|
|
70
|
-
*/
|
|
71
|
-
async preloadServerModule() {
|
|
72
|
-
if (this.server || !this.serverOptions)
|
|
73
|
-
return;
|
|
74
|
-
await this.loadServerModule();
|
|
75
|
-
}
|
|
76
|
-
loadServerModule() {
|
|
77
|
-
if (!this.serverModulePromise) {
|
|
78
|
-
this.serverModulePromise = import("../server").catch((error) => {
|
|
79
|
-
this.serverModulePromise = void 0;
|
|
80
|
-
throw error;
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
return this.serverModulePromise;
|
|
84
|
-
}
|
|
85
67
|
/**
|
|
86
68
|
* 初始化 Server(公开方法,需要外部显式调用并等待)
|
|
87
69
|
* Server 配置从构造函数传入的 options.server 中获取
|
|
@@ -96,7 +78,7 @@ var PisellOSCore = class {
|
|
|
96
78
|
return;
|
|
97
79
|
}
|
|
98
80
|
try {
|
|
99
|
-
const ServerModule = await
|
|
81
|
+
const ServerModule = await import("../server");
|
|
100
82
|
const Server = ServerModule.default;
|
|
101
83
|
this.server = new Server(this);
|
|
102
84
|
this.log("Server 实例已创建");
|
|
@@ -1,51 +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
|
-
ITEM_REWARD_STRATEGY: () => import_examples.ITEM_REWARD_STRATEGY,
|
|
34
|
-
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
35
|
-
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
36
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
37
|
-
default: () => import_adapter2.default
|
|
38
|
-
});
|
|
39
|
-
module.exports = __toCommonJS(promotion_exports);
|
|
40
|
-
var import_evaluator = require("./evaluator");
|
|
41
|
-
var import_adapter = require("./adapter");
|
|
42
|
-
var import_adapter2 = __toESM(require("./adapter"));
|
|
43
|
-
var import_examples = require("./examples");
|
|
44
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
-
0 && (module.exports = {
|
|
46
|
-
BUY_X_GET_Y_FREE_STRATEGY,
|
|
47
|
-
ITEM_REWARD_STRATEGY,
|
|
48
|
-
PromotionAdapter,
|
|
49
|
-
PromotionEvaluator,
|
|
50
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
51
|
-
});
|
|
@@ -415,7 +415,6 @@ var WalletPassEvaluator = class {
|
|
|
415
415
|
* 计算适用商品的总金额和数量
|
|
416
416
|
*/
|
|
417
417
|
calculateApplicableProducts(products, applicableProductIds, deductTaxAndFee) {
|
|
418
|
-
console.log(products, "products1234");
|
|
419
418
|
let total = 0;
|
|
420
419
|
let count = 0;
|
|
421
420
|
if (applicableProductIds !== null && applicableProductIds.length === 0) {
|
|
@@ -166,7 +166,6 @@ var getApplicableProducts = (voucher, productsData) => {
|
|
|
166
166
|
return productsData.filter((p) => applicableProductIds.includes(p.product_id));
|
|
167
167
|
};
|
|
168
168
|
function processVouchers(applicableVouchers, orderTotalAmount, products) {
|
|
169
|
-
console.log(products, "products123");
|
|
170
169
|
const productsCopy = expandProductsWithBundleItems(products, true);
|
|
171
170
|
let remainingOrderAmount = new import_decimal.default(orderTotalAmount);
|
|
172
171
|
const getItemPassUsage = (usageMap, walletPassProductId, lineKey) => {
|
|
@@ -202,6 +202,8 @@ function buildCacheItemFromOrderLine(input) {
|
|
|
202
202
|
const productTitle = resolveProductTitle(product, booking, sourceProduct);
|
|
203
203
|
const productCover = resolveProductCover(product, booking, sourceProduct);
|
|
204
204
|
const productOptionString = (0, import_orderLineDisplay.buildProductOptionStringFromOrderLine)(product);
|
|
205
|
+
const hasBundle = Array.isArray(product.product_bundle) && product.product_bundle.length > 0;
|
|
206
|
+
const bundleEdit = product.bundle_edit ?? (hasBundle ? 0 : void 0);
|
|
205
207
|
const other = {
|
|
206
208
|
product_variant_id: product.product_variant_id ?? 0,
|
|
207
209
|
option: (0, import_utils.getProductSkuOptions)(product),
|
|
@@ -234,6 +236,7 @@ function buildCacheItemFromOrderLine(input) {
|
|
|
234
236
|
product.discount_list,
|
|
235
237
|
(_c = product.metadata) == null ? void 0 : _c.product_discount_reason
|
|
236
238
|
) || void 0,
|
|
239
|
+
...bundleEdit !== void 0 ? { bundle_edit: bundleEdit } : {},
|
|
237
240
|
...productOptionString ? { product_option_string: productOptionString } : {}
|
|
238
241
|
};
|
|
239
242
|
const manualDiscount = (product.discount_list || []).find((d) => (d == null ? void 0 : d.type) === "product");
|
|
@@ -44,6 +44,10 @@ export declare class CustomerModule extends BaseModule implements Module, Custom
|
|
|
44
44
|
* 用于按 ID 补齐客户等内部查询,避免把临时的 num/searchParams 污染到滚动列表。
|
|
45
45
|
*/
|
|
46
46
|
queryCustomerList(params?: ShopGetCustomerListParams): Promise<ICustomerListResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* 查询单个客户详情,不写入 customerList / pagination 状态。
|
|
49
|
+
*/
|
|
50
|
+
queryCustomerDetail(id: string | number): Promise<ShopCustomer | null>;
|
|
47
51
|
/**
|
|
48
52
|
* 获取客户列表
|
|
49
53
|
* @param params 查询参数
|
|
@@ -201,6 +201,17 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
201
201
|
pageSize
|
|
202
202
|
};
|
|
203
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* 查询单个客户详情,不写入 customerList / pagination 状态。
|
|
206
|
+
*/
|
|
207
|
+
async queryCustomerDetail(id) {
|
|
208
|
+
var _a;
|
|
209
|
+
const result = await this.request.get(`/customer/info/${id}`, {
|
|
210
|
+
with_trashed: 1
|
|
211
|
+
});
|
|
212
|
+
const customer = ((_a = result == null ? void 0 : result.data) == null ? void 0 : _a.customer) || (result == null ? void 0 : result.data) || (result == null ? void 0 : result.customer) || null;
|
|
213
|
+
return customer && typeof customer === "object" ? customer : null;
|
|
214
|
+
}
|
|
204
215
|
/**
|
|
205
216
|
* 获取客户列表
|
|
206
217
|
* @param params 查询参数
|
|
@@ -112,6 +112,8 @@ export interface CustomerModuleAPI {
|
|
|
112
112
|
getCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
|
|
113
113
|
/** 查询客户列表但不更新列表分页状态 */
|
|
114
114
|
queryCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
|
|
115
|
+
/** 查询单个客户详情但不修改客户列表状态 */
|
|
116
|
+
queryCustomerDetail: (id: string | number) => Promise<ShopCustomer | null>;
|
|
115
117
|
/** 设置客户列表 */
|
|
116
118
|
setCustomerList: (customers: ShopCustomer[], total?: number) => void;
|
|
117
119
|
/** 设置当前选择的客户 */
|
|
@@ -4746,8 +4746,9 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
4746
4746
|
delete row[`product_${"option"}_item`];
|
|
4747
4747
|
if (!Array.isArray(row.product_bundle))
|
|
4748
4748
|
row.product_bundle = [];
|
|
4749
|
-
|
|
4750
|
-
|
|
4749
|
+
row.metadata = row.metadata && typeof row.metadata === "object" ? { ...row.metadata } : {};
|
|
4750
|
+
delete row.bundle_edit;
|
|
4751
|
+
delete row.metadata.bundle_edit;
|
|
4751
4752
|
if (row.booking_uid && !row.metadata.booking_uid) {
|
|
4752
4753
|
row.metadata.booking_uid = row.booking_uid;
|
|
4753
4754
|
}
|
|
@@ -801,6 +801,8 @@ function normalizeSubmitProduct(product) {
|
|
|
801
801
|
delete productRest[`product_${"option"}_item`];
|
|
802
802
|
const rawMetadata = submitProduct.metadata || {};
|
|
803
803
|
const bookingUid = rawMetadata.booking_uid;
|
|
804
|
+
const hasProductBundle = Array.isArray(submitProduct.product_bundle) && submitProduct.product_bundle.length > 0;
|
|
805
|
+
const bundleEdit = submitProduct.bundle_edit ?? rawMetadata.bundle_edit ?? (hasProductBundle ? 0 : void 0);
|
|
804
806
|
const cleanMetadata = {};
|
|
805
807
|
if (rawMetadata.unique_identification_number) {
|
|
806
808
|
cleanMetadata.unique_identification_number = rawMetadata.unique_identification_number;
|
|
@@ -843,6 +845,7 @@ function normalizeSubmitProduct(product) {
|
|
|
843
845
|
return {
|
|
844
846
|
...productRest,
|
|
845
847
|
...bookingUid ? { booking_uid: bookingUid } : {},
|
|
848
|
+
...bundleEdit !== void 0 ? { bundle_edit: bundleEdit } : {},
|
|
846
849
|
product_quantity: toBundleNumber(num ?? submitProduct.product_quantity, 1),
|
|
847
850
|
product_sku: productSku,
|
|
848
851
|
discount_list: collectSubmitProductDiscountList(submitProduct),
|
|
@@ -543,7 +543,6 @@ var WalletPassPaymentImpl = class {
|
|
|
543
543
|
vouchers: allList
|
|
544
544
|
});
|
|
545
545
|
const { recommended, transformList, noApplicableVoucher, recommendedAmount } = res;
|
|
546
|
-
console.log(res, "resres12");
|
|
547
546
|
this.walletRecommendList = recommended;
|
|
548
547
|
this.walletInitData = {
|
|
549
548
|
transformList,
|
|
@@ -9,8 +9,6 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
9
9
|
private request;
|
|
10
10
|
private store;
|
|
11
11
|
private scheduleResolver?;
|
|
12
|
-
private app;
|
|
13
|
-
private quotationListUpdatedListener?;
|
|
14
12
|
constructor(name?: string, version?: string);
|
|
15
13
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
16
14
|
loadQuotations(params?: {
|
|
@@ -18,7 +16,6 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
18
16
|
customer_id?: number | string;
|
|
19
17
|
}): Promise<void>;
|
|
20
18
|
getQuotationList(): QuotationItem[];
|
|
21
|
-
setQuotationListUpdatedListener(listener?: () => void): void;
|
|
22
19
|
getQuotationCustomerScopeInfo(): QuotationCustomerScopeInfo;
|
|
23
20
|
/**
|
|
24
21
|
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
@@ -63,9 +60,6 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
63
60
|
customer_id?: number | string;
|
|
64
61
|
}): Map<string, string | null>;
|
|
65
62
|
setScheduleResolver(resolver: (id: number) => ScheduleItem | undefined): void;
|
|
66
|
-
private applyQuotationResponse;
|
|
67
|
-
private notifyQuotationListUpdated;
|
|
68
|
-
private getQuotationCacheKeyData;
|
|
69
63
|
private isQuotationVisibleForCustomer;
|
|
70
64
|
private hasValidCustomerId;
|
|
71
65
|
private normalizeCustomerId;
|
|
@@ -32,49 +32,32 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
|
32
32
|
this.store = { list: [] };
|
|
33
33
|
}
|
|
34
34
|
async initialize(core, options) {
|
|
35
|
-
var _a, _b;
|
|
36
35
|
this.core = core;
|
|
37
36
|
this.request = core.getPlugin("request");
|
|
38
37
|
if (!this.request)
|
|
39
38
|
throw new Error("QuotationModule 需要 request 插件支持");
|
|
40
|
-
this.app = (_b = (_a = core.getPlugin("app")) == null ? void 0 : _a.getApp) == null ? void 0 : _b.call(_a);
|
|
41
39
|
this.store = { list: [] };
|
|
42
40
|
}
|
|
43
41
|
async loadQuotations(params) {
|
|
42
|
+
var _a;
|
|
44
43
|
const query = {};
|
|
45
44
|
if (params == null ? void 0 : params.channel)
|
|
46
45
|
query.channel = params.channel;
|
|
47
46
|
if ((params == null ? void 0 : params.channel) === "online_store") {
|
|
48
47
|
query.channel = "online-store";
|
|
49
48
|
}
|
|
50
|
-
let initialResultApplied = false;
|
|
51
|
-
const applyRemoteUpdate = (response) => {
|
|
52
|
-
this.applyQuotationResponse(response);
|
|
53
|
-
if (initialResultApplied) {
|
|
54
|
-
this.notifyQuotationListUpdated();
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
49
|
const res = await this.request.get(
|
|
58
50
|
"/quotation/available",
|
|
59
51
|
query,
|
|
60
|
-
{
|
|
61
|
-
cache: {
|
|
62
|
-
type: "indexDB",
|
|
63
|
-
updateCache: true,
|
|
64
|
-
cacheKeyData: this.getQuotationCacheKeyData(query)
|
|
65
|
-
},
|
|
66
|
-
cacheUpdateChange: applyRemoteUpdate
|
|
67
|
-
}
|
|
52
|
+
{ useCache: false, osServer: true }
|
|
68
53
|
);
|
|
69
|
-
|
|
70
|
-
|
|
54
|
+
const list = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || (res == null ? void 0 : res.list) || [];
|
|
55
|
+
list.sort((a, b) => b.sort - a.sort);
|
|
56
|
+
this.store.list = list;
|
|
71
57
|
}
|
|
72
58
|
getQuotationList() {
|
|
73
59
|
return this.store.list;
|
|
74
60
|
}
|
|
75
|
-
setQuotationListUpdatedListener(listener) {
|
|
76
|
-
this.quotationListUpdatedListener = listener;
|
|
77
|
-
}
|
|
78
61
|
getQuotationCustomerScopeInfo() {
|
|
79
62
|
const customerById = /* @__PURE__ */ new Map();
|
|
80
63
|
const quotationScopes = this.store.list.filter((quotation) => Array.isArray(quotation.customer) && quotation.customer.length > 0).map((quotation) => {
|
|
@@ -173,33 +156,6 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
|
173
156
|
setScheduleResolver(resolver) {
|
|
174
157
|
this.scheduleResolver = resolver;
|
|
175
158
|
}
|
|
176
|
-
applyQuotationResponse(response) {
|
|
177
|
-
var _a;
|
|
178
|
-
const source = ((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) || (response == null ? void 0 : response.list) || [];
|
|
179
|
-
this.store.list = [...source].sort((a, b) => Number(b.sort || 0) - Number(a.sort || 0));
|
|
180
|
-
}
|
|
181
|
-
notifyQuotationListUpdated() {
|
|
182
|
-
var _a;
|
|
183
|
-
try {
|
|
184
|
-
(_a = this.quotationListUpdatedListener) == null ? void 0 : _a.call(this);
|
|
185
|
-
} catch (error) {
|
|
186
|
-
console.warn("[QuotationModule] 报价单后台更新回调失败", error);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
getQuotationCacheKeyData(query) {
|
|
190
|
-
var _a, _b, _c;
|
|
191
|
-
let shopId = "";
|
|
192
|
-
try {
|
|
193
|
-
const storedCore = (_c = (_b = (_a = this.app) == null ? void 0 : _a.storage) == null ? void 0 : _b.getStorage) == null ? void 0 : _c.call(_b, "core");
|
|
194
|
-
const coreInfo = typeof storedCore === "string" ? JSON.parse(storedCore || "{}") : storedCore || {};
|
|
195
|
-
shopId = String((coreInfo == null ? void 0 : coreInfo.id) || "");
|
|
196
|
-
} catch {
|
|
197
|
-
}
|
|
198
|
-
return {
|
|
199
|
-
...query,
|
|
200
|
-
shop_id: shopId
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
159
|
isQuotationVisibleForCustomer(quotation, customerId) {
|
|
204
160
|
const customers = quotation.customer || [];
|
|
205
161
|
if (customers.length === 0)
|
package/lib/plugins/request.d.ts
CHANGED
package/lib/server/index.d.ts
CHANGED
|
@@ -157,17 +157,13 @@ declare class Server {
|
|
|
157
157
|
* 重新拉取全量 SSE 接口,更新本地数据后触发 onProductsSyncCompleted
|
|
158
158
|
* 不影响当前界面展示,适用于切回前台、定时刷新等场景
|
|
159
159
|
*/
|
|
160
|
-
refreshProductsInBackground(
|
|
161
|
-
trigger?: string;
|
|
162
|
-
}): Promise<void>;
|
|
160
|
+
refreshProductsInBackground(): Promise<void>;
|
|
163
161
|
/**
|
|
164
162
|
* 后台静默刷新订单数据
|
|
165
163
|
* 重新拉取全量 SSE 接口,更新本地数据后触发 onOrdersSyncCompleted
|
|
166
164
|
* 不影响当前界面展示,适用于切回前台、定时刷新等场景
|
|
167
165
|
*/
|
|
168
|
-
refreshOrdersInBackground(
|
|
169
|
-
trigger?: string;
|
|
170
|
-
}): Promise<void>;
|
|
166
|
+
refreshOrdersInBackground(): Promise<void>;
|
|
171
167
|
/**
|
|
172
168
|
* 编辑正式订单时强制查询 Server 最新快照并覆盖本地缓存。
|
|
173
169
|
* 商品成员增删由 OrderModule 在 SQLite/Store 更新完成后广播,
|
package/lib/server/index.js
CHANGED
|
@@ -795,8 +795,7 @@ var Server = class {
|
|
|
795
795
|
checkoutData,
|
|
796
796
|
order: printableOrder,
|
|
797
797
|
response: null,
|
|
798
|
-
requireFullyPaid: false
|
|
799
|
-
isManualPrint: true
|
|
798
|
+
requireFullyPaid: false
|
|
800
799
|
});
|
|
801
800
|
return {
|
|
802
801
|
code: 200,
|
|
@@ -1688,22 +1687,11 @@ var Server = class {
|
|
|
1688
1687
|
return;
|
|
1689
1688
|
}
|
|
1690
1689
|
try {
|
|
1690
|
+
await this.schedule.loadAllSchedule();
|
|
1691
1691
|
this.products.clearPriceCache();
|
|
1692
1692
|
await this.products.setupQuotationPriceBridge({
|
|
1693
1693
|
scheduleModule: this.schedule,
|
|
1694
|
-
channel: (_a = this.core.context) == null ? void 0 : _a.channel
|
|
1695
|
-
onQuotationUpdated: () => {
|
|
1696
|
-
void this.recomputeAndNotifyProductQuery();
|
|
1697
|
-
}
|
|
1698
|
-
});
|
|
1699
|
-
void this.schedule.loadAllSchedule().then(() => {
|
|
1700
|
-
var _a2;
|
|
1701
|
-
(_a2 = this.products) == null ? void 0 : _a2.clearPriceCache();
|
|
1702
|
-
void this.recomputeAndNotifyProductQuery();
|
|
1703
|
-
}).catch((error) => {
|
|
1704
|
-
this.logWarning("Products 报价单价格桥接后台刷新 Schedule 失败,继续使用本地数据", {
|
|
1705
|
-
error: error instanceof Error ? error.message : String(error)
|
|
1706
|
-
});
|
|
1694
|
+
channel: (_a = this.core.context) == null ? void 0 : _a.channel
|
|
1707
1695
|
});
|
|
1708
1696
|
this.logInfo("Products 报价单价格桥接初始化完成");
|
|
1709
1697
|
} catch (error) {
|
|
@@ -1761,27 +1749,22 @@ var Server = class {
|
|
|
1761
1749
|
* 重新拉取全量 SSE 接口,更新本地数据后触发 onProductsSyncCompleted
|
|
1762
1750
|
* 不影响当前界面展示,适用于切回前台、定时刷新等场景
|
|
1763
1751
|
*/
|
|
1764
|
-
async refreshProductsInBackground(
|
|
1752
|
+
async refreshProductsInBackground() {
|
|
1765
1753
|
if (!this.products) {
|
|
1766
1754
|
this.logWarning("refreshProductsInBackground: Products 模块未注册");
|
|
1767
1755
|
return;
|
|
1768
1756
|
}
|
|
1769
|
-
|
|
1770
|
-
this.logInfo("refreshProductsInBackground 开始", { trigger });
|
|
1757
|
+
this.logInfo("refreshProductsInBackground 开始");
|
|
1771
1758
|
const startTime = Date.now();
|
|
1772
1759
|
try {
|
|
1773
|
-
await this.products.silentRefresh(
|
|
1760
|
+
await this.products.silentRefresh();
|
|
1774
1761
|
const duration = Date.now() - startTime;
|
|
1775
|
-
this.logInfo("refreshProductsInBackground 完成", {
|
|
1776
|
-
trigger,
|
|
1777
|
-
duration: `${duration}ms`
|
|
1778
|
-
});
|
|
1762
|
+
this.logInfo("refreshProductsInBackground 完成", { duration: `${duration}ms` });
|
|
1779
1763
|
} catch (error) {
|
|
1780
1764
|
const duration = Date.now() - startTime;
|
|
1781
1765
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1782
1766
|
console.error("[Server] refreshProductsInBackground 失败:", error);
|
|
1783
1767
|
this.logError("refreshProductsInBackground 失败", {
|
|
1784
|
-
trigger,
|
|
1785
1768
|
duration: `${duration}ms`,
|
|
1786
1769
|
error: errorMessage
|
|
1787
1770
|
});
|
|
@@ -1792,27 +1775,22 @@ var Server = class {
|
|
|
1792
1775
|
* 重新拉取全量 SSE 接口,更新本地数据后触发 onOrdersSyncCompleted
|
|
1793
1776
|
* 不影响当前界面展示,适用于切回前台、定时刷新等场景
|
|
1794
1777
|
*/
|
|
1795
|
-
async refreshOrdersInBackground(
|
|
1778
|
+
async refreshOrdersInBackground() {
|
|
1796
1779
|
if (!this.order) {
|
|
1797
1780
|
this.logWarning("refreshOrdersInBackground: Order 模块未注册");
|
|
1798
1781
|
return;
|
|
1799
1782
|
}
|
|
1800
|
-
|
|
1801
|
-
this.logInfo("refreshOrdersInBackground 开始", { trigger });
|
|
1783
|
+
this.logInfo("refreshOrdersInBackground 开始");
|
|
1802
1784
|
const startTime = Date.now();
|
|
1803
1785
|
try {
|
|
1804
|
-
await this.order.silentRefresh(
|
|
1786
|
+
await this.order.silentRefresh();
|
|
1805
1787
|
const duration = Date.now() - startTime;
|
|
1806
|
-
this.logInfo("refreshOrdersInBackground 完成", {
|
|
1807
|
-
trigger,
|
|
1808
|
-
duration: `${duration}ms`
|
|
1809
|
-
});
|
|
1788
|
+
this.logInfo("refreshOrdersInBackground 完成", { duration: `${duration}ms` });
|
|
1810
1789
|
} catch (error) {
|
|
1811
1790
|
const duration = Date.now() - startTime;
|
|
1812
1791
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1813
1792
|
console.error("[Server] refreshOrdersInBackground 失败:", error);
|
|
1814
1793
|
this.logError("refreshOrdersInBackground 失败", {
|
|
1815
|
-
trigger,
|
|
1816
1794
|
duration: `${duration}ms`,
|
|
1817
1795
|
error: errorMessage
|
|
1818
1796
|
});
|
|
@@ -4116,7 +4094,7 @@ var Server = class {
|
|
|
4116
4094
|
var _a, _b, _c, _d, _e;
|
|
4117
4095
|
if (((_b = (_a = this.core.context) == null ? void 0 : _a.getPlatform) == null ? void 0 : _b.call(_a)) !== "android")
|
|
4118
4096
|
return true;
|
|
4119
|
-
return ((_e = (_d = (_c = this.app) == null ? void 0 : _c.storage) == null ? void 0 : _d.getStorage) == null ? void 0 : _e.call(_d, AUTO_PRINT_STORAGE_KEY))
|
|
4097
|
+
return ((_e = (_d = (_c = this.app) == null ? void 0 : _c.storage) == null ? void 0 : _d.getStorage) == null ? void 0 : _e.call(_d, AUTO_PRINT_STORAGE_KEY)) !== "false";
|
|
4120
4098
|
}
|
|
4121
4099
|
shouldBuildSmallTicketData(order) {
|
|
4122
4100
|
if (!order || typeof order !== "object")
|
|
@@ -10,7 +10,6 @@ export declare class FloorPlanModule extends BaseModule implements Module {
|
|
|
10
10
|
private store;
|
|
11
11
|
private request;
|
|
12
12
|
private logger;
|
|
13
|
-
private dbManager;
|
|
14
13
|
private floorPlanDataSource;
|
|
15
14
|
private pendingSyncMessages;
|
|
16
15
|
private syncTimer?;
|
|
@@ -29,9 +28,6 @@ export declare class FloorPlanModule extends BaseModule implements Module {
|
|
|
29
28
|
private mergeItems;
|
|
30
29
|
private removeByIds;
|
|
31
30
|
private loadListFromServer;
|
|
32
|
-
private loadListFromSQLite;
|
|
33
|
-
private saveListToSQLite;
|
|
34
|
-
private refreshListFromServer;
|
|
35
31
|
fetchByIdFromServer(id: number | string): Promise<FloorPlanItem | null>;
|
|
36
32
|
fetchByCodeFromServer(code: string): Promise<FloorPlanItem | null>;
|
|
37
33
|
preload(): Promise<void>;
|