@pisell/pisellos 0.0.10 → 0.0.13
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/Account/index.d.ts +4 -2
- package/dist/modules/Account/index.js +23 -36
- package/dist/modules/Account/types.d.ts +1 -0
- package/dist/modules/AccountList/index.d.ts +2 -0
- package/dist/modules/AccountList/index.js +34 -11
- package/dist/modules/Cart/index.d.ts +17 -11
- package/dist/modules/Cart/index.js +179 -121
- package/dist/modules/Cart/types.d.ts +98 -9
- package/dist/modules/Cart/types.js +8 -0
- package/dist/modules/Cart/utils.d.ts +114 -0
- package/dist/modules/Cart/utils.js +345 -0
- package/dist/modules/Date/index.d.ts +11 -12
- package/dist/modules/Date/index.js +104 -60
- package/dist/modules/Date/types.d.ts +51 -20
- package/dist/modules/Date/types.js +2 -5
- package/dist/modules/Date/utils.d.ts +35 -0
- package/dist/modules/Date/utils.js +211 -0
- package/dist/modules/Discount/index.d.ts +26 -0
- package/dist/modules/Discount/index.js +234 -0
- package/dist/modules/Discount/types.d.ts +66 -0
- package/dist/modules/Discount/types.js +5 -0
- package/dist/modules/Order/index.d.ts +16 -12
- package/dist/modules/Order/index.js +38 -166
- package/dist/modules/Order/types.d.ts +18 -41
- package/dist/modules/Order/types.js +0 -14
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +45 -76
- package/dist/modules/Payment/types.d.ts +0 -2
- package/dist/modules/Payment/types.js +2 -0
- package/dist/modules/Product/types.d.ts +48 -1
- package/dist/modules/ProductList/index.d.ts +1 -0
- package/dist/modules/ProductList/index.js +21 -1
- package/dist/modules/ProductList/types.d.ts +1 -0
- package/dist/modules/Resource/types.d.ts +6 -2
- package/dist/modules/Rules/index.d.ts +32 -0
- package/dist/modules/Rules/index.js +423 -0
- package/dist/modules/Rules/types.d.ts +46 -0
- package/dist/modules/Rules/types.js +5 -0
- package/dist/modules/Summary/index.d.ts +13 -0
- package/dist/modules/Summary/index.js +80 -0
- package/dist/modules/Summary/types.d.ts +13 -0
- package/dist/modules/Summary/types.js +1 -0
- package/dist/modules/Summary/utils.d.ts +19 -0
- package/dist/modules/Summary/utils.js +56 -0
- package/dist/plugins/index.d.ts +3 -2
- package/dist/plugins/index.js +2 -1
- package/dist/plugins/request.d.ts +4 -3
- package/dist/plugins/request.js +30 -30
- package/dist/plugins/shopStore.d.ts +4 -0
- package/dist/plugins/shopStore.js +1 -0
- package/dist/solution/BookingByStep/index.d.ts +73 -12
- package/dist/solution/BookingByStep/index.js +635 -99
- package/dist/solution/BookingByStep/types.d.ts +2 -0
- package/dist/solution/BookingByStep/types.js +11 -8
- package/dist/solution/BookingByStep/utils/products.d.ts +11 -0
- package/dist/solution/BookingByStep/utils/products.js +47 -0
- package/dist/solution/BookingByStep/utils/resources.d.ts +59 -10
- package/dist/solution/BookingByStep/utils/resources.js +144 -79
- package/dist/solution/ShopDiscount/index.d.ts +50 -0
- package/dist/solution/ShopDiscount/index.js +546 -0
- package/dist/solution/ShopDiscount/types.d.ts +24 -0
- package/dist/solution/ShopDiscount/types.js +10 -0
- package/dist/solution/ShopDiscount/utils.d.ts +1 -0
- package/dist/solution/ShopDiscount/utils.js +7 -0
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/lib/modules/Account/index.d.ts +4 -2
- package/lib/modules/Account/index.js +14 -3
- package/lib/modules/Account/types.d.ts +1 -0
- package/lib/modules/AccountList/index.d.ts +2 -0
- package/lib/modules/AccountList/index.js +17 -0
- package/lib/modules/Cart/index.d.ts +17 -11
- package/lib/modules/Cart/index.js +72 -21
- package/lib/modules/Cart/types.d.ts +98 -9
- package/lib/modules/Cart/utils.d.ts +114 -0
- package/lib/modules/Cart/utils.js +320 -0
- package/lib/modules/Date/index.d.ts +11 -12
- package/lib/modules/Date/index.js +50 -31
- package/lib/modules/Date/types.d.ts +51 -20
- package/lib/modules/Date/types.js +0 -4
- package/lib/modules/Date/utils.d.ts +35 -0
- package/lib/modules/Date/utils.js +167 -0
- package/lib/modules/Discount/index.d.ts +26 -0
- package/lib/modules/Discount/index.js +118 -0
- package/lib/modules/Discount/types.d.ts +66 -0
- package/lib/modules/Discount/types.js +33 -0
- package/lib/modules/Order/index.d.ts +16 -12
- package/lib/modules/Order/index.js +23 -51
- package/lib/modules/Order/types.d.ts +18 -41
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +6 -17
- package/lib/modules/Payment/types.d.ts +0 -2
- package/lib/modules/Product/types.d.ts +48 -1
- package/lib/modules/ProductList/index.d.ts +1 -0
- package/lib/modules/ProductList/index.js +4 -0
- package/lib/modules/ProductList/types.d.ts +1 -0
- package/lib/modules/Resource/types.d.ts +6 -2
- package/lib/modules/Rules/index.d.ts +32 -0
- package/lib/modules/Rules/index.js +283 -0
- package/lib/modules/Rules/types.d.ts +46 -0
- package/lib/modules/Rules/types.js +33 -0
- package/lib/modules/Summary/index.d.ts +13 -0
- package/lib/modules/Summary/index.js +49 -0
- package/lib/modules/Summary/types.d.ts +13 -0
- package/lib/modules/Summary/types.js +17 -0
- package/lib/modules/Summary/utils.d.ts +19 -0
- package/lib/modules/Summary/utils.js +79 -0
- package/lib/plugins/index.d.ts +3 -2
- package/lib/plugins/index.js +3 -1
- package/lib/plugins/request.d.ts +4 -3
- package/lib/plugins/request.js +4 -20
- package/lib/plugins/shopStore.d.ts +4 -0
- package/lib/plugins/shopStore.js +17 -0
- package/lib/solution/BookingByStep/index.d.ts +73 -12
- package/lib/solution/BookingByStep/index.js +451 -24
- package/lib/solution/BookingByStep/types.d.ts +2 -0
- package/lib/solution/BookingByStep/types.js +3 -0
- package/lib/solution/BookingByStep/utils/products.d.ts +11 -0
- package/lib/solution/BookingByStep/utils/products.js +60 -0
- package/lib/solution/BookingByStep/utils/resources.d.ts +59 -10
- package/lib/solution/BookingByStep/utils/resources.js +106 -49
- package/lib/solution/ShopDiscount/index.d.ts +50 -0
- package/lib/solution/ShopDiscount/index.js +321 -0
- package/lib/solution/ShopDiscount/types.d.ts +24 -0
- package/lib/solution/ShopDiscount/types.js +38 -0
- package/lib/solution/ShopDiscount/utils.d.ts +1 -0
- package/lib/solution/ShopDiscount/utils.js +32 -0
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/package.json +4 -4
|
@@ -1,57 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Resource } from '../Resource/types';
|
|
3
|
-
import { TimeSlot } from '../Date/types';
|
|
1
|
+
import { CartItem } from "../Cart/types";
|
|
4
2
|
export declare enum OrderHooks {
|
|
5
3
|
OnOrderCreate = "order:onOrderCreate",
|
|
6
4
|
OnOrderUpdate = "order:onOrderUpdate",
|
|
7
5
|
OnOrderCancel = "order:onOrderCancel",
|
|
8
6
|
OnOrderStatusChange = "order:onOrderStatusChange"
|
|
9
7
|
}
|
|
10
|
-
|
|
11
|
-
* 订单状态
|
|
12
|
-
*/
|
|
13
|
-
export type OrderStatus = 'pending' | 'paid' | 'confirmed' | 'completed' | 'cancelled' | 'refunded';
|
|
14
|
-
/**
|
|
15
|
-
* 订单项
|
|
16
|
-
*/
|
|
17
|
-
export interface OrderItem {
|
|
18
|
-
id: string;
|
|
19
|
-
productId: string;
|
|
20
|
-
quantity: number;
|
|
21
|
-
price: number;
|
|
22
|
-
guest: Guest;
|
|
23
|
-
resource: Resource;
|
|
24
|
-
timeSlot: TimeSlot;
|
|
8
|
+
export interface OrderState {
|
|
25
9
|
}
|
|
26
10
|
/**
|
|
27
11
|
* 订单信息
|
|
28
12
|
*/
|
|
29
|
-
export interface
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
totalAmount: number;
|
|
35
|
-
createdAt: Date;
|
|
36
|
-
updatedAt: Date;
|
|
37
|
-
metadata?: Record<string, any>;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* 订单模块状态
|
|
41
|
-
*/
|
|
42
|
-
export interface OrderState {
|
|
43
|
-
currentOrder: Order | null;
|
|
44
|
-
orderHistory: Order[];
|
|
13
|
+
export interface CommitOrderParams {
|
|
14
|
+
url?: string;
|
|
15
|
+
query: {
|
|
16
|
+
cartItems: CartItem[];
|
|
17
|
+
};
|
|
45
18
|
}
|
|
46
19
|
/**
|
|
47
20
|
* 订单模块 API
|
|
48
21
|
*/
|
|
49
22
|
export interface OrderModuleAPI {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
23
|
+
/**
|
|
24
|
+
* 创建订单
|
|
25
|
+
* @param params 订单信息
|
|
26
|
+
* @returns 订单信息
|
|
27
|
+
*/
|
|
28
|
+
createOrder: (params: CommitOrderParams["query"]) => any;
|
|
29
|
+
/**
|
|
30
|
+
* 提交订单
|
|
31
|
+
* @param params 订单信息
|
|
32
|
+
*/
|
|
33
|
+
commitOrder: (params: CommitOrderParams) => Promise<void>;
|
|
57
34
|
}
|
|
@@ -6,24 +6,10 @@ export var OrderHooks = /*#__PURE__*/function (OrderHooks) {
|
|
|
6
6
|
return OrderHooks;
|
|
7
7
|
}({});
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* 订单状态
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
// 已退款
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 订单项
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
9
|
/**
|
|
20
10
|
* 订单信息
|
|
21
11
|
*/
|
|
22
12
|
|
|
23
|
-
/**
|
|
24
|
-
* 订单模块状态
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
13
|
/**
|
|
28
14
|
* 订单模块 API
|
|
29
15
|
*/
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
3
|
import { Payment, PaymentModuleAPI, PaymentMethod, PaymentStatus } from './types';
|
|
4
|
-
import { Order } from '../Order/types';
|
|
5
4
|
export declare class PaymentModule extends BaseModule implements Module, PaymentModuleAPI {
|
|
6
5
|
protected defaultName: string;
|
|
7
6
|
protected defaultVersion: string;
|
|
8
7
|
private state;
|
|
9
8
|
constructor(name?: string, version?: string);
|
|
10
9
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
11
|
-
initPayment(order: Order, method: PaymentMethod): Promise<Payment>;
|
|
12
10
|
processPayment(paymentId: string): Promise<void>;
|
|
13
11
|
getPayment(paymentId: string): Promise<Payment>;
|
|
14
12
|
getPaymentHistory(): Promise<Payment[]>;
|
|
@@ -55,71 +55,40 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
55
55
|
return _initialize.apply(this, arguments);
|
|
56
56
|
}
|
|
57
57
|
return initialize;
|
|
58
|
-
}()
|
|
58
|
+
}() // async initPayment(order: OrderModule, method: PaymentMethod) {
|
|
59
|
+
// const payment: Payment = {}
|
|
60
|
+
// this.state.currentPayment = payment
|
|
61
|
+
// await this.core.effects.emit(PaymentHooks.OnPaymentInit, payment)
|
|
62
|
+
// return payment
|
|
63
|
+
// }
|
|
59
64
|
}, {
|
|
60
|
-
key: "
|
|
65
|
+
key: "processPayment",
|
|
61
66
|
value: function () {
|
|
62
|
-
var
|
|
67
|
+
var _processPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(paymentId) {
|
|
63
68
|
var payment;
|
|
64
69
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
65
70
|
while (1) switch (_context2.prev = _context2.next) {
|
|
66
|
-
case 0:
|
|
67
|
-
payment = {
|
|
68
|
-
id: Date.now().toString(),
|
|
69
|
-
// 实际应该使用更可靠的 ID 生成方式
|
|
70
|
-
orderId: order.id,
|
|
71
|
-
amount: order.totalAmount,
|
|
72
|
-
currency: 'CNY',
|
|
73
|
-
// 默认货币
|
|
74
|
-
method: method,
|
|
75
|
-
status: 'pending',
|
|
76
|
-
createdAt: new Date(),
|
|
77
|
-
updatedAt: new Date()
|
|
78
|
-
};
|
|
79
|
-
this.state.currentPayment = payment;
|
|
80
|
-
_context2.next = 4;
|
|
81
|
-
return this.core.effects.emit(PaymentHooks.OnPaymentInit, payment);
|
|
82
|
-
case 4:
|
|
83
|
-
return _context2.abrupt("return", payment);
|
|
84
|
-
case 5:
|
|
85
|
-
case "end":
|
|
86
|
-
return _context2.stop();
|
|
87
|
-
}
|
|
88
|
-
}, _callee2, this);
|
|
89
|
-
}));
|
|
90
|
-
function initPayment(_x3, _x4) {
|
|
91
|
-
return _initPayment.apply(this, arguments);
|
|
92
|
-
}
|
|
93
|
-
return initPayment;
|
|
94
|
-
}()
|
|
95
|
-
}, {
|
|
96
|
-
key: "processPayment",
|
|
97
|
-
value: function () {
|
|
98
|
-
var _processPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(paymentId) {
|
|
99
|
-
var payment;
|
|
100
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
101
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
102
71
|
case 0:
|
|
103
72
|
payment = this.state.paymentHistory.find(function (p) {
|
|
104
73
|
return p.id === paymentId;
|
|
105
74
|
});
|
|
106
75
|
if (payment) {
|
|
107
|
-
|
|
76
|
+
_context2.next = 3;
|
|
108
77
|
break;
|
|
109
78
|
}
|
|
110
|
-
return
|
|
79
|
+
return _context2.abrupt("return");
|
|
111
80
|
case 3:
|
|
112
81
|
payment.status = 'processing';
|
|
113
82
|
payment.updatedAt = new Date();
|
|
114
|
-
|
|
83
|
+
_context2.next = 7;
|
|
115
84
|
return this.core.effects.emit(PaymentHooks.OnPaymentSuccess, payment);
|
|
116
85
|
case 7:
|
|
117
86
|
case "end":
|
|
118
|
-
return
|
|
87
|
+
return _context2.stop();
|
|
119
88
|
}
|
|
120
|
-
},
|
|
89
|
+
}, _callee2, this);
|
|
121
90
|
}));
|
|
122
|
-
function processPayment(
|
|
91
|
+
function processPayment(_x3) {
|
|
123
92
|
return _processPayment.apply(this, arguments);
|
|
124
93
|
}
|
|
125
94
|
return processPayment;
|
|
@@ -127,28 +96,28 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
127
96
|
}, {
|
|
128
97
|
key: "getPayment",
|
|
129
98
|
value: function () {
|
|
130
|
-
var _getPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
99
|
+
var _getPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(paymentId) {
|
|
131
100
|
var payment;
|
|
132
|
-
return _regeneratorRuntime().wrap(function
|
|
133
|
-
while (1) switch (
|
|
101
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
102
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
134
103
|
case 0:
|
|
135
104
|
payment = this.state.paymentHistory.find(function (p) {
|
|
136
105
|
return p.id === paymentId;
|
|
137
106
|
});
|
|
138
107
|
if (payment) {
|
|
139
|
-
|
|
108
|
+
_context3.next = 3;
|
|
140
109
|
break;
|
|
141
110
|
}
|
|
142
111
|
throw new Error('Payment not found');
|
|
143
112
|
case 3:
|
|
144
|
-
return
|
|
113
|
+
return _context3.abrupt("return", payment);
|
|
145
114
|
case 4:
|
|
146
115
|
case "end":
|
|
147
|
-
return
|
|
116
|
+
return _context3.stop();
|
|
148
117
|
}
|
|
149
|
-
},
|
|
118
|
+
}, _callee3, this);
|
|
150
119
|
}));
|
|
151
|
-
function getPayment(
|
|
120
|
+
function getPayment(_x4) {
|
|
152
121
|
return _getPayment.apply(this, arguments);
|
|
153
122
|
}
|
|
154
123
|
return getPayment;
|
|
@@ -156,16 +125,16 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
156
125
|
}, {
|
|
157
126
|
key: "getPaymentHistory",
|
|
158
127
|
value: function () {
|
|
159
|
-
var _getPaymentHistory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
160
|
-
return _regeneratorRuntime().wrap(function
|
|
161
|
-
while (1) switch (
|
|
128
|
+
var _getPaymentHistory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
129
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
130
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
162
131
|
case 0:
|
|
163
|
-
return
|
|
132
|
+
return _context4.abrupt("return", this.state.paymentHistory);
|
|
164
133
|
case 1:
|
|
165
134
|
case "end":
|
|
166
|
-
return
|
|
135
|
+
return _context4.stop();
|
|
167
136
|
}
|
|
168
|
-
},
|
|
137
|
+
}, _callee4, this);
|
|
169
138
|
}));
|
|
170
139
|
function getPaymentHistory() {
|
|
171
140
|
return _getPaymentHistory.apply(this, arguments);
|
|
@@ -175,31 +144,31 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
175
144
|
}, {
|
|
176
145
|
key: "refund",
|
|
177
146
|
value: function () {
|
|
178
|
-
var _refund = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
147
|
+
var _refund = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(paymentId) {
|
|
179
148
|
var payment;
|
|
180
|
-
return _regeneratorRuntime().wrap(function
|
|
181
|
-
while (1) switch (
|
|
149
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
150
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
182
151
|
case 0:
|
|
183
152
|
payment = this.state.paymentHistory.find(function (p) {
|
|
184
153
|
return p.id === paymentId;
|
|
185
154
|
});
|
|
186
155
|
if (payment) {
|
|
187
|
-
|
|
156
|
+
_context5.next = 3;
|
|
188
157
|
break;
|
|
189
158
|
}
|
|
190
|
-
return
|
|
159
|
+
return _context5.abrupt("return");
|
|
191
160
|
case 3:
|
|
192
161
|
payment.status = 'refunded';
|
|
193
162
|
payment.updatedAt = new Date();
|
|
194
|
-
|
|
163
|
+
_context5.next = 7;
|
|
195
164
|
return this.core.effects.emit(PaymentHooks.OnPaymentRefund, payment);
|
|
196
165
|
case 7:
|
|
197
166
|
case "end":
|
|
198
|
-
return
|
|
167
|
+
return _context5.stop();
|
|
199
168
|
}
|
|
200
|
-
},
|
|
169
|
+
}, _callee5, this);
|
|
201
170
|
}));
|
|
202
|
-
function refund(
|
|
171
|
+
function refund(_x5) {
|
|
203
172
|
return _refund.apply(this, arguments);
|
|
204
173
|
}
|
|
205
174
|
return refund;
|
|
@@ -212,28 +181,28 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
212
181
|
}, {
|
|
213
182
|
key: "checkPaymentStatus",
|
|
214
183
|
value: function () {
|
|
215
|
-
var _checkPaymentStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
184
|
+
var _checkPaymentStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(paymentId) {
|
|
216
185
|
var payment;
|
|
217
|
-
return _regeneratorRuntime().wrap(function
|
|
218
|
-
while (1) switch (
|
|
186
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
187
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
219
188
|
case 0:
|
|
220
189
|
payment = this.state.paymentHistory.find(function (p) {
|
|
221
190
|
return p.id === paymentId;
|
|
222
191
|
});
|
|
223
192
|
if (payment) {
|
|
224
|
-
|
|
193
|
+
_context6.next = 3;
|
|
225
194
|
break;
|
|
226
195
|
}
|
|
227
196
|
throw new Error('Payment not found');
|
|
228
197
|
case 3:
|
|
229
|
-
return
|
|
198
|
+
return _context6.abrupt("return", payment.status);
|
|
230
199
|
case 4:
|
|
231
200
|
case "end":
|
|
232
|
-
return
|
|
201
|
+
return _context6.stop();
|
|
233
202
|
}
|
|
234
|
-
},
|
|
203
|
+
}, _callee6, this);
|
|
235
204
|
}));
|
|
236
|
-
function checkPaymentStatus(
|
|
205
|
+
function checkPaymentStatus(_x6) {
|
|
237
206
|
return _checkPaymentStatus.apply(this, arguments);
|
|
238
207
|
}
|
|
239
208
|
return checkPaymentStatus;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Order } from '../Order/types';
|
|
2
1
|
export declare enum PaymentHooks {
|
|
3
2
|
OnPaymentInit = "payment:onPaymentInit",
|
|
4
3
|
OnPaymentSuccess = "payment:onPaymentSuccess",
|
|
@@ -39,7 +38,6 @@ export interface PaymentState {
|
|
|
39
38
|
* 支付模块 API
|
|
40
39
|
*/
|
|
41
40
|
export interface PaymentModuleAPI {
|
|
42
|
-
initPayment: (order: Order, method: PaymentMethod) => Promise<Payment>;
|
|
43
41
|
processPayment: (paymentId: string) => Promise<void>;
|
|
44
42
|
getPayment: (paymentId: string) => Promise<Payment>;
|
|
45
43
|
getPaymentHistory: () => Promise<Payment[]>;
|
|
@@ -17,7 +17,7 @@ export interface ProductData {
|
|
|
17
17
|
/** 商品slug */
|
|
18
18
|
slug: string;
|
|
19
19
|
/** draft:草稿;published:已发布;pending:待发布;archived:已归档 */
|
|
20
|
-
status:
|
|
20
|
+
status: "draft" | "published" | "pending" | "archived";
|
|
21
21
|
/** 库存数量 */
|
|
22
22
|
stock_quantity: number;
|
|
23
23
|
/** 销售数量 */
|
|
@@ -132,10 +132,26 @@ export interface ProductData {
|
|
|
132
132
|
base_price: string;
|
|
133
133
|
/** 规格列表 */
|
|
134
134
|
variant: any[];
|
|
135
|
+
/** 媒体 */
|
|
135
136
|
media: ProductMedia[];
|
|
137
|
+
/** 标签 */
|
|
136
138
|
tags: ProductTag[];
|
|
139
|
+
/** 分类 */
|
|
137
140
|
categories: ProductCategory[];
|
|
141
|
+
/** 套餐组 */
|
|
138
142
|
bundle_groups: ProductBundleGroup[];
|
|
143
|
+
/** 商品资源 */
|
|
144
|
+
product_resource?: {
|
|
145
|
+
resources?: ProductResourceItem[];
|
|
146
|
+
};
|
|
147
|
+
/** 组合商品id,动态附加 */
|
|
148
|
+
product_variant_id?: number;
|
|
149
|
+
/** 套餐信息 */
|
|
150
|
+
bundle?: any[];
|
|
151
|
+
/** 商品选项组成 */
|
|
152
|
+
options?: any[];
|
|
153
|
+
/** 商品原信息 */
|
|
154
|
+
origin?: any;
|
|
139
155
|
}
|
|
140
156
|
/**
|
|
141
157
|
* 商品媒体信息接口
|
|
@@ -387,3 +403,34 @@ export interface ProductBundleItem {
|
|
|
387
403
|
/** 明细库存 */
|
|
388
404
|
stock_quantity: string;
|
|
389
405
|
}
|
|
406
|
+
/**
|
|
407
|
+
* 商品资源
|
|
408
|
+
*/
|
|
409
|
+
export interface ProductResourceItem {
|
|
410
|
+
/** 资源是否启用:0: 禁用, 1: 启用 */
|
|
411
|
+
status: 0 | 1;
|
|
412
|
+
/** 资源id */
|
|
413
|
+
id: number;
|
|
414
|
+
/** 资源标题 */
|
|
415
|
+
title: string;
|
|
416
|
+
/** 资源编码 */
|
|
417
|
+
code: "resource";
|
|
418
|
+
/** 默认资源 */
|
|
419
|
+
default_resource?: number[];
|
|
420
|
+
/** 可选资源 */
|
|
421
|
+
optional_resource?: number[];
|
|
422
|
+
/** 资源类型id */
|
|
423
|
+
resource_type_id: number;
|
|
424
|
+
/** 选择类型 */
|
|
425
|
+
select_type?: {
|
|
426
|
+
type: "single";
|
|
427
|
+
min: 1;
|
|
428
|
+
max: 1;
|
|
429
|
+
};
|
|
430
|
+
/** 创建时间 */
|
|
431
|
+
created_at: string;
|
|
432
|
+
/** 更新时间 */
|
|
433
|
+
updated_at: string;
|
|
434
|
+
/** 可用资源列表 */
|
|
435
|
+
renderList?: any[];
|
|
436
|
+
}
|
|
@@ -13,4 +13,5 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
13
13
|
getProducts(): Promise<ProductData[]>;
|
|
14
14
|
getProduct(id: number): Promise<Product | undefined>;
|
|
15
15
|
addProduct(products: ProductData[]): Promise<void>;
|
|
16
|
+
selectProducts(products: ProductData[]): Promise<void>;
|
|
16
17
|
}
|
|
@@ -49,8 +49,9 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
49
49
|
this.store = options.store;
|
|
50
50
|
this.store.productMap = new Map();
|
|
51
51
|
this.store.list = [];
|
|
52
|
+
this.store.selectProducts = [];
|
|
52
53
|
this.storeChange();
|
|
53
|
-
case
|
|
54
|
+
case 6:
|
|
54
55
|
case "end":
|
|
55
56
|
return _context.stop();
|
|
56
57
|
}
|
|
@@ -162,6 +163,25 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
162
163
|
}
|
|
163
164
|
return addProduct;
|
|
164
165
|
}()
|
|
166
|
+
}, {
|
|
167
|
+
key: "selectProducts",
|
|
168
|
+
value: function () {
|
|
169
|
+
var _selectProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(products) {
|
|
170
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
171
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
172
|
+
case 0:
|
|
173
|
+
this.store.selectProducts = products;
|
|
174
|
+
case 1:
|
|
175
|
+
case "end":
|
|
176
|
+
return _context6.stop();
|
|
177
|
+
}
|
|
178
|
+
}, _callee6, this);
|
|
179
|
+
}));
|
|
180
|
+
function selectProducts(_x7) {
|
|
181
|
+
return _selectProducts.apply(this, arguments);
|
|
182
|
+
}
|
|
183
|
+
return selectProducts;
|
|
184
|
+
}()
|
|
165
185
|
}]);
|
|
166
186
|
return ProductList;
|
|
167
187
|
}(BaseModule);
|
|
@@ -16,12 +16,16 @@ export interface ResourceTimeSlot {
|
|
|
16
16
|
* 资源信息
|
|
17
17
|
*/
|
|
18
18
|
export interface Resource {
|
|
19
|
-
id: string;
|
|
20
|
-
|
|
19
|
+
id: string | number;
|
|
20
|
+
main_field: string;
|
|
21
|
+
form_id: string | number;
|
|
21
22
|
type: string;
|
|
22
23
|
capacity: number;
|
|
23
24
|
timeSlots: ResourceTimeSlot[];
|
|
24
25
|
metadata?: Record<string, any>;
|
|
26
|
+
startTime?: string;
|
|
27
|
+
endTime?: string;
|
|
28
|
+
resourceType?: string;
|
|
25
29
|
}
|
|
26
30
|
/**
|
|
27
31
|
* 资源列表状态
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Module, PisellCore, ModuleOptions } from "../../types";
|
|
2
|
+
import { BaseModule } from "../BaseModule";
|
|
3
|
+
import { Rules, RulesModuleAPI, DiscountResult } from "./types";
|
|
4
|
+
import { Discount } from "../Discount/types";
|
|
5
|
+
export declare class RulesModule extends BaseModule implements Module, RulesModuleAPI {
|
|
6
|
+
protected defaultName: string;
|
|
7
|
+
protected defaultVersion: string;
|
|
8
|
+
private store;
|
|
9
|
+
private hooks;
|
|
10
|
+
constructor(name?: string, version?: string);
|
|
11
|
+
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
12
|
+
setRulesList(rulesList: Rules[]): Promise<void>;
|
|
13
|
+
getRulesList(): Rules[];
|
|
14
|
+
isDiscountListAvailable({ oldDiscountList, newDiscountList, productList, }: {
|
|
15
|
+
oldDiscountList: Discount[];
|
|
16
|
+
newDiscountList: Discount[];
|
|
17
|
+
productList: any[];
|
|
18
|
+
}): {
|
|
19
|
+
isAvailable: boolean;
|
|
20
|
+
discountList: Discount[];
|
|
21
|
+
productList: any[];
|
|
22
|
+
};
|
|
23
|
+
calcDiscount({ discountList, productList, }: {
|
|
24
|
+
discountList: Discount[];
|
|
25
|
+
productList: any[];
|
|
26
|
+
}, options?: {
|
|
27
|
+
isSelected?: boolean;
|
|
28
|
+
discountId: number;
|
|
29
|
+
}): DiscountResult;
|
|
30
|
+
destroy(): Promise<void>;
|
|
31
|
+
clear(): Promise<void>;
|
|
32
|
+
}
|