@pisell/pisellos 0.0.151 → 0.0.152
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/Rules/index.js +10 -1
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +22 -8
- package/lib/modules/Rules/index.js +2 -1
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +11 -0
- package/package.json +1 -1
|
@@ -149,6 +149,15 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
149
149
|
var _this3 = this;
|
|
150
150
|
var discountList = _ref2.discountList,
|
|
151
151
|
productList = _ref2.productList;
|
|
152
|
+
// debugger
|
|
153
|
+
|
|
154
|
+
// 识别出来是不是在编辑的界面里又新增了商品
|
|
155
|
+
// 这种情况下,如果有可用的优惠券,也会自动勾选上
|
|
156
|
+
var isEditModeAddNewProduct = productList.find(function (n) {
|
|
157
|
+
return n.booking_id;
|
|
158
|
+
}) && productList.find(function (n) {
|
|
159
|
+
return !n.booking_id;
|
|
160
|
+
});
|
|
152
161
|
var editModeDiscount = [];
|
|
153
162
|
var addModeDiscount = [];
|
|
154
163
|
discountList.forEach(function (discount) {
|
|
@@ -370,7 +379,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
370
379
|
}
|
|
371
380
|
return;
|
|
372
381
|
}
|
|
373
|
-
if (applicableDiscounts.length && product.booking_id && typeof selectedDiscount.isManualSelect === 'undefined' && !(options !== null && options !== void 0 && options.scan)) {
|
|
382
|
+
if (applicableDiscounts.length && product.booking_id && typeof selectedDiscount.isManualSelect === 'undefined' && !(options !== null && options !== void 0 && options.scan) && !isEditModeAddNewProduct) {
|
|
374
383
|
return;
|
|
375
384
|
}
|
|
376
385
|
|
|
@@ -38,6 +38,7 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
38
38
|
isAvailable: boolean;
|
|
39
39
|
productList: Record<string, any>[];
|
|
40
40
|
discountList: Discount[];
|
|
41
|
+
type: "server" | "clientCalc";
|
|
41
42
|
}>;
|
|
42
43
|
calcDiscountApplicableProductTotalPrice(discount: Discount): number | undefined;
|
|
43
44
|
private getCustomer;
|
|
@@ -327,11 +327,23 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
327
327
|
break;
|
|
328
328
|
}
|
|
329
329
|
return _context5.abrupt("return", {
|
|
330
|
+
type: "clientCalc",
|
|
330
331
|
isAvailable: false,
|
|
331
332
|
productList: this.store.productList || [],
|
|
332
333
|
discountList: this.getDiscountList()
|
|
333
334
|
});
|
|
334
335
|
case 10:
|
|
336
|
+
if (resultDiscountList.length) {
|
|
337
|
+
_context5.next = 12;
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
return _context5.abrupt("return", {
|
|
341
|
+
type: "server",
|
|
342
|
+
isAvailable: false,
|
|
343
|
+
productList: this.store.productList || [],
|
|
344
|
+
discountList: this.getDiscountList()
|
|
345
|
+
});
|
|
346
|
+
case 12:
|
|
335
347
|
withScanList = resultDiscountList.map(function (item) {
|
|
336
348
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
337
349
|
isScan: true
|
|
@@ -347,37 +359,39 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
347
359
|
discountList: this.getDiscountList()
|
|
348
360
|
}, newProductList = _ref3.productList, newDiscountList = _ref3.discountList, isAvailable = _ref3.isAvailable;
|
|
349
361
|
if (!isAvailable) {
|
|
350
|
-
_context5.next =
|
|
362
|
+
_context5.next = 20;
|
|
351
363
|
break;
|
|
352
364
|
}
|
|
353
365
|
this.setDiscountList(newDiscountList || []);
|
|
354
366
|
this.setProductList(newProductList || []);
|
|
355
367
|
if (!(this.isWalkIn() && resultDiscountList.length && ((_this$options$otherPa6 = this.options.otherParams) === null || _this$options$otherPa6 === void 0 ? void 0 : _this$options$otherPa6.platform) === 'shop')) {
|
|
356
|
-
_context5.next =
|
|
368
|
+
_context5.next = 20;
|
|
357
369
|
break;
|
|
358
370
|
}
|
|
359
|
-
_context5.next =
|
|
371
|
+
_context5.next = 20;
|
|
360
372
|
return this.getCustomerWallet(resultDiscountList[0].customer_id);
|
|
361
|
-
case
|
|
373
|
+
case 20:
|
|
362
374
|
return _context5.abrupt("return", {
|
|
375
|
+
type: "clientCalc",
|
|
363
376
|
isAvailable: isAvailable || false,
|
|
364
377
|
productList: newProductList || this.store.productList || [],
|
|
365
378
|
discountList: newDiscountList || this.getDiscountList()
|
|
366
379
|
});
|
|
367
|
-
case
|
|
368
|
-
_context5.prev =
|
|
380
|
+
case 23:
|
|
381
|
+
_context5.prev = 23;
|
|
369
382
|
_context5.t1 = _context5["catch"](0);
|
|
370
383
|
console.error('[ShopDiscount] 扫码出错:', _context5.t1);
|
|
371
384
|
return _context5.abrupt("return", {
|
|
385
|
+
type: "clientCalc",
|
|
372
386
|
isAvailable: false,
|
|
373
387
|
productList: this.store.productList || [],
|
|
374
388
|
discountList: this.getDiscountList()
|
|
375
389
|
});
|
|
376
|
-
case
|
|
390
|
+
case 27:
|
|
377
391
|
case "end":
|
|
378
392
|
return _context5.stop();
|
|
379
393
|
}
|
|
380
|
-
}, _callee5, this, [[0,
|
|
394
|
+
}, _callee5, this, [[0, 23]]);
|
|
381
395
|
}));
|
|
382
396
|
function scanCode(_x4) {
|
|
383
397
|
return _scanCode.apply(this, arguments);
|
|
@@ -105,6 +105,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
105
105
|
discountList,
|
|
106
106
|
productList
|
|
107
107
|
}, options) {
|
|
108
|
+
const isEditModeAddNewProduct = productList.find((n) => n.booking_id) && productList.find((n) => !n.booking_id);
|
|
108
109
|
const editModeDiscount = [];
|
|
109
110
|
const addModeDiscount = [];
|
|
110
111
|
discountList.forEach((discount) => {
|
|
@@ -262,7 +263,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
262
263
|
}
|
|
263
264
|
return;
|
|
264
265
|
}
|
|
265
|
-
if (applicableDiscounts.length && product.booking_id && typeof selectedDiscount.isManualSelect === "undefined" && !(options == null ? void 0 : options.scan)) {
|
|
266
|
+
if (applicableDiscounts.length && product.booking_id && typeof selectedDiscount.isManualSelect === "undefined" && !(options == null ? void 0 : options.scan) && !isEditModeAddNewProduct) {
|
|
266
267
|
return;
|
|
267
268
|
}
|
|
268
269
|
const isNeedSplit = (selectedDiscount.tag || selectedDiscount.type) === "good_pass";
|
|
@@ -38,6 +38,7 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
38
38
|
isAvailable: boolean;
|
|
39
39
|
productList: Record<string, any>[];
|
|
40
40
|
discountList: Discount[];
|
|
41
|
+
type: "server" | "clientCalc";
|
|
41
42
|
}>;
|
|
42
43
|
calcDiscountApplicableProductTotalPrice(discount: Discount): number | undefined;
|
|
43
44
|
private getCustomer;
|
|
@@ -205,6 +205,15 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
205
205
|
const rulesModule = this.store.rules;
|
|
206
206
|
if (!rulesModule) {
|
|
207
207
|
return {
|
|
208
|
+
type: "clientCalc",
|
|
209
|
+
isAvailable: false,
|
|
210
|
+
productList: this.store.productList || [],
|
|
211
|
+
discountList: this.getDiscountList()
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
if (!resultDiscountList.length) {
|
|
215
|
+
return {
|
|
216
|
+
type: "server",
|
|
208
217
|
isAvailable: false,
|
|
209
218
|
productList: this.store.productList || [],
|
|
210
219
|
discountList: this.getDiscountList()
|
|
@@ -239,6 +248,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
239
248
|
}
|
|
240
249
|
}
|
|
241
250
|
return {
|
|
251
|
+
type: "clientCalc",
|
|
242
252
|
isAvailable: isAvailable || false,
|
|
243
253
|
productList: newProductList || this.store.productList || [],
|
|
244
254
|
discountList: newDiscountList || this.getDiscountList()
|
|
@@ -246,6 +256,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
246
256
|
} catch (error) {
|
|
247
257
|
console.error("[ShopDiscount] 扫码出错:", error);
|
|
248
258
|
return {
|
|
259
|
+
type: "clientCalc",
|
|
249
260
|
isAvailable: false,
|
|
250
261
|
productList: this.store.productList || [],
|
|
251
262
|
discountList: this.getDiscountList()
|