@pisell/pisellos 3.0.41 → 3.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/AccountList/index.js +17 -12
- package/dist/modules/Cart/index.d.ts +14 -0
- package/dist/modules/Cart/index.js +38 -1
- package/dist/modules/Cart/utils/cartProduct.d.ts +3 -0
- package/dist/modules/Cart/utils/cartProduct.js +28 -8
- package/dist/modules/Cart/utils/changePrice.d.ts +3 -0
- package/dist/modules/Cart/utils/changePrice.js +104 -0
- package/dist/modules/Date/index.js +74 -10
- package/dist/modules/Date/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +13 -6
- package/dist/modules/Discount/types.d.ts +10 -0
- package/dist/modules/ProductList/index.d.ts +7 -0
- package/dist/modules/ProductList/index.js +102 -39
- package/dist/modules/Rules/index.js +218 -80
- package/dist/modules/Rules/types.d.ts +7 -1
- package/dist/modules/Schedule/index.d.ts +9 -1
- package/dist/modules/Schedule/index.js +122 -2
- package/dist/modules/Schedule/types.d.ts +13 -0
- package/dist/modules/Schedule/utils.js +4 -0
- package/dist/solution/BookingByStep/index.d.ts +121 -30
- package/dist/solution/BookingByStep/index.js +760 -1065
- package/dist/solution/BookingByStep/utils/capacity.d.ts +47 -0
- package/dist/solution/BookingByStep/utils/capacity.js +132 -0
- package/dist/solution/BookingByStep/utils/resources.d.ts +21 -29
- package/dist/solution/BookingByStep/utils/resources.js +39 -95
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +11 -0
- package/dist/solution/BookingByStep/utils/timeslots.js +15 -0
- package/dist/solution/ShopDiscount/index.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.js +119 -44
- package/lib/modules/AccountList/index.js +4 -0
- package/lib/modules/Cart/index.d.ts +14 -0
- package/lib/modules/Cart/index.js +34 -1
- package/lib/modules/Cart/utils/cartProduct.d.ts +3 -0
- package/lib/modules/Cart/utils/cartProduct.js +20 -8
- package/lib/modules/Cart/utils/changePrice.d.ts +3 -0
- package/lib/modules/Cart/utils/changePrice.js +78 -0
- package/lib/modules/Date/index.js +62 -5
- package/lib/modules/Date/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +17 -6
- package/lib/modules/Discount/types.d.ts +10 -0
- package/lib/modules/ProductList/index.d.ts +7 -0
- package/lib/modules/ProductList/index.js +45 -0
- package/lib/modules/Rules/index.js +154 -63
- package/lib/modules/Rules/types.d.ts +7 -1
- package/lib/modules/Schedule/index.d.ts +9 -1
- package/lib/modules/Schedule/index.js +79 -1
- package/lib/modules/Schedule/types.d.ts +13 -0
- package/lib/modules/Schedule/utils.js +4 -1
- package/lib/solution/BookingByStep/index.d.ts +121 -30
- package/lib/solution/BookingByStep/index.js +395 -585
- package/lib/solution/BookingByStep/utils/capacity.d.ts +47 -0
- package/lib/solution/BookingByStep/utils/capacity.js +106 -0
- package/lib/solution/BookingByStep/utils/resources.d.ts +21 -29
- package/lib/solution/BookingByStep/utils/resources.js +21 -58
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +11 -0
- package/lib/solution/BookingByStep/utils/timeslots.js +7 -0
- package/lib/solution/ShopDiscount/index.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.js +91 -19
- package/package.json +1 -1
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
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); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
2
8
|
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; }
|
|
3
9
|
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); } }
|
|
4
10
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
@@ -18,6 +24,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
18
24
|
import { uniqueById } from "../../solution/ShopDiscount/utils";
|
|
19
25
|
import { BaseModule } from "../BaseModule";
|
|
20
26
|
import { DiscountHooks } from "./types";
|
|
27
|
+
import Decimal from 'decimal.js';
|
|
21
28
|
export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
22
29
|
_inherits(DiscountModule, _BaseModule);
|
|
23
30
|
var _super = _createSuper(DiscountModule);
|
|
@@ -113,7 +120,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
113
120
|
key: "loadPrepareConfig",
|
|
114
121
|
value: function () {
|
|
115
122
|
var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
116
|
-
var _prepareConfig$data;
|
|
123
|
+
var _prepareConfig$data, _prepareConfig$data2;
|
|
117
124
|
var prepareConfig, goodPassList;
|
|
118
125
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
119
126
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -122,7 +129,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
122
129
|
return this.request.post("/order/prepare/config", params);
|
|
123
130
|
case 2:
|
|
124
131
|
prepareConfig = _context3.sent;
|
|
125
|
-
goodPassList = this.filterEnabledDiscountList((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data = prepareConfig.data) === null || _prepareConfig$data === void 0 ? void 0 : _prepareConfig$data.good_pass_list) || []) || [];
|
|
132
|
+
goodPassList = this.filterEnabledDiscountList([].concat(_toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data = prepareConfig.data) === null || _prepareConfig$data === void 0 ? void 0 : _prepareConfig$data.good_pass_list) || []), _toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data2 = prepareConfig.data) === null || _prepareConfig$data2 === void 0 ? void 0 : _prepareConfig$data2.discount_card_list) || []))) || []; // this.setDiscountList(goodPassList);
|
|
126
133
|
return _context3.abrupt("return", goodPassList);
|
|
127
134
|
case 5:
|
|
128
135
|
case "end":
|
|
@@ -147,7 +154,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
147
154
|
return this.request.get("/machinecode/batch-search", {
|
|
148
155
|
code: code,
|
|
149
156
|
translate_flag: 1,
|
|
150
|
-
|
|
157
|
+
tags: ['good_pass', 'product_discount_card'],
|
|
151
158
|
available: 1,
|
|
152
159
|
relation_product: 1
|
|
153
160
|
});
|
|
@@ -170,7 +177,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
170
177
|
key: "filterEnabledDiscountList",
|
|
171
178
|
value: function filterEnabledDiscountList(discountList) {
|
|
172
179
|
return discountList.filter(function (discount) {
|
|
173
|
-
return discount.limit_status === 'enable' &&
|
|
180
|
+
return discount.limit_status === 'enable' && new Decimal((discount === null || discount === void 0 ? void 0 : discount.par_value) || 0).minus(new Decimal((discount === null || discount === void 0 ? void 0 : discount.used_par_value) || 0)).greaterThan(0);
|
|
174
181
|
});
|
|
175
182
|
}
|
|
176
183
|
|
|
@@ -198,8 +205,8 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
198
205
|
}
|
|
199
206
|
if (discount.appliedProductDetails) {
|
|
200
207
|
return discount.appliedProductDetails.reduce(function (total, product) {
|
|
201
|
-
var price =
|
|
202
|
-
return total
|
|
208
|
+
var price = new Decimal((product === null || product === void 0 ? void 0 : product.amount) || 0).mul((product === null || product === void 0 ? void 0 : product.num) || 1);
|
|
209
|
+
return new Decimal(total).plus(price).toNumber();
|
|
203
210
|
}, 0);
|
|
204
211
|
}
|
|
205
212
|
}
|
|
@@ -27,6 +27,14 @@ interface ApplicableProductDetails {
|
|
|
27
27
|
resource_id: number;
|
|
28
28
|
title: string;
|
|
29
29
|
original_amount: string;
|
|
30
|
+
num: number;
|
|
31
|
+
discount?: {
|
|
32
|
+
product_id?: number;
|
|
33
|
+
original_amount?: string;
|
|
34
|
+
percent?: string;
|
|
35
|
+
resource_id?: number;
|
|
36
|
+
title?: string;
|
|
37
|
+
};
|
|
30
38
|
}
|
|
31
39
|
export interface Discount {
|
|
32
40
|
id: number;
|
|
@@ -60,6 +68,8 @@ export interface Discount {
|
|
|
60
68
|
applicableProductIds?: number[];
|
|
61
69
|
applicableProductDetails: ApplicableProductDetails[];
|
|
62
70
|
appliedProductDetails: ApplicableProductDetails[];
|
|
71
|
+
isDisabledForProductUsed?: boolean;
|
|
72
|
+
amount?: number;
|
|
63
73
|
}
|
|
64
74
|
export interface DiscountState {
|
|
65
75
|
discountList: Discount[];
|
|
@@ -11,6 +11,13 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
11
11
|
constructor(name?: string, version?: string);
|
|
12
12
|
initialize(core: PisellCore, options: any): Promise<void>;
|
|
13
13
|
storeChange(path?: string, value?: any): Promise<void>;
|
|
14
|
+
loadProducts({ category_ids, product_ids, collection, schedule_date, cacheId }: {
|
|
15
|
+
category_ids?: number[];
|
|
16
|
+
product_ids?: number[];
|
|
17
|
+
collection?: number | string[];
|
|
18
|
+
schedule_date?: string;
|
|
19
|
+
cacheId?: string;
|
|
20
|
+
}): Promise<any>;
|
|
14
21
|
loadProductsPrice({ ids, customer_id, schedule_date, channel, }: {
|
|
15
22
|
ids?: number[];
|
|
16
23
|
customer_id?: number;
|
|
@@ -97,15 +97,78 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
97
97
|
return storeChange;
|
|
98
98
|
}()
|
|
99
99
|
}, {
|
|
100
|
-
key: "
|
|
100
|
+
key: "loadProducts",
|
|
101
101
|
value: function () {
|
|
102
|
-
var
|
|
103
|
-
var _ref$
|
|
102
|
+
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref) {
|
|
103
|
+
var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, schedule_date, cacheId, userPlugin, customer_id, _userPlugin$get, productsData;
|
|
104
104
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
105
105
|
while (1) switch (_context3.prev = _context3.next) {
|
|
106
106
|
case 0:
|
|
107
|
-
_ref$
|
|
108
|
-
|
|
107
|
+
_ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId;
|
|
108
|
+
// // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
|
|
109
|
+
// if (!schedule_ids?.length) {
|
|
110
|
+
// const schedule_ids_data = this.store.schedule
|
|
111
|
+
// .getScheduleListByIds(schedule_ids)
|
|
112
|
+
// .map((n) => n.id);
|
|
113
|
+
// if (schedule_ids_data.length) {
|
|
114
|
+
// schedule_ids = schedule_ids_data;
|
|
115
|
+
// } else if (schedule_date) {
|
|
116
|
+
// // 后端说如果 schedule_ids 如果为空,需要给[0]
|
|
117
|
+
// schedule_ids = [0];
|
|
118
|
+
// }
|
|
119
|
+
// }
|
|
120
|
+
userPlugin = this.core.getPlugin('user');
|
|
121
|
+
customer_id = undefined;
|
|
122
|
+
try {
|
|
123
|
+
customer_id = userPlugin === null || userPlugin === void 0 || (_userPlugin$get = userPlugin.get()) === null || _userPlugin$get === void 0 ? void 0 : _userPlugin$get.id;
|
|
124
|
+
} catch (error) {
|
|
125
|
+
console.error(error);
|
|
126
|
+
}
|
|
127
|
+
// 如果没传schedule_date,则从
|
|
128
|
+
_context3.next = 6;
|
|
129
|
+
return this.request.post("/product/query", {
|
|
130
|
+
open_quotation: 1,
|
|
131
|
+
open_bundle: 0,
|
|
132
|
+
exclude_extension_type: ['product_party', 'product_event', 'product_series_event', 'product_package_ticket', 'ticket', 'event_item'],
|
|
133
|
+
with: ['category', 'collection', 'resourceRelation'],
|
|
134
|
+
status: 'published',
|
|
135
|
+
num: 500,
|
|
136
|
+
skip: 1,
|
|
137
|
+
customer_id: customer_id,
|
|
138
|
+
category_ids: category_ids,
|
|
139
|
+
ids: product_ids,
|
|
140
|
+
collection: collection,
|
|
141
|
+
front_end_cache_id: cacheId,
|
|
142
|
+
// client_schedule_ids: schedule_ids,
|
|
143
|
+
schedule_date: schedule_date
|
|
144
|
+
}, {
|
|
145
|
+
useCache: true
|
|
146
|
+
});
|
|
147
|
+
case 6:
|
|
148
|
+
productsData = _context3.sent;
|
|
149
|
+
this.addProduct(productsData.data.list);
|
|
150
|
+
return _context3.abrupt("return", productsData.data.list);
|
|
151
|
+
case 9:
|
|
152
|
+
case "end":
|
|
153
|
+
return _context3.stop();
|
|
154
|
+
}
|
|
155
|
+
}, _callee3, this);
|
|
156
|
+
}));
|
|
157
|
+
function loadProducts(_x5) {
|
|
158
|
+
return _loadProducts.apply(this, arguments);
|
|
159
|
+
}
|
|
160
|
+
return loadProducts;
|
|
161
|
+
}()
|
|
162
|
+
}, {
|
|
163
|
+
key: "loadProductsPrice",
|
|
164
|
+
value: function () {
|
|
165
|
+
var _loadProductsPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref2) {
|
|
166
|
+
var _ref2$ids, ids, customer_id, schedule_date, channel, productsData;
|
|
167
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
168
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
169
|
+
case 0:
|
|
170
|
+
_ref2$ids = _ref2.ids, ids = _ref2$ids === void 0 ? [] : _ref2$ids, customer_id = _ref2.customer_id, schedule_date = _ref2.schedule_date, channel = _ref2.channel;
|
|
171
|
+
_context4.next = 3;
|
|
109
172
|
return this.request.post("/product/query/price", {
|
|
110
173
|
ids: ids,
|
|
111
174
|
customer_id: customer_id,
|
|
@@ -115,15 +178,15 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
115
178
|
useCache: true
|
|
116
179
|
});
|
|
117
180
|
case 3:
|
|
118
|
-
productsData =
|
|
119
|
-
return
|
|
181
|
+
productsData = _context4.sent;
|
|
182
|
+
return _context4.abrupt("return", productsData.data);
|
|
120
183
|
case 5:
|
|
121
184
|
case "end":
|
|
122
|
-
return
|
|
185
|
+
return _context4.stop();
|
|
123
186
|
}
|
|
124
|
-
},
|
|
187
|
+
}, _callee4, this);
|
|
125
188
|
}));
|
|
126
|
-
function loadProductsPrice(
|
|
189
|
+
function loadProductsPrice(_x6) {
|
|
127
190
|
return _loadProductsPrice.apply(this, arguments);
|
|
128
191
|
}
|
|
129
192
|
return loadProductsPrice;
|
|
@@ -131,19 +194,19 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
131
194
|
}, {
|
|
132
195
|
key: "getProducts",
|
|
133
196
|
value: function () {
|
|
134
|
-
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
135
|
-
return _regeneratorRuntime().wrap(function
|
|
136
|
-
while (1) switch (
|
|
197
|
+
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
198
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
199
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
137
200
|
case 0:
|
|
138
|
-
|
|
201
|
+
_context5.next = 2;
|
|
139
202
|
return this.core.effects.emit(ProductListHooks.onGetProducts, this.store.list);
|
|
140
203
|
case 2:
|
|
141
|
-
return
|
|
204
|
+
return _context5.abrupt("return", cloneDeep(this.store.list));
|
|
142
205
|
case 3:
|
|
143
206
|
case "end":
|
|
144
|
-
return
|
|
207
|
+
return _context5.stop();
|
|
145
208
|
}
|
|
146
|
-
},
|
|
209
|
+
}, _callee5, this);
|
|
147
210
|
}));
|
|
148
211
|
function getProducts() {
|
|
149
212
|
return _getProducts.apply(this, arguments);
|
|
@@ -153,29 +216,29 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
153
216
|
}, {
|
|
154
217
|
key: "getProduct",
|
|
155
218
|
value: function () {
|
|
156
|
-
var _getProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
219
|
+
var _getProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(id) {
|
|
157
220
|
var product;
|
|
158
|
-
return _regeneratorRuntime().wrap(function
|
|
159
|
-
while (1) switch (
|
|
221
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
222
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
160
223
|
case 0:
|
|
161
|
-
|
|
224
|
+
_context6.next = 2;
|
|
162
225
|
return this.core.effects.emit(ProductListHooks.onGetProduct, this.store.list);
|
|
163
226
|
case 2:
|
|
164
227
|
product = this.store.productMap.get("".concat(id));
|
|
165
228
|
if (!product) {
|
|
166
|
-
|
|
229
|
+
_context6.next = 5;
|
|
167
230
|
break;
|
|
168
231
|
}
|
|
169
|
-
return
|
|
232
|
+
return _context6.abrupt("return", product);
|
|
170
233
|
case 5:
|
|
171
|
-
return
|
|
234
|
+
return _context6.abrupt("return", undefined);
|
|
172
235
|
case 6:
|
|
173
236
|
case "end":
|
|
174
|
-
return
|
|
237
|
+
return _context6.stop();
|
|
175
238
|
}
|
|
176
|
-
},
|
|
239
|
+
}, _callee6, this);
|
|
177
240
|
}));
|
|
178
|
-
function getProduct(
|
|
241
|
+
function getProduct(_x7) {
|
|
179
242
|
return _getProduct.apply(this, arguments);
|
|
180
243
|
}
|
|
181
244
|
return getProduct;
|
|
@@ -183,10 +246,10 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
183
246
|
}, {
|
|
184
247
|
key: "addProduct",
|
|
185
248
|
value: function () {
|
|
186
|
-
var _addProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
249
|
+
var _addProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(products) {
|
|
187
250
|
var _this3 = this;
|
|
188
|
-
return _regeneratorRuntime().wrap(function
|
|
189
|
-
while (1) switch (
|
|
251
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
252
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
190
253
|
case 0:
|
|
191
254
|
// 加到 list 以后上面的storeChange 会自动初始化商品详情的 module 实例
|
|
192
255
|
// list 需要根据 id 去重
|
|
@@ -206,11 +269,11 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
206
269
|
this.storeChange();
|
|
207
270
|
case 3:
|
|
208
271
|
case "end":
|
|
209
|
-
return
|
|
272
|
+
return _context7.stop();
|
|
210
273
|
}
|
|
211
|
-
},
|
|
274
|
+
}, _callee7, this);
|
|
212
275
|
}));
|
|
213
|
-
function addProduct(
|
|
276
|
+
function addProduct(_x8) {
|
|
214
277
|
return _addProduct.apply(this, arguments);
|
|
215
278
|
}
|
|
216
279
|
return addProduct;
|
|
@@ -218,18 +281,18 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
218
281
|
}, {
|
|
219
282
|
key: "selectProducts",
|
|
220
283
|
value: function () {
|
|
221
|
-
var _selectProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
222
|
-
return _regeneratorRuntime().wrap(function
|
|
223
|
-
while (1) switch (
|
|
284
|
+
var _selectProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(products) {
|
|
285
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
286
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
224
287
|
case 0:
|
|
225
288
|
this.store.selectProducts = products;
|
|
226
289
|
case 1:
|
|
227
290
|
case "end":
|
|
228
|
-
return
|
|
291
|
+
return _context8.stop();
|
|
229
292
|
}
|
|
230
|
-
},
|
|
293
|
+
}, _callee8, this);
|
|
231
294
|
}));
|
|
232
|
-
function selectProducts(
|
|
295
|
+
function selectProducts(_x9) {
|
|
233
296
|
return _selectProducts.apply(this, arguments);
|
|
234
297
|
}
|
|
235
298
|
return selectProducts;
|