@pisell/pisellos 2.3.11 → 2.3.12

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.
@@ -1029,7 +1029,8 @@ var Server = /*#__PURE__*/function () {
1029
1029
  checkoutData: checkoutData,
1030
1030
  order: printableOrder,
1031
1031
  response: null,
1032
- requireFullyPaid: false
1032
+ requireFullyPaid: false,
1033
+ isManualPrint: true
1033
1034
  });
1034
1035
  case 27:
1035
1036
  printResult = _context16.sent;
@@ -4235,7 +4236,7 @@ var Server = /*#__PURE__*/function () {
4235
4236
  action: 'print_all',
4236
4237
  device_id: (_params$deviceId = params.deviceId) !== null && _params$deviceId !== void 0 ? _params$deviceId : deviceId,
4237
4238
  payload: {
4238
- type: '99',
4239
+ type: params.isManualPrint ? '0' : '99',
4239
4240
  data: params.receiptOnly ? {
4240
4241
  order_id: printIdentity,
4241
4242
  small_ticket_data: (_params$syncedOrder = params.syncedOrder) === null || _params$syncedOrder === void 0 || (_params$syncedOrder = _params$syncedOrder.payment_info) === null || _params$syncedOrder === void 0 ? void 0 : _params$syncedOrder.small_ticket_data,
@@ -4331,7 +4332,8 @@ var Server = /*#__PURE__*/function () {
4331
4332
  checkoutData: params.checkoutData,
4332
4333
  syncedOrder: printableOrder,
4333
4334
  response: params.response,
4334
- receiptOnly: true
4335
+ receiptOnly: true,
4336
+ isManualPrint: params.isManualPrint
4335
4337
  });
4336
4338
  case 10:
4337
4339
  return _context46.abrupt("return", {
@@ -322,7 +322,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
322
322
  * 获取当前的客户搜索条件
323
323
  * @returns 当前搜索条件
324
324
  */
325
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
325
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
326
326
  /**
327
327
  * 获取客户列表状态(包含滚动加载相关状态)
328
328
  * @returns 客户状态
@@ -2600,7 +2600,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2600
2600
  key: "handlePrintWristband",
2601
2601
  value: function () {
2602
2602
  var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
2603
- var deviceTask, deviceId;
2603
+ var deviceTask, deviceId, idempotencyKey;
2604
2604
  return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2605
2605
  while (1) switch (_context32.prev = _context32.next) {
2606
2606
  case 0:
@@ -2622,8 +2622,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2622
2622
  return this.getShortNumberOrDeviceId();
2623
2623
  case 6:
2624
2624
  deviceId = _context32.sent;
2625
+ idempotencyKey = createUuidV4();
2625
2626
  deviceTask.dispatch({
2626
- action: 'print_v1',
2627
+ action: 'print_all',
2627
2628
  device_id: deviceId,
2628
2629
  payload: {
2629
2630
  type: 'WRISTBAND',
@@ -2632,13 +2633,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2632
2633
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
2633
2634
  }
2634
2635
  },
2635
- idempotency_key: createUuidV4(),
2636
+ idempotency_key: idempotencyKey,
2636
2637
  name: 'PRINT_V1',
2637
- source: 'server',
2638
- source_type: 'order',
2639
- source_id: createUuidV4()
2638
+ source: 'bookingTicket',
2639
+ source_type: 'handlePrintWristband',
2640
+ source_id: idempotencyKey
2640
2641
  });
2641
- case 8:
2642
+ case 9:
2642
2643
  case "end":
2643
2644
  return _context32.stop();
2644
2645
  }
@@ -2656,10 +2657,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2656
2657
  return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2657
2658
  while (1) switch (_context33.prev = _context33.next) {
2658
2659
  case 0:
2660
+ // 优先修改 tempOrder 中 vouchers 的是否 checkIn 字段(需要同步数据库)
2661
+ // 然后触发 checkIn 接口
2662
+ this.request.post('/shop/machinecode/batch-metadata', {
2663
+ voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
2664
+ });
2665
+ case 1:
2659
2666
  case "end":
2660
2667
  return _context33.stop();
2661
2668
  }
2662
- }, _callee33);
2669
+ }, _callee33, this);
2663
2670
  }));
2664
2671
  function handleCheckIn(_x24) {
2665
2672
  return _handleCheckIn.apply(this, arguments);
@@ -0,0 +1,49 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/model/strategy/adapter/promotion/index.ts
30
+ var promotion_exports = {};
31
+ __export(promotion_exports, {
32
+ BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
33
+ PromotionAdapter: () => import_adapter.PromotionAdapter,
34
+ PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
35
+ X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
36
+ default: () => import_adapter2.default
37
+ });
38
+ module.exports = __toCommonJS(promotion_exports);
39
+ var import_evaluator = require("./evaluator");
40
+ var import_adapter = require("./adapter");
41
+ var import_adapter2 = __toESM(require("./adapter"));
42
+ var import_examples = require("./examples");
43
+ // Annotate the CommonJS export names for ESM import in node:
44
+ 0 && (module.exports = {
45
+ BUY_X_GET_Y_FREE_STRATEGY,
46
+ PromotionAdapter,
47
+ PromotionEvaluator,
48
+ X_ITEMS_FOR_Y_PRICE_STRATEGY
49
+ });
@@ -639,7 +639,8 @@ var Server = class {
639
639
  checkoutData,
640
640
  order: printableOrder,
641
641
  response: null,
642
- requireFullyPaid: false
642
+ requireFullyPaid: false,
643
+ isManualPrint: true
643
644
  });
644
645
  return {
645
646
  code: 200,
@@ -2656,7 +2657,7 @@ var Server = class {
2656
2657
  action: "print_all",
2657
2658
  device_id: params.deviceId ?? deviceId,
2658
2659
  payload: {
2659
- type: "99",
2660
+ type: params.isManualPrint ? "0" : "99",
2660
2661
  data: params.receiptOnly ? {
2661
2662
  order_id: printIdentity,
2662
2663
  small_ticket_data: (_b = (_a = params.syncedOrder) == null ? void 0 : _a.payment_info) == null ? void 0 : _b.small_ticket_data,
@@ -2712,7 +2713,8 @@ var Server = class {
2712
2713
  checkoutData: params.checkoutData,
2713
2714
  syncedOrder: printableOrder,
2714
2715
  response: params.response,
2715
- receiptOnly: true
2716
+ receiptOnly: true,
2717
+ isManualPrint: params.isManualPrint
2716
2718
  });
2717
2719
  return { printed: true, order: printableOrder };
2718
2720
  }
@@ -322,7 +322,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
322
322
  * 获取当前的客户搜索条件
323
323
  * @returns 当前搜索条件
324
324
  */
325
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
325
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
326
326
  /**
327
327
  * 获取客户列表状态(包含滚动加载相关状态)
328
328
  * @returns 客户状态
@@ -1525,8 +1525,9 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
1525
1525
  return;
1526
1526
  }
1527
1527
  const deviceId = await this.getShortNumberOrDeviceId();
1528
+ const idempotencyKey = (0, import_utils.createUuidV4)();
1528
1529
  deviceTask.dispatch({
1529
- action: "print_v1",
1530
+ action: "print_all",
1530
1531
  device_id: deviceId,
1531
1532
  payload: {
1532
1533
  type: "WRISTBAND",
@@ -1535,15 +1536,18 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
1535
1536
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
1536
1537
  }
1537
1538
  },
1538
- idempotency_key: (0, import_utils.createUuidV4)(),
1539
+ idempotency_key: idempotencyKey,
1539
1540
  name: "PRINT_V1",
1540
- source: "server",
1541
- source_type: "order",
1542
- source_id: (0, import_utils.createUuidV4)()
1541
+ source: "bookingTicket",
1542
+ source_type: "handlePrintWristband",
1543
+ source_id: idempotencyKey
1543
1544
  });
1544
1545
  }
1545
1546
  // 触发 checkIn
1546
1547
  async handleCheckIn(params) {
1548
+ this.request.post("/shop/machinecode/batch-metadata", {
1549
+ voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
1550
+ });
1547
1551
  }
1548
1552
  /**
1549
1553
  * 销毁模块:先调用父类(销毁所有 store 内子模块 + emit destroy + super.destroy()),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.11",
4
+ "version": "2.3.12",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",