@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;
|
|
@@ -499,13 +499,15 @@ export function shouldSyncOrderForPayment(paymentCode, paymentType) {
|
|
|
499
499
|
* @param paymentType 支付方式类型
|
|
500
500
|
* @returns 是否为现金支付
|
|
501
501
|
*/
|
|
502
|
-
export function isCashPayment(
|
|
503
|
-
var
|
|
504
|
-
var
|
|
502
|
+
export function isCashPayment(paymentItem) {
|
|
503
|
+
var _paymentItem$code, _paymentItem$type, _paymentItem$name;
|
|
504
|
+
var codeUpper = ((_paymentItem$code = paymentItem.code) === null || _paymentItem$code === void 0 ? void 0 : _paymentItem$code.toUpperCase()) || '';
|
|
505
|
+
var typeUpper = ((_paymentItem$type = paymentItem.type) === null || _paymentItem$type === void 0 ? void 0 : _paymentItem$type.toUpperCase()) || '';
|
|
506
|
+
var isNameCash = (_paymentItem$name = paymentItem.name) === null || _paymentItem$name === void 0 ? void 0 : _paymentItem$name.toLowerCase().includes('cash');
|
|
505
507
|
|
|
506
508
|
// 现金支付识别规则
|
|
507
509
|
var cashIdentifiers = ['CASH', 'CASHMANUAL', 'MANUAL'];
|
|
508
510
|
return cashIdentifiers.some(function (identifier) {
|
|
509
511
|
return codeUpper.includes(identifier) || typeUpper.includes(identifier);
|
|
510
|
-
});
|
|
512
|
+
}) || isNameCash;
|
|
511
513
|
}
|
|
@@ -678,6 +678,344 @@ var defaultConfig = {
|
|
|
678
678
|
* webpos 渠道配置
|
|
679
679
|
*/
|
|
680
680
|
var webposConfig = {
|
|
681
|
+
sendEmailVerificationCode: {
|
|
682
|
+
url: '/auth/email/register-code',
|
|
683
|
+
method: 'GET',
|
|
684
|
+
transformParams: function transformParams(params) {
|
|
685
|
+
return {
|
|
686
|
+
email: params.target
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
},
|
|
690
|
+
sendEmailLoginCode: {
|
|
691
|
+
url: '/auth/send-email-code',
|
|
692
|
+
method: 'POST',
|
|
693
|
+
transformParams: function transformParams(params) {
|
|
694
|
+
return {
|
|
695
|
+
email: params.target,
|
|
696
|
+
purpose: params.purpose,
|
|
697
|
+
type: params.type
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
sendSmsRegisterCode: {
|
|
702
|
+
url: '/auth/mobile/sms-register',
|
|
703
|
+
method: 'POST',
|
|
704
|
+
transformParams: function transformParams(params) {
|
|
705
|
+
return {
|
|
706
|
+
phone: String(params.phone),
|
|
707
|
+
country_calling_code: String(params.country_calling_code)
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
},
|
|
711
|
+
sendEmailRegisterLink: {
|
|
712
|
+
url: '/auth/email/link/new-send-register-link',
|
|
713
|
+
method: 'POST',
|
|
714
|
+
transformParams: function transformParams(email) {
|
|
715
|
+
return {
|
|
716
|
+
email: email
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
},
|
|
720
|
+
verifyEmailRegistrationLink: {
|
|
721
|
+
url: '/auth/email/link/new-register',
|
|
722
|
+
method: 'POST',
|
|
723
|
+
transformParams: function transformParams(params) {
|
|
724
|
+
return {
|
|
725
|
+
code: params.code,
|
|
726
|
+
password: params.password
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
},
|
|
730
|
+
emailPasswordLogin: {
|
|
731
|
+
url: '/tenant/account/login/email',
|
|
732
|
+
method: 'POST',
|
|
733
|
+
transformParams: function transformParams(params) {
|
|
734
|
+
return {
|
|
735
|
+
email: params.email,
|
|
736
|
+
password: params.password,
|
|
737
|
+
device: "webpos" + new Date().getTime()
|
|
738
|
+
};
|
|
739
|
+
},
|
|
740
|
+
options: function options(values) {
|
|
741
|
+
return {
|
|
742
|
+
// withCredentials: true,
|
|
743
|
+
prefix: false,
|
|
744
|
+
isDefaultSaasDomain: true,
|
|
745
|
+
cache: {
|
|
746
|
+
mode: "remote_local",
|
|
747
|
+
type: "indexDB",
|
|
748
|
+
cacheKeyData: values
|
|
749
|
+
}
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
},
|
|
753
|
+
emailCodeRegister: {
|
|
754
|
+
url: '/auth/email/register',
|
|
755
|
+
method: 'POST',
|
|
756
|
+
transformParams: function transformParams(params) {
|
|
757
|
+
return {
|
|
758
|
+
email: params.email,
|
|
759
|
+
code: params.code,
|
|
760
|
+
password: params.password
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
},
|
|
764
|
+
phoneCodeRegister: {
|
|
765
|
+
url: '/auth/mobile/register',
|
|
766
|
+
method: 'POST',
|
|
767
|
+
transformParams: function transformParams(params) {
|
|
768
|
+
return {
|
|
769
|
+
phone: String(params.phone),
|
|
770
|
+
password: params.password,
|
|
771
|
+
code: params.code,
|
|
772
|
+
country_calling_code: String(params.country_calling_code)
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
resendEmailRegisterLink: {
|
|
777
|
+
url: '/auth/email/link/resend_register_link',
|
|
778
|
+
method: 'POST',
|
|
779
|
+
transformParams: function transformParams(params) {
|
|
780
|
+
return {
|
|
781
|
+
code: params.code
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
},
|
|
785
|
+
checkEmailLinkCode: {
|
|
786
|
+
url: '/auth/email/link/new-register-check-code',
|
|
787
|
+
method: 'GET',
|
|
788
|
+
transformParams: function transformParams(params) {
|
|
789
|
+
return {
|
|
790
|
+
code: params.code
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
},
|
|
794
|
+
sendSmsLoginCode: {
|
|
795
|
+
url: '/auth/send-login-msg',
|
|
796
|
+
method: 'POST',
|
|
797
|
+
transformParams: function transformParams(params) {
|
|
798
|
+
return {
|
|
799
|
+
phone: String(params.phone),
|
|
800
|
+
country_calling_code: String(params.country_calling_code)
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
},
|
|
804
|
+
phoneCodeLogin: {
|
|
805
|
+
url: '/auth/mobile-login',
|
|
806
|
+
method: 'POST',
|
|
807
|
+
transformParams: function transformParams(params) {
|
|
808
|
+
return {
|
|
809
|
+
phone: String(params.phone),
|
|
810
|
+
country_calling_code: String(params.country_calling_code),
|
|
811
|
+
code: params.code
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
},
|
|
815
|
+
guestLogin: {
|
|
816
|
+
url: '/auth/guest/login',
|
|
817
|
+
method: 'POST',
|
|
818
|
+
transformParams: function transformParams(params) {
|
|
819
|
+
return {
|
|
820
|
+
login_channel: params.login_channel,
|
|
821
|
+
guest_code: params.guest_code
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
checkEmailExists: {
|
|
826
|
+
url: '/auth/email/check-email',
|
|
827
|
+
method: 'GET',
|
|
828
|
+
transformParams: function transformParams(params) {
|
|
829
|
+
return {
|
|
830
|
+
email: params.email,
|
|
831
|
+
sales_channel: 'online_store'
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
},
|
|
835
|
+
checkEmailCode: {
|
|
836
|
+
url: '/auth/email/check-email-code',
|
|
837
|
+
method: 'GET',
|
|
838
|
+
transformParams: function transformParams(params) {
|
|
839
|
+
return {
|
|
840
|
+
email: params.email,
|
|
841
|
+
code: params.code,
|
|
842
|
+
action: params.action
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
},
|
|
846
|
+
checkMobileCode: {
|
|
847
|
+
url: '/auth/mobile/check-mobile-code',
|
|
848
|
+
method: 'GET',
|
|
849
|
+
transformParams: function transformParams(params) {
|
|
850
|
+
return {
|
|
851
|
+
phone: String(params.phone),
|
|
852
|
+
code: params.code,
|
|
853
|
+
country_calling_code: String(params.country_calling_code),
|
|
854
|
+
action: params.action
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
},
|
|
858
|
+
phonePasswordLogin: {
|
|
859
|
+
url: '/auth/mobile/login',
|
|
860
|
+
method: 'POST',
|
|
861
|
+
transformParams: function transformParams(params) {
|
|
862
|
+
return {
|
|
863
|
+
phone: String(params.phone),
|
|
864
|
+
password: params.password,
|
|
865
|
+
country_calling_code: String(params.country_calling_code)
|
|
866
|
+
};
|
|
867
|
+
}
|
|
868
|
+
},
|
|
869
|
+
sendPasswordResetEmail: {
|
|
870
|
+
url: '/auth/email/reset-password-code',
|
|
871
|
+
method: 'GET',
|
|
872
|
+
transformParams: function transformParams(params) {
|
|
873
|
+
return {
|
|
874
|
+
email: params.email
|
|
875
|
+
};
|
|
876
|
+
}
|
|
877
|
+
},
|
|
878
|
+
sendPasswordResetSms: {
|
|
879
|
+
url: '/auth/mobile/sms-forget',
|
|
880
|
+
method: 'POST',
|
|
881
|
+
transformParams: function transformParams(params) {
|
|
882
|
+
return {
|
|
883
|
+
phone: String(params.phone),
|
|
884
|
+
country_calling_code: String(params.country_calling_code)
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
},
|
|
888
|
+
sendResetPasswordLink: {
|
|
889
|
+
url: '/auth/email/link/send_reset_pwd_link',
|
|
890
|
+
method: 'POST',
|
|
891
|
+
transformParams: function transformParams(params) {
|
|
892
|
+
return {
|
|
893
|
+
email: params.email
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
},
|
|
897
|
+
checkResetPasswordCode: {
|
|
898
|
+
url: '/auth/email/link/check_code',
|
|
899
|
+
method: 'GET',
|
|
900
|
+
transformParams: function transformParams(params) {
|
|
901
|
+
return {
|
|
902
|
+
code: params.code
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
},
|
|
906
|
+
resetPasswordByCode: {
|
|
907
|
+
url: '/auth/email/link/reset_pwd_by_code',
|
|
908
|
+
method: 'POST',
|
|
909
|
+
transformParams: function transformParams(params) {
|
|
910
|
+
return {
|
|
911
|
+
code: params.code,
|
|
912
|
+
password: params.password
|
|
913
|
+
};
|
|
914
|
+
}
|
|
915
|
+
},
|
|
916
|
+
resetPasswordByEmail: {
|
|
917
|
+
url: '/auth/email/reset-password',
|
|
918
|
+
method: 'POST',
|
|
919
|
+
transformParams: function transformParams(params) {
|
|
920
|
+
return {
|
|
921
|
+
email: params.email,
|
|
922
|
+
password: params.password,
|
|
923
|
+
code: params.code
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
},
|
|
927
|
+
resetPasswordByPhone: {
|
|
928
|
+
url: '/auth/mobile/reset-password',
|
|
929
|
+
method: 'POST',
|
|
930
|
+
transformParams: function transformParams(params) {
|
|
931
|
+
return {
|
|
932
|
+
phone: String(params.phone),
|
|
933
|
+
password: params.password,
|
|
934
|
+
code: params.code,
|
|
935
|
+
country_calling_code: String(params.country_calling_code)
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
},
|
|
939
|
+
verifyCode: {
|
|
940
|
+
url: '/auth/verify-code',
|
|
941
|
+
method: 'POST',
|
|
942
|
+
transformParams: function transformParams(params) {
|
|
943
|
+
return params;
|
|
944
|
+
}
|
|
945
|
+
},
|
|
946
|
+
register: {
|
|
947
|
+
url: '/auth/register',
|
|
948
|
+
method: 'POST',
|
|
949
|
+
transformParams: function transformParams(params) {
|
|
950
|
+
return params;
|
|
951
|
+
}
|
|
952
|
+
},
|
|
953
|
+
login: {
|
|
954
|
+
url: '/auth/login',
|
|
955
|
+
method: 'POST',
|
|
956
|
+
transformParams: function transformParams(params) {
|
|
957
|
+
return params;
|
|
958
|
+
}
|
|
959
|
+
},
|
|
960
|
+
oauthLogin: {
|
|
961
|
+
url: '/auth/oauth-login',
|
|
962
|
+
method: 'POST',
|
|
963
|
+
transformParams: function transformParams(params) {
|
|
964
|
+
return params;
|
|
965
|
+
}
|
|
966
|
+
},
|
|
967
|
+
validateToken: {
|
|
968
|
+
url: '/auth/validate',
|
|
969
|
+
method: 'GET',
|
|
970
|
+
transformParams: function transformParams(token) {
|
|
971
|
+
return {};
|
|
972
|
+
},
|
|
973
|
+
options: {
|
|
974
|
+
headers: function headers(token) {
|
|
975
|
+
return {
|
|
976
|
+
Authorization: "Bearer ".concat(token)
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
},
|
|
981
|
+
logout: {
|
|
982
|
+
url: '/auth/logout',
|
|
983
|
+
method: 'POST',
|
|
984
|
+
transformParams: function transformParams() {
|
|
985
|
+
return {};
|
|
986
|
+
}
|
|
987
|
+
},
|
|
988
|
+
getCountries: {
|
|
989
|
+
url: '/area/country',
|
|
990
|
+
method: 'GET',
|
|
991
|
+
transformParams: function transformParams() {
|
|
992
|
+
return {};
|
|
993
|
+
}
|
|
994
|
+
},
|
|
995
|
+
facebookLogin: {
|
|
996
|
+
url: '/auth/facebook/login',
|
|
997
|
+
method: 'POST',
|
|
998
|
+
transformParams: function transformParams(params) {
|
|
999
|
+
return {
|
|
1000
|
+
token: params.token
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
},
|
|
1004
|
+
appleLogin: {
|
|
1005
|
+
url: '/auth/apple/login',
|
|
1006
|
+
method: 'POST',
|
|
1007
|
+
transformParams: function transformParams(params) {
|
|
1008
|
+
return {
|
|
1009
|
+
code: params.code
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
};
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* webpos 租户登录 渠道配置
|
|
1017
|
+
*/
|
|
1018
|
+
var shopWebposConfig = {
|
|
681
1019
|
sendEmailVerificationCode: {
|
|
682
1020
|
url: '/auth/email/register-code',
|
|
683
1021
|
method: 'GET',
|
|
@@ -1017,7 +1355,8 @@ var webposConfig = {
|
|
|
1017
1355
|
export var channelConfigMap = {
|
|
1018
1356
|
'online-store': onlineStoreConfig,
|
|
1019
1357
|
'default': defaultConfig,
|
|
1020
|
-
'webpos': webposConfig
|
|
1358
|
+
'webpos': webposConfig,
|
|
1359
|
+
'shop.webpos': shopWebposConfig
|
|
1021
1360
|
};
|
|
1022
1361
|
|
|
1023
1362
|
/**
|
|
@@ -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;
|