@pisell/pisellos 2.2.39 → 2.2.40
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/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/modules/Cart/types.d.ts +0 -2
- package/dist/modules/Cart/utils/cartProduct.js +0 -11
- package/dist/modules/Discount/types.d.ts +0 -15
- package/dist/modules/Payment/index.d.ts +1 -2
- package/dist/modules/Payment/index.js +7 -10
- package/dist/modules/Payment/utils.js +0 -3
- package/dist/modules/Payment/walletpass.d.ts +0 -23
- package/dist/modules/Payment/walletpass.js +95 -191
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Rules/index.d.ts +3 -8
- package/dist/modules/Rules/index.js +23 -143
- package/dist/modules/Rules/types.d.ts +0 -1
- package/dist/modules/Summary/types.d.ts +0 -2
- package/dist/modules/Summary/utils.d.ts +0 -6
- package/dist/modules/Summary/utils.js +0 -21
- package/dist/plugins/window.d.ts +0 -2
- package/dist/solution/BookingByStep/index.d.ts +0 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Checkout/index.js +0 -2
- package/dist/solution/RegisterAndLogin/config.js +339 -1
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +3 -13
- package/dist/solution/ShopDiscount/types.d.ts +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/modules/Cart/types.d.ts +0 -2
- package/lib/modules/Cart/utils/cartProduct.js +0 -9
- package/lib/modules/Discount/types.d.ts +0 -15
- package/lib/modules/Payment/index.d.ts +1 -2
- package/lib/modules/Payment/index.js +0 -1
- package/lib/modules/Payment/utils.js +0 -3
- package/lib/modules/Payment/walletpass.d.ts +0 -23
- package/lib/modules/Payment/walletpass.js +17 -94
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Rules/index.d.ts +3 -8
- package/lib/modules/Rules/index.js +187 -352
- package/lib/modules/Rules/types.d.ts +0 -1
- package/lib/modules/Summary/types.d.ts +0 -2
- package/lib/modules/Summary/utils.d.ts +0 -6
- package/lib/modules/Summary/utils.js +0 -15
- package/lib/plugins/window.d.ts +0 -2
- package/lib/solution/BookingByStep/index.d.ts +0 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Checkout/index.js +0 -2
- package/lib/solution/RegisterAndLogin/config.js +265 -1
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +2 -8
- package/lib/solution/ShopDiscount/types.d.ts +0 -1
- package/package.json +1 -1
- package/dist/model/index.d.ts +0 -1
- package/dist/model/index.js +0 -1
- package/dist/model/strategy/adapter/index.d.ts +0 -3
- package/dist/model/strategy/adapter/index.js +0 -4
- package/dist/model/strategy/adapter/type.d.ts +0 -28
- package/dist/model/strategy/adapter/type.js +0 -1
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -497
- package/dist/model/strategy/adapter/walletPass/example.d.ts +0 -4
- package/dist/model/strategy/adapter/walletPass/example.js +0 -258
- package/dist/model/strategy/adapter/walletPass/index.d.ts +0 -32
- package/dist/model/strategy/adapter/walletPass/index.js +0 -182
- package/dist/model/strategy/adapter/walletPass/locales.d.ts +0 -1
- package/dist/model/strategy/adapter/walletPass/locales.js +0 -23
- package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -165
- package/dist/model/strategy/adapter/walletPass/type.js +0 -1
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -50
- package/dist/model/strategy/adapter/walletPass/utils.js +0 -965
- package/dist/model/strategy/index.d.ts +0 -94
- package/dist/model/strategy/index.js +0 -551
- package/dist/model/strategy/strategy-example.d.ts +0 -5
- package/dist/model/strategy/strategy-example.js +0 -331
- package/dist/model/strategy/type.d.ts +0 -228
- package/dist/model/strategy/type.js +0 -94
- package/lib/model/index.d.ts +0 -1
- package/lib/model/index.js +0 -23
- package/lib/model/strategy/adapter/index.d.ts +0 -3
- package/lib/model/strategy/adapter/index.js +0 -45
- package/lib/model/strategy/adapter/type.d.ts +0 -28
- package/lib/model/strategy/adapter/type.js +0 -17
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -421
- package/lib/model/strategy/adapter/walletPass/example.d.ts +0 -4
- package/lib/model/strategy/adapter/walletPass/example.js +0 -207
- package/lib/model/strategy/adapter/walletPass/index.d.ts +0 -32
- package/lib/model/strategy/adapter/walletPass/index.js +0 -142
- package/lib/model/strategy/adapter/walletPass/locales.d.ts +0 -1
- package/lib/model/strategy/adapter/walletPass/locales.js +0 -51
- package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -165
- package/lib/model/strategy/adapter/walletPass/type.js +0 -17
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -50
- package/lib/model/strategy/adapter/walletPass/utils.js +0 -660
- package/lib/model/strategy/index.d.ts +0 -94
- package/lib/model/strategy/index.js +0 -413
- package/lib/model/strategy/strategy-example.d.ts +0 -5
- package/lib/model/strategy/strategy-example.js +0 -318
- package/lib/model/strategy/type.d.ts +0 -228
- package/lib/model/strategy/type.js +0 -44
|
@@ -13,12 +13,6 @@ export declare const getBundleDiscountList: (bundle: any[]) => any[];
|
|
|
13
13
|
* @returns 商品总价字符串,保留2位小数
|
|
14
14
|
*/
|
|
15
15
|
export declare const calculateSubtotal: (items: CartItem[]) => string;
|
|
16
|
-
/**
|
|
17
|
-
* 计算商品小计(不含其他费用 不包含折扣卡商品券抵扣金额)
|
|
18
|
-
* @param items - 购物车商品数组
|
|
19
|
-
* @returns 商品总价字符串,保留2位小数
|
|
20
|
-
*/
|
|
21
|
-
export declare const calculateOriginSubtotal: (items: CartItem[]) => string;
|
|
22
16
|
/**
|
|
23
17
|
* @title: 单个商品的税费
|
|
24
18
|
* @description:
|
|
@@ -30,7 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var utils_exports = {};
|
|
31
31
|
__export(utils_exports, {
|
|
32
32
|
calculateDeposit: () => calculateDeposit,
|
|
33
|
-
calculateOriginSubtotal: () => calculateOriginSubtotal,
|
|
34
33
|
calculatePriceDetails: () => calculatePriceDetails,
|
|
35
34
|
calculateSubtotal: () => calculateSubtotal,
|
|
36
35
|
calculateTaxFee: () => calculateTaxFee,
|
|
@@ -40,15 +39,12 @@ module.exports = __toCommonJS(utils_exports);
|
|
|
40
39
|
var import_decimal = __toESM(require("decimal.js"));
|
|
41
40
|
var calculatePriceDetails = (shopInfo, items) => {
|
|
42
41
|
const subtotal = new import_decimal.default(calculateSubtotal(items));
|
|
43
|
-
const subOriginTotal = new import_decimal.default(calculateOriginSubtotal(items));
|
|
44
42
|
const totalTaxFee = new import_decimal.default(calculateTaxFee(shopInfo, items));
|
|
45
43
|
const total = (shopInfo == null ? void 0 : shopInfo.is_price_include_tax) ? subtotal : subtotal.plus(totalTaxFee);
|
|
46
|
-
const originTotal = (shopInfo == null ? void 0 : shopInfo.is_price_include_tax) ? subOriginTotal : subOriginTotal.plus(totalTaxFee);
|
|
47
44
|
const deposit = calculateDeposit(items);
|
|
48
45
|
return {
|
|
49
46
|
subtotal: subtotal.toFixed(2),
|
|
50
47
|
total: total.toFixed(2),
|
|
51
|
-
originTotal: originTotal.toFixed(2),
|
|
52
48
|
taxTitle: shopInfo == null ? void 0 : shopInfo.tax_title,
|
|
53
49
|
totalTaxFee: totalTaxFee.toFixed(2),
|
|
54
50
|
isPriceIncludeTax: shopInfo == null ? void 0 : shopInfo.is_price_include_tax,
|
|
@@ -87,16 +83,6 @@ var calculateSubtotal = (items) => {
|
|
|
87
83
|
}, new import_decimal.default(0));
|
|
88
84
|
return subtotal.toFixed(2);
|
|
89
85
|
};
|
|
90
|
-
var calculateOriginSubtotal = (items) => {
|
|
91
|
-
if (!(items == null ? void 0 : items.length)) {
|
|
92
|
-
return "0.00";
|
|
93
|
-
}
|
|
94
|
-
const subtotal = items.reduce((sum, item) => {
|
|
95
|
-
const cartItemTotalPrice = new import_decimal.default(item.summaryOriginTotal || 0);
|
|
96
|
-
return sum.plus(cartItemTotalPrice);
|
|
97
|
-
}, new import_decimal.default(0));
|
|
98
|
-
return subtotal.toFixed(2);
|
|
99
|
-
};
|
|
100
86
|
var calculateTaxFee = (shopInfo, items) => {
|
|
101
87
|
if (!(items == null ? void 0 : items.length)) {
|
|
102
88
|
return "0.00";
|
|
@@ -138,7 +124,6 @@ var calculateDeposit = (items) => {
|
|
|
138
124
|
// Annotate the CommonJS export names for ESM import in node:
|
|
139
125
|
0 && (module.exports = {
|
|
140
126
|
calculateDeposit,
|
|
141
|
-
calculateOriginSubtotal,
|
|
142
127
|
calculatePriceDetails,
|
|
143
128
|
calculateSubtotal,
|
|
144
129
|
calculateTaxFee,
|
package/lib/plugins/window.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { WalletPassEvaluator } from '../model';
|
|
2
1
|
import { Plugin } from '../types';
|
|
3
2
|
/**
|
|
4
3
|
* WindowPlugin 接口定义
|
|
@@ -15,7 +14,6 @@ export interface WindowPlugin extends Plugin {
|
|
|
15
14
|
document: Partial<Document>;
|
|
16
15
|
history: History;
|
|
17
16
|
interaction?: any;
|
|
18
|
-
getWalletPassEvaluator?: () => WalletPassEvaluator;
|
|
19
17
|
}
|
|
20
18
|
/**
|
|
21
19
|
* 简单的 Storage 接口实现
|
|
@@ -144,7 +144,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
144
144
|
getSummary(): Promise<{
|
|
145
145
|
subtotal: string | number;
|
|
146
146
|
total: string | number;
|
|
147
|
-
originTotal: string | number;
|
|
148
147
|
taxTitle?: string | undefined;
|
|
149
148
|
totalTaxFee?: string | number | undefined;
|
|
150
149
|
isPriceIncludeTax?: 0 | 1 | undefined;
|
|
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
123
123
|
* 获取当前的客户搜索条件
|
|
124
124
|
* @returns 当前搜索条件
|
|
125
125
|
*/
|
|
126
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
126
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
127
127
|
/**
|
|
128
128
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
129
129
|
* @returns 客户状态
|
|
@@ -224,7 +224,6 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
224
224
|
product_id: item.product_id,
|
|
225
225
|
product_variant_id: item.product_variant_id,
|
|
226
226
|
quantity: item.num,
|
|
227
|
-
is_price_include_tax: item.is_price_include_tax,
|
|
228
227
|
// 商品是否含税:1;0
|
|
229
228
|
is_charge_tax: item.is_charge_tax ?? 0,
|
|
230
229
|
// 若商品不含税,计算得到的税费,单位(元)
|
|
@@ -249,7 +248,6 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
249
248
|
},
|
|
250
249
|
product_bundle: item.product_bundle.map((bundle) => {
|
|
251
250
|
return {
|
|
252
|
-
is_price_include_tax: item.is_price_include_tax,
|
|
253
251
|
bundle_id: bundle.bundle_id,
|
|
254
252
|
bundle_product_id: bundle.bundle_product_id,
|
|
255
253
|
bundle_variant_id: bundle.bundle_variant_id,
|
|
@@ -796,10 +796,274 @@ var webposConfig = {
|
|
|
796
796
|
})
|
|
797
797
|
}
|
|
798
798
|
};
|
|
799
|
+
var shopWebposConfig = {
|
|
800
|
+
sendEmailVerificationCode: {
|
|
801
|
+
url: "/auth/email/register-code",
|
|
802
|
+
method: "GET",
|
|
803
|
+
transformParams: (params) => ({
|
|
804
|
+
email: params.target
|
|
805
|
+
})
|
|
806
|
+
},
|
|
807
|
+
sendEmailLoginCode: {
|
|
808
|
+
url: "/auth/send-email-code",
|
|
809
|
+
method: "POST",
|
|
810
|
+
transformParams: (params) => ({
|
|
811
|
+
email: params.target,
|
|
812
|
+
purpose: params.purpose,
|
|
813
|
+
type: params.type
|
|
814
|
+
})
|
|
815
|
+
},
|
|
816
|
+
sendSmsRegisterCode: {
|
|
817
|
+
url: "/auth/mobile/sms-register",
|
|
818
|
+
method: "POST",
|
|
819
|
+
transformParams: (params) => ({
|
|
820
|
+
phone: String(params.phone),
|
|
821
|
+
country_calling_code: String(params.country_calling_code)
|
|
822
|
+
})
|
|
823
|
+
},
|
|
824
|
+
sendEmailRegisterLink: {
|
|
825
|
+
url: "/auth/email/link/new-send-register-link",
|
|
826
|
+
method: "POST",
|
|
827
|
+
transformParams: (email) => ({
|
|
828
|
+
email
|
|
829
|
+
})
|
|
830
|
+
},
|
|
831
|
+
verifyEmailRegistrationLink: {
|
|
832
|
+
url: "/auth/email/link/new-register",
|
|
833
|
+
method: "POST",
|
|
834
|
+
transformParams: (params) => ({
|
|
835
|
+
code: params.code,
|
|
836
|
+
password: params.password
|
|
837
|
+
})
|
|
838
|
+
},
|
|
839
|
+
emailPasswordLogin: {
|
|
840
|
+
url: "/tenant/auth/login/email",
|
|
841
|
+
method: "POST",
|
|
842
|
+
transformParams: (params) => ({
|
|
843
|
+
email: params.email,
|
|
844
|
+
password: params.password,
|
|
845
|
+
device: "webpos" + (/* @__PURE__ */ new Date()).getTime()
|
|
846
|
+
}),
|
|
847
|
+
options: (values) => ({
|
|
848
|
+
// withCredentials: true,
|
|
849
|
+
prefix: false,
|
|
850
|
+
cache: {
|
|
851
|
+
mode: "remote_local",
|
|
852
|
+
type: "indexDB",
|
|
853
|
+
cacheKeyData: values
|
|
854
|
+
}
|
|
855
|
+
})
|
|
856
|
+
},
|
|
857
|
+
emailCodeRegister: {
|
|
858
|
+
url: "/auth/email/register",
|
|
859
|
+
method: "POST",
|
|
860
|
+
transformParams: (params) => ({
|
|
861
|
+
email: params.email,
|
|
862
|
+
code: params.code,
|
|
863
|
+
password: params.password
|
|
864
|
+
})
|
|
865
|
+
},
|
|
866
|
+
phoneCodeRegister: {
|
|
867
|
+
url: "/auth/mobile/register",
|
|
868
|
+
method: "POST",
|
|
869
|
+
transformParams: (params) => ({
|
|
870
|
+
phone: String(params.phone),
|
|
871
|
+
password: params.password,
|
|
872
|
+
code: params.code,
|
|
873
|
+
country_calling_code: String(params.country_calling_code)
|
|
874
|
+
})
|
|
875
|
+
},
|
|
876
|
+
resendEmailRegisterLink: {
|
|
877
|
+
url: "/auth/email/link/resend_register_link",
|
|
878
|
+
method: "POST",
|
|
879
|
+
transformParams: (params) => ({
|
|
880
|
+
code: params.code
|
|
881
|
+
})
|
|
882
|
+
},
|
|
883
|
+
checkEmailLinkCode: {
|
|
884
|
+
url: "/auth/email/link/new-register-check-code",
|
|
885
|
+
method: "GET",
|
|
886
|
+
transformParams: (params) => ({
|
|
887
|
+
code: params.code
|
|
888
|
+
})
|
|
889
|
+
},
|
|
890
|
+
sendSmsLoginCode: {
|
|
891
|
+
url: "/auth/send-login-msg",
|
|
892
|
+
method: "POST",
|
|
893
|
+
transformParams: (params) => ({
|
|
894
|
+
phone: String(params.phone),
|
|
895
|
+
country_calling_code: String(params.country_calling_code)
|
|
896
|
+
})
|
|
897
|
+
},
|
|
898
|
+
phoneCodeLogin: {
|
|
899
|
+
url: "/auth/mobile-login",
|
|
900
|
+
method: "POST",
|
|
901
|
+
transformParams: (params) => ({
|
|
902
|
+
phone: String(params.phone),
|
|
903
|
+
country_calling_code: String(params.country_calling_code),
|
|
904
|
+
code: params.code
|
|
905
|
+
})
|
|
906
|
+
},
|
|
907
|
+
guestLogin: {
|
|
908
|
+
url: "/auth/guest/login",
|
|
909
|
+
method: "POST",
|
|
910
|
+
transformParams: (params) => ({
|
|
911
|
+
login_channel: params.login_channel,
|
|
912
|
+
guest_code: params.guest_code
|
|
913
|
+
})
|
|
914
|
+
},
|
|
915
|
+
checkEmailExists: {
|
|
916
|
+
url: "/auth/email/check-email",
|
|
917
|
+
method: "GET",
|
|
918
|
+
transformParams: (params) => ({
|
|
919
|
+
email: params.email,
|
|
920
|
+
sales_channel: "online_store"
|
|
921
|
+
})
|
|
922
|
+
},
|
|
923
|
+
checkEmailCode: {
|
|
924
|
+
url: "/auth/email/check-email-code",
|
|
925
|
+
method: "GET",
|
|
926
|
+
transformParams: (params) => ({
|
|
927
|
+
email: params.email,
|
|
928
|
+
code: params.code,
|
|
929
|
+
action: params.action
|
|
930
|
+
})
|
|
931
|
+
},
|
|
932
|
+
checkMobileCode: {
|
|
933
|
+
url: "/auth/mobile/check-mobile-code",
|
|
934
|
+
method: "GET",
|
|
935
|
+
transformParams: (params) => ({
|
|
936
|
+
phone: String(params.phone),
|
|
937
|
+
code: params.code,
|
|
938
|
+
country_calling_code: String(params.country_calling_code),
|
|
939
|
+
action: params.action
|
|
940
|
+
})
|
|
941
|
+
},
|
|
942
|
+
phonePasswordLogin: {
|
|
943
|
+
url: "/auth/mobile/login",
|
|
944
|
+
method: "POST",
|
|
945
|
+
transformParams: (params) => ({
|
|
946
|
+
phone: String(params.phone),
|
|
947
|
+
password: params.password,
|
|
948
|
+
country_calling_code: String(params.country_calling_code)
|
|
949
|
+
})
|
|
950
|
+
},
|
|
951
|
+
sendPasswordResetEmail: {
|
|
952
|
+
url: "/auth/email/reset-password-code",
|
|
953
|
+
method: "GET",
|
|
954
|
+
transformParams: (params) => ({
|
|
955
|
+
email: params.email
|
|
956
|
+
})
|
|
957
|
+
},
|
|
958
|
+
sendPasswordResetSms: {
|
|
959
|
+
url: "/auth/mobile/sms-forget",
|
|
960
|
+
method: "POST",
|
|
961
|
+
transformParams: (params) => ({
|
|
962
|
+
phone: String(params.phone),
|
|
963
|
+
country_calling_code: String(params.country_calling_code)
|
|
964
|
+
})
|
|
965
|
+
},
|
|
966
|
+
sendResetPasswordLink: {
|
|
967
|
+
url: "/auth/email/link/send_reset_pwd_link",
|
|
968
|
+
method: "POST",
|
|
969
|
+
transformParams: (params) => ({
|
|
970
|
+
email: params.email
|
|
971
|
+
})
|
|
972
|
+
},
|
|
973
|
+
checkResetPasswordCode: {
|
|
974
|
+
url: "/auth/email/link/check_code",
|
|
975
|
+
method: "GET",
|
|
976
|
+
transformParams: (params) => ({
|
|
977
|
+
code: params.code
|
|
978
|
+
})
|
|
979
|
+
},
|
|
980
|
+
resetPasswordByCode: {
|
|
981
|
+
url: "/auth/email/link/reset_pwd_by_code",
|
|
982
|
+
method: "POST",
|
|
983
|
+
transformParams: (params) => ({
|
|
984
|
+
code: params.code,
|
|
985
|
+
password: params.password
|
|
986
|
+
})
|
|
987
|
+
},
|
|
988
|
+
resetPasswordByEmail: {
|
|
989
|
+
url: "/auth/email/reset-password",
|
|
990
|
+
method: "POST",
|
|
991
|
+
transformParams: (params) => ({
|
|
992
|
+
email: params.email,
|
|
993
|
+
password: params.password,
|
|
994
|
+
code: params.code
|
|
995
|
+
})
|
|
996
|
+
},
|
|
997
|
+
resetPasswordByPhone: {
|
|
998
|
+
url: "/auth/mobile/reset-password",
|
|
999
|
+
method: "POST",
|
|
1000
|
+
transformParams: (params) => ({
|
|
1001
|
+
phone: String(params.phone),
|
|
1002
|
+
password: params.password,
|
|
1003
|
+
code: params.code,
|
|
1004
|
+
country_calling_code: String(params.country_calling_code)
|
|
1005
|
+
})
|
|
1006
|
+
},
|
|
1007
|
+
verifyCode: {
|
|
1008
|
+
url: "/auth/verify-code",
|
|
1009
|
+
method: "POST",
|
|
1010
|
+
transformParams: (params) => params
|
|
1011
|
+
},
|
|
1012
|
+
register: {
|
|
1013
|
+
url: "/auth/register",
|
|
1014
|
+
method: "POST",
|
|
1015
|
+
transformParams: (params) => params
|
|
1016
|
+
},
|
|
1017
|
+
login: {
|
|
1018
|
+
url: "/auth/login",
|
|
1019
|
+
method: "POST",
|
|
1020
|
+
transformParams: (params) => params
|
|
1021
|
+
},
|
|
1022
|
+
oauthLogin: {
|
|
1023
|
+
url: "/auth/oauth-login",
|
|
1024
|
+
method: "POST",
|
|
1025
|
+
transformParams: (params) => params
|
|
1026
|
+
},
|
|
1027
|
+
validateToken: {
|
|
1028
|
+
url: "/auth/validate",
|
|
1029
|
+
method: "GET",
|
|
1030
|
+
transformParams: (token) => ({}),
|
|
1031
|
+
options: {
|
|
1032
|
+
headers: (token) => ({
|
|
1033
|
+
Authorization: `Bearer ${token}`
|
|
1034
|
+
})
|
|
1035
|
+
}
|
|
1036
|
+
},
|
|
1037
|
+
logout: {
|
|
1038
|
+
url: "/auth/logout",
|
|
1039
|
+
method: "POST",
|
|
1040
|
+
transformParams: () => ({})
|
|
1041
|
+
},
|
|
1042
|
+
getCountries: {
|
|
1043
|
+
url: "/area/country",
|
|
1044
|
+
method: "GET",
|
|
1045
|
+
transformParams: () => ({})
|
|
1046
|
+
},
|
|
1047
|
+
facebookLogin: {
|
|
1048
|
+
url: "/auth/facebook/login",
|
|
1049
|
+
method: "POST",
|
|
1050
|
+
transformParams: (params) => ({
|
|
1051
|
+
token: params.token
|
|
1052
|
+
})
|
|
1053
|
+
},
|
|
1054
|
+
appleLogin: {
|
|
1055
|
+
url: "/auth/apple/login",
|
|
1056
|
+
method: "POST",
|
|
1057
|
+
transformParams: (params) => ({
|
|
1058
|
+
code: params.code
|
|
1059
|
+
})
|
|
1060
|
+
}
|
|
1061
|
+
};
|
|
799
1062
|
var channelConfigMap = {
|
|
800
1063
|
"online-store": onlineStoreConfig,
|
|
801
1064
|
"default": defaultConfig,
|
|
802
|
-
"webpos": webposConfig
|
|
1065
|
+
"webpos": webposConfig,
|
|
1066
|
+
"shop.webpos": shopWebposConfig
|
|
803
1067
|
};
|
|
804
1068
|
function getChannelConfig(channel) {
|
|
805
1069
|
return channelConfigMap[channel] || channelConfigMap["default"];
|
|
@@ -21,7 +21,6 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
21
21
|
getCurrentBookingTime(): string | null;
|
|
22
22
|
private filterDiscountListByBookingTime;
|
|
23
23
|
setCustomer(customer: Customer): Promise<void>;
|
|
24
|
-
setOriginTotalAmount(amount: number): void;
|
|
25
24
|
setHolders(holders: {
|
|
26
25
|
form_record_id: number;
|
|
27
26
|
}[]): void;
|
|
@@ -55,8 +55,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
55
55
|
originalDiscountList: [],
|
|
56
56
|
currentBookingTime: "",
|
|
57
57
|
filteredDiscountList: [],
|
|
58
|
-
bookingSubject: void 0
|
|
59
|
-
orderTotalAmount: 0
|
|
58
|
+
bookingSubject: void 0
|
|
60
59
|
};
|
|
61
60
|
}
|
|
62
61
|
// =========== 生命周期方法 ===========
|
|
@@ -194,9 +193,6 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
194
193
|
);
|
|
195
194
|
}
|
|
196
195
|
}
|
|
197
|
-
setOriginTotalAmount(amount) {
|
|
198
|
-
this.store.orderTotalAmount = amount;
|
|
199
|
-
}
|
|
200
196
|
// 设置holders
|
|
201
197
|
setHolders(holders) {
|
|
202
198
|
this.store.holders = holders;
|
|
@@ -216,7 +212,6 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
216
212
|
{
|
|
217
213
|
productList,
|
|
218
214
|
discountList: this.getDiscountList(),
|
|
219
|
-
orderTotalAmount: this.store.orderTotalAmount || 0,
|
|
220
215
|
holders: this.store.holders || [],
|
|
221
216
|
isFormSubject: ((_a = this.store.bookingSubject) == null ? void 0 : _a.type) === "form"
|
|
222
217
|
},
|
|
@@ -309,8 +304,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
309
304
|
oldDiscountList: this.getDiscountList(),
|
|
310
305
|
newDiscountList: withScanList,
|
|
311
306
|
holders: this.store.holders || [],
|
|
312
|
-
isFormSubject: ((_b = this.store.bookingSubject) == null ? void 0 : _b.type) === "form"
|
|
313
|
-
orderTotalAmount: this.store.orderTotalAmount || 0
|
|
307
|
+
isFormSubject: ((_b = this.store.bookingSubject) == null ? void 0 : _b.type) === "form"
|
|
314
308
|
}) || {
|
|
315
309
|
isAvailable: false,
|
|
316
310
|
productList: this.store.productList || [],
|
package/package.json
CHANGED
package/dist/model/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './strategy';
|
package/dist/model/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./strategy";
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { EvaluationResult, RuntimeContext } from '../type';
|
|
2
|
-
export interface BusinessAdapter {
|
|
3
|
-
/**
|
|
4
|
-
* 适配器名称
|
|
5
|
-
*/
|
|
6
|
-
name: string;
|
|
7
|
-
/**
|
|
8
|
-
* 适配器版本
|
|
9
|
-
*/
|
|
10
|
-
version: string;
|
|
11
|
-
/**
|
|
12
|
-
* 准备运行时上下文
|
|
13
|
-
* 将业务数据转换为策略引擎可识别的上下文
|
|
14
|
-
*/
|
|
15
|
-
prepareContext(businessData: any): RuntimeContext;
|
|
16
|
-
/**
|
|
17
|
-
* 转换执行结果
|
|
18
|
-
* 将策略引擎的通用结果转换为业务层需要的格式
|
|
19
|
-
*/
|
|
20
|
-
transformResult(result: EvaluationResult, businessData?: any): any;
|
|
21
|
-
/**
|
|
22
|
-
* 根据业务数据重新格式化配置
|
|
23
|
-
*/
|
|
24
|
-
formatConfig(result: EvaluationResult, businessData?: any): {
|
|
25
|
-
result: EvaluationResult;
|
|
26
|
-
businessData?: any;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { StrategyConfig } from '../../type';
|
|
2
|
-
import { Voucher, Product, VoucherEvaluationResult, EvaluatorInput } from './type';
|
|
3
|
-
/**
|
|
4
|
-
* Wallet Pass 评估器
|
|
5
|
-
* 用于评估哪些 voucher 可以在当前订单中使用
|
|
6
|
-
*/
|
|
7
|
-
export declare class WalletPassEvaluator {
|
|
8
|
-
private engine;
|
|
9
|
-
private strategyConfigs;
|
|
10
|
-
private locale;
|
|
11
|
-
constructor();
|
|
12
|
-
setStrategyConfigs(strategyConfigs: StrategyConfig[]): void;
|
|
13
|
-
getStrategyConfigs(): StrategyConfig[];
|
|
14
|
-
setLocale(locale: string): void;
|
|
15
|
-
getText(key: string): string;
|
|
16
|
-
/**
|
|
17
|
-
* 搜索券的格式
|
|
18
|
-
* @param input 输入
|
|
19
|
-
* @returns 返回搜索券的格式
|
|
20
|
-
*/
|
|
21
|
-
searchVoucherFormat(input: EvaluatorInput): Voucher[];
|
|
22
|
-
/**
|
|
23
|
-
* 评估可用的 vouchers
|
|
24
|
-
*/
|
|
25
|
-
evaluate(input: EvaluatorInput): VoucherEvaluationResult[];
|
|
26
|
-
/** 检查代金券/折扣卡是否可用 并返回config */
|
|
27
|
-
checkVoucherAvailability(input: EvaluatorInput): {
|
|
28
|
-
isAvailable: boolean;
|
|
29
|
-
config: {
|
|
30
|
-
[x: string]: any;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* 获取推荐券
|
|
35
|
-
* @param input 输入
|
|
36
|
-
* @returns 返回推荐券列表
|
|
37
|
-
*/
|
|
38
|
-
getRecommendedVouchers(input: EvaluatorInput): {
|
|
39
|
-
recommendedAmount: any;
|
|
40
|
-
recommended: any[];
|
|
41
|
-
transformList: any[];
|
|
42
|
-
noApplicableVoucher: Voucher[];
|
|
43
|
-
};
|
|
44
|
-
enhanceWithReason(voucher: any): any;
|
|
45
|
-
/**
|
|
46
|
-
* 优惠券处理函数
|
|
47
|
-
* @param applicableVouchers 可用的券列表
|
|
48
|
-
* @param orderTotalAmount 订单总金额
|
|
49
|
-
* @param products 订单商品列表
|
|
50
|
-
* @returns 返回推荐券列表和全部列表,每个券包含 _available_max_amount 和 _unified_available_status
|
|
51
|
-
*/
|
|
52
|
-
processVouchers(vouchers: Voucher[], orderTotalAmount: number, products: Product[]): {
|
|
53
|
-
recommended: any[];
|
|
54
|
-
transformList: any[];
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* 重新计算优惠券状态(基于已选券的增量计算)
|
|
58
|
-
* @param allVouchers 所有原始券列表
|
|
59
|
-
* @param selectedVouchers 已选中的券列表(按选中顺序)
|
|
60
|
-
* @param orderTotalAmount 订单总金额
|
|
61
|
-
* @param products 订单商品列表
|
|
62
|
-
* @returns 返回更新后的所有券列表和已选券的详细抵扣信息
|
|
63
|
-
*/
|
|
64
|
-
recalculateVouchers(allVouchers: any[], selectedVouchers: any[], orderTotalAmount: number, products: any[]): {
|
|
65
|
-
allWithUpdatedStatus: any[];
|
|
66
|
-
selectedWithDetails: any[];
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* 查找适用于指定 voucher 的策略配置
|
|
70
|
-
*/
|
|
71
|
-
private findApplicableStrategies;
|
|
72
|
-
/**
|
|
73
|
-
* 检查策略中是否包含指定的 voucher ID
|
|
74
|
-
*/
|
|
75
|
-
private checkVoucherInStrategy;
|
|
76
|
-
/**
|
|
77
|
-
* 递归检查条件组中是否包含 voucher ID
|
|
78
|
-
*/
|
|
79
|
-
private checkVoucherInConditionGroup;
|
|
80
|
-
/**
|
|
81
|
-
* 计算适用商品的总金额和数量
|
|
82
|
-
*/
|
|
83
|
-
private calculateApplicableProducts;
|
|
84
|
-
}
|