@pisell/pisellos 2.3.1 → 2.3.3
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/Order/index.d.ts +9 -0
- package/dist/modules/Order/index.js +448 -371
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/Quotation/index.d.ts +16 -2
- package/dist/modules/Quotation/index.js +71 -38
- package/dist/modules/Quotation/types.d.ts +14 -0
- package/dist/modules/SalesSummary/index.d.ts +1 -0
- package/dist/modules/SalesSummary/index.js +7 -4
- package/dist/modules/Schedule/index.d.ts +4 -0
- package/dist/modules/Schedule/index.js +31 -1
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/server/index.js +13 -13
- package/dist/server/modules/order/index.d.ts +25 -7
- package/dist/server/modules/order/index.js +370 -309
- package/dist/server/modules/products/index.d.ts +4 -0
- package/dist/server/modules/products/index.js +76 -45
- package/dist/server/modules/quotation/index.d.ts +39 -0
- package/dist/server/modules/quotation/index.js +278 -66
- package/dist/server/modules/schedule/index.d.ts +2 -0
- package/dist/server/modules/schedule/index.js +10 -2
- package/dist/solution/BaseSales/index.d.ts +10 -1
- package/dist/solution/BaseSales/index.js +825 -528
- package/dist/solution/BaseSales/types.d.ts +7 -0
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +12 -1
- package/dist/solution/BaseSales/utils/quotationPrice.js +16 -3
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/lib/modules/Order/index.d.ts +9 -0
- package/lib/modules/Order/index.js +48 -9
- package/lib/modules/Order/types.d.ts +2 -0
- package/lib/modules/Quotation/index.d.ts +16 -2
- package/lib/modules/Quotation/index.js +49 -13
- package/lib/modules/Quotation/types.d.ts +14 -0
- package/lib/modules/SalesSummary/index.d.ts +1 -0
- package/lib/modules/SalesSummary/index.js +4 -3
- package/lib/modules/Schedule/index.d.ts +4 -0
- package/lib/modules/Schedule/index.js +21 -0
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/server/index.js +1 -1
- package/lib/server/modules/order/index.d.ts +25 -7
- package/lib/server/modules/order/index.js +88 -54
- package/lib/server/modules/products/index.d.ts +4 -0
- package/lib/server/modules/products/index.js +43 -19
- package/lib/server/modules/quotation/index.d.ts +39 -0
- package/lib/server/modules/quotation/index.js +179 -1
- package/lib/server/modules/schedule/index.d.ts +2 -0
- package/lib/server/modules/schedule/index.js +8 -1
- package/lib/solution/BaseSales/index.d.ts +10 -1
- package/lib/solution/BaseSales/index.js +218 -19
- package/lib/solution/BaseSales/types.d.ts +7 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +12 -1
- package/lib/solution/BaseSales/utils/quotationPrice.js +15 -3
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
5
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
2
6
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
7
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
4
8
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
@@ -147,6 +151,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
147
151
|
_defineProperty(_assertThisInitialized(_this), "currentSalesDetail", null);
|
|
148
152
|
_defineProperty(_assertThisInitialized(_this), "discountConfigCacheKey", null);
|
|
149
153
|
_defineProperty(_assertThisInitialized(_this), "hasManualDiscountSelection", false);
|
|
154
|
+
_defineProperty(_assertThisInitialized(_this), "reusedSharedSubModuleNames", new Set());
|
|
150
155
|
_defineProperty(_assertThisInitialized(_this), "paymentMethodsCache", []);
|
|
151
156
|
return _this;
|
|
152
157
|
}
|
|
@@ -160,6 +165,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
160
165
|
value: function getRegisteredModuleNames() {
|
|
161
166
|
return ['products', 'order', 'salesSummary', 'schedule', 'payment', 'quotation'];
|
|
162
167
|
}
|
|
168
|
+
}, {
|
|
169
|
+
key: "getReusableSharedSubModule",
|
|
170
|
+
value: function getReusableSharedSubModule(moduleName) {
|
|
171
|
+
var _this$core;
|
|
172
|
+
if (moduleName !== 'schedule' && moduleName !== 'quotation') return null;
|
|
173
|
+
return ((_this$core = this.core) === null || _this$core === void 0 ? void 0 : _this$core.getModule(moduleName)) || null;
|
|
174
|
+
}
|
|
175
|
+
}, {
|
|
176
|
+
key: "isScheduleListLoaded",
|
|
177
|
+
value: function isScheduleListLoaded(scheduleModule) {
|
|
178
|
+
if (!scheduleModule) return false;
|
|
179
|
+
if (typeof scheduleModule.isScheduleListLoaded === 'function') {
|
|
180
|
+
return scheduleModule.isScheduleListLoaded();
|
|
181
|
+
}
|
|
182
|
+
if (typeof scheduleModule.getScheduleList === 'function') {
|
|
183
|
+
return Array.isArray(scheduleModule.getScheduleList());
|
|
184
|
+
}
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
163
187
|
|
|
164
188
|
/**
|
|
165
189
|
* 记录信息日志
|
|
@@ -251,14 +275,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
251
275
|
if (customerId === null || customerId === undefined) return undefined;
|
|
252
276
|
return customerId;
|
|
253
277
|
}
|
|
278
|
+
}, {
|
|
279
|
+
key: "normalizePriceContextCustomerId",
|
|
280
|
+
value: function normalizePriceContextCustomerId(customerId) {
|
|
281
|
+
if (customerId === undefined || customerId === null || customerId === '') return null;
|
|
282
|
+
return String(customerId);
|
|
283
|
+
}
|
|
254
284
|
}, {
|
|
255
285
|
key: "applyQuotationScheduleResolver",
|
|
256
286
|
value: function applyQuotationScheduleResolver(quotation) {
|
|
257
287
|
var scheduleModule = this.store.schedule;
|
|
258
288
|
if (!scheduleModule) return;
|
|
289
|
+
var scheduleById = new Map();
|
|
290
|
+
var scheduleList = typeof scheduleModule.getScheduleList === 'function' ? scheduleModule.getScheduleList() : [];
|
|
291
|
+
if (Array.isArray(scheduleList)) {
|
|
292
|
+
scheduleList.forEach(function (schedule) {
|
|
293
|
+
if ((schedule === null || schedule === void 0 ? void 0 : schedule.id) !== undefined && (schedule === null || schedule === void 0 ? void 0 : schedule.id) !== null) {
|
|
294
|
+
scheduleById.set(String(schedule.id), schedule);
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}
|
|
259
298
|
quotation.setScheduleResolver(function (id) {
|
|
260
|
-
var _scheduleModule$getSc;
|
|
261
|
-
var
|
|
299
|
+
var _scheduleModule$getSc, _getScheduleByIds, _ref;
|
|
300
|
+
var scheduleId = String(id);
|
|
301
|
+
if (scheduleById.has(scheduleId)) return scheduleById.get(scheduleId);
|
|
302
|
+
var schedules = ((_scheduleModule$getSc = scheduleModule.getScheduleListByIds) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule, [id])) || ((_getScheduleByIds = (_ref = scheduleModule).getScheduleByIds) === null || _getScheduleByIds === void 0 ? void 0 : _getScheduleByIds.call(_ref, [id])) || [];
|
|
303
|
+
if (schedules[0]) scheduleById.set(scheduleId, schedules[0]);
|
|
262
304
|
return schedules[0];
|
|
263
305
|
});
|
|
264
306
|
}
|
|
@@ -330,67 +372,108 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
330
372
|
};
|
|
331
373
|
}
|
|
332
374
|
}, {
|
|
333
|
-
key: "
|
|
375
|
+
key: "loadProductsForPriceQuery",
|
|
334
376
|
value: function () {
|
|
335
|
-
var
|
|
336
|
-
var
|
|
377
|
+
var _loadProductsForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
378
|
+
var ids, productsById, _this$otherParams2, _response$data, response, list;
|
|
337
379
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
338
380
|
while (1) switch (_context2.prev = _context2.next) {
|
|
339
381
|
case 0:
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
382
|
+
ids = Array.from(new Set(params.ids.filter(function (id) {
|
|
383
|
+
return Number.isFinite(id);
|
|
384
|
+
})));
|
|
385
|
+
productsById = new Map();
|
|
386
|
+
if (!(!ids.length || !this.request)) {
|
|
343
387
|
_context2.next = 4;
|
|
344
388
|
break;
|
|
345
389
|
}
|
|
346
|
-
return _context2.abrupt("return",
|
|
390
|
+
return _context2.abrupt("return", productsById);
|
|
347
391
|
case 4:
|
|
348
|
-
|
|
349
|
-
_context2.
|
|
350
|
-
_context2.next = 8;
|
|
392
|
+
_context2.prev = 4;
|
|
393
|
+
_context2.next = 7;
|
|
351
394
|
return this.request.post('/product/query', {
|
|
352
|
-
ids:
|
|
395
|
+
ids: ids,
|
|
353
396
|
open_quotation: 1,
|
|
354
397
|
open_bundle: 1,
|
|
355
398
|
status: 'published',
|
|
356
399
|
num: 1,
|
|
357
400
|
skip: 1,
|
|
358
|
-
customer_id: customerId,
|
|
359
|
-
schedule_date: schedule.schedule_date,
|
|
360
|
-
schedule_datetime: schedule.schedule_datetime,
|
|
401
|
+
customer_id: params.customerId,
|
|
402
|
+
schedule_date: params.schedule.schedule_date,
|
|
403
|
+
schedule_datetime: params.schedule.schedule_datetime,
|
|
361
404
|
application_code: params.channel || ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.channel)
|
|
362
405
|
}, {
|
|
363
406
|
osServer: true,
|
|
364
407
|
customToast: function customToast() {}
|
|
365
408
|
});
|
|
366
|
-
case
|
|
409
|
+
case 7:
|
|
367
410
|
response = _context2.sent;
|
|
368
411
|
list = (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.list) || (response === null || response === void 0 ? void 0 : response.list) || [];
|
|
369
412
|
if (Array.isArray(list)) {
|
|
370
|
-
_context2.next =
|
|
413
|
+
_context2.next = 11;
|
|
371
414
|
break;
|
|
372
415
|
}
|
|
373
|
-
return _context2.abrupt("return",
|
|
374
|
-
case
|
|
375
|
-
|
|
416
|
+
return _context2.abrupt("return", productsById);
|
|
417
|
+
case 11:
|
|
418
|
+
list.forEach(function (item) {
|
|
376
419
|
var _item$id;
|
|
377
|
-
|
|
378
|
-
|
|
420
|
+
var productId = Number((_item$id = item === null || item === void 0 ? void 0 : item.id) !== null && _item$id !== void 0 ? _item$id : item === null || item === void 0 ? void 0 : item.product_id);
|
|
421
|
+
if (Number.isFinite(productId)) productsById.set(productId, item);
|
|
422
|
+
});
|
|
423
|
+
return _context2.abrupt("return", productsById);
|
|
379
424
|
case 15:
|
|
380
425
|
_context2.prev = 15;
|
|
381
|
-
_context2.t0 = _context2["catch"](
|
|
382
|
-
this.logWarning('
|
|
383
|
-
|
|
426
|
+
_context2.t0 = _context2["catch"](4);
|
|
427
|
+
this.logWarning('loadProductsForPriceQuery: 商品批量重查失败,使用入参 fallback', {
|
|
428
|
+
ids: ids,
|
|
384
429
|
error: _context2.t0 instanceof Error ? _context2.t0.message : String(_context2.t0)
|
|
385
430
|
});
|
|
386
|
-
return _context2.abrupt("return",
|
|
431
|
+
return _context2.abrupt("return", productsById);
|
|
387
432
|
case 19:
|
|
388
433
|
case "end":
|
|
389
434
|
return _context2.stop();
|
|
390
435
|
}
|
|
391
|
-
}, _callee2, this, [[
|
|
436
|
+
}, _callee2, this, [[4, 15]]);
|
|
437
|
+
}));
|
|
438
|
+
function loadProductsForPriceQuery(_x2) {
|
|
439
|
+
return _loadProductsForPriceQuery.apply(this, arguments);
|
|
440
|
+
}
|
|
441
|
+
return loadProductsForPriceQuery;
|
|
442
|
+
}()
|
|
443
|
+
}, {
|
|
444
|
+
key: "loadProductForPriceQuery",
|
|
445
|
+
value: function () {
|
|
446
|
+
var _loadProductForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params, customerId) {
|
|
447
|
+
var product, productId, schedule, productsById;
|
|
448
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
449
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
450
|
+
case 0:
|
|
451
|
+
product = params.product || {};
|
|
452
|
+
productId = this.getPriceQueryProductId(product);
|
|
453
|
+
if (!(productId === null || !this.request)) {
|
|
454
|
+
_context3.next = 4;
|
|
455
|
+
break;
|
|
456
|
+
}
|
|
457
|
+
return _context3.abrupt("return", null);
|
|
458
|
+
case 4:
|
|
459
|
+
schedule = this.getPriceQuerySchedule(params);
|
|
460
|
+
_context3.next = 7;
|
|
461
|
+
return this.loadProductsForPriceQuery({
|
|
462
|
+
ids: [productId],
|
|
463
|
+
schedule: schedule,
|
|
464
|
+
customerId: customerId,
|
|
465
|
+
channel: params.channel
|
|
466
|
+
});
|
|
467
|
+
case 7:
|
|
468
|
+
productsById = _context3.sent;
|
|
469
|
+
return _context3.abrupt("return", productsById.get(productId) || null);
|
|
470
|
+
case 9:
|
|
471
|
+
case "end":
|
|
472
|
+
return _context3.stop();
|
|
473
|
+
}
|
|
474
|
+
}, _callee3, this);
|
|
392
475
|
}));
|
|
393
|
-
function loadProductForPriceQuery(
|
|
476
|
+
function loadProductForPriceQuery(_x3, _x4) {
|
|
394
477
|
return _loadProductForPriceQuery.apply(this, arguments);
|
|
395
478
|
}
|
|
396
479
|
return loadProductForPriceQuery;
|
|
@@ -403,10 +486,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
403
486
|
return groups.flatMap(function (group) {
|
|
404
487
|
var items = Array.isArray(group === null || group === void 0 ? void 0 : group.bundle_item) ? group.bundle_item : Array.isArray(group === null || group === void 0 ? void 0 : group.bundleItem) ? group.bundleItem : [];
|
|
405
488
|
return items.map(function (item) {
|
|
406
|
-
var _item$group_id,
|
|
489
|
+
var _item$group_id, _ref2, _item$bundle_group_id;
|
|
407
490
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
408
491
|
group_id: (_item$group_id = item === null || item === void 0 ? void 0 : item.group_id) !== null && _item$group_id !== void 0 ? _item$group_id : group === null || group === void 0 ? void 0 : group.id,
|
|
409
|
-
bundle_group_id: (
|
|
492
|
+
bundle_group_id: (_ref2 = (_item$bundle_group_id = item === null || item === void 0 ? void 0 : item.bundle_group_id) !== null && _item$bundle_group_id !== void 0 ? _item$bundle_group_id : item === null || item === void 0 ? void 0 : item.group_id) !== null && _ref2 !== void 0 ? _ref2 : group === null || group === void 0 ? void 0 : group.id
|
|
410
493
|
});
|
|
411
494
|
});
|
|
412
495
|
});
|
|
@@ -437,21 +520,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
437
520
|
}, {
|
|
438
521
|
key: "getAuthoritativeBundleUnitPrice",
|
|
439
522
|
value: function getAuthoritativeBundleUnitPrice(bundle) {
|
|
440
|
-
var
|
|
441
|
-
return (
|
|
523
|
+
var _ref3, _ref4, _ref5, _bundle$price;
|
|
524
|
+
return (_ref3 = (_ref4 = (_ref5 = (_bundle$price = bundle.price) !== null && _bundle$price !== void 0 ? _bundle$price : bundle.bundle_selling_price) !== null && _ref5 !== void 0 ? _ref5 : bundle.custom_price) !== null && _ref4 !== void 0 ? _ref4 : bundle.product_price) !== null && _ref3 !== void 0 ? _ref3 : bundle.base_price;
|
|
442
525
|
}
|
|
443
526
|
}, {
|
|
444
527
|
key: "mergeProductForPriceQuery",
|
|
445
528
|
value: function mergeProductForPriceQuery(product, authoritativeProduct) {
|
|
446
529
|
var _this2 = this,
|
|
447
530
|
_product$id,
|
|
448
|
-
_ref5,
|
|
449
|
-
_product$product_id2,
|
|
450
531
|
_ref6,
|
|
451
|
-
_product$
|
|
532
|
+
_product$product_id2,
|
|
452
533
|
_ref7,
|
|
453
|
-
_product$
|
|
534
|
+
_product$product_vari,
|
|
454
535
|
_ref8,
|
|
536
|
+
_product$num,
|
|
537
|
+
_ref9,
|
|
455
538
|
_product$quantity,
|
|
456
539
|
_product$metadata4;
|
|
457
540
|
if (!authoritativeProduct) return product;
|
|
@@ -471,10 +554,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
471
554
|
});
|
|
472
555
|
return _objectSpread(_objectSpread(_objectSpread({}, product), authoritativeProduct), {}, {
|
|
473
556
|
id: (_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : authoritativeProduct.id,
|
|
474
|
-
product_id: (
|
|
475
|
-
product_variant_id: (
|
|
476
|
-
num: (
|
|
477
|
-
quantity: (
|
|
557
|
+
product_id: (_ref6 = (_product$product_id2 = product.product_id) !== null && _product$product_id2 !== void 0 ? _product$product_id2 : authoritativeProduct.product_id) !== null && _ref6 !== void 0 ? _ref6 : authoritativeProduct.id,
|
|
558
|
+
product_variant_id: (_ref7 = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : authoritativeProduct.product_variant_id) !== null && _ref7 !== void 0 ? _ref7 : 0,
|
|
559
|
+
num: (_ref8 = (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : product.quantity) !== null && _ref8 !== void 0 ? _ref8 : authoritativeProduct.num,
|
|
560
|
+
quantity: (_ref9 = (_product$quantity = product.quantity) !== null && _product$quantity !== void 0 ? _product$quantity : product.num) !== null && _ref9 !== void 0 ? _ref9 : authoritativeProduct.quantity,
|
|
478
561
|
product_sku: function () {
|
|
479
562
|
var authoritativeSku = ensureProductSku(authoritativeProduct);
|
|
480
563
|
var productSku = ensureProductSku(product);
|
|
@@ -548,53 +631,61 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
548
631
|
}, {
|
|
549
632
|
key: "syncOtherParamsToSubModules",
|
|
550
633
|
value: (function () {
|
|
551
|
-
var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
552
|
-
var
|
|
553
|
-
|
|
634
|
+
var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(changedParams) {
|
|
635
|
+
var _this3 = this;
|
|
636
|
+
var _ref10,
|
|
637
|
+
_ref10$cover,
|
|
554
638
|
cover,
|
|
555
639
|
nextSubModuleOtherParams,
|
|
556
|
-
|
|
557
|
-
return _regeneratorRuntime().wrap(function
|
|
558
|
-
while (1) switch (
|
|
640
|
+
_args5 = arguments;
|
|
641
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
642
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
559
643
|
case 0:
|
|
560
|
-
|
|
644
|
+
_ref10 = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {}, _ref10$cover = _ref10.cover, cover = _ref10$cover === void 0 ? false : _ref10$cover;
|
|
561
645
|
nextSubModuleOtherParams = this.buildSubModuleOtherParams();
|
|
562
|
-
|
|
563
|
-
return Promise.all(Object.
|
|
564
|
-
var
|
|
565
|
-
var targetModule;
|
|
566
|
-
return _regeneratorRuntime().wrap(function
|
|
567
|
-
while (1) switch (
|
|
646
|
+
_context5.next = 4;
|
|
647
|
+
return Promise.all(Object.entries(this.store).map( /*#__PURE__*/function () {
|
|
648
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref11) {
|
|
649
|
+
var _ref13, moduleName, subModule, targetModule;
|
|
650
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
651
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
568
652
|
case 0:
|
|
653
|
+
_ref13 = _slicedToArray(_ref11, 2), moduleName = _ref13[0], subModule = _ref13[1];
|
|
654
|
+
if (!_this3.reusedSharedSubModuleNames.has(moduleName)) {
|
|
655
|
+
_context4.next = 3;
|
|
656
|
+
break;
|
|
657
|
+
}
|
|
658
|
+
return _context4.abrupt("return");
|
|
659
|
+
case 3:
|
|
569
660
|
targetModule = subModule;
|
|
570
661
|
if (!(!targetModule || typeof targetModule.updateOtherParams !== 'function')) {
|
|
571
|
-
|
|
662
|
+
_context4.next = 6;
|
|
572
663
|
break;
|
|
573
664
|
}
|
|
574
|
-
return
|
|
575
|
-
case
|
|
576
|
-
|
|
665
|
+
return _context4.abrupt("return");
|
|
666
|
+
case 6:
|
|
667
|
+
_context4.next = 8;
|
|
577
668
|
return targetModule.updateOtherParams(nextSubModuleOtherParams, {
|
|
578
669
|
changedParams: changedParams,
|
|
579
670
|
cover: cover
|
|
580
671
|
});
|
|
581
|
-
case
|
|
672
|
+
case 8:
|
|
582
673
|
case "end":
|
|
583
|
-
return
|
|
674
|
+
return _context4.stop();
|
|
584
675
|
}
|
|
585
|
-
},
|
|
676
|
+
}, _callee4);
|
|
586
677
|
}));
|
|
587
|
-
return function (
|
|
588
|
-
return
|
|
678
|
+
return function (_x6) {
|
|
679
|
+
return _ref12.apply(this, arguments);
|
|
589
680
|
};
|
|
590
681
|
}()));
|
|
591
682
|
case 4:
|
|
592
683
|
case "end":
|
|
593
|
-
return
|
|
684
|
+
return _context5.stop();
|
|
594
685
|
}
|
|
595
|
-
},
|
|
686
|
+
}, _callee5, this);
|
|
596
687
|
}));
|
|
597
|
-
function syncOtherParamsToSubModules(
|
|
688
|
+
function syncOtherParamsToSubModules(_x5) {
|
|
598
689
|
return _syncOtherParamsToSubModules.apply(this, arguments);
|
|
599
690
|
}
|
|
600
691
|
return syncOtherParamsToSubModules;
|
|
@@ -668,75 +759,82 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
668
759
|
}, {
|
|
669
760
|
key: "initialize",
|
|
670
761
|
value: function () {
|
|
671
|
-
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
762
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(core) {
|
|
672
763
|
var _this$otherParams4,
|
|
673
|
-
|
|
764
|
+
_this4 = this,
|
|
674
765
|
_this$otherParams5;
|
|
675
766
|
var options,
|
|
676
767
|
app,
|
|
677
768
|
targetCacheData,
|
|
678
769
|
moduleNames,
|
|
679
|
-
|
|
680
|
-
return _regeneratorRuntime().wrap(function
|
|
681
|
-
while (1) switch (
|
|
770
|
+
_args6 = arguments;
|
|
771
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
772
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
682
773
|
case 0:
|
|
683
|
-
options =
|
|
774
|
+
options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
684
775
|
this.core = core;
|
|
685
776
|
this.initializeOptions = options || {};
|
|
686
777
|
// this.store = { ...this.store, ...(options.store as Partial<BaseSalesState>) };
|
|
687
778
|
this.otherParams = options.otherParams || {};
|
|
688
779
|
this.cacheId = (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.cacheId;
|
|
780
|
+
this.reusedSharedSubModuleNames.clear();
|
|
689
781
|
this.window = core.getPlugin('window');
|
|
690
782
|
this.request = core.getPlugin('request');
|
|
691
783
|
|
|
692
784
|
// 获取 logger 实例
|
|
693
785
|
this.appPlugin = core.getPlugin('app');
|
|
694
786
|
if (this.appPlugin) {
|
|
695
|
-
|
|
787
|
+
_context6.next = 11;
|
|
696
788
|
break;
|
|
697
789
|
}
|
|
698
790
|
throw new Error('Checkout 解决方案需要 app 插件支持');
|
|
699
|
-
case
|
|
791
|
+
case 11:
|
|
700
792
|
app = this.appPlugin.getApp();
|
|
701
793
|
this.logger = app.logger;
|
|
702
794
|
targetCacheData = this.readSessionCacheData();
|
|
703
795
|
moduleNames = this.getRegisteredModuleNames();
|
|
704
796
|
moduleNames.forEach(function (step) {
|
|
705
|
-
var
|
|
797
|
+
var reusedModule = _this4.getReusableSharedSubModule(step);
|
|
798
|
+
if (reusedModule) {
|
|
799
|
+
_this4.store[step] = reusedModule;
|
|
800
|
+
_this4.reusedSharedSubModuleNames.add(step);
|
|
801
|
+
return;
|
|
802
|
+
}
|
|
803
|
+
var targetModule = _this4.createSubModule(step);
|
|
706
804
|
if (!targetModule) {
|
|
707
805
|
throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
|
|
708
806
|
}
|
|
709
|
-
var hooks =
|
|
710
|
-
|
|
711
|
-
|
|
807
|
+
var hooks = _this4.getSubModuleHooks(step);
|
|
808
|
+
_this4.store[step] = targetModule;
|
|
809
|
+
_this4.core.registerModule(targetModule, _objectSpread(_objectSpread({
|
|
712
810
|
initialState: (targetCacheData === null || targetCacheData === void 0 ? void 0 : targetCacheData[targetModule.name]) || {}
|
|
713
811
|
}, hooks ? {
|
|
714
812
|
hooks: hooks
|
|
715
813
|
} : {}), {}, {
|
|
716
|
-
otherParams:
|
|
814
|
+
otherParams: _this4.buildSubModuleOtherParams()
|
|
717
815
|
}));
|
|
718
816
|
});
|
|
719
|
-
if (!this.store.schedule) {
|
|
720
|
-
|
|
817
|
+
if (!(this.store.schedule && !this.isScheduleListLoaded(this.store.schedule))) {
|
|
818
|
+
_context6.next = 19;
|
|
721
819
|
break;
|
|
722
820
|
}
|
|
723
|
-
|
|
821
|
+
_context6.next = 19;
|
|
724
822
|
return this.store.schedule.loadAllSchedule();
|
|
725
|
-
case
|
|
823
|
+
case 19:
|
|
726
824
|
if (this.store.order && typeof ((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.enableTempOrderPersist) === 'boolean') {
|
|
727
825
|
this.store.order.setEnableTempOrderPersist(this.otherParams.enableTempOrderPersist);
|
|
728
826
|
}
|
|
729
|
-
|
|
827
|
+
_context6.next = 22;
|
|
730
828
|
return this.getPaymentMethodsAsync();
|
|
731
|
-
case 21:
|
|
732
|
-
this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
733
829
|
case 22:
|
|
830
|
+
this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
831
|
+
case 23:
|
|
734
832
|
case "end":
|
|
735
|
-
return
|
|
833
|
+
return _context6.stop();
|
|
736
834
|
}
|
|
737
|
-
},
|
|
835
|
+
}, _callee6, this);
|
|
738
836
|
}));
|
|
739
|
-
function initialize(
|
|
837
|
+
function initialize(_x7) {
|
|
740
838
|
return _initialize.apply(this, arguments);
|
|
741
839
|
}
|
|
742
840
|
return initialize;
|
|
@@ -744,13 +842,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
744
842
|
}, {
|
|
745
843
|
key: "destroy",
|
|
746
844
|
value: function () {
|
|
747
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
748
|
-
var
|
|
749
|
-
return _regeneratorRuntime().wrap(function
|
|
750
|
-
while (1) switch (
|
|
845
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
846
|
+
var _this5 = this;
|
|
847
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
848
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
751
849
|
case 0:
|
|
752
850
|
Object.keys(this.store).forEach(function (key) {
|
|
753
|
-
|
|
851
|
+
if (_this5.reusedSharedSubModuleNames.has(key)) return;
|
|
852
|
+
var sub = _this5.store[key];
|
|
754
853
|
if (sub && typeof sub.destroy === 'function') {
|
|
755
854
|
try {
|
|
756
855
|
sub.destroy();
|
|
@@ -760,15 +859,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
760
859
|
}
|
|
761
860
|
});
|
|
762
861
|
this.currentSalesDetail = null;
|
|
763
|
-
|
|
862
|
+
_context7.next = 4;
|
|
764
863
|
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
765
864
|
case 4:
|
|
766
865
|
_get(_getPrototypeOf(BaseSalesImpl.prototype), "destroy", this).call(this);
|
|
767
866
|
case 5:
|
|
768
867
|
case "end":
|
|
769
|
-
return
|
|
868
|
+
return _context7.stop();
|
|
770
869
|
}
|
|
771
|
-
},
|
|
870
|
+
}, _callee7, this);
|
|
772
871
|
}));
|
|
773
872
|
function destroy() {
|
|
774
873
|
return _destroy.apply(this, arguments);
|
|
@@ -785,14 +884,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
785
884
|
}, {
|
|
786
885
|
key: "loadSalesDetail",
|
|
787
886
|
value: (function () {
|
|
788
|
-
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
789
|
-
var
|
|
887
|
+
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(orderIdOrParams) {
|
|
888
|
+
var _ref14, _ref15, _ref16, _ref17, _params$orderId;
|
|
790
889
|
var params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, remoteRecord, currentTempOrder, record, sales;
|
|
791
|
-
return _regeneratorRuntime().wrap(function
|
|
792
|
-
while (1) switch (
|
|
890
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
891
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
793
892
|
case 0:
|
|
794
893
|
if (this.store.order) {
|
|
795
|
-
|
|
894
|
+
_context8.next = 2;
|
|
796
895
|
break;
|
|
797
896
|
}
|
|
798
897
|
throw new Error('order 模块未初始化');
|
|
@@ -802,32 +901,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
802
901
|
};
|
|
803
902
|
externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
|
|
804
903
|
preloadedSalesDetail = params.preloadedSalesDetail;
|
|
805
|
-
lookup = (
|
|
904
|
+
lookup = (_ref14 = (_ref15 = (_ref16 = (_ref17 = (_params$orderId = params.orderId) !== null && _params$orderId !== void 0 ? _params$orderId : externalSaleNumber) !== null && _ref17 !== void 0 ? _ref17 : params.orderNumber) !== null && _ref16 !== void 0 ? _ref16 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_id) !== null && _ref15 !== void 0 ? _ref15 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.external_sale_number) !== null && _ref14 !== void 0 ? _ref14 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_number;
|
|
806
905
|
if (!(!preloadedSalesDetail && (lookup === undefined || lookup === null || lookup === ''))) {
|
|
807
|
-
|
|
906
|
+
_context8.next = 8;
|
|
808
907
|
break;
|
|
809
908
|
}
|
|
810
909
|
throw new Error('加载销售详情需要 orderId、externalSaleNumber 或 orderNumber');
|
|
811
910
|
case 8:
|
|
812
911
|
if (!(preloadedSalesDetail !== null && preloadedSalesDetail !== void 0)) {
|
|
813
|
-
|
|
912
|
+
_context8.next = 12;
|
|
814
913
|
break;
|
|
815
914
|
}
|
|
816
|
-
|
|
817
|
-
|
|
915
|
+
_context8.t0 = preloadedSalesDetail;
|
|
916
|
+
_context8.next = 15;
|
|
818
917
|
break;
|
|
819
918
|
case 12:
|
|
820
|
-
|
|
919
|
+
_context8.next = 14;
|
|
821
920
|
return this.store.order.getSalesOrderByLookup({
|
|
822
921
|
lookup: lookup,
|
|
823
922
|
forceRemote: params.forceRemote
|
|
824
923
|
});
|
|
825
924
|
case 14:
|
|
826
|
-
|
|
925
|
+
_context8.t0 = _context8.sent;
|
|
827
926
|
case 15:
|
|
828
|
-
loadedRecord =
|
|
927
|
+
loadedRecord = _context8.t0;
|
|
829
928
|
if (!(!preloadedSalesDetail && (!loadedRecord || loadedRecord.code !== 200))) {
|
|
830
|
-
|
|
929
|
+
_context8.next = 19;
|
|
831
930
|
break;
|
|
832
931
|
}
|
|
833
932
|
message = loadedRecord && (loadedRecord.message || loadedRecord.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(lookup);
|
|
@@ -836,26 +935,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
836
935
|
remoteRecord = preloadedSalesDetail !== null && preloadedSalesDetail !== void 0 ? preloadedSalesDetail : loadedRecord.data;
|
|
837
936
|
currentTempOrder = params.merge ? this.store.order.getTempOrder() : null;
|
|
838
937
|
record = params.merge ? mergeSalesDetailRecordWithTempOrder(currentTempOrder, remoteRecord) : remoteRecord;
|
|
839
|
-
|
|
938
|
+
_context8.next = 24;
|
|
840
939
|
return this.store.order.hydrateTempOrderFromRecord(record, {
|
|
841
940
|
recalcOnHydrate: false
|
|
842
941
|
});
|
|
843
942
|
case 24:
|
|
844
|
-
sales =
|
|
943
|
+
sales = _context8.sent;
|
|
845
944
|
this.currentSalesDetail = sales;
|
|
846
|
-
|
|
945
|
+
_context8.next = 28;
|
|
847
946
|
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
848
947
|
sales: sales
|
|
849
948
|
});
|
|
850
949
|
case 28:
|
|
851
|
-
return
|
|
950
|
+
return _context8.abrupt("return", sales);
|
|
852
951
|
case 29:
|
|
853
952
|
case "end":
|
|
854
|
-
return
|
|
953
|
+
return _context8.stop();
|
|
855
954
|
}
|
|
856
|
-
},
|
|
955
|
+
}, _callee8, this);
|
|
857
956
|
}));
|
|
858
|
-
function loadSalesDetail(
|
|
957
|
+
function loadSalesDetail(_x8) {
|
|
859
958
|
return _loadSalesDetail.apply(this, arguments);
|
|
860
959
|
}
|
|
861
960
|
return loadSalesDetail;
|
|
@@ -935,34 +1034,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
935
1034
|
}, {
|
|
936
1035
|
key: "replaceTempOrder",
|
|
937
1036
|
value: function () {
|
|
938
|
-
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1037
|
+
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(tempOrder) {
|
|
939
1038
|
var nextTempOrder;
|
|
940
|
-
return _regeneratorRuntime().wrap(function
|
|
941
|
-
while (1) switch (
|
|
1039
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
1040
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
942
1041
|
case 0:
|
|
943
1042
|
if (this.store.order) {
|
|
944
|
-
|
|
1043
|
+
_context9.next = 2;
|
|
945
1044
|
break;
|
|
946
1045
|
}
|
|
947
1046
|
throw new Error('order 模块未初始化');
|
|
948
1047
|
case 2:
|
|
949
|
-
|
|
1048
|
+
_context9.next = 4;
|
|
950
1049
|
return this.store.order.replaceTempOrder(tempOrder);
|
|
951
1050
|
case 4:
|
|
952
|
-
nextTempOrder =
|
|
953
|
-
|
|
1051
|
+
nextTempOrder = _context9.sent;
|
|
1052
|
+
_context9.next = 7;
|
|
954
1053
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
955
1054
|
tempOrder: nextTempOrder
|
|
956
1055
|
});
|
|
957
1056
|
case 7:
|
|
958
|
-
return
|
|
1057
|
+
return _context9.abrupt("return", nextTempOrder);
|
|
959
1058
|
case 8:
|
|
960
1059
|
case "end":
|
|
961
|
-
return
|
|
1060
|
+
return _context9.stop();
|
|
962
1061
|
}
|
|
963
|
-
},
|
|
1062
|
+
}, _callee9, this);
|
|
964
1063
|
}));
|
|
965
|
-
function replaceTempOrder(
|
|
1064
|
+
function replaceTempOrder(_x9) {
|
|
966
1065
|
return _replaceTempOrder.apply(this, arguments);
|
|
967
1066
|
}
|
|
968
1067
|
return replaceTempOrder;
|
|
@@ -1060,40 +1159,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1060
1159
|
}, {
|
|
1061
1160
|
key: "addNewOrder",
|
|
1062
1161
|
value: function () {
|
|
1063
|
-
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1162
|
+
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
1064
1163
|
var tempOrder;
|
|
1065
|
-
return _regeneratorRuntime().wrap(function
|
|
1066
|
-
while (1) switch (
|
|
1164
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1165
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
1067
1166
|
case 0:
|
|
1068
|
-
|
|
1167
|
+
_context10.prev = 0;
|
|
1069
1168
|
if (this.store.order) {
|
|
1070
|
-
|
|
1169
|
+
_context10.next = 3;
|
|
1071
1170
|
break;
|
|
1072
1171
|
}
|
|
1073
1172
|
throw new Error('order 模块未初始化');
|
|
1074
1173
|
case 3:
|
|
1075
|
-
|
|
1174
|
+
_context10.next = 5;
|
|
1076
1175
|
return this.store.order.addNewOrder();
|
|
1077
1176
|
case 5:
|
|
1078
|
-
tempOrder =
|
|
1177
|
+
tempOrder = _context10.sent;
|
|
1079
1178
|
if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
|
|
1080
|
-
|
|
1179
|
+
_context10.next = 10;
|
|
1081
1180
|
break;
|
|
1082
1181
|
}
|
|
1083
1182
|
this.store.order.persistTempOrder();
|
|
1084
|
-
|
|
1183
|
+
_context10.next = 10;
|
|
1085
1184
|
return this.store.order.saveDraft();
|
|
1086
1185
|
case 10:
|
|
1087
|
-
return
|
|
1186
|
+
return _context10.abrupt("return", tempOrder);
|
|
1088
1187
|
case 13:
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
throw
|
|
1188
|
+
_context10.prev = 13;
|
|
1189
|
+
_context10.t0 = _context10["catch"](0);
|
|
1190
|
+
throw _context10.t0;
|
|
1092
1191
|
case 16:
|
|
1093
1192
|
case "end":
|
|
1094
|
-
return
|
|
1193
|
+
return _context10.stop();
|
|
1095
1194
|
}
|
|
1096
|
-
},
|
|
1195
|
+
}, _callee10, this, [[0, 13]]);
|
|
1097
1196
|
}));
|
|
1098
1197
|
function addNewOrder() {
|
|
1099
1198
|
return _addNewOrder.apply(this, arguments);
|
|
@@ -1103,22 +1202,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1103
1202
|
}, {
|
|
1104
1203
|
key: "saveDraft",
|
|
1105
1204
|
value: function () {
|
|
1106
|
-
var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1107
|
-
return _regeneratorRuntime().wrap(function
|
|
1108
|
-
while (1) switch (
|
|
1205
|
+
var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
1206
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
1207
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1109
1208
|
case 0:
|
|
1110
1209
|
if (this.store.order) {
|
|
1111
|
-
|
|
1210
|
+
_context11.next = 2;
|
|
1112
1211
|
break;
|
|
1113
1212
|
}
|
|
1114
1213
|
throw new Error('order 模块未初始化');
|
|
1115
1214
|
case 2:
|
|
1116
|
-
return
|
|
1215
|
+
return _context11.abrupt("return", this.store.order.saveDraft());
|
|
1117
1216
|
case 3:
|
|
1118
1217
|
case "end":
|
|
1119
|
-
return
|
|
1218
|
+
return _context11.stop();
|
|
1120
1219
|
}
|
|
1121
|
-
},
|
|
1220
|
+
}, _callee11, this);
|
|
1122
1221
|
}));
|
|
1123
1222
|
function saveDraft() {
|
|
1124
1223
|
return _saveDraft.apply(this, arguments);
|
|
@@ -1129,14 +1228,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1129
1228
|
}, {
|
|
1130
1229
|
key: "restoreOrder",
|
|
1131
1230
|
value: function () {
|
|
1132
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1231
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
1133
1232
|
var tempOrder;
|
|
1134
|
-
return _regeneratorRuntime().wrap(function
|
|
1135
|
-
while (1) switch (
|
|
1233
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1234
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1136
1235
|
case 0:
|
|
1137
|
-
|
|
1236
|
+
_context12.prev = 0;
|
|
1138
1237
|
if (this.store.order) {
|
|
1139
|
-
|
|
1238
|
+
_context12.next = 3;
|
|
1140
1239
|
break;
|
|
1141
1240
|
}
|
|
1142
1241
|
throw new Error('scanOrder 解决方案需要 order 模块支持');
|
|
@@ -1146,29 +1245,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1146
1245
|
this.currentSalesDetail = null;
|
|
1147
1246
|
this.discountConfigCacheKey = null;
|
|
1148
1247
|
this.hasManualDiscountSelection = false;
|
|
1149
|
-
|
|
1248
|
+
_context12.next = 9;
|
|
1150
1249
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
1151
1250
|
tempOrder: tempOrder
|
|
1152
1251
|
});
|
|
1153
1252
|
case 9:
|
|
1154
1253
|
if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
|
|
1155
|
-
|
|
1254
|
+
_context12.next = 13;
|
|
1156
1255
|
break;
|
|
1157
1256
|
}
|
|
1158
1257
|
this.store.order.persistTempOrder();
|
|
1159
|
-
|
|
1258
|
+
_context12.next = 13;
|
|
1160
1259
|
return this.store.order.saveDraft();
|
|
1161
1260
|
case 13:
|
|
1162
|
-
return
|
|
1261
|
+
return _context12.abrupt("return", tempOrder);
|
|
1163
1262
|
case 16:
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
throw
|
|
1263
|
+
_context12.prev = 16;
|
|
1264
|
+
_context12.t0 = _context12["catch"](0);
|
|
1265
|
+
throw _context12.t0;
|
|
1167
1266
|
case 19:
|
|
1168
1267
|
case "end":
|
|
1169
|
-
return
|
|
1268
|
+
return _context12.stop();
|
|
1170
1269
|
}
|
|
1171
|
-
},
|
|
1270
|
+
}, _callee12, this, [[0, 16]]);
|
|
1172
1271
|
}));
|
|
1173
1272
|
function restoreOrder() {
|
|
1174
1273
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -1182,22 +1281,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1182
1281
|
}, {
|
|
1183
1282
|
key: "clearOrderCartLines",
|
|
1184
1283
|
value: (function () {
|
|
1185
|
-
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1284
|
+
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
1186
1285
|
var tempOrder;
|
|
1187
|
-
return _regeneratorRuntime().wrap(function
|
|
1188
|
-
while (1) switch (
|
|
1286
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1287
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1189
1288
|
case 0:
|
|
1190
|
-
|
|
1289
|
+
_context13.prev = 0;
|
|
1191
1290
|
if (this.store.order) {
|
|
1192
|
-
|
|
1291
|
+
_context13.next = 3;
|
|
1193
1292
|
break;
|
|
1194
1293
|
}
|
|
1195
1294
|
throw new Error('order 模块未初始化');
|
|
1196
1295
|
case 3:
|
|
1197
|
-
|
|
1296
|
+
_context13.next = 5;
|
|
1198
1297
|
return this.store.order.clearOrderCartLines();
|
|
1199
1298
|
case 5:
|
|
1200
|
-
tempOrder =
|
|
1299
|
+
tempOrder = _context13.sent;
|
|
1201
1300
|
if (this.currentSalesDetail) {
|
|
1202
1301
|
this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
|
|
1203
1302
|
products: [],
|
|
@@ -1207,29 +1306,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1207
1306
|
discount_list: []
|
|
1208
1307
|
});
|
|
1209
1308
|
}
|
|
1210
|
-
|
|
1309
|
+
_context13.next = 9;
|
|
1211
1310
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
1212
1311
|
tempOrder: tempOrder
|
|
1213
1312
|
});
|
|
1214
1313
|
case 9:
|
|
1215
1314
|
if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
|
|
1216
|
-
|
|
1315
|
+
_context13.next = 13;
|
|
1217
1316
|
break;
|
|
1218
1317
|
}
|
|
1219
1318
|
this.store.order.persistTempOrder();
|
|
1220
|
-
|
|
1319
|
+
_context13.next = 13;
|
|
1221
1320
|
return this.store.order.saveDraft();
|
|
1222
1321
|
case 13:
|
|
1223
|
-
return
|
|
1322
|
+
return _context13.abrupt("return", tempOrder);
|
|
1224
1323
|
case 16:
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
throw
|
|
1324
|
+
_context13.prev = 16;
|
|
1325
|
+
_context13.t0 = _context13["catch"](0);
|
|
1326
|
+
throw _context13.t0;
|
|
1228
1327
|
case 19:
|
|
1229
1328
|
case "end":
|
|
1230
|
-
return
|
|
1329
|
+
return _context13.stop();
|
|
1231
1330
|
}
|
|
1232
|
-
},
|
|
1331
|
+
}, _callee13, this, [[0, 16]]);
|
|
1233
1332
|
}));
|
|
1234
1333
|
function clearOrderCartLines() {
|
|
1235
1334
|
return _clearOrderCartLines.apply(this, arguments);
|
|
@@ -1246,32 +1345,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1246
1345
|
}, {
|
|
1247
1346
|
key: "getSummary",
|
|
1248
1347
|
value: function () {
|
|
1249
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1348
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
1250
1349
|
var summary;
|
|
1251
|
-
return _regeneratorRuntime().wrap(function
|
|
1252
|
-
while (1) switch (
|
|
1350
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1351
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1253
1352
|
case 0:
|
|
1254
|
-
|
|
1353
|
+
_context14.prev = 0;
|
|
1255
1354
|
if (this.store.order) {
|
|
1256
|
-
|
|
1355
|
+
_context14.next = 3;
|
|
1257
1356
|
break;
|
|
1258
1357
|
}
|
|
1259
1358
|
throw new Error('order 模块未初始化');
|
|
1260
1359
|
case 3:
|
|
1261
|
-
|
|
1360
|
+
_context14.next = 5;
|
|
1262
1361
|
return this.store.order.getOrderSummary();
|
|
1263
1362
|
case 5:
|
|
1264
|
-
summary =
|
|
1265
|
-
return
|
|
1363
|
+
summary = _context14.sent;
|
|
1364
|
+
return _context14.abrupt("return", summary);
|
|
1266
1365
|
case 9:
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
throw
|
|
1366
|
+
_context14.prev = 9;
|
|
1367
|
+
_context14.t0 = _context14["catch"](0);
|
|
1368
|
+
throw _context14.t0;
|
|
1270
1369
|
case 12:
|
|
1271
1370
|
case "end":
|
|
1272
|
-
return
|
|
1371
|
+
return _context14.stop();
|
|
1273
1372
|
}
|
|
1274
|
-
},
|
|
1373
|
+
}, _callee14, this, [[0, 9]]);
|
|
1275
1374
|
}));
|
|
1276
1375
|
function getSummary() {
|
|
1277
1376
|
return _getSummary.apply(this, arguments);
|
|
@@ -1281,10 +1380,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1281
1380
|
}, {
|
|
1282
1381
|
key: "getHistoricalProductDiscountList",
|
|
1283
1382
|
value: function getHistoricalProductDiscountList(products) {
|
|
1284
|
-
var
|
|
1383
|
+
var _this6 = this;
|
|
1285
1384
|
var historyDiscountList = [];
|
|
1286
1385
|
products.forEach(function (item) {
|
|
1287
|
-
if (!
|
|
1386
|
+
if (!_this6.isPersistedOrderProduct(item)) return;
|
|
1288
1387
|
(item.discount_list || []).forEach(function (discount) {
|
|
1289
1388
|
var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
|
|
1290
1389
|
var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
|
|
@@ -1344,11 +1443,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1344
1443
|
}, {
|
|
1345
1444
|
key: "shouldSkipAutoApplyFetchedDiscountsInEditMode",
|
|
1346
1445
|
value: function shouldSkipAutoApplyFetchedDiscountsInEditMode(params) {
|
|
1347
|
-
var
|
|
1446
|
+
var _this7 = this;
|
|
1348
1447
|
if (params.discountAction !== 'edit') return false;
|
|
1349
1448
|
if (!params.products.length) return false;
|
|
1350
1449
|
var hasDraftProduct = params.products.some(function (product) {
|
|
1351
|
-
return !
|
|
1450
|
+
return !_this7.isPersistedOrderProduct(product);
|
|
1352
1451
|
});
|
|
1353
1452
|
if (hasDraftProduct) return false;
|
|
1354
1453
|
var hasSelectedDiscount = params.currentDiscountList.some(function (discount) {
|
|
@@ -1388,14 +1487,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1388
1487
|
}, {
|
|
1389
1488
|
key: "loadDiscountConfig",
|
|
1390
1489
|
value: function () {
|
|
1391
|
-
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1490
|
+
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
|
|
1392
1491
|
var _this$getOrderIdentit, _tempOrder$customer, _tempOrder$_extend, _tempOrder$_extend2, _discountModule$getDi, _discountModule$getOr, _discountModule$getDi2;
|
|
1393
1492
|
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$metadata5, _tempOrder$_extend3, _product$metadata$sou, _product$metadata6, _product$metadata7, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, summary;
|
|
1394
|
-
return _regeneratorRuntime().wrap(function
|
|
1395
|
-
while (1) switch (
|
|
1493
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1494
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1396
1495
|
case 0:
|
|
1397
1496
|
if (this.store.order) {
|
|
1398
|
-
|
|
1497
|
+
_context15.next = 2;
|
|
1399
1498
|
break;
|
|
1400
1499
|
}
|
|
1401
1500
|
throw new Error('order 模块未初始化');
|
|
@@ -1415,18 +1514,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1415
1514
|
discountConfigCacheKey = [customerId, discountAction, Number(orderId) || 0].join(':');
|
|
1416
1515
|
preparedDiscountList = [];
|
|
1417
1516
|
if (!(customerId && customerId !== 1)) {
|
|
1418
|
-
|
|
1517
|
+
_context15.next = 25;
|
|
1419
1518
|
break;
|
|
1420
1519
|
}
|
|
1421
1520
|
if (!(this.discountConfigCacheKey === discountConfigCacheKey)) {
|
|
1422
|
-
|
|
1521
|
+
_context15.next = 19;
|
|
1423
1522
|
break;
|
|
1424
1523
|
}
|
|
1425
1524
|
preparedDiscountList = originalDiscountList;
|
|
1426
|
-
|
|
1525
|
+
_context15.next = 25;
|
|
1427
1526
|
break;
|
|
1428
1527
|
case 19:
|
|
1429
|
-
|
|
1528
|
+
_context15.next = 21;
|
|
1430
1529
|
return this.store.order.loadDiscountConfig({
|
|
1431
1530
|
customerId: customerId,
|
|
1432
1531
|
action: discountAction,
|
|
@@ -1434,23 +1533,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1434
1533
|
apply: false
|
|
1435
1534
|
});
|
|
1436
1535
|
case 21:
|
|
1437
|
-
preparedDiscountList =
|
|
1536
|
+
preparedDiscountList = _context15.sent;
|
|
1438
1537
|
this.discountConfigCacheKey = discountConfigCacheKey;
|
|
1439
|
-
|
|
1538
|
+
_context15.next = 25;
|
|
1440
1539
|
return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, preparedDiscountList);
|
|
1441
1540
|
case 25:
|
|
1442
1541
|
if (!(hasManualDiscountSelection && currentDiscountList.length)) {
|
|
1443
|
-
|
|
1542
|
+
_context15.next = 27;
|
|
1444
1543
|
break;
|
|
1445
1544
|
}
|
|
1446
|
-
return
|
|
1545
|
+
return _context15.abrupt("return", {
|
|
1447
1546
|
productList: tempOrder.products || [],
|
|
1448
1547
|
discountList: currentDiscountList
|
|
1449
1548
|
});
|
|
1450
1549
|
case 27:
|
|
1451
1550
|
nextDiscountList = this.mergeHistoricalDiscountList(preparedDiscountList || (discountModule === null || discountModule === void 0 || (_discountModule$getDi2 = discountModule.getDiscountList) === null || _discountModule$getDi2 === void 0 ? void 0 : _discountModule$getDi2.call(discountModule)) || [], tempOrder.products || []);
|
|
1452
1551
|
nextDiscountList = this.mergeCurrentDiscountSelectionState(nextDiscountList, currentDiscountList);
|
|
1453
|
-
|
|
1552
|
+
_context15.next = 31;
|
|
1454
1553
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1455
1554
|
case 31:
|
|
1456
1555
|
shouldSkipAutoApplyFetchedDiscounts = this.shouldSkipAutoApplyFetchedDiscountsInEditMode({
|
|
@@ -1460,17 +1559,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1460
1559
|
nextDiscountList: nextDiscountList
|
|
1461
1560
|
});
|
|
1462
1561
|
if (!shouldSkipAutoApplyFetchedDiscounts) {
|
|
1463
|
-
|
|
1562
|
+
_context15.next = 40;
|
|
1464
1563
|
break;
|
|
1465
1564
|
}
|
|
1466
|
-
|
|
1565
|
+
_context15.next = 35;
|
|
1467
1566
|
return this.store.order.recalculateSummary({
|
|
1468
1567
|
createIfMissing: true
|
|
1469
1568
|
});
|
|
1470
1569
|
case 35:
|
|
1471
|
-
_summary =
|
|
1570
|
+
_summary = _context15.sent;
|
|
1472
1571
|
this.store.order.persistTempOrder();
|
|
1473
|
-
|
|
1572
|
+
_context15.next = 39;
|
|
1474
1573
|
return this.effectsEmit('onDiscountApplied', {
|
|
1475
1574
|
productList: tempOrder.products || [],
|
|
1476
1575
|
discountList: nextDiscountList,
|
|
@@ -1478,13 +1577,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1478
1577
|
tempOrder: tempOrder
|
|
1479
1578
|
});
|
|
1480
1579
|
case 39:
|
|
1481
|
-
return
|
|
1580
|
+
return _context15.abrupt("return", {
|
|
1482
1581
|
productList: tempOrder.products || [],
|
|
1483
1582
|
discountList: nextDiscountList
|
|
1484
1583
|
});
|
|
1485
1584
|
case 40:
|
|
1486
1585
|
if (!rulesModule) {
|
|
1487
|
-
|
|
1586
|
+
_context15.next = 76;
|
|
1488
1587
|
break;
|
|
1489
1588
|
}
|
|
1490
1589
|
holders = (_tempOrder$holder = tempOrder.holder) !== null && _tempOrder$holder !== void 0 && _tempOrder$holder.form_record_id ? [{
|
|
@@ -1504,21 +1603,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1504
1603
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
1505
1604
|
}
|
|
1506
1605
|
_iterator = _createForOfIteratorHelper(tempOrder.products || []);
|
|
1507
|
-
|
|
1606
|
+
_context15.prev = 45;
|
|
1508
1607
|
_iterator.s();
|
|
1509
1608
|
case 47:
|
|
1510
1609
|
if ((_step = _iterator.n()).done) {
|
|
1511
|
-
|
|
1610
|
+
_context15.next = 62;
|
|
1512
1611
|
break;
|
|
1513
1612
|
}
|
|
1514
1613
|
product = _step.value;
|
|
1515
1614
|
productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
|
|
1516
1615
|
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;
|
|
1517
1616
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
1518
|
-
|
|
1617
|
+
_context15.next = 53;
|
|
1519
1618
|
break;
|
|
1520
1619
|
}
|
|
1521
|
-
return
|
|
1620
|
+
return _context15.abrupt("continue", 60);
|
|
1522
1621
|
case 53:
|
|
1523
1622
|
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
1524
1623
|
return sum + Number(pd.amount || 0);
|
|
@@ -1536,41 +1635,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1536
1635
|
bundle: product.product_bundle
|
|
1537
1636
|
});
|
|
1538
1637
|
case 60:
|
|
1539
|
-
|
|
1638
|
+
_context15.next = 47;
|
|
1540
1639
|
break;
|
|
1541
1640
|
case 62:
|
|
1542
|
-
|
|
1641
|
+
_context15.next = 67;
|
|
1543
1642
|
break;
|
|
1544
1643
|
case 64:
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
_iterator.e(
|
|
1644
|
+
_context15.prev = 64;
|
|
1645
|
+
_context15.t0 = _context15["catch"](45);
|
|
1646
|
+
_iterator.e(_context15.t0);
|
|
1548
1647
|
case 67:
|
|
1549
|
-
|
|
1648
|
+
_context15.prev = 67;
|
|
1550
1649
|
_iterator.f();
|
|
1551
|
-
return
|
|
1650
|
+
return _context15.finish(67);
|
|
1552
1651
|
case 70:
|
|
1553
1652
|
if (!result.discountList) {
|
|
1554
|
-
|
|
1653
|
+
_context15.next = 76;
|
|
1555
1654
|
break;
|
|
1556
1655
|
}
|
|
1557
1656
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
1558
1657
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1559
|
-
|
|
1658
|
+
_context15.next = 75;
|
|
1560
1659
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1561
1660
|
case 75:
|
|
1562
1661
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
1563
1662
|
return discount.isSelected;
|
|
1564
1663
|
});
|
|
1565
1664
|
case 76:
|
|
1566
|
-
|
|
1665
|
+
_context15.next = 78;
|
|
1567
1666
|
return this.store.order.recalculateSummary({
|
|
1568
1667
|
createIfMissing: true
|
|
1569
1668
|
});
|
|
1570
1669
|
case 78:
|
|
1571
|
-
summary =
|
|
1670
|
+
summary = _context15.sent;
|
|
1572
1671
|
this.store.order.persistTempOrder();
|
|
1573
|
-
|
|
1672
|
+
_context15.next = 82;
|
|
1574
1673
|
return this.effectsEmit('onDiscountApplied', {
|
|
1575
1674
|
productList: tempOrder.products || [],
|
|
1576
1675
|
discountList: nextDiscountList,
|
|
@@ -1578,17 +1677,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1578
1677
|
tempOrder: tempOrder
|
|
1579
1678
|
});
|
|
1580
1679
|
case 82:
|
|
1581
|
-
return
|
|
1680
|
+
return _context15.abrupt("return", {
|
|
1582
1681
|
productList: tempOrder.products || [],
|
|
1583
1682
|
discountList: nextDiscountList
|
|
1584
1683
|
});
|
|
1585
1684
|
case 83:
|
|
1586
1685
|
case "end":
|
|
1587
|
-
return
|
|
1686
|
+
return _context15.stop();
|
|
1588
1687
|
}
|
|
1589
|
-
},
|
|
1688
|
+
}, _callee15, this, [[45, 64, 67, 70]]);
|
|
1590
1689
|
}));
|
|
1591
|
-
function loadDiscountConfig(
|
|
1690
|
+
function loadDiscountConfig(_x10) {
|
|
1592
1691
|
return _loadDiscountConfig.apply(this, arguments);
|
|
1593
1692
|
}
|
|
1594
1693
|
return loadDiscountConfig;
|
|
@@ -1596,14 +1695,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1596
1695
|
}, {
|
|
1597
1696
|
key: "bestDiscount",
|
|
1598
1697
|
value: function () {
|
|
1599
|
-
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1698
|
+
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(cb) {
|
|
1600
1699
|
var _discountModule$getOr2, _discountModule$getDi3;
|
|
1601
1700
|
var tempOrder, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _tempOrder$holder3, _tempOrder$holder4, _orderStore$summary2, holders;
|
|
1602
|
-
return _regeneratorRuntime().wrap(function
|
|
1603
|
-
while (1) switch (
|
|
1701
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1702
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1604
1703
|
case 0:
|
|
1605
1704
|
if (this.store.order) {
|
|
1606
|
-
|
|
1705
|
+
_context16.next = 2;
|
|
1607
1706
|
break;
|
|
1608
1707
|
}
|
|
1609
1708
|
throw new Error('order 模块未初始化');
|
|
@@ -1619,11 +1718,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1619
1718
|
productList: tempOrder.products || [],
|
|
1620
1719
|
discountList: nextDiscountList
|
|
1621
1720
|
};
|
|
1622
|
-
|
|
1721
|
+
_context16.next = 12;
|
|
1623
1722
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1624
1723
|
case 12:
|
|
1625
1724
|
if (!rulesModule) {
|
|
1626
|
-
|
|
1725
|
+
_context16.next = 23;
|
|
1627
1726
|
break;
|
|
1628
1727
|
}
|
|
1629
1728
|
holders = (_tempOrder$holder3 = tempOrder.holder) !== null && _tempOrder$holder3 !== void 0 && _tempOrder$holder3.form_record_id ? [{
|
|
@@ -1640,12 +1739,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1640
1739
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
1641
1740
|
}
|
|
1642
1741
|
if (!result.discountList) {
|
|
1643
|
-
|
|
1742
|
+
_context16.next = 23;
|
|
1644
1743
|
break;
|
|
1645
1744
|
}
|
|
1646
1745
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
1647
1746
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1648
|
-
|
|
1747
|
+
_context16.next = 21;
|
|
1649
1748
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1650
1749
|
case 21:
|
|
1651
1750
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
@@ -1656,21 +1755,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1656
1755
|
discountList: nextDiscountList
|
|
1657
1756
|
};
|
|
1658
1757
|
case 23:
|
|
1659
|
-
|
|
1758
|
+
_context16.next = 25;
|
|
1660
1759
|
return this.store.order.recalculateSummary({
|
|
1661
1760
|
createIfMissing: true
|
|
1662
1761
|
});
|
|
1663
1762
|
case 25:
|
|
1664
1763
|
this.store.order.persistTempOrder();
|
|
1665
1764
|
cb === null || cb === void 0 || cb(result);
|
|
1666
|
-
return
|
|
1765
|
+
return _context16.abrupt("return", result);
|
|
1667
1766
|
case 28:
|
|
1668
1767
|
case "end":
|
|
1669
|
-
return
|
|
1768
|
+
return _context16.stop();
|
|
1670
1769
|
}
|
|
1671
|
-
},
|
|
1770
|
+
}, _callee16, this);
|
|
1672
1771
|
}));
|
|
1673
|
-
function bestDiscount(
|
|
1772
|
+
function bestDiscount(_x11) {
|
|
1674
1773
|
return _bestDiscount.apply(this, arguments);
|
|
1675
1774
|
}
|
|
1676
1775
|
return bestDiscount;
|
|
@@ -1684,49 +1783,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1684
1783
|
}, {
|
|
1685
1784
|
key: "scanPromotionCode",
|
|
1686
1785
|
value: function () {
|
|
1687
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1786
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(code, customerId) {
|
|
1688
1787
|
var raw;
|
|
1689
|
-
return _regeneratorRuntime().wrap(function
|
|
1690
|
-
while (1) switch (
|
|
1788
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1789
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1691
1790
|
case 0:
|
|
1692
|
-
|
|
1791
|
+
_context17.prev = 0;
|
|
1693
1792
|
if (this.store.order) {
|
|
1694
|
-
|
|
1793
|
+
_context17.next = 3;
|
|
1695
1794
|
break;
|
|
1696
1795
|
}
|
|
1697
1796
|
throw new Error('order 模块未初始化');
|
|
1698
1797
|
case 3:
|
|
1699
|
-
|
|
1798
|
+
_context17.next = 5;
|
|
1700
1799
|
return this.store.order.scanCode(code, customerId);
|
|
1701
1800
|
case 5:
|
|
1702
|
-
raw =
|
|
1801
|
+
raw = _context17.sent;
|
|
1703
1802
|
if (!raw.isAvailable) {
|
|
1704
|
-
|
|
1803
|
+
_context17.next = 10;
|
|
1705
1804
|
break;
|
|
1706
1805
|
}
|
|
1707
|
-
|
|
1806
|
+
_context17.next = 9;
|
|
1708
1807
|
return this.store.order.recalculateSummary({
|
|
1709
1808
|
createIfMissing: true
|
|
1710
1809
|
});
|
|
1711
1810
|
case 9:
|
|
1712
1811
|
this.store.order.persistTempOrder();
|
|
1713
1812
|
case 10:
|
|
1714
|
-
return
|
|
1813
|
+
return _context17.abrupt("return", {
|
|
1715
1814
|
isAvailable: raw.isAvailable,
|
|
1716
1815
|
type: raw.type,
|
|
1717
1816
|
unavailableReason: raw.unavailableReason
|
|
1718
1817
|
});
|
|
1719
1818
|
case 13:
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
throw
|
|
1819
|
+
_context17.prev = 13;
|
|
1820
|
+
_context17.t0 = _context17["catch"](0);
|
|
1821
|
+
throw _context17.t0;
|
|
1723
1822
|
case 16:
|
|
1724
1823
|
case "end":
|
|
1725
|
-
return
|
|
1824
|
+
return _context17.stop();
|
|
1726
1825
|
}
|
|
1727
|
-
},
|
|
1826
|
+
}, _callee17, this, [[0, 13]]);
|
|
1728
1827
|
}));
|
|
1729
|
-
function scanPromotionCode(
|
|
1828
|
+
function scanPromotionCode(_x12, _x13) {
|
|
1730
1829
|
return _scanPromotionCode.apply(this, arguments);
|
|
1731
1830
|
}
|
|
1732
1831
|
return scanPromotionCode;
|
|
@@ -1734,14 +1833,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1734
1833
|
}, {
|
|
1735
1834
|
key: "setDiscountSelected",
|
|
1736
1835
|
value: function () {
|
|
1737
|
-
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1836
|
+
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
|
|
1738
1837
|
var _tempOrder$holder5, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder6, result, beforeSelectedIds, _iterator2, _step2, d, selectedResourceIds, _iterator3, _step3, _product$metadata8, _tempOrder$_extend4, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
|
|
1739
|
-
return _regeneratorRuntime().wrap(function
|
|
1740
|
-
while (1) switch (
|
|
1838
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1839
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1741
1840
|
case 0:
|
|
1742
|
-
|
|
1841
|
+
_context18.prev = 0;
|
|
1743
1842
|
if (this.store.order) {
|
|
1744
|
-
|
|
1843
|
+
_context18.next = 3;
|
|
1745
1844
|
break;
|
|
1746
1845
|
}
|
|
1747
1846
|
throw new Error('order 模块未初始化');
|
|
@@ -1762,7 +1861,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1762
1861
|
form_record_id: tempOrder.holder.form_record_id
|
|
1763
1862
|
}] : [];
|
|
1764
1863
|
nextDiscountList = updated;
|
|
1765
|
-
|
|
1864
|
+
_context18.next = 14;
|
|
1766
1865
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
1767
1866
|
case 14:
|
|
1768
1867
|
if (rulesModule) {
|
|
@@ -1812,21 +1911,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1812
1911
|
return d.id;
|
|
1813
1912
|
}));
|
|
1814
1913
|
_iterator3 = _createForOfIteratorHelper(tempOrder.products);
|
|
1815
|
-
|
|
1914
|
+
_context18.prev = 17;
|
|
1816
1915
|
_iterator3.s();
|
|
1817
1916
|
case 19:
|
|
1818
1917
|
if ((_step3 = _iterator3.n()).done) {
|
|
1819
|
-
|
|
1918
|
+
_context18.next = 35;
|
|
1820
1919
|
break;
|
|
1821
1920
|
}
|
|
1822
1921
|
product = _step3.value;
|
|
1823
1922
|
productUid = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.unique_identification_number;
|
|
1824
1923
|
runtimeOrigin = productUid ? (_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.productsByUid) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4[productUid]) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.origin : undefined;
|
|
1825
1924
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
1826
|
-
|
|
1925
|
+
_context18.next = 25;
|
|
1827
1926
|
break;
|
|
1828
1927
|
}
|
|
1829
|
-
return
|
|
1928
|
+
return _context18.abrupt("continue", 33);
|
|
1830
1929
|
case 25:
|
|
1831
1930
|
product.discount_list = (product.discount_list || []).filter(function (pd) {
|
|
1832
1931
|
var _pd$discount$resource, _pd$discount;
|
|
@@ -1852,28 +1951,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1852
1951
|
bundle: product.product_bundle
|
|
1853
1952
|
});
|
|
1854
1953
|
case 33:
|
|
1855
|
-
|
|
1954
|
+
_context18.next = 19;
|
|
1856
1955
|
break;
|
|
1857
1956
|
case 35:
|
|
1858
|
-
|
|
1957
|
+
_context18.next = 40;
|
|
1859
1958
|
break;
|
|
1860
1959
|
case 37:
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
_iterator3.e(
|
|
1960
|
+
_context18.prev = 37;
|
|
1961
|
+
_context18.t0 = _context18["catch"](17);
|
|
1962
|
+
_iterator3.e(_context18.t0);
|
|
1864
1963
|
case 40:
|
|
1865
|
-
|
|
1964
|
+
_context18.prev = 40;
|
|
1866
1965
|
_iterator3.f();
|
|
1867
|
-
return
|
|
1966
|
+
return _context18.finish(40);
|
|
1868
1967
|
case 43:
|
|
1869
1968
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1870
|
-
|
|
1969
|
+
_context18.next = 46;
|
|
1871
1970
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1872
1971
|
case 46:
|
|
1873
1972
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
1874
1973
|
return d.isSelected;
|
|
1875
1974
|
});
|
|
1876
|
-
|
|
1975
|
+
_context18.next = 49;
|
|
1877
1976
|
return this.store.order.recalculateSummary({
|
|
1878
1977
|
createIfMissing: true
|
|
1879
1978
|
});
|
|
@@ -1885,19 +1984,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1885
1984
|
selectedDiscountList: tempOrder.discount_list,
|
|
1886
1985
|
tempOrder: tempOrder
|
|
1887
1986
|
});
|
|
1888
|
-
|
|
1987
|
+
_context18.next = 56;
|
|
1889
1988
|
break;
|
|
1890
1989
|
case 53:
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
throw
|
|
1990
|
+
_context18.prev = 53;
|
|
1991
|
+
_context18.t1 = _context18["catch"](0);
|
|
1992
|
+
throw _context18.t1;
|
|
1894
1993
|
case 56:
|
|
1895
1994
|
case "end":
|
|
1896
|
-
return
|
|
1995
|
+
return _context18.stop();
|
|
1897
1996
|
}
|
|
1898
|
-
},
|
|
1997
|
+
}, _callee18, this, [[0, 53], [17, 37, 40, 43]]);
|
|
1899
1998
|
}));
|
|
1900
|
-
function setDiscountSelected(
|
|
1999
|
+
function setDiscountSelected(_x14) {
|
|
1901
2000
|
return _setDiscountSelected.apply(this, arguments);
|
|
1902
2001
|
}
|
|
1903
2002
|
return setDiscountSelected;
|
|
@@ -1905,23 +2004,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1905
2004
|
}, {
|
|
1906
2005
|
key: "applyDiscountCalculationResult",
|
|
1907
2006
|
value: function () {
|
|
1908
|
-
var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2007
|
+
var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(result) {
|
|
1909
2008
|
var tempOrder, orderStore, discountModule;
|
|
1910
|
-
return _regeneratorRuntime().wrap(function
|
|
1911
|
-
while (1) switch (
|
|
2009
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
2010
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1912
2011
|
case 0:
|
|
1913
|
-
|
|
2012
|
+
_context19.prev = 0;
|
|
1914
2013
|
if (this.store.order) {
|
|
1915
|
-
|
|
2014
|
+
_context19.next = 3;
|
|
1916
2015
|
break;
|
|
1917
2016
|
}
|
|
1918
2017
|
throw new Error('order 模块未初始化');
|
|
1919
2018
|
case 3:
|
|
1920
2019
|
if (result) {
|
|
1921
|
-
|
|
2020
|
+
_context19.next = 5;
|
|
1922
2021
|
break;
|
|
1923
2022
|
}
|
|
1924
|
-
return
|
|
2023
|
+
return _context19.abrupt("return");
|
|
1925
2024
|
case 5:
|
|
1926
2025
|
tempOrder = this.store.order.ensureTempOrder();
|
|
1927
2026
|
orderStore = this.store.order.store || {};
|
|
@@ -1930,36 +2029,36 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1930
2029
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
1931
2030
|
}
|
|
1932
2031
|
if (!result.discountList) {
|
|
1933
|
-
|
|
2032
|
+
_context19.next = 14;
|
|
1934
2033
|
break;
|
|
1935
2034
|
}
|
|
1936
2035
|
OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
|
|
1937
|
-
|
|
2036
|
+
_context19.next = 13;
|
|
1938
2037
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(result.discountList);
|
|
1939
2038
|
case 13:
|
|
1940
2039
|
tempOrder.discount_list = result.discountList.filter(function (discount) {
|
|
1941
2040
|
return discount.isSelected;
|
|
1942
2041
|
});
|
|
1943
2042
|
case 14:
|
|
1944
|
-
|
|
2043
|
+
_context19.next = 16;
|
|
1945
2044
|
return this.store.order.recalculateSummary({
|
|
1946
2045
|
createIfMissing: true
|
|
1947
2046
|
});
|
|
1948
2047
|
case 16:
|
|
1949
2048
|
this.store.order.persistTempOrder();
|
|
1950
|
-
|
|
2049
|
+
_context19.next = 22;
|
|
1951
2050
|
break;
|
|
1952
2051
|
case 19:
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
throw
|
|
2052
|
+
_context19.prev = 19;
|
|
2053
|
+
_context19.t0 = _context19["catch"](0);
|
|
2054
|
+
throw _context19.t0;
|
|
1956
2055
|
case 22:
|
|
1957
2056
|
case "end":
|
|
1958
|
-
return
|
|
2057
|
+
return _context19.stop();
|
|
1959
2058
|
}
|
|
1960
|
-
},
|
|
2059
|
+
}, _callee19, this, [[0, 19]]);
|
|
1961
2060
|
}));
|
|
1962
|
-
function applyDiscountCalculationResult(
|
|
2061
|
+
function applyDiscountCalculationResult(_x15) {
|
|
1963
2062
|
return _applyDiscountCalculationResult.apply(this, arguments);
|
|
1964
2063
|
}
|
|
1965
2064
|
return applyDiscountCalculationResult;
|
|
@@ -1967,18 +2066,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1967
2066
|
}, {
|
|
1968
2067
|
key: "submitScanOrder",
|
|
1969
2068
|
value: function () {
|
|
1970
|
-
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1971
|
-
return _regeneratorRuntime().wrap(function
|
|
1972
|
-
while (1) switch (
|
|
2069
|
+
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
2070
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
2071
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1973
2072
|
case 0:
|
|
1974
|
-
return
|
|
2073
|
+
return _context20.abrupt("return", this.submitSalesOrder(params));
|
|
1975
2074
|
case 1:
|
|
1976
2075
|
case "end":
|
|
1977
|
-
return
|
|
2076
|
+
return _context20.stop();
|
|
1978
2077
|
}
|
|
1979
|
-
},
|
|
2078
|
+
}, _callee20, this);
|
|
1980
2079
|
}));
|
|
1981
|
-
function submitScanOrder(
|
|
2080
|
+
function submitScanOrder(_x16) {
|
|
1982
2081
|
return _submitScanOrder.apply(this, arguments);
|
|
1983
2082
|
}
|
|
1984
2083
|
return submitScanOrder;
|
|
@@ -1992,14 +2091,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1992
2091
|
}, {
|
|
1993
2092
|
key: "submitSalesOrder",
|
|
1994
2093
|
value: (function () {
|
|
1995
|
-
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2094
|
+
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
1996
2095
|
var _this$otherParams6, _this$otherParams7, _this$otherParams8, _this$otherParams9;
|
|
1997
2096
|
var inferredPaymentStatus, submitParams;
|
|
1998
|
-
return _regeneratorRuntime().wrap(function
|
|
1999
|
-
while (1) switch (
|
|
2097
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2098
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2000
2099
|
case 0:
|
|
2001
2100
|
if (this.store.order) {
|
|
2002
|
-
|
|
2101
|
+
_context21.next = 2;
|
|
2003
2102
|
break;
|
|
2004
2103
|
}
|
|
2005
2104
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -2022,14 +2121,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2022
2121
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2023
2122
|
enhancePayload: params.enhancePayload
|
|
2024
2123
|
} : {});
|
|
2025
|
-
return
|
|
2124
|
+
return _context21.abrupt("return", this.store.order.submitTempOrder(submitParams));
|
|
2026
2125
|
case 5:
|
|
2027
2126
|
case "end":
|
|
2028
|
-
return
|
|
2127
|
+
return _context21.stop();
|
|
2029
2128
|
}
|
|
2030
|
-
},
|
|
2129
|
+
}, _callee21, this);
|
|
2031
2130
|
}));
|
|
2032
|
-
function submitSalesOrder(
|
|
2131
|
+
function submitSalesOrder(_x17) {
|
|
2033
2132
|
return _submitSalesOrder.apply(this, arguments);
|
|
2034
2133
|
}
|
|
2035
2134
|
return submitSalesOrder;
|
|
@@ -2037,14 +2136,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2037
2136
|
}, {
|
|
2038
2137
|
key: "submitTempOrderAsync",
|
|
2039
2138
|
value: function () {
|
|
2040
|
-
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2139
|
+
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
2041
2140
|
var _this$otherParams10, _this$otherParams11, _this$otherParams12, _this$otherParams13;
|
|
2042
2141
|
var inferredPaymentStatus, submitParams;
|
|
2043
|
-
return _regeneratorRuntime().wrap(function
|
|
2044
|
-
while (1) switch (
|
|
2142
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2143
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2045
2144
|
case 0:
|
|
2046
2145
|
if (this.store.order) {
|
|
2047
|
-
|
|
2146
|
+
_context22.next = 2;
|
|
2048
2147
|
break;
|
|
2049
2148
|
}
|
|
2050
2149
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -2065,14 +2164,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2065
2164
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2066
2165
|
enhancePayload: params.enhancePayload
|
|
2067
2166
|
} : {});
|
|
2068
|
-
return
|
|
2167
|
+
return _context22.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
|
|
2069
2168
|
case 5:
|
|
2070
2169
|
case "end":
|
|
2071
|
-
return
|
|
2170
|
+
return _context22.stop();
|
|
2072
2171
|
}
|
|
2073
|
-
},
|
|
2172
|
+
}, _callee22, this);
|
|
2074
2173
|
}));
|
|
2075
|
-
function submitTempOrderAsync(
|
|
2174
|
+
function submitTempOrderAsync(_x18) {
|
|
2076
2175
|
return _submitTempOrderAsync.apply(this, arguments);
|
|
2077
2176
|
}
|
|
2078
2177
|
return submitTempOrderAsync;
|
|
@@ -2080,14 +2179,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2080
2179
|
}, {
|
|
2081
2180
|
key: "printLocalOrderReceipt",
|
|
2082
2181
|
value: function () {
|
|
2083
|
-
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2182
|
+
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(lookup) {
|
|
2084
2183
|
var _this$otherParams14, _this$otherParams15, _this$otherParams16, _this$otherParams17;
|
|
2085
2184
|
var hasLookup, lookupPayload, context, payload, response, _this$store$order$app, _this$store$order3, _data;
|
|
2086
|
-
return _regeneratorRuntime().wrap(function
|
|
2087
|
-
while (1) switch (
|
|
2185
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2186
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2088
2187
|
case 0:
|
|
2089
2188
|
if (this.store.order) {
|
|
2090
|
-
|
|
2189
|
+
_context23.next = 2;
|
|
2091
2190
|
break;
|
|
2092
2191
|
}
|
|
2093
2192
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -2118,28 +2217,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2118
2217
|
channel: context.channel,
|
|
2119
2218
|
type: context.type
|
|
2120
2219
|
});
|
|
2121
|
-
|
|
2220
|
+
_context23.next = 8;
|
|
2122
2221
|
return this.request.post('/local/print-order', payload, {
|
|
2123
2222
|
osServer: true,
|
|
2124
2223
|
customToast: function customToast() {}
|
|
2125
2224
|
});
|
|
2126
2225
|
case 8:
|
|
2127
|
-
response =
|
|
2226
|
+
response = _context23.sent;
|
|
2128
2227
|
if (hasLookup) {
|
|
2129
|
-
|
|
2228
|
+
_context23.next = 12;
|
|
2130
2229
|
break;
|
|
2131
2230
|
}
|
|
2132
|
-
|
|
2231
|
+
_context23.next = 12;
|
|
2133
2232
|
return (_this$store$order$app = (_this$store$order3 = this.store.order).applyLocalPrintOrderNumbers) === null || _this$store$order$app === void 0 ? void 0 : _this$store$order$app.call(_this$store$order3, response === null || response === void 0 || (_data = response.data) === null || _data === void 0 ? void 0 : _data.order);
|
|
2134
2233
|
case 12:
|
|
2135
|
-
return
|
|
2234
|
+
return _context23.abrupt("return", response);
|
|
2136
2235
|
case 13:
|
|
2137
2236
|
case "end":
|
|
2138
|
-
return
|
|
2237
|
+
return _context23.stop();
|
|
2139
2238
|
}
|
|
2140
|
-
},
|
|
2239
|
+
}, _callee23, this);
|
|
2141
2240
|
}));
|
|
2142
|
-
function printLocalOrderReceipt(
|
|
2241
|
+
function printLocalOrderReceipt(_x19) {
|
|
2143
2242
|
return _printLocalOrderReceipt.apply(this, arguments);
|
|
2144
2243
|
}
|
|
2145
2244
|
return printLocalOrderReceipt;
|
|
@@ -2160,19 +2259,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2160
2259
|
}, {
|
|
2161
2260
|
key: "syncPaymentsToOrder",
|
|
2162
2261
|
value: function () {
|
|
2163
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2164
|
-
var
|
|
2262
|
+
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
2263
|
+
var _ref18, _params$businessCode, _this$otherParams18, _this$otherParams19, _params$channel;
|
|
2165
2264
|
var businessCode, channel, syncParams, syncState, payments, syncResult;
|
|
2166
|
-
return _regeneratorRuntime().wrap(function
|
|
2167
|
-
while (1) switch (
|
|
2265
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2266
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2168
2267
|
case 0:
|
|
2169
2268
|
if (this.store.order) {
|
|
2170
|
-
|
|
2269
|
+
_context24.next = 2;
|
|
2171
2270
|
break;
|
|
2172
2271
|
}
|
|
2173
2272
|
throw new Error('order 模块未初始化');
|
|
2174
2273
|
case 2:
|
|
2175
|
-
businessCode = (
|
|
2274
|
+
businessCode = (_ref18 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode) !== null && _ref18 !== void 0 ? _ref18 : (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.business_code;
|
|
2176
2275
|
channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
|
|
2177
2276
|
syncParams = _objectSpread(_objectSpread(_objectSpread({}, params), businessCode !== undefined ? {
|
|
2178
2277
|
businessCode: businessCode
|
|
@@ -2181,13 +2280,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2181
2280
|
} : {});
|
|
2182
2281
|
syncState = this.store.order.getOrderSyncState();
|
|
2183
2282
|
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
2184
|
-
|
|
2283
|
+
_context24.next = 8;
|
|
2185
2284
|
break;
|
|
2186
2285
|
}
|
|
2187
|
-
return
|
|
2286
|
+
return _context24.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
2188
2287
|
case 8:
|
|
2189
2288
|
payments = params.payments || [];
|
|
2190
|
-
|
|
2289
|
+
_context24.next = 11;
|
|
2191
2290
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
2192
2291
|
payments: payments,
|
|
2193
2292
|
params: syncParams,
|
|
@@ -2195,12 +2294,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2195
2294
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
2196
2295
|
});
|
|
2197
2296
|
case 11:
|
|
2198
|
-
|
|
2199
|
-
|
|
2297
|
+
_context24.prev = 11;
|
|
2298
|
+
_context24.next = 14;
|
|
2200
2299
|
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
2201
2300
|
case 14:
|
|
2202
|
-
syncResult =
|
|
2203
|
-
|
|
2301
|
+
syncResult = _context24.sent;
|
|
2302
|
+
_context24.next = 17;
|
|
2204
2303
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
2205
2304
|
ok: true,
|
|
2206
2305
|
syncResult: syncResult,
|
|
@@ -2210,28 +2309,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2210
2309
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
2211
2310
|
});
|
|
2212
2311
|
case 17:
|
|
2213
|
-
return
|
|
2312
|
+
return _context24.abrupt("return", syncResult);
|
|
2214
2313
|
case 20:
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2314
|
+
_context24.prev = 20;
|
|
2315
|
+
_context24.t0 = _context24["catch"](11);
|
|
2316
|
+
_context24.next = 24;
|
|
2218
2317
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
2219
2318
|
ok: false,
|
|
2220
|
-
error:
|
|
2319
|
+
error: _context24.t0,
|
|
2221
2320
|
payments: this.store.order.getOrderPayments(),
|
|
2222
2321
|
params: syncParams,
|
|
2223
2322
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
2224
2323
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
2225
2324
|
});
|
|
2226
2325
|
case 24:
|
|
2227
|
-
throw
|
|
2326
|
+
throw _context24.t0;
|
|
2228
2327
|
case 25:
|
|
2229
2328
|
case "end":
|
|
2230
|
-
return
|
|
2329
|
+
return _context24.stop();
|
|
2231
2330
|
}
|
|
2232
|
-
},
|
|
2331
|
+
}, _callee24, this, [[11, 20]]);
|
|
2233
2332
|
}));
|
|
2234
|
-
function syncPaymentsToOrder(
|
|
2333
|
+
function syncPaymentsToOrder(_x20) {
|
|
2235
2334
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
2236
2335
|
}
|
|
2237
2336
|
return syncPaymentsToOrder;
|
|
@@ -2259,9 +2358,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2259
2358
|
var _this$otherParams20,
|
|
2260
2359
|
_paymentRecord$paymen,
|
|
2261
2360
|
_paymentRecord$create,
|
|
2262
|
-
|
|
2361
|
+
_ref19,
|
|
2263
2362
|
_paymentRecord$origin,
|
|
2264
|
-
|
|
2363
|
+
_this8 = this;
|
|
2265
2364
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2266
2365
|
var paymentRecord = payment;
|
|
2267
2366
|
var paymentAmount = new Decimal(paymentRecord.amount || 0);
|
|
@@ -2283,7 +2382,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2283
2382
|
var paymentTime = (_paymentRecord$paymen = paymentRecord.payment_time) !== null && _paymentRecord$paymen !== void 0 ? _paymentRecord$paymen : paymentTimestamp;
|
|
2284
2383
|
var createdAt = (_paymentRecord$create = paymentRecord.created_at) !== null && _paymentRecord$create !== void 0 ? _paymentRecord$create : paymentTimestamp;
|
|
2285
2384
|
var serviceCharge = paymentRecord.service_charge && _typeof(paymentRecord.service_charge) === 'object' ? paymentRecord.service_charge : null;
|
|
2286
|
-
var calculatedServiceFee = serviceCharge ? new Decimal((
|
|
2385
|
+
var calculatedServiceFee = serviceCharge ? new Decimal((_ref19 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref19 !== void 0 ? _ref19 : 0).times(serviceCharge.percentage || 0).plus(serviceCharge.amount || 0).toDecimalPlaces(2).toFixed(2) : undefined;
|
|
2287
2386
|
var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({}, paymentRecord), calculatedServiceFee !== undefined ? {
|
|
2288
2387
|
service_fee: calculatedServiceFee
|
|
2289
2388
|
} : {}), {}, {
|
|
@@ -2301,7 +2400,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2301
2400
|
submitWhenPaid: true,
|
|
2302
2401
|
smallTicketDataFlag: 1
|
|
2303
2402
|
}).catch(function (error) {
|
|
2304
|
-
|
|
2403
|
+
_this8.logError('auto sync payments failed', {
|
|
2305
2404
|
error: error instanceof Error ? error.message : String(error)
|
|
2306
2405
|
});
|
|
2307
2406
|
});
|
|
@@ -2393,20 +2492,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2393
2492
|
}, {
|
|
2394
2493
|
key: "initWalletData",
|
|
2395
2494
|
value: function () {
|
|
2396
|
-
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2397
|
-
var _params$order_wait_pa,
|
|
2495
|
+
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
|
|
2496
|
+
var _params$order_wait_pa, _ref20, _tempOrder$is_price_i;
|
|
2398
2497
|
var snapshot, tempOrder, amount, walletBusinessData, result;
|
|
2399
|
-
return _regeneratorRuntime().wrap(function
|
|
2400
|
-
while (1) switch (
|
|
2498
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2499
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2401
2500
|
case 0:
|
|
2402
2501
|
if (this.store.order) {
|
|
2403
|
-
|
|
2502
|
+
_context25.next = 2;
|
|
2404
2503
|
break;
|
|
2405
2504
|
}
|
|
2406
2505
|
throw new Error('order 模块未初始化');
|
|
2407
2506
|
case 2:
|
|
2408
2507
|
if (this.store.payment) {
|
|
2409
|
-
|
|
2508
|
+
_context25.next = 4;
|
|
2410
2509
|
break;
|
|
2411
2510
|
}
|
|
2412
2511
|
throw new Error('payment 模块未初始化');
|
|
@@ -2415,10 +2514,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2415
2514
|
tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
2416
2515
|
amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
2417
2516
|
if (!(!tempOrder || !amount)) {
|
|
2418
|
-
|
|
2517
|
+
_context25.next = 9;
|
|
2419
2518
|
break;
|
|
2420
2519
|
}
|
|
2421
|
-
return
|
|
2520
|
+
return _context25.abrupt("return", {
|
|
2422
2521
|
walletRecommendList: [],
|
|
2423
2522
|
userIdentificationCodes: [],
|
|
2424
2523
|
transformList: [],
|
|
@@ -2437,15 +2536,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2437
2536
|
},
|
|
2438
2537
|
products: this.getWalletProductList(),
|
|
2439
2538
|
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),
|
|
2440
|
-
is_price_include_tax: (
|
|
2539
|
+
is_price_include_tax: (_ref20 = (_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 && _ref20 !== void 0 ? _ref20 : 1
|
|
2441
2540
|
}, snapshot.identity.orderId ? {
|
|
2442
2541
|
payment_order_id: String(snapshot.identity.orderId)
|
|
2443
2542
|
} : {});
|
|
2444
|
-
|
|
2543
|
+
_context25.next = 12;
|
|
2445
2544
|
return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
2446
2545
|
case 12:
|
|
2447
|
-
result =
|
|
2448
|
-
|
|
2546
|
+
result = _context25.sent;
|
|
2547
|
+
_context25.next = 15;
|
|
2449
2548
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
2450
2549
|
orderId: snapshot.identity.orderId,
|
|
2451
2550
|
customerId: walletBusinessData.customer_id,
|
|
@@ -2457,14 +2556,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2457
2556
|
timestamp: Date.now()
|
|
2458
2557
|
});
|
|
2459
2558
|
case 15:
|
|
2460
|
-
return
|
|
2559
|
+
return _context25.abrupt("return", result);
|
|
2461
2560
|
case 16:
|
|
2462
2561
|
case "end":
|
|
2463
|
-
return
|
|
2562
|
+
return _context25.stop();
|
|
2464
2563
|
}
|
|
2465
|
-
},
|
|
2564
|
+
}, _callee25, this);
|
|
2466
2565
|
}));
|
|
2467
|
-
function initWalletData(
|
|
2566
|
+
function initWalletData(_x21) {
|
|
2468
2567
|
return _initWalletData.apply(this, arguments);
|
|
2469
2568
|
}
|
|
2470
2569
|
return initWalletData;
|
|
@@ -2491,35 +2590,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2491
2590
|
}, {
|
|
2492
2591
|
key: "getPaymentMethodsAsync",
|
|
2493
2592
|
value: (function () {
|
|
2494
|
-
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2593
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
2495
2594
|
var response, paymentMethods;
|
|
2496
|
-
return _regeneratorRuntime().wrap(function
|
|
2497
|
-
while (1) switch (
|
|
2595
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2596
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2498
2597
|
case 0:
|
|
2499
|
-
|
|
2500
|
-
|
|
2598
|
+
_context26.prev = 0;
|
|
2599
|
+
_context26.next = 3;
|
|
2501
2600
|
return this.request.get('/pay/custom-payment/all', {
|
|
2502
2601
|
filterPaymentMethods: true
|
|
2503
2602
|
}, {
|
|
2504
2603
|
osServer: true
|
|
2505
2604
|
});
|
|
2506
2605
|
case 3:
|
|
2507
|
-
response =
|
|
2606
|
+
response = _context26.sent;
|
|
2508
2607
|
paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
2509
2608
|
this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
|
|
2510
|
-
return
|
|
2609
|
+
return _context26.abrupt("return", this.getPaymentMethods());
|
|
2511
2610
|
case 9:
|
|
2512
|
-
|
|
2513
|
-
|
|
2611
|
+
_context26.prev = 9;
|
|
2612
|
+
_context26.t0 = _context26["catch"](0);
|
|
2514
2613
|
this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
|
|
2515
|
-
error:
|
|
2614
|
+
error: _context26.t0 instanceof Error ? _context26.t0.message : String(_context26.t0)
|
|
2516
2615
|
});
|
|
2517
|
-
return
|
|
2616
|
+
return _context26.abrupt("return", this.getPaymentMethods());
|
|
2518
2617
|
case 13:
|
|
2519
2618
|
case "end":
|
|
2520
|
-
return
|
|
2619
|
+
return _context26.stop();
|
|
2521
2620
|
}
|
|
2522
|
-
},
|
|
2621
|
+
}, _callee26, this, [[0, 9]]);
|
|
2523
2622
|
}));
|
|
2524
2623
|
function getPaymentMethodsAsync() {
|
|
2525
2624
|
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
@@ -2567,49 +2666,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2567
2666
|
}, {
|
|
2568
2667
|
key: "sendCustomerPayLink",
|
|
2569
2668
|
value: (function () {
|
|
2570
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2571
|
-
var orderIds,
|
|
2572
|
-
return _regeneratorRuntime().wrap(function
|
|
2573
|
-
while (1) switch (
|
|
2669
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
2670
|
+
var orderIds, _ref21, _ref22, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
2671
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2672
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2574
2673
|
case 0:
|
|
2575
2674
|
if (this.store.order) {
|
|
2576
|
-
|
|
2675
|
+
_context27.next = 2;
|
|
2577
2676
|
break;
|
|
2578
2677
|
}
|
|
2579
2678
|
throw new Error('order 模块未初始化');
|
|
2580
2679
|
case 2:
|
|
2581
2680
|
orderIds = params.order_ids || params.orderIds || [];
|
|
2582
2681
|
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
2583
|
-
|
|
2682
|
+
_context27.next = 11;
|
|
2584
2683
|
break;
|
|
2585
2684
|
}
|
|
2586
|
-
|
|
2685
|
+
_context27.next = 6;
|
|
2587
2686
|
return this.submitSalesOrder({
|
|
2588
2687
|
smallTicketDataFlag: 1
|
|
2589
2688
|
});
|
|
2590
2689
|
case 6:
|
|
2591
|
-
submitResult =
|
|
2592
|
-
orderId = (
|
|
2690
|
+
submitResult = _context27.sent;
|
|
2691
|
+
orderId = (_ref21 = (_ref22 = (_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 && _ref22 !== void 0 ? _ref22 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref21 !== void 0 ? _ref21 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
2593
2692
|
if (orderId) {
|
|
2594
|
-
|
|
2693
|
+
_context27.next = 10;
|
|
2595
2694
|
break;
|
|
2596
2695
|
}
|
|
2597
2696
|
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
2598
2697
|
case 10:
|
|
2599
2698
|
orderIds = [orderId];
|
|
2600
2699
|
case 11:
|
|
2601
|
-
return
|
|
2700
|
+
return _context27.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
2602
2701
|
emails: params.emails,
|
|
2603
2702
|
notify_action: params.notify_action,
|
|
2604
2703
|
order_ids: orderIds
|
|
2605
2704
|
}));
|
|
2606
2705
|
case 12:
|
|
2607
2706
|
case "end":
|
|
2608
|
-
return
|
|
2707
|
+
return _context27.stop();
|
|
2609
2708
|
}
|
|
2610
|
-
},
|
|
2709
|
+
}, _callee27, this);
|
|
2611
2710
|
}));
|
|
2612
|
-
function sendCustomerPayLink(
|
|
2711
|
+
function sendCustomerPayLink(_x22) {
|
|
2613
2712
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
2614
2713
|
}
|
|
2615
2714
|
return sendCustomerPayLink;
|
|
@@ -2622,27 +2721,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2622
2721
|
}, {
|
|
2623
2722
|
key: "calculateProductBookingPrice",
|
|
2624
2723
|
value: function () {
|
|
2625
|
-
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2724
|
+
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2626
2725
|
var _params$customer_id;
|
|
2627
2726
|
var quotation, customerId, authoritativeProduct, product;
|
|
2628
|
-
return _regeneratorRuntime().wrap(function
|
|
2629
|
-
while (1) switch (
|
|
2727
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2728
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2630
2729
|
case 0:
|
|
2631
2730
|
quotation = this.store.quotation;
|
|
2632
2731
|
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
2633
|
-
|
|
2732
|
+
_context28.next = 4;
|
|
2634
2733
|
return this.loadProductForPriceQuery(params, customerId);
|
|
2635
2734
|
case 4:
|
|
2636
|
-
authoritativeProduct =
|
|
2735
|
+
authoritativeProduct = _context28.sent;
|
|
2637
2736
|
product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
2638
|
-
|
|
2737
|
+
_context28.next = 8;
|
|
2639
2738
|
return this.loadQuotationForPriceQuery({
|
|
2640
2739
|
quotation: quotation,
|
|
2641
2740
|
customer_id: customerId,
|
|
2642
2741
|
channel: params.channel
|
|
2643
2742
|
});
|
|
2644
2743
|
case 8:
|
|
2645
|
-
return
|
|
2744
|
+
return _context28.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
2646
2745
|
product: product,
|
|
2647
2746
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
2648
2747
|
customer_id: customerId,
|
|
@@ -2650,46 +2749,209 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2650
2749
|
})));
|
|
2651
2750
|
case 9:
|
|
2652
2751
|
case "end":
|
|
2653
|
-
return
|
|
2752
|
+
return _context28.stop();
|
|
2654
2753
|
}
|
|
2655
|
-
},
|
|
2754
|
+
}, _callee28, this);
|
|
2656
2755
|
}));
|
|
2657
|
-
function calculateProductBookingPrice(
|
|
2756
|
+
function calculateProductBookingPrice(_x23) {
|
|
2658
2757
|
return _calculateProductBookingPrice.apply(this, arguments);
|
|
2659
2758
|
}
|
|
2660
2759
|
return calculateProductBookingPrice;
|
|
2661
2760
|
}()
|
|
2761
|
+
}, {
|
|
2762
|
+
key: "getQuotationCustomerScopeInfo",
|
|
2763
|
+
value: function getQuotationCustomerScopeInfo() {
|
|
2764
|
+
var _this9 = this;
|
|
2765
|
+
var quotation = this.store.quotation;
|
|
2766
|
+
if (quotation && typeof quotation.getQuotationCustomerScopeInfo === 'function') {
|
|
2767
|
+
return quotation.getQuotationCustomerScopeInfo();
|
|
2768
|
+
}
|
|
2769
|
+
var list = typeof (quotation === null || quotation === void 0 ? void 0 : quotation.getQuotationList) === 'function' ? quotation.getQuotationList() : [];
|
|
2770
|
+
var customerById = new Map();
|
|
2771
|
+
var quotationScopes = (Array.isArray(list) ? list : []).filter(function (item) {
|
|
2772
|
+
return Array.isArray(item === null || item === void 0 ? void 0 : item.customer) && item.customer.length > 0;
|
|
2773
|
+
}).map(function (item) {
|
|
2774
|
+
var localSeen = new Set();
|
|
2775
|
+
var customers = item.customer.filter(function (customer) {
|
|
2776
|
+
var customerId = _this9.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
|
|
2777
|
+
if (!customerId || localSeen.has(customerId)) return false;
|
|
2778
|
+
localSeen.add(customerId);
|
|
2779
|
+
if (!customerById.has(customerId)) customerById.set(customerId, customer);
|
|
2780
|
+
return true;
|
|
2781
|
+
});
|
|
2782
|
+
return {
|
|
2783
|
+
quotationId: item.id,
|
|
2784
|
+
quotationName: item.name,
|
|
2785
|
+
customerIds: customers.map(function (customer) {
|
|
2786
|
+
return String(customer.id);
|
|
2787
|
+
}),
|
|
2788
|
+
customers: customers
|
|
2789
|
+
};
|
|
2790
|
+
});
|
|
2791
|
+
return {
|
|
2792
|
+
quotationCount: Array.isArray(list) ? list.length : 0,
|
|
2793
|
+
hasCustomerScopedQuotations: quotationScopes.length > 0,
|
|
2794
|
+
allQuotationsCustomerScoped: Array.isArray(list) && list.length > 0 && quotationScopes.length === list.length,
|
|
2795
|
+
customerIds: Array.from(customerById.keys()),
|
|
2796
|
+
customers: Array.from(customerById.values()),
|
|
2797
|
+
quotationScopes: quotationScopes
|
|
2798
|
+
};
|
|
2799
|
+
}
|
|
2800
|
+
}, {
|
|
2801
|
+
key: "shouldRecalculateProductBookingPricesForContextChange",
|
|
2802
|
+
value: function shouldRecalculateProductBookingPricesForContextChange(params) {
|
|
2803
|
+
var scopeInfo = this.getQuotationCustomerScopeInfo();
|
|
2804
|
+
var scopedCustomerIds = new Set(scopeInfo.customerIds.map(function (id) {
|
|
2805
|
+
return String(id);
|
|
2806
|
+
}));
|
|
2807
|
+
var previousCustomerId = this.normalizePriceContextCustomerId(params.previousCustomerId);
|
|
2808
|
+
var nextCustomerId = this.normalizePriceContextCustomerId(params.nextCustomerId);
|
|
2809
|
+
var previousInScope = previousCustomerId ? scopedCustomerIds.has(previousCustomerId) : false;
|
|
2810
|
+
var nextInScope = nextCustomerId ? scopedCustomerIds.has(nextCustomerId) : false;
|
|
2811
|
+
var shouldRecalculate = false;
|
|
2812
|
+
if (scopeInfo.hasCustomerScopedQuotations) {
|
|
2813
|
+
if (previousInScope) {
|
|
2814
|
+
shouldRecalculate = true;
|
|
2815
|
+
} else if (!previousCustomerId && !nextInScope) {
|
|
2816
|
+
shouldRecalculate = false;
|
|
2817
|
+
} else {
|
|
2818
|
+
shouldRecalculate = nextInScope;
|
|
2819
|
+
}
|
|
2820
|
+
}
|
|
2821
|
+
return shouldRecalculate;
|
|
2822
|
+
}
|
|
2823
|
+
}, {
|
|
2824
|
+
key: "calculateProductBookingPrices",
|
|
2825
|
+
value: function () {
|
|
2826
|
+
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(paramsList) {
|
|
2827
|
+
var _paramsList$0$custome,
|
|
2828
|
+
_paramsList$,
|
|
2829
|
+
_this10 = this,
|
|
2830
|
+
_paramsList$2;
|
|
2831
|
+
var quotation, customerId, productMapsByGroup, groups;
|
|
2832
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2833
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2834
|
+
case 0:
|
|
2835
|
+
if (paramsList.length) {
|
|
2836
|
+
_context30.next = 2;
|
|
2837
|
+
break;
|
|
2838
|
+
}
|
|
2839
|
+
return _context30.abrupt("return", []);
|
|
2840
|
+
case 2:
|
|
2841
|
+
quotation = this.store.quotation;
|
|
2842
|
+
customerId = (_paramsList$0$custome = (_paramsList$ = paramsList[0]) === null || _paramsList$ === void 0 ? void 0 : _paramsList$.customer_id) !== null && _paramsList$0$custome !== void 0 ? _paramsList$0$custome : this.getCurrentOrderCustomerId();
|
|
2843
|
+
productMapsByGroup = new Map();
|
|
2844
|
+
groups = new Map();
|
|
2845
|
+
paramsList.forEach(function (params) {
|
|
2846
|
+
var _this10$otherParams;
|
|
2847
|
+
var product = params.product || {};
|
|
2848
|
+
var productId = _this10.getPriceQueryProductId(product);
|
|
2849
|
+
if (productId === null) return;
|
|
2850
|
+
var schedule = _this10.getPriceQuerySchedule(params);
|
|
2851
|
+
var channel = params.channel || ((_this10$otherParams = _this10.otherParams) === null || _this10$otherParams === void 0 ? void 0 : _this10$otherParams.channel);
|
|
2852
|
+
var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
|
|
2853
|
+
var group = groups.get(groupKey) || {
|
|
2854
|
+
ids: new Set(),
|
|
2855
|
+
schedule: schedule,
|
|
2856
|
+
channel: channel
|
|
2857
|
+
};
|
|
2858
|
+
group.ids.add(productId);
|
|
2859
|
+
groups.set(groupKey, group);
|
|
2860
|
+
});
|
|
2861
|
+
_context30.next = 9;
|
|
2862
|
+
return Promise.all(Array.from(groups.entries()).map( /*#__PURE__*/function () {
|
|
2863
|
+
var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(_ref23) {
|
|
2864
|
+
var _ref25, groupKey, group, productsById;
|
|
2865
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2866
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2867
|
+
case 0:
|
|
2868
|
+
_ref25 = _slicedToArray(_ref23, 2), groupKey = _ref25[0], group = _ref25[1];
|
|
2869
|
+
_context29.next = 3;
|
|
2870
|
+
return _this10.loadProductsForPriceQuery({
|
|
2871
|
+
ids: Array.from(group.ids),
|
|
2872
|
+
schedule: group.schedule,
|
|
2873
|
+
customerId: customerId,
|
|
2874
|
+
channel: group.channel
|
|
2875
|
+
});
|
|
2876
|
+
case 3:
|
|
2877
|
+
productsById = _context29.sent;
|
|
2878
|
+
productMapsByGroup.set(groupKey, productsById);
|
|
2879
|
+
case 5:
|
|
2880
|
+
case "end":
|
|
2881
|
+
return _context29.stop();
|
|
2882
|
+
}
|
|
2883
|
+
}, _callee29);
|
|
2884
|
+
}));
|
|
2885
|
+
return function (_x25) {
|
|
2886
|
+
return _ref24.apply(this, arguments);
|
|
2887
|
+
};
|
|
2888
|
+
}()));
|
|
2889
|
+
case 9:
|
|
2890
|
+
_context30.next = 11;
|
|
2891
|
+
return this.loadQuotationForPriceQuery({
|
|
2892
|
+
quotation: quotation,
|
|
2893
|
+
customer_id: customerId,
|
|
2894
|
+
channel: (_paramsList$2 = paramsList[0]) === null || _paramsList$2 === void 0 ? void 0 : _paramsList$2.channel
|
|
2895
|
+
});
|
|
2896
|
+
case 11:
|
|
2897
|
+
return _context30.abrupt("return", paramsList.map(function (params) {
|
|
2898
|
+
var _this10$otherParams2, _productMapsByGroup$g;
|
|
2899
|
+
var productInput = params.product || {};
|
|
2900
|
+
var productId = _this10.getPriceQueryProductId(productInput);
|
|
2901
|
+
var schedule = _this10.getPriceQuerySchedule(params);
|
|
2902
|
+
var channel = params.channel || ((_this10$otherParams2 = _this10.otherParams) === null || _this10$otherParams2 === void 0 ? void 0 : _this10$otherParams2.channel);
|
|
2903
|
+
var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
|
|
2904
|
+
var authoritativeProduct = productId === null ? null : ((_productMapsByGroup$g = productMapsByGroup.get(groupKey)) === null || _productMapsByGroup$g === void 0 ? void 0 : _productMapsByGroup$g.get(productId)) || null;
|
|
2905
|
+
var product = _this10.mergeProductForPriceQuery(productInput, authoritativeProduct);
|
|
2906
|
+
return calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
2907
|
+
product: product,
|
|
2908
|
+
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
2909
|
+
customer_id: customerId,
|
|
2910
|
+
quotation: quotation
|
|
2911
|
+
}));
|
|
2912
|
+
}));
|
|
2913
|
+
case 12:
|
|
2914
|
+
case "end":
|
|
2915
|
+
return _context30.stop();
|
|
2916
|
+
}
|
|
2917
|
+
}, _callee30, this);
|
|
2918
|
+
}));
|
|
2919
|
+
function calculateProductBookingPrices(_x24) {
|
|
2920
|
+
return _calculateProductBookingPrices.apply(this, arguments);
|
|
2921
|
+
}
|
|
2922
|
+
return calculateProductBookingPrices;
|
|
2923
|
+
}()
|
|
2662
2924
|
}, {
|
|
2663
2925
|
key: "addProductToOrder",
|
|
2664
2926
|
value: function () {
|
|
2665
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2927
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(product, booking) {
|
|
2666
2928
|
var products;
|
|
2667
|
-
return _regeneratorRuntime().wrap(function
|
|
2668
|
-
while (1) switch (
|
|
2929
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2930
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2669
2931
|
case 0:
|
|
2670
|
-
|
|
2932
|
+
_context31.prev = 0;
|
|
2671
2933
|
if (this.store.order) {
|
|
2672
|
-
|
|
2934
|
+
_context31.next = 3;
|
|
2673
2935
|
break;
|
|
2674
2936
|
}
|
|
2675
2937
|
throw new Error('order 模块未初始化');
|
|
2676
2938
|
case 3:
|
|
2677
|
-
|
|
2939
|
+
_context31.next = 5;
|
|
2678
2940
|
return this.store.order.addProductToOrder(product, booking);
|
|
2679
2941
|
case 5:
|
|
2680
|
-
products =
|
|
2681
|
-
return
|
|
2942
|
+
products = _context31.sent;
|
|
2943
|
+
return _context31.abrupt("return", products);
|
|
2682
2944
|
case 9:
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
throw
|
|
2945
|
+
_context31.prev = 9;
|
|
2946
|
+
_context31.t0 = _context31["catch"](0);
|
|
2947
|
+
throw _context31.t0;
|
|
2686
2948
|
case 12:
|
|
2687
2949
|
case "end":
|
|
2688
|
-
return
|
|
2950
|
+
return _context31.stop();
|
|
2689
2951
|
}
|
|
2690
|
-
},
|
|
2952
|
+
}, _callee31, this, [[0, 9]]);
|
|
2691
2953
|
}));
|
|
2692
|
-
function addProductToOrder(
|
|
2954
|
+
function addProductToOrder(_x26, _x27) {
|
|
2693
2955
|
return _addProductToOrder.apply(this, arguments);
|
|
2694
2956
|
}
|
|
2695
2957
|
return addProductToOrder;
|
|
@@ -2697,69 +2959,104 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2697
2959
|
}, {
|
|
2698
2960
|
key: "updateOrderProduct",
|
|
2699
2961
|
value: function () {
|
|
2700
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2962
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
2701
2963
|
var products;
|
|
2702
|
-
return _regeneratorRuntime().wrap(function
|
|
2703
|
-
while (1) switch (
|
|
2964
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2965
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2704
2966
|
case 0:
|
|
2705
|
-
|
|
2967
|
+
_context32.prev = 0;
|
|
2706
2968
|
if (this.store.order) {
|
|
2707
|
-
|
|
2969
|
+
_context32.next = 3;
|
|
2708
2970
|
break;
|
|
2709
2971
|
}
|
|
2710
2972
|
throw new Error('order 模块未初始化');
|
|
2711
2973
|
case 3:
|
|
2712
|
-
|
|
2974
|
+
_context32.next = 5;
|
|
2713
2975
|
return this.store.order.updateOrderProduct(params);
|
|
2714
2976
|
case 5:
|
|
2715
|
-
products =
|
|
2716
|
-
return
|
|
2977
|
+
products = _context32.sent;
|
|
2978
|
+
return _context32.abrupt("return", products);
|
|
2717
2979
|
case 9:
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
throw
|
|
2980
|
+
_context32.prev = 9;
|
|
2981
|
+
_context32.t0 = _context32["catch"](0);
|
|
2982
|
+
throw _context32.t0;
|
|
2721
2983
|
case 12:
|
|
2722
2984
|
case "end":
|
|
2723
|
-
return
|
|
2985
|
+
return _context32.stop();
|
|
2724
2986
|
}
|
|
2725
|
-
},
|
|
2987
|
+
}, _callee32, this, [[0, 9]]);
|
|
2726
2988
|
}));
|
|
2727
|
-
function updateOrderProduct(
|
|
2989
|
+
function updateOrderProduct(_x28) {
|
|
2728
2990
|
return _updateOrderProduct.apply(this, arguments);
|
|
2729
2991
|
}
|
|
2730
2992
|
return updateOrderProduct;
|
|
2731
2993
|
}()
|
|
2994
|
+
}, {
|
|
2995
|
+
key: "updateOrderProducts",
|
|
2996
|
+
value: function () {
|
|
2997
|
+
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(paramsList) {
|
|
2998
|
+
var products;
|
|
2999
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3000
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3001
|
+
case 0:
|
|
3002
|
+
_context33.prev = 0;
|
|
3003
|
+
if (this.store.order) {
|
|
3004
|
+
_context33.next = 3;
|
|
3005
|
+
break;
|
|
3006
|
+
}
|
|
3007
|
+
throw new Error('order 模块未初始化');
|
|
3008
|
+
case 3:
|
|
3009
|
+
_context33.next = 5;
|
|
3010
|
+
return this.store.order.updateOrderProducts(paramsList);
|
|
3011
|
+
case 5:
|
|
3012
|
+
products = _context33.sent;
|
|
3013
|
+
return _context33.abrupt("return", products);
|
|
3014
|
+
case 9:
|
|
3015
|
+
_context33.prev = 9;
|
|
3016
|
+
_context33.t0 = _context33["catch"](0);
|
|
3017
|
+
throw _context33.t0;
|
|
3018
|
+
case 12:
|
|
3019
|
+
case "end":
|
|
3020
|
+
return _context33.stop();
|
|
3021
|
+
}
|
|
3022
|
+
}, _callee33, this, [[0, 9]]);
|
|
3023
|
+
}));
|
|
3024
|
+
function updateOrderProducts(_x29) {
|
|
3025
|
+
return _updateOrderProducts.apply(this, arguments);
|
|
3026
|
+
}
|
|
3027
|
+
return updateOrderProducts;
|
|
3028
|
+
}()
|
|
2732
3029
|
}, {
|
|
2733
3030
|
key: "updateOrderProductQuantity",
|
|
2734
3031
|
value: function () {
|
|
2735
|
-
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3032
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
|
|
2736
3033
|
var products;
|
|
2737
|
-
return _regeneratorRuntime().wrap(function
|
|
2738
|
-
while (1) switch (
|
|
3034
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3035
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2739
3036
|
case 0:
|
|
2740
|
-
|
|
3037
|
+
_context34.prev = 0;
|
|
2741
3038
|
if (this.store.order) {
|
|
2742
|
-
|
|
3039
|
+
_context34.next = 3;
|
|
2743
3040
|
break;
|
|
2744
3041
|
}
|
|
2745
3042
|
throw new Error('order 模块未初始化');
|
|
2746
3043
|
case 3:
|
|
2747
|
-
|
|
3044
|
+
_context34.next = 5;
|
|
2748
3045
|
return this.store.order.updateOrderProductQuantity(params);
|
|
2749
3046
|
case 5:
|
|
2750
|
-
products =
|
|
2751
|
-
return
|
|
3047
|
+
products = _context34.sent;
|
|
3048
|
+
return _context34.abrupt("return", products);
|
|
2752
3049
|
case 9:
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
throw
|
|
3050
|
+
_context34.prev = 9;
|
|
3051
|
+
_context34.t0 = _context34["catch"](0);
|
|
3052
|
+
throw _context34.t0;
|
|
2756
3053
|
case 12:
|
|
2757
3054
|
case "end":
|
|
2758
|
-
return
|
|
3055
|
+
return _context34.stop();
|
|
2759
3056
|
}
|
|
2760
|
-
},
|
|
3057
|
+
}, _callee34, this, [[0, 9]]);
|
|
2761
3058
|
}));
|
|
2762
|
-
function updateOrderProductQuantity(
|
|
3059
|
+
function updateOrderProductQuantity(_x30) {
|
|
2763
3060
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
2764
3061
|
}
|
|
2765
3062
|
return updateOrderProductQuantity;
|
|
@@ -2782,12 +3079,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2782
3079
|
}, {
|
|
2783
3080
|
key: "setOrderProductLineNote",
|
|
2784
3081
|
value: (function () {
|
|
2785
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3082
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(identity, note) {
|
|
2786
3083
|
var params, products;
|
|
2787
|
-
return _regeneratorRuntime().wrap(function
|
|
2788
|
-
while (1) switch (
|
|
3084
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3085
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2789
3086
|
case 0:
|
|
2790
|
-
|
|
3087
|
+
_context35.prev = 0;
|
|
2791
3088
|
params = {
|
|
2792
3089
|
product_id: identity.product_id,
|
|
2793
3090
|
product_variant_id: identity.product_variant_id,
|
|
@@ -2802,22 +3099,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2802
3099
|
params.product_sku = identity.product_sku;
|
|
2803
3100
|
}
|
|
2804
3101
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
2805
|
-
|
|
3102
|
+
_context35.next = 7;
|
|
2806
3103
|
return this.updateOrderProduct(params);
|
|
2807
3104
|
case 7:
|
|
2808
|
-
products =
|
|
2809
|
-
return
|
|
3105
|
+
products = _context35.sent;
|
|
3106
|
+
return _context35.abrupt("return", products);
|
|
2810
3107
|
case 11:
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
throw
|
|
3108
|
+
_context35.prev = 11;
|
|
3109
|
+
_context35.t0 = _context35["catch"](0);
|
|
3110
|
+
throw _context35.t0;
|
|
2814
3111
|
case 14:
|
|
2815
3112
|
case "end":
|
|
2816
|
-
return
|
|
3113
|
+
return _context35.stop();
|
|
2817
3114
|
}
|
|
2818
|
-
},
|
|
3115
|
+
}, _callee35, this, [[0, 11]]);
|
|
2819
3116
|
}));
|
|
2820
|
-
function setOrderProductLineNote(
|
|
3117
|
+
function setOrderProductLineNote(_x31, _x32) {
|
|
2821
3118
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
2822
3119
|
}
|
|
2823
3120
|
return setOrderProductLineNote;
|
|
@@ -2832,32 +3129,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2832
3129
|
}, {
|
|
2833
3130
|
key: "removeProductsFromOrder",
|
|
2834
3131
|
value: (function () {
|
|
2835
|
-
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2836
|
-
return _regeneratorRuntime().wrap(function
|
|
2837
|
-
while (1) switch (
|
|
3132
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(identities) {
|
|
3133
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3134
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2838
3135
|
case 0:
|
|
2839
|
-
|
|
3136
|
+
_context36.prev = 0;
|
|
2840
3137
|
if (this.store.order) {
|
|
2841
|
-
|
|
3138
|
+
_context36.next = 3;
|
|
2842
3139
|
break;
|
|
2843
3140
|
}
|
|
2844
3141
|
throw new Error('order 模块未初始化');
|
|
2845
3142
|
case 3:
|
|
2846
|
-
|
|
3143
|
+
_context36.next = 5;
|
|
2847
3144
|
return this.store.order.removeProductsFromOrder(identities);
|
|
2848
3145
|
case 5:
|
|
2849
|
-
return
|
|
3146
|
+
return _context36.abrupt("return", _context36.sent);
|
|
2850
3147
|
case 8:
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
throw
|
|
3148
|
+
_context36.prev = 8;
|
|
3149
|
+
_context36.t0 = _context36["catch"](0);
|
|
3150
|
+
throw _context36.t0;
|
|
2854
3151
|
case 11:
|
|
2855
3152
|
case "end":
|
|
2856
|
-
return
|
|
3153
|
+
return _context36.stop();
|
|
2857
3154
|
}
|
|
2858
|
-
},
|
|
3155
|
+
}, _callee36, this, [[0, 8]]);
|
|
2859
3156
|
}));
|
|
2860
|
-
function removeProductsFromOrder(
|
|
3157
|
+
function removeProductsFromOrder(_x33) {
|
|
2861
3158
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
2862
3159
|
}
|
|
2863
3160
|
return removeProductsFromOrder;
|
|
@@ -2865,18 +3162,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2865
3162
|
}, {
|
|
2866
3163
|
key: "removeProductFromOrder",
|
|
2867
3164
|
value: function () {
|
|
2868
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2869
|
-
return _regeneratorRuntime().wrap(function
|
|
2870
|
-
while (1) switch (
|
|
3165
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(identity) {
|
|
3166
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3167
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
2871
3168
|
case 0:
|
|
2872
|
-
return
|
|
3169
|
+
return _context37.abrupt("return", this.removeProductsFromOrder([identity]));
|
|
2873
3170
|
case 1:
|
|
2874
3171
|
case "end":
|
|
2875
|
-
return
|
|
3172
|
+
return _context37.stop();
|
|
2876
3173
|
}
|
|
2877
|
-
},
|
|
3174
|
+
}, _callee37, this);
|
|
2878
3175
|
}));
|
|
2879
|
-
function removeProductFromOrder(
|
|
3176
|
+
function removeProductFromOrder(_x34) {
|
|
2880
3177
|
return _removeProductFromOrder.apply(this, arguments);
|
|
2881
3178
|
}
|
|
2882
3179
|
return removeProductFromOrder;
|
|
@@ -2926,23 +3223,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2926
3223
|
}, {
|
|
2927
3224
|
key: "applyPromotion",
|
|
2928
3225
|
value: (function () {
|
|
2929
|
-
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2930
|
-
return _regeneratorRuntime().wrap(function
|
|
2931
|
-
while (1) switch (
|
|
3226
|
+
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
3227
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3228
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
2932
3229
|
case 0:
|
|
2933
3230
|
if (this.store.order) {
|
|
2934
|
-
|
|
3231
|
+
_context38.next = 2;
|
|
2935
3232
|
break;
|
|
2936
3233
|
}
|
|
2937
3234
|
throw new Error('order 模块未初始化');
|
|
2938
3235
|
case 2:
|
|
2939
|
-
|
|
3236
|
+
_context38.next = 4;
|
|
2940
3237
|
return this.store.order.applyPromotion();
|
|
2941
3238
|
case 4:
|
|
2942
3239
|
case "end":
|
|
2943
|
-
return
|
|
3240
|
+
return _context38.stop();
|
|
2944
3241
|
}
|
|
2945
|
-
},
|
|
3242
|
+
}, _callee38, this);
|
|
2946
3243
|
}));
|
|
2947
3244
|
function applyPromotion() {
|
|
2948
3245
|
return _applyPromotion.apply(this, arguments);
|
|
@@ -2969,18 +3266,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2969
3266
|
}, {
|
|
2970
3267
|
key: "getProductList",
|
|
2971
3268
|
value: function () {
|
|
2972
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3269
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
2973
3270
|
var _this$otherParams21;
|
|
2974
3271
|
var menu_list_ids, _this$store$products, res;
|
|
2975
|
-
return _regeneratorRuntime().wrap(function
|
|
2976
|
-
while (1) switch (
|
|
3272
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3273
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
2977
3274
|
case 0:
|
|
2978
3275
|
// 可以直接通过配置里的 menu 读取
|
|
2979
3276
|
menu_list_ids = ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 || (_this$otherParams21 = _this$otherParams21.dineInConfig) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21['menu.associated_menus'].map(function (n) {
|
|
2980
3277
|
return Number(n.value);
|
|
2981
3278
|
})) || [];
|
|
2982
|
-
|
|
2983
|
-
|
|
3279
|
+
_context39.prev = 1;
|
|
3280
|
+
_context39.next = 4;
|
|
2984
3281
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
2985
3282
|
menu_list_ids: menu_list_ids,
|
|
2986
3283
|
cacheId: this.cacheId,
|
|
@@ -2988,17 +3285,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2988
3285
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
2989
3286
|
});
|
|
2990
3287
|
case 4:
|
|
2991
|
-
res =
|
|
2992
|
-
return
|
|
3288
|
+
res = _context39.sent;
|
|
3289
|
+
return _context39.abrupt("return", res);
|
|
2993
3290
|
case 8:
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
throw
|
|
3291
|
+
_context39.prev = 8;
|
|
3292
|
+
_context39.t0 = _context39["catch"](1);
|
|
3293
|
+
throw _context39.t0;
|
|
2997
3294
|
case 11:
|
|
2998
3295
|
case "end":
|
|
2999
|
-
return
|
|
3296
|
+
return _context39.stop();
|
|
3000
3297
|
}
|
|
3001
|
-
},
|
|
3298
|
+
}, _callee39, this, [[1, 8]]);
|
|
3002
3299
|
}));
|
|
3003
3300
|
function getProductList() {
|
|
3004
3301
|
return _getProductList.apply(this, arguments);
|
|
@@ -3013,33 +3310,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3013
3310
|
}, {
|
|
3014
3311
|
key: "setOtherParams",
|
|
3015
3312
|
value: function () {
|
|
3016
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3313
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
|
|
3017
3314
|
var _this$otherParams22;
|
|
3018
|
-
var
|
|
3019
|
-
|
|
3315
|
+
var _ref26,
|
|
3316
|
+
_ref26$cover,
|
|
3020
3317
|
cover,
|
|
3021
|
-
|
|
3022
|
-
return _regeneratorRuntime().wrap(function
|
|
3023
|
-
while (1) switch (
|
|
3318
|
+
_args40 = arguments;
|
|
3319
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3320
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3024
3321
|
case 0:
|
|
3025
|
-
|
|
3322
|
+
_ref26 = _args40.length > 1 && _args40[1] !== undefined ? _args40[1] : {}, _ref26$cover = _ref26.cover, cover = _ref26$cover === void 0 ? false : _ref26$cover;
|
|
3026
3323
|
if (cover) {
|
|
3027
3324
|
this.otherParams = _objectSpread({}, params);
|
|
3028
3325
|
} else {
|
|
3029
3326
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
3030
3327
|
}
|
|
3031
3328
|
this.cacheId = (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.cacheId;
|
|
3032
|
-
|
|
3329
|
+
_context40.next = 5;
|
|
3033
3330
|
return this.syncOtherParamsToSubModules(params, {
|
|
3034
3331
|
cover: cover
|
|
3035
3332
|
});
|
|
3036
3333
|
case 5:
|
|
3037
3334
|
case "end":
|
|
3038
|
-
return
|
|
3335
|
+
return _context40.stop();
|
|
3039
3336
|
}
|
|
3040
|
-
},
|
|
3337
|
+
}, _callee40, this);
|
|
3041
3338
|
}));
|
|
3042
|
-
function setOtherParams(
|
|
3339
|
+
function setOtherParams(_x35) {
|
|
3043
3340
|
return _setOtherParams.apply(this, arguments);
|
|
3044
3341
|
}
|
|
3045
3342
|
return setOtherParams;
|