@pisell/pisellos 0.0.479 → 0.0.481
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.d.ts +3 -2
- package/dist/core/index.js +7 -0
- package/dist/effects/index.d.ts +2 -2
- package/dist/effects/index.js +34 -81
- package/dist/model/strategy/adapter/promotion/evaluator.js +99 -26
- package/dist/model/strategy/adapter/walletPass/type.d.ts +9 -2
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +6 -6
- package/dist/model/strategy/adapter/walletPass/utils.js +111 -72
- package/dist/modules/Customer/index.js +1 -1
- package/dist/modules/Discount/index.d.ts +6 -2
- package/dist/modules/Discount/index.js +14 -8
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +18 -13
- package/dist/modules/Payment/index.d.ts +4 -0
- package/dist/modules/Payment/index.js +774 -649
- package/dist/modules/Payment/walletpass.js +44 -17
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +2 -0
- package/dist/modules/ProductList/index.d.ts +3 -0
- package/dist/modules/ProductList/index.js +9 -7
- package/dist/modules/Rules/index.d.ts +2 -2
- package/dist/modules/Rules/index.js +37 -31
- package/dist/modules/Rules/types.d.ts +2 -2
- package/dist/modules/Schedule/index.d.ts +9 -0
- package/dist/modules/Schedule/index.js +15 -2
- package/dist/plugins/app-types/app/app.d.ts +1 -0
- package/dist/plugins/request.d.ts +2 -0
- package/dist/server/index.d.ts +107 -2
- package/dist/server/index.js +1507 -279
- package/dist/server/modules/index.d.ts +6 -0
- package/dist/server/modules/index.js +7 -0
- package/dist/server/modules/menu/index.d.ts +19 -0
- package/dist/server/modules/menu/index.js +221 -71
- package/dist/server/modules/order/index.d.ts +87 -0
- package/dist/server/modules/order/index.js +916 -0
- package/dist/server/modules/order/types.d.ts +530 -0
- package/dist/server/modules/order/types.js +141 -0
- package/dist/server/modules/order/utils/filterBookings.d.ts +6 -0
- package/dist/server/modules/order/utils/filterBookings.js +350 -0
- package/dist/server/modules/order/utils/filterOrders.d.ts +15 -0
- package/dist/server/modules/order/utils/filterOrders.js +226 -0
- package/dist/server/modules/products/index.d.ts +117 -5
- package/dist/server/modules/products/index.js +1450 -240
- package/dist/server/modules/products/types.d.ts +25 -1
- package/dist/server/modules/products/types.js +3 -0
- package/dist/server/modules/resource/index.d.ts +86 -0
- package/dist/server/modules/resource/index.js +1128 -0
- package/dist/server/modules/resource/types.d.ts +121 -0
- package/dist/server/modules/resource/types.js +47 -0
- package/dist/server/modules/schedule/index.d.ts +19 -0
- package/dist/server/modules/schedule/index.js +229 -68
- package/dist/server/utils/product.d.ts +5 -0
- package/dist/server/utils/product.js +71 -31
- package/dist/solution/BookingTicket/index.d.ts +10 -2
- package/dist/solution/BookingTicket/index.js +41 -28
- package/dist/solution/BookingTicket/utils/scan/index.js +1 -1
- package/dist/solution/Checkout/index.d.ts +1 -0
- package/dist/solution/Checkout/index.js +286 -188
- package/dist/solution/Checkout/utils/index.d.ts +2 -1
- package/dist/solution/Checkout/utils/index.js +6 -4
- package/dist/solution/RegisterAndLogin/config.js +340 -1
- package/dist/solution/Sales/index.d.ts +96 -0
- package/dist/solution/Sales/index.js +566 -0
- package/dist/solution/Sales/types.d.ts +67 -0
- package/dist/solution/Sales/types.js +26 -0
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +35 -22
- package/dist/solution/ShopDiscount/types.d.ts +6 -0
- package/dist/solution/ShopDiscount/utils.d.ts +9 -0
- package/dist/solution/ShopDiscount/utils.js +21 -27
- package/dist/solution/index.d.ts +2 -1
- package/dist/solution/index.js +2 -1
- package/dist/types/index.d.ts +5 -0
- package/lib/core/index.d.ts +3 -2
- package/lib/core/index.js +4 -0
- package/lib/effects/index.d.ts +2 -2
- package/lib/effects/index.js +22 -31
- package/lib/model/strategy/adapter/promotion/evaluator.js +57 -8
- package/lib/model/strategy/adapter/walletPass/type.d.ts +9 -2
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +6 -6
- package/lib/model/strategy/adapter/walletPass/utils.js +115 -48
- package/lib/modules/Customer/index.js +1 -1
- package/lib/modules/Discount/index.d.ts +6 -2
- package/lib/modules/Discount/index.js +3 -1
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +20 -18
- package/lib/modules/Payment/index.d.ts +4 -0
- package/lib/modules/Payment/index.js +134 -66
- package/lib/modules/Payment/walletpass.js +23 -4
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +2 -0
- package/lib/modules/ProductList/index.d.ts +3 -0
- package/lib/modules/ProductList/index.js +2 -2
- package/lib/modules/Rules/index.d.ts +2 -2
- package/lib/modules/Rules/index.js +69 -73
- package/lib/modules/Rules/types.d.ts +2 -2
- package/lib/modules/Schedule/index.d.ts +9 -0
- package/lib/modules/Schedule/index.js +11 -0
- package/lib/plugins/app-types/app/app.d.ts +1 -0
- package/lib/plugins/request.d.ts +2 -0
- package/lib/server/index.d.ts +107 -2
- package/lib/server/index.js +773 -51
- package/lib/server/modules/index.d.ts +6 -0
- package/lib/server/modules/index.js +16 -2
- package/lib/server/modules/menu/index.d.ts +19 -0
- package/lib/server/modules/menu/index.js +121 -2
- package/lib/server/modules/order/index.d.ts +87 -0
- package/lib/server/modules/order/index.js +543 -0
- package/lib/server/modules/order/types.d.ts +530 -0
- package/lib/server/modules/order/types.js +34 -0
- package/lib/server/modules/order/utils/filterBookings.d.ts +6 -0
- package/lib/server/modules/order/utils/filterBookings.js +320 -0
- package/lib/server/modules/order/utils/filterOrders.d.ts +15 -0
- package/lib/server/modules/order/utils/filterOrders.js +197 -0
- package/lib/server/modules/products/index.d.ts +117 -5
- package/lib/server/modules/products/index.js +799 -62
- package/lib/server/modules/products/types.d.ts +25 -1
- package/lib/server/modules/products/types.js +1 -0
- package/lib/server/modules/resource/index.d.ts +86 -0
- package/lib/server/modules/resource/index.js +557 -0
- package/lib/server/modules/resource/types.d.ts +121 -0
- package/lib/server/modules/resource/types.js +35 -0
- package/lib/server/modules/schedule/index.d.ts +19 -0
- package/lib/server/modules/schedule/index.js +141 -12
- package/lib/server/utils/product.d.ts +5 -0
- package/lib/server/utils/product.js +56 -27
- package/lib/solution/BookingTicket/index.d.ts +10 -2
- package/lib/solution/BookingTicket/index.js +10 -2
- package/lib/solution/BookingTicket/utils/scan/index.js +0 -1
- package/lib/solution/Checkout/index.d.ts +1 -0
- package/lib/solution/Checkout/index.js +399 -331
- package/lib/solution/Checkout/utils/index.d.ts +2 -1
- package/lib/solution/Checkout/utils/index.js +6 -4
- package/lib/solution/RegisterAndLogin/config.js +266 -1
- package/lib/solution/Sales/index.d.ts +96 -0
- package/lib/solution/Sales/index.js +416 -0
- package/lib/solution/Sales/types.d.ts +67 -0
- package/lib/solution/Sales/types.js +35 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +14 -6
- package/lib/solution/ShopDiscount/types.d.ts +6 -0
- package/lib/solution/ShopDiscount/utils.d.ts +9 -0
- package/lib/solution/ShopDiscount/utils.js +6 -10
- package/lib/solution/index.d.ts +2 -1
- package/lib/solution/index.js +4 -2
- package/lib/types/index.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CheckoutInitParams, CheckoutError, CheckoutErrorType, LocalOrderData, CartSummaryItem, ExtractedAmountInfo } from '../types';
|
|
2
2
|
import { CartItem } from '../../../modules/Cart/types';
|
|
3
|
+
import { PaymentItemInput } from '../../../modules/Payment/types';
|
|
3
4
|
/**
|
|
4
5
|
* 验证结账数据
|
|
5
6
|
*/
|
|
@@ -118,4 +119,4 @@ export declare function shouldSyncOrderForPayment(paymentCode: string, paymentTy
|
|
|
118
119
|
* @param paymentType 支付方式类型
|
|
119
120
|
* @returns 是否为现金支付
|
|
120
121
|
*/
|
|
121
|
-
export declare function isCashPayment(
|
|
122
|
+
export declare function isCashPayment(paymentItem: PaymentItemInput): boolean;
|
|
@@ -326,13 +326,15 @@ function shouldSyncOrderForPayment(paymentCode, paymentType) {
|
|
|
326
326
|
}
|
|
327
327
|
return true;
|
|
328
328
|
}
|
|
329
|
-
function isCashPayment(
|
|
330
|
-
|
|
331
|
-
const
|
|
329
|
+
function isCashPayment(paymentItem) {
|
|
330
|
+
var _a, _b, _c;
|
|
331
|
+
const codeUpper = ((_a = paymentItem.code) == null ? void 0 : _a.toUpperCase()) || "";
|
|
332
|
+
const typeUpper = ((_b = paymentItem.type) == null ? void 0 : _b.toUpperCase()) || "";
|
|
333
|
+
const isNameCash = (_c = paymentItem.name) == null ? void 0 : _c.toLowerCase().includes("cash");
|
|
332
334
|
const cashIdentifiers = ["CASH", "CASHMANUAL", "MANUAL"];
|
|
333
335
|
return cashIdentifiers.some(
|
|
334
336
|
(identifier) => codeUpper.includes(identifier) || typeUpper.includes(identifier)
|
|
335
|
-
);
|
|
337
|
+
) || isNameCash;
|
|
336
338
|
}
|
|
337
339
|
// Annotate the CommonJS export names for ESM import in node:
|
|
338
340
|
0 && (module.exports = {
|
|
@@ -533,6 +533,270 @@ var defaultConfig = {
|
|
|
533
533
|
}
|
|
534
534
|
};
|
|
535
535
|
var webposConfig = {
|
|
536
|
+
sendEmailVerificationCode: {
|
|
537
|
+
url: "/auth/email/register-code",
|
|
538
|
+
method: "GET",
|
|
539
|
+
transformParams: (params) => ({
|
|
540
|
+
email: params.target
|
|
541
|
+
})
|
|
542
|
+
},
|
|
543
|
+
sendEmailLoginCode: {
|
|
544
|
+
url: "/auth/send-email-code",
|
|
545
|
+
method: "POST",
|
|
546
|
+
transformParams: (params) => ({
|
|
547
|
+
email: params.target,
|
|
548
|
+
purpose: params.purpose,
|
|
549
|
+
type: params.type
|
|
550
|
+
})
|
|
551
|
+
},
|
|
552
|
+
sendSmsRegisterCode: {
|
|
553
|
+
url: "/auth/mobile/sms-register",
|
|
554
|
+
method: "POST",
|
|
555
|
+
transformParams: (params) => ({
|
|
556
|
+
phone: String(params.phone),
|
|
557
|
+
country_calling_code: String(params.country_calling_code)
|
|
558
|
+
})
|
|
559
|
+
},
|
|
560
|
+
sendEmailRegisterLink: {
|
|
561
|
+
url: "/auth/email/link/new-send-register-link",
|
|
562
|
+
method: "POST",
|
|
563
|
+
transformParams: (email) => ({
|
|
564
|
+
email
|
|
565
|
+
})
|
|
566
|
+
},
|
|
567
|
+
verifyEmailRegistrationLink: {
|
|
568
|
+
url: "/auth/email/link/new-register",
|
|
569
|
+
method: "POST",
|
|
570
|
+
transformParams: (params) => ({
|
|
571
|
+
code: params.code,
|
|
572
|
+
password: params.password
|
|
573
|
+
})
|
|
574
|
+
},
|
|
575
|
+
emailPasswordLogin: {
|
|
576
|
+
url: "/tenant/account/login/email",
|
|
577
|
+
method: "POST",
|
|
578
|
+
transformParams: (params) => ({
|
|
579
|
+
email: params.email,
|
|
580
|
+
password: params.password,
|
|
581
|
+
device: "webpos" + (/* @__PURE__ */ new Date()).getTime()
|
|
582
|
+
}),
|
|
583
|
+
options: (values) => ({
|
|
584
|
+
// withCredentials: true,
|
|
585
|
+
prefix: false,
|
|
586
|
+
isDefaultSaasDomain: true,
|
|
587
|
+
cache: {
|
|
588
|
+
mode: "remote_local",
|
|
589
|
+
type: "indexDB",
|
|
590
|
+
cacheKeyData: values
|
|
591
|
+
}
|
|
592
|
+
})
|
|
593
|
+
},
|
|
594
|
+
emailCodeRegister: {
|
|
595
|
+
url: "/auth/email/register",
|
|
596
|
+
method: "POST",
|
|
597
|
+
transformParams: (params) => ({
|
|
598
|
+
email: params.email,
|
|
599
|
+
code: params.code,
|
|
600
|
+
password: params.password
|
|
601
|
+
})
|
|
602
|
+
},
|
|
603
|
+
phoneCodeRegister: {
|
|
604
|
+
url: "/auth/mobile/register",
|
|
605
|
+
method: "POST",
|
|
606
|
+
transformParams: (params) => ({
|
|
607
|
+
phone: String(params.phone),
|
|
608
|
+
password: params.password,
|
|
609
|
+
code: params.code,
|
|
610
|
+
country_calling_code: String(params.country_calling_code)
|
|
611
|
+
})
|
|
612
|
+
},
|
|
613
|
+
resendEmailRegisterLink: {
|
|
614
|
+
url: "/auth/email/link/resend_register_link",
|
|
615
|
+
method: "POST",
|
|
616
|
+
transformParams: (params) => ({
|
|
617
|
+
code: params.code
|
|
618
|
+
})
|
|
619
|
+
},
|
|
620
|
+
checkEmailLinkCode: {
|
|
621
|
+
url: "/auth/email/link/new-register-check-code",
|
|
622
|
+
method: "GET",
|
|
623
|
+
transformParams: (params) => ({
|
|
624
|
+
code: params.code
|
|
625
|
+
})
|
|
626
|
+
},
|
|
627
|
+
sendSmsLoginCode: {
|
|
628
|
+
url: "/auth/send-login-msg",
|
|
629
|
+
method: "POST",
|
|
630
|
+
transformParams: (params) => ({
|
|
631
|
+
phone: String(params.phone),
|
|
632
|
+
country_calling_code: String(params.country_calling_code)
|
|
633
|
+
})
|
|
634
|
+
},
|
|
635
|
+
phoneCodeLogin: {
|
|
636
|
+
url: "/auth/mobile-login",
|
|
637
|
+
method: "POST",
|
|
638
|
+
transformParams: (params) => ({
|
|
639
|
+
phone: String(params.phone),
|
|
640
|
+
country_calling_code: String(params.country_calling_code),
|
|
641
|
+
code: params.code
|
|
642
|
+
})
|
|
643
|
+
},
|
|
644
|
+
guestLogin: {
|
|
645
|
+
url: "/auth/guest/login",
|
|
646
|
+
method: "POST",
|
|
647
|
+
transformParams: (params) => ({
|
|
648
|
+
login_channel: params.login_channel,
|
|
649
|
+
guest_code: params.guest_code
|
|
650
|
+
})
|
|
651
|
+
},
|
|
652
|
+
checkEmailExists: {
|
|
653
|
+
url: "/auth/email/check-email",
|
|
654
|
+
method: "GET",
|
|
655
|
+
transformParams: (params) => ({
|
|
656
|
+
email: params.email,
|
|
657
|
+
sales_channel: "online_store"
|
|
658
|
+
})
|
|
659
|
+
},
|
|
660
|
+
checkEmailCode: {
|
|
661
|
+
url: "/auth/email/check-email-code",
|
|
662
|
+
method: "GET",
|
|
663
|
+
transformParams: (params) => ({
|
|
664
|
+
email: params.email,
|
|
665
|
+
code: params.code,
|
|
666
|
+
action: params.action
|
|
667
|
+
})
|
|
668
|
+
},
|
|
669
|
+
checkMobileCode: {
|
|
670
|
+
url: "/auth/mobile/check-mobile-code",
|
|
671
|
+
method: "GET",
|
|
672
|
+
transformParams: (params) => ({
|
|
673
|
+
phone: String(params.phone),
|
|
674
|
+
code: params.code,
|
|
675
|
+
country_calling_code: String(params.country_calling_code),
|
|
676
|
+
action: params.action
|
|
677
|
+
})
|
|
678
|
+
},
|
|
679
|
+
phonePasswordLogin: {
|
|
680
|
+
url: "/auth/mobile/login",
|
|
681
|
+
method: "POST",
|
|
682
|
+
transformParams: (params) => ({
|
|
683
|
+
phone: String(params.phone),
|
|
684
|
+
password: params.password,
|
|
685
|
+
country_calling_code: String(params.country_calling_code)
|
|
686
|
+
})
|
|
687
|
+
},
|
|
688
|
+
sendPasswordResetEmail: {
|
|
689
|
+
url: "/auth/email/reset-password-code",
|
|
690
|
+
method: "GET",
|
|
691
|
+
transformParams: (params) => ({
|
|
692
|
+
email: params.email
|
|
693
|
+
})
|
|
694
|
+
},
|
|
695
|
+
sendPasswordResetSms: {
|
|
696
|
+
url: "/auth/mobile/sms-forget",
|
|
697
|
+
method: "POST",
|
|
698
|
+
transformParams: (params) => ({
|
|
699
|
+
phone: String(params.phone),
|
|
700
|
+
country_calling_code: String(params.country_calling_code)
|
|
701
|
+
})
|
|
702
|
+
},
|
|
703
|
+
sendResetPasswordLink: {
|
|
704
|
+
url: "/auth/email/link/send_reset_pwd_link",
|
|
705
|
+
method: "POST",
|
|
706
|
+
transformParams: (params) => ({
|
|
707
|
+
email: params.email
|
|
708
|
+
})
|
|
709
|
+
},
|
|
710
|
+
checkResetPasswordCode: {
|
|
711
|
+
url: "/auth/email/link/check_code",
|
|
712
|
+
method: "GET",
|
|
713
|
+
transformParams: (params) => ({
|
|
714
|
+
code: params.code
|
|
715
|
+
})
|
|
716
|
+
},
|
|
717
|
+
resetPasswordByCode: {
|
|
718
|
+
url: "/auth/email/link/reset_pwd_by_code",
|
|
719
|
+
method: "POST",
|
|
720
|
+
transformParams: (params) => ({
|
|
721
|
+
code: params.code,
|
|
722
|
+
password: params.password
|
|
723
|
+
})
|
|
724
|
+
},
|
|
725
|
+
resetPasswordByEmail: {
|
|
726
|
+
url: "/auth/email/reset-password",
|
|
727
|
+
method: "POST",
|
|
728
|
+
transformParams: (params) => ({
|
|
729
|
+
email: params.email,
|
|
730
|
+
password: params.password,
|
|
731
|
+
code: params.code
|
|
732
|
+
})
|
|
733
|
+
},
|
|
734
|
+
resetPasswordByPhone: {
|
|
735
|
+
url: "/auth/mobile/reset-password",
|
|
736
|
+
method: "POST",
|
|
737
|
+
transformParams: (params) => ({
|
|
738
|
+
phone: String(params.phone),
|
|
739
|
+
password: params.password,
|
|
740
|
+
code: params.code,
|
|
741
|
+
country_calling_code: String(params.country_calling_code)
|
|
742
|
+
})
|
|
743
|
+
},
|
|
744
|
+
verifyCode: {
|
|
745
|
+
url: "/auth/verify-code",
|
|
746
|
+
method: "POST",
|
|
747
|
+
transformParams: (params) => params
|
|
748
|
+
},
|
|
749
|
+
register: {
|
|
750
|
+
url: "/auth/register",
|
|
751
|
+
method: "POST",
|
|
752
|
+
transformParams: (params) => params
|
|
753
|
+
},
|
|
754
|
+
login: {
|
|
755
|
+
url: "/auth/login",
|
|
756
|
+
method: "POST",
|
|
757
|
+
transformParams: (params) => params
|
|
758
|
+
},
|
|
759
|
+
oauthLogin: {
|
|
760
|
+
url: "/auth/oauth-login",
|
|
761
|
+
method: "POST",
|
|
762
|
+
transformParams: (params) => params
|
|
763
|
+
},
|
|
764
|
+
validateToken: {
|
|
765
|
+
url: "/auth/validate",
|
|
766
|
+
method: "GET",
|
|
767
|
+
transformParams: (token) => ({}),
|
|
768
|
+
options: {
|
|
769
|
+
headers: (token) => ({
|
|
770
|
+
Authorization: `Bearer ${token}`
|
|
771
|
+
})
|
|
772
|
+
}
|
|
773
|
+
},
|
|
774
|
+
logout: {
|
|
775
|
+
url: "/auth/logout",
|
|
776
|
+
method: "POST",
|
|
777
|
+
transformParams: () => ({})
|
|
778
|
+
},
|
|
779
|
+
getCountries: {
|
|
780
|
+
url: "/area/country",
|
|
781
|
+
method: "GET",
|
|
782
|
+
transformParams: () => ({})
|
|
783
|
+
},
|
|
784
|
+
facebookLogin: {
|
|
785
|
+
url: "/auth/facebook/login",
|
|
786
|
+
method: "POST",
|
|
787
|
+
transformParams: (params) => ({
|
|
788
|
+
token: params.token
|
|
789
|
+
})
|
|
790
|
+
},
|
|
791
|
+
appleLogin: {
|
|
792
|
+
url: "/auth/apple/login",
|
|
793
|
+
method: "POST",
|
|
794
|
+
transformParams: (params) => ({
|
|
795
|
+
code: params.code
|
|
796
|
+
})
|
|
797
|
+
}
|
|
798
|
+
};
|
|
799
|
+
var shopWebposConfig = {
|
|
536
800
|
sendEmailVerificationCode: {
|
|
537
801
|
url: "/auth/email/register-code",
|
|
538
802
|
method: "GET",
|
|
@@ -798,7 +1062,8 @@ var webposConfig = {
|
|
|
798
1062
|
var channelConfigMap = {
|
|
799
1063
|
"online-store": onlineStoreConfig,
|
|
800
1064
|
"default": defaultConfig,
|
|
801
|
-
"webpos": webposConfig
|
|
1065
|
+
"webpos": webposConfig,
|
|
1066
|
+
"shop.webpos": shopWebposConfig
|
|
802
1067
|
};
|
|
803
1068
|
function getChannelConfig(channel) {
|
|
804
1069
|
return channelConfigMap[channel] || channelConfigMap["default"];
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
3
|
+
import { BaseModule } from '../../modules/BaseModule';
|
|
4
|
+
import type { RequestPlugin } from '../../plugins/request';
|
|
5
|
+
import { SalesState, SalesModuleAPI, Reservation, SalesResourceBookingItem, SalesTimelineHighlights } from './types';
|
|
6
|
+
import type { BookingData } from '../../server/modules/order/types';
|
|
7
|
+
export * from './types';
|
|
8
|
+
/**
|
|
9
|
+
* Sales 解决方案基础骨架
|
|
10
|
+
*
|
|
11
|
+
* 当前阶段仅提供:
|
|
12
|
+
* - solution 目录结构
|
|
13
|
+
* - 标准入口导出
|
|
14
|
+
* - 基础生命周期占位
|
|
15
|
+
*
|
|
16
|
+
* 不提前实现 store 编排、初始化流程细节、状态计算逻辑。
|
|
17
|
+
*/
|
|
18
|
+
export declare class SalesImpl extends BaseModule implements Module, SalesModuleAPI {
|
|
19
|
+
protected defaultName: string;
|
|
20
|
+
protected defaultVersion: string;
|
|
21
|
+
protected defaultTimelineBucketMinutes: number;
|
|
22
|
+
isSolution: boolean;
|
|
23
|
+
protected store: SalesState;
|
|
24
|
+
protected options: ModuleOptions;
|
|
25
|
+
protected otherParams: Record<string, any>;
|
|
26
|
+
protected request: RequestPlugin;
|
|
27
|
+
constructor(name?: string, version?: string);
|
|
28
|
+
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
29
|
+
/** 获取当前 store 快照 */
|
|
30
|
+
getState(): SalesState;
|
|
31
|
+
/** 获取当前选择日期 */
|
|
32
|
+
getCurrentDay(): dayjs.Dayjs;
|
|
33
|
+
/** 设置当前选择日期,会自动归一到当天 00:00:00 */
|
|
34
|
+
setCurrentDay(currentDay: dayjs.ConfigType): dayjs.Dayjs;
|
|
35
|
+
/** 获取当前预约列表 */
|
|
36
|
+
getReservationList(): Reservation[];
|
|
37
|
+
/** 覆盖设置当前预约列表 */
|
|
38
|
+
setReservationList(reservationList: Reservation[]): Reservation[];
|
|
39
|
+
/** 重置预约列表为空 */
|
|
40
|
+
resetReservationList(): Reservation[];
|
|
41
|
+
destroy(): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* 时间轴粒度(分钟)
|
|
44
|
+
* - 默认 15 分钟
|
|
45
|
+
* - 可通过 registerModule 时的 options.otherParams.timelineBucketMinutes 覆盖
|
|
46
|
+
*/
|
|
47
|
+
private getTimelineBucketMinutes;
|
|
48
|
+
/**
|
|
49
|
+
* 解析营业日统计窗口:
|
|
50
|
+
* - 当 operating_day_boundary.type === 'start_time'
|
|
51
|
+
* 使用「今天 + boundary.time」到「明天 + boundary.time」
|
|
52
|
+
* - 否则回退自然日(00:00 到次日 00:00)
|
|
53
|
+
*/
|
|
54
|
+
private getTimelineRangeByOperatingBoundary;
|
|
55
|
+
/**
|
|
56
|
+
* 统计时间轴每个时间片的预约数量。
|
|
57
|
+
* 算法使用差分数组,复杂度 O(n + s):
|
|
58
|
+
* - n = booking 数量
|
|
59
|
+
* - s = 时间片数量
|
|
60
|
+
*/
|
|
61
|
+
getTimelineHighlights(bookingList?: BookingData[], startDateTime?: string, endDateTime?: string): SalesTimelineHighlights;
|
|
62
|
+
/** dayjs 未启用插件时,手动封装 >= 判断 */
|
|
63
|
+
private isSameOrAfter;
|
|
64
|
+
/** dayjs 未启用插件时,手动封装 <= 判断 */
|
|
65
|
+
private isSameOrBefore;
|
|
66
|
+
/**
|
|
67
|
+
* 将 booking 的日期/时间字段统一组装为 dayjs
|
|
68
|
+
* - date + time 都有:按完整时间解析
|
|
69
|
+
* - 只有一个字段:按单字段解析(兼容历史数据)
|
|
70
|
+
* - 都没有:返回 invalid
|
|
71
|
+
*/
|
|
72
|
+
private toBookingDateTime;
|
|
73
|
+
/**
|
|
74
|
+
* 预约状态映射(面向 UI 的统一状态)
|
|
75
|
+
* 说明:locked 逻辑后续会补业务规则,这里先保留分支占位。
|
|
76
|
+
*/
|
|
77
|
+
private getBookingStatus;
|
|
78
|
+
private getResourceId;
|
|
79
|
+
/**
|
|
80
|
+
* 资源下 bookings 的返回裁剪策略:
|
|
81
|
+
* 1) 优先返回当前时刻正在进行中的预约(允许并发返回多条)
|
|
82
|
+
* 2) 若无 active,返回已超时且仍占用中的预约(允许并发多条)
|
|
83
|
+
* 3) 若仍无,返回最近一组未来预约(同 start_time 的并发预约全部返回)
|
|
84
|
+
* 4) 最后兜底返回一条(避免资源有历史预约时完全无反馈)
|
|
85
|
+
*/
|
|
86
|
+
private pickBookingsForCurrentPoint;
|
|
87
|
+
/**
|
|
88
|
+
* 标准化单条 booking:
|
|
89
|
+
* - 过滤终态(rejected/cancelled/completed)
|
|
90
|
+
* - 注入 status / isTimeout / reserved_status
|
|
91
|
+
*/
|
|
92
|
+
private normalizeMatchedBooking;
|
|
93
|
+
getResourceBookingList(currentTime: string, bookingList?: BookingData[]): Promise<SalesResourceBookingItem[]>;
|
|
94
|
+
}
|
|
95
|
+
export { SalesImpl as Sales };
|
|
96
|
+
export default SalesImpl;
|