oak-pay-business 2.2.1 → 2.2.2

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.
Files changed (34) hide show
  1. package/es/checkers/order.js +39 -0
  2. package/es/components/account/detail/web.pc.module.less +68 -68
  3. package/es/components/order/pay/index.js +1 -1
  4. package/es/components/order/pay/info.js +6 -6
  5. package/es/components/order/pay/info.module.less +24 -24
  6. package/es/components/order/pay/web.mobile.module.less +35 -35
  7. package/es/components/order/pay/web.pc.module.less +35 -35
  8. package/es/components/payConfig/upsert/offline/web.pc.module.less +4 -4
  9. package/es/components/payConfig/upsert/web.pc.module.less +10 -10
  10. package/es/components/withdrawAccount/list/index.less +8 -0
  11. package/es/components/withdrawAccount/list/index.xml +6 -1
  12. package/es/context/BackendRuntimeContext.d.ts +1 -1
  13. package/es/data/i18n.js +4 -0
  14. package/es/entities/Order.d.ts +2 -1
  15. package/es/entities/Order.js +1 -0
  16. package/es/locales/error/zh-CN.json +4 -0
  17. package/es/oak-app-domain/Order/Schema.d.ts +8 -2
  18. package/es/oak-app-domain/Order/Storage.js +3 -1
  19. package/es/oak-app-domain/Order/locales/zh_CN.json +1 -1
  20. package/es/oak-app-domain/System/Storage.js +1 -2
  21. package/es/utils/application.d.ts +1 -1
  22. package/es/utils/wpProductFrontend.js +1 -1
  23. package/lib/checkers/order.js +39 -0
  24. package/lib/data/i18n.js +4 -0
  25. package/lib/entities/Order.d.ts +2 -1
  26. package/lib/entities/Order.js +1 -0
  27. package/lib/locales/error/zh-CN.json +4 -0
  28. package/lib/oak-app-domain/Order/Schema.d.ts +8 -2
  29. package/lib/oak-app-domain/Order/Storage.js +3 -1
  30. package/lib/oak-app-domain/Order/locales/zh_CN.json +1 -1
  31. package/lib/oak-app-domain/System/Storage.js +1 -2
  32. package/lib/utils/wpProductFrontend.js +1 -1
  33. package/package.json +171 -200
  34. package/src/entities/Order.ts +3 -1
@@ -1,5 +1,6 @@
1
1
  import assert from 'assert';
2
2
  import { pipeline } from 'oak-domain/lib/utils/executor';
3
+ import { OakInputIllegalException } from 'oak-domain/lib/types';
3
4
  const checkers = [
4
5
  {
5
6
  type: 'logical',
@@ -20,6 +21,44 @@ const checkers = [
20
21
  }
21
22
  }
22
23
  },
24
+ {
25
+ type: 'logicalData',
26
+ entity: 'order',
27
+ action: 'startPaying',
28
+ checker: (operation, context) => {
29
+ const { data, filter } = operation;
30
+ assert(typeof filter.id === 'string');
31
+ return pipeline(() => context.select('order', {
32
+ data: {
33
+ id: 1,
34
+ price: 1,
35
+ paid: 1,
36
+ refunded: 1,
37
+ iState: 1,
38
+ },
39
+ filter: {
40
+ id: filter.id,
41
+ },
42
+ }, {}), (orders) => {
43
+ const [order] = orders;
44
+ const { price, paid, iState, allowPartialPay } = order;
45
+ assert(['unpaid', 'partiallyRefunded'].includes(iState) && paid === 0);
46
+ const { pay$order: pays } = data;
47
+ if (!(pays instanceof Array) || !pays.length) {
48
+ throw new OakInputIllegalException('order', ['pay$order'], 'error::order.nonePay');
49
+ }
50
+ let amount = 0;
51
+ pays.forEach(({ action, data }) => {
52
+ assert(action === 'create');
53
+ const { price } = data;
54
+ amount += price;
55
+ });
56
+ if (!allowPartialPay && amount !== price) {
57
+ throw new OakInputIllegalException('order', ['pay$order'], 'error::order.payAmountNotEnough');
58
+ }
59
+ });
60
+ }
61
+ },
23
62
  {
24
63
  // 订单结算,将收入分帐到相关的Account中
25
64
  type: 'logicalData',
@@ -1,69 +1,69 @@
1
- .card {
2
- width: 100%;
3
-
4
- .content {
5
- display: flex;
6
- flex-direction: column;
7
- align-items: stretch;
8
-
9
-
10
- .oper {
11
- align-self: center;
12
- width: 70%;
13
- margin-bottom: 28px;
14
- display: flex;
15
- flex-direction: column;
16
- align-items: stretch;
17
-
18
- .title {
19
- margin-bottom: 28px;
20
- align-self: flex-start;
21
- color: var(--oak-color-primary3);
22
- font-size: var(--oak-font-size-title-medium);
23
- }
24
- }
25
- }
26
- }
27
-
28
- .grid {
29
- min-width: 133px;
30
- border-radius: 6px;
31
- padding: 16px;
32
- display: flex;
33
- flex-direction: column;
34
- margin: 13px;
35
-
36
- .label {
37
- font-size: 16px;
38
- font-weight: 400;
39
- color: var(--oak-color-primary);
40
- margin-bottom: 12px;
41
- }
42
-
43
- .value {
44
- font-size: 24px;
45
- font-weight: 600;
46
- color: var(--oak-color-primary);
47
- line-height: 33.6px;
48
- }
49
- }
50
-
51
- .fortify {
52
- background-color: var(--oak-color-primary-light);
53
-
54
- .label {
55
- font-weight: 900;
56
- }
57
-
58
- .value {
59
- font-weight: bolder;
60
- }
61
- }
62
-
63
- .uf {
64
- margin: 12px;
65
- display: flex;
66
- flex-direction: column;
67
- align-items: center;
68
- padding: 12px;
1
+ .card {
2
+ width: 100%;
3
+
4
+ .content {
5
+ display: flex;
6
+ flex-direction: column;
7
+ align-items: stretch;
8
+
9
+
10
+ .oper {
11
+ align-self: center;
12
+ width: 70%;
13
+ margin-bottom: 28px;
14
+ display: flex;
15
+ flex-direction: column;
16
+ align-items: stretch;
17
+
18
+ .title {
19
+ margin-bottom: 28px;
20
+ align-self: flex-start;
21
+ color: var(--oak-color-primary3);
22
+ font-size: var(--oak-font-size-title-medium);
23
+ }
24
+ }
25
+ }
26
+ }
27
+
28
+ .grid {
29
+ min-width: 133px;
30
+ border-radius: 6px;
31
+ padding: 16px;
32
+ display: flex;
33
+ flex-direction: column;
34
+ margin: 13px;
35
+
36
+ .label {
37
+ font-size: 16px;
38
+ font-weight: 400;
39
+ color: var(--oak-color-primary);
40
+ margin-bottom: 12px;
41
+ }
42
+
43
+ .value {
44
+ font-size: 24px;
45
+ font-weight: 600;
46
+ color: var(--oak-color-primary);
47
+ line-height: 33.6px;
48
+ }
49
+ }
50
+
51
+ .fortify {
52
+ background-color: var(--oak-color-primary-light);
53
+
54
+ .label {
55
+ font-weight: 900;
56
+ }
57
+
58
+ .value {
59
+ font-weight: bolder;
60
+ }
61
+ }
62
+
63
+ .uf {
64
+ margin: 12px;
65
+ display: flex;
66
+ flex-direction: column;
67
+ align-items: center;
68
+ padding: 12px;
69
69
  }
@@ -83,7 +83,7 @@ export default OakComponent({
83
83
  accountPriceYuan: undefined,
84
84
  rest,
85
85
  restYuan: ToYuan(rest),
86
- });
86
+ }, () => this.tryCreatePays());
87
87
  }
88
88
  },
89
89
  setAccountPrice(price) {
@@ -1,11 +1,11 @@
1
1
  import Styles from './info.module.less';
2
2
  export default function Info(props) {
3
3
  const { price, t } = props;
4
- return (<div className={Styles.info}>
5
- <div className={Styles.should}>{t('price')}</div>
6
- <div className={Styles.price}>
7
- <div>{t('common::pay.symbol')}</div>
8
- <div>{price}</div>
9
- </div>
4
+ return (<div className={Styles.info}>
5
+ <div className={Styles.should}>{t('price')}</div>
6
+ <div className={Styles.price}>
7
+ <div>{t('common::pay.symbol')}</div>
8
+ <div>{price}</div>
9
+ </div>
10
10
  </div>);
11
11
  }
@@ -1,25 +1,25 @@
1
-
2
- .info {
3
- margin: 8px;
4
- height: 140px;
5
- display: flex;
6
- flex-direction: column;
7
- align-items: center;
8
- justify-content: center;
9
- background-color: var(--oak-color-info);
10
-
11
- .should {
12
- font-size: large;
13
- font-weight: bold;
14
- }
15
-
16
- .price {
17
- display: flex;
18
- flex-direction: row;
19
- padding: 3px;
20
- font-size: xx-large;
21
- font-weight: bolder;
22
- color: var(--oak-color-primary);
23
- align-items: baseline;
24
- }
1
+
2
+ .info {
3
+ margin: 8px;
4
+ height: 140px;
5
+ display: flex;
6
+ flex-direction: column;
7
+ align-items: center;
8
+ justify-content: center;
9
+ background-color: var(--oak-color-info);
10
+
11
+ .should {
12
+ font-size: large;
13
+ font-weight: bold;
14
+ }
15
+
16
+ .price {
17
+ display: flex;
18
+ flex-direction: row;
19
+ padding: 3px;
20
+ font-size: xx-large;
21
+ font-weight: bolder;
22
+ color: var(--oak-color-primary);
23
+ align-items: baseline;
24
+ }
25
25
  }
@@ -1,36 +1,36 @@
1
- .container {
2
- width: 100%;
3
- height: 100%;
4
- display: flex;
5
- flex-direction: column;
6
- align-items: stretch;
7
- background-color: var(--oak-bg-color-page);
8
- // min-height: 500px;
9
-
10
- .ctrl {
11
- margin: 8px;
12
- margin-top: 10px;
13
- flex: 1;
14
-
15
- .pc1 {
16
- width: 100%;
17
- height: 100%;
18
- display: flex;
19
- flex-direction: column;
20
- margin-top: 4px;
21
-
22
- .content {
23
- background-color: var(--oak-bg-color-container);
24
- padding: 4px;
25
- border-radius: 2px;
26
- padding: 16px;
27
-
28
- .tips {
29
- color: var(--oak-color-warning);
30
- font-size: small;
31
- margin-top: 3px;
32
- }
33
- }
34
- }
35
- }
1
+ .container {
2
+ width: 100%;
3
+ height: 100%;
4
+ display: flex;
5
+ flex-direction: column;
6
+ align-items: stretch;
7
+ background-color: var(--oak-bg-color-page);
8
+ // min-height: 500px;
9
+
10
+ .ctrl {
11
+ margin: 8px;
12
+ margin-top: 10px;
13
+ flex: 1;
14
+
15
+ .pc1 {
16
+ width: 100%;
17
+ height: 100%;
18
+ display: flex;
19
+ flex-direction: column;
20
+ margin-top: 4px;
21
+
22
+ .content {
23
+ background-color: var(--oak-bg-color-container);
24
+ padding: 4px;
25
+ border-radius: 2px;
26
+ padding: 16px;
27
+
28
+ .tips {
29
+ color: var(--oak-color-warning);
30
+ font-size: small;
31
+ margin-top: 3px;
32
+ }
33
+ }
34
+ }
35
+ }
36
36
  }
@@ -1,36 +1,36 @@
1
- .container {
2
- width: 100%;
3
- height: 100%;
4
- display: flex;
5
- flex-direction: column;
6
- align-items: stretch;
7
- background-color: var(--oak-bg-color-page);
8
- // min-height: 500px;
9
-
10
- .ctrl {
11
- margin: 8px;
12
- margin-top: 10px;
13
- flex: 1;
14
-
15
- .pc1 {
16
- width: 100%;
17
- height: 100%;
18
- display: flex;
19
- flex-direction: column;
20
- margin-top: 4px;
21
-
22
- .content {
23
- background-color: var(--oak-bg-color-container);
24
- padding: 4px;
25
- border-radius: 2px;
26
- padding: 16px;
27
-
28
- .tips {
29
- color: var(--oak-color-warning);
30
- font-size: small;
31
- margin-left: 10px;
32
- }
33
- }
34
- }
35
- }
1
+ .container {
2
+ width: 100%;
3
+ height: 100%;
4
+ display: flex;
5
+ flex-direction: column;
6
+ align-items: stretch;
7
+ background-color: var(--oak-bg-color-page);
8
+ // min-height: 500px;
9
+
10
+ .ctrl {
11
+ margin: 8px;
12
+ margin-top: 10px;
13
+ flex: 1;
14
+
15
+ .pc1 {
16
+ width: 100%;
17
+ height: 100%;
18
+ display: flex;
19
+ flex-direction: column;
20
+ margin-top: 4px;
21
+
22
+ .content {
23
+ background-color: var(--oak-bg-color-container);
24
+ padding: 4px;
25
+ border-radius: 2px;
26
+ padding: 16px;
27
+
28
+ .tips {
29
+ color: var(--oak-color-warning);
30
+ font-size: small;
31
+ margin-left: 10px;
32
+ }
33
+ }
34
+ }
35
+ }
36
36
  }
@@ -1,5 +1,5 @@
1
- .container {
2
- display: flex;
3
- flex-direction: column;
4
- width: 100%;
1
+ .container {
2
+ display: flex;
3
+ flex-direction: column;
4
+ width: 100%;
5
5
  }
@@ -1,11 +1,11 @@
1
- .empty {
2
- min-height: 600px;
3
- }
4
-
5
- .container {
6
- width: 100%;
7
- display: flex;
8
- flex-direction: column;
9
- align-items: center;
10
- justify-content: center;
1
+ .empty {
2
+ min-height: 600px;
3
+ }
4
+
5
+ .container {
6
+ width: 100%;
7
+ display: flex;
8
+ flex-direction: column;
9
+ align-items: center;
10
+ justify-content: center;
11
11
  }
@@ -2,6 +2,14 @@
2
2
  @import '../../../config/styles/mp/index.less';
3
3
 
4
4
 
5
+ .loading {
6
+ display: flex;
7
+ align-items: center;
8
+ justify-content: center;
9
+ flex: 1;
10
+ height: 100%;
11
+ }
12
+
5
13
  .warningContainer {
6
14
  padding: 48rpx;
7
15
  background-color: #fff;
@@ -1,4 +1,9 @@
1
- <block wx:if="{{!withdrawAccounts.length}}">
1
+ <block wx:if="{{oakLoading || oakExecuting}}">
2
+ <view class="loading">
3
+ <l-loading show="{{true}}" type="circle" />
4
+ </view>
5
+ </block>
6
+ <block wx:elif="{{!withdrawAccounts.length}}">
2
7
  <view class="warningContainer">
3
8
  <oak-icon name="prompt_fill" size="48" color="#FF8F1F" />
4
9
  <view>{{t('noData')}}</view>
@@ -15,7 +15,7 @@ export declare class BackendRuntimeContext<ED extends EntityDict & BaseEntityDic
15
15
  type?: number | undefined;
16
16
  systemId?: number | undefined;
17
17
  system?: import("../oak-app-domain/System/Schema").Projection | undefined;
18
- config?: number | import("oak-domain/lib/types").JsonProjection<import("../oak-app-domain/Application/Schema").WebConfig | import("../oak-app-domain/Application/Schema").WechatMpConfig | import("../oak-app-domain/Application/Schema").WechatPublicConfig | import("../oak-app-domain/Application/Schema").NativeConfig> | undefined;
18
+ config?: number | import("oak-domain/lib/types").JsonProjection<import("../oak-app-domain/Application/Schema").WechatMpConfig | import("../oak-app-domain/Application/Schema").WebConfig | import("../oak-app-domain/Application/Schema").WechatPublicConfig | import("../oak-app-domain/Application/Schema").NativeConfig> | undefined;
19
19
  style?: number | import("oak-domain/lib/types").JsonProjection<import("oak-general-business/lib/types/Style").Style> | undefined;
20
20
  domainId?: number | undefined;
21
21
  domain?: import("../oak-app-domain/Domain/Schema").Projection | undefined;
package/es/data/i18n.js CHANGED
@@ -749,6 +749,10 @@ const i18ns = [
749
749
  },
750
750
  "system": {
751
751
  "withdrawLossUnSet": "系统的提现规则尚未设置,请联系管理员"
752
+ },
753
+ "order": {
754
+ "payAmountNotEnough": "支付的额度总和不足",
755
+ "nonePay": "没有传入支付信息"
752
756
  }
753
757
  }
754
758
  },
@@ -10,11 +10,12 @@ export interface Schema extends EntityShape {
10
10
  refunded: Price;
11
11
  title: String<32>;
12
12
  desc: Text;
13
- timeoutAt: Datetime;
13
+ timeoutAt?: Datetime;
14
14
  creator: User;
15
15
  entity: String<32>;
16
16
  entityId: String<64>;
17
17
  settled: Boolean;
18
+ allowPartialPay?: Boolean;
18
19
  system: System;
19
20
  opers: AccountOper[];
20
21
  }
@@ -55,6 +55,7 @@ export const entityDesc = {
55
55
  title: '订单标题',
56
56
  desc: "订单描述",
57
57
  timeoutAt: '过期时间',
58
+ allowPartialPay: '允许部分支付',
58
59
  creator: '创建者',
59
60
  entity: '关联对象',
60
61
  entityId: '关联对象Id',
@@ -12,5 +12,9 @@
12
12
  },
13
13
  "system": {
14
14
  "withdrawLossUnSet": "系统的提现规则尚未设置,请联系管理员"
15
+ },
16
+ "order": {
17
+ "payAmountNotEnough": "支付的额度总和不足",
18
+ "nonePay": "没有传入支付信息"
15
19
  }
16
20
  }
@@ -14,11 +14,12 @@ export type OpSchema = EntityShape & {
14
14
  refunded: Price;
15
15
  title: String<32>;
16
16
  desc: Text;
17
- timeoutAt: Datetime;
17
+ timeoutAt?: Datetime | null;
18
18
  creatorId: ForeignKey<"user">;
19
19
  entity: String<32>;
20
20
  entityId: String<64>;
21
21
  settled: Boolean;
22
+ allowPartialPay?: Boolean | null;
22
23
  systemId: ForeignKey<"system">;
23
24
  iState?: IState | null;
24
25
  };
@@ -29,11 +30,12 @@ export type Schema = EntityShape & {
29
30
  refunded: Price;
30
31
  title: String<32>;
31
32
  desc: Text;
32
- timeoutAt: Datetime;
33
+ timeoutAt?: Datetime | null;
33
34
  creatorId: ForeignKey<"user">;
34
35
  entity: String<32>;
35
36
  entityId: String<64>;
36
37
  settled: Boolean;
38
+ allowPartialPay?: Boolean | null;
37
39
  systemId: ForeignKey<"system">;
38
40
  iState?: IState | null;
39
41
  creator: User.Schema;
@@ -61,6 +63,7 @@ type AttrFilter = {
61
63
  entity: Q_StringValue;
62
64
  entityId: Q_StringValue;
63
65
  settled: Q_BooleanValue;
66
+ allowPartialPay: Q_BooleanValue;
64
67
  systemId: Q_StringValue;
65
68
  system: System.Filter;
66
69
  iState: Q_EnumValue<IState>;
@@ -86,6 +89,7 @@ export type Projection = {
86
89
  entity?: number;
87
90
  entityId?: number;
88
91
  settled?: number;
92
+ allowPartialPay?: number;
89
93
  systemId?: number;
90
94
  system?: System.Projection;
91
95
  iState?: number;
@@ -141,6 +145,8 @@ export type SortAttr = {
141
145
  entityId: number;
142
146
  } | {
143
147
  settled: number;
148
+ } | {
149
+ allowPartialPay: number;
144
150
  } | {
145
151
  systemId: number;
146
152
  } | {
@@ -25,7 +25,6 @@ export const desc = {
25
25
  type: "text"
26
26
  },
27
27
  timeoutAt: {
28
- notNull: true,
29
28
  type: "datetime"
30
29
  },
31
30
  creatorId: {
@@ -51,6 +50,9 @@ export const desc = {
51
50
  notNull: true,
52
51
  type: "boolean"
53
52
  },
53
+ allowPartialPay: {
54
+ type: "boolean"
55
+ },
54
56
  systemId: {
55
57
  notNull: true,
56
58
  type: "ref",
@@ -1 +1 @@
1
- { "name": "订单", "attr": { "price": "订单金额", "paid": "已支付金额", "refunded": "已退款金额", "iState": "订单状态", "title": "订单标题", "desc": "订单描述", "timeoutAt": "过期时间", "creator": "创建者", "entity": "关联对象", "entityId": "关联对象Id", "settled": "是否结算", "opers": "相关帐户操作", "system": "所属系统" }, "action": { "startPaying": "开始支付", "payAll": "全部支付", "payPartially": "部分支付", "payNone": "支付失败", "timeout": "过期", "cancel": "放弃", "startRefunding": "开始退款", "refundAll": "完全退款", "refundNone": "退款失败", "refundPartially": "部分退款", "settle": "结算" }, "v": { "iState": { "paid": "已付款", "partiallyPaid": "部分支付", "paying": "支付中", "unpaid": "待付款", "timeout": "已超时", "cancelled": "已取消", "refunded": "已退款", "partiallyRefunded": "已部分退款", "refunding": "退款中" } } }
1
+ { "name": "订单", "attr": { "price": "订单金额", "paid": "已支付金额", "refunded": "已退款金额", "iState": "订单状态", "title": "订单标题", "desc": "订单描述", "timeoutAt": "过期时间", "allowPartialPay": "允许部分支付", "creator": "创建者", "entity": "关联对象", "entityId": "关联对象Id", "settled": "是否结算", "opers": "相关帐户操作", "system": "所属系统" }, "action": { "startPaying": "开始支付", "payAll": "全部支付", "payPartially": "部分支付", "payNone": "支付失败", "timeout": "过期", "cancel": "放弃", "startRefunding": "开始退款", "refundAll": "完全退款", "refundNone": "退款失败", "refundPartially": "部分退款", "settle": "结算" }, "v": { "iState": { "paid": "已付款", "partiallyPaid": "部分支付", "paying": "支付中", "unpaid": "待付款", "timeout": "已超时", "cancelled": "已取消", "refunded": "已退款", "partiallyRefunded": "已部分退款", "refunding": "退款中" } } }
@@ -34,8 +34,7 @@ export const desc = {
34
34
  : {
35
35
  type: "object"
36
36
  },
37
- entity // 如果为true,则按照渠道taxLossRatio和refundCompensateRatio进行扣取(如果因为depositLossRatio已经大于taxLossRatio,则全额退款)
38
- : {
37
+ entity: {
39
38
  type: "varchar",
40
39
  params: {
41
40
  length: 32
@@ -14,7 +14,7 @@ export declare const mergedProjection: {
14
14
  type?: number | undefined;
15
15
  systemId?: number | undefined;
16
16
  system?: import("../oak-app-domain/System/Schema").Projection | undefined;
17
- config?: number | import("oak-domain/lib/types").JsonProjection<import("../oak-app-domain/Application/Schema").WebConfig | import("../oak-app-domain/Application/Schema").WechatMpConfig | import("../oak-app-domain/Application/Schema").WechatPublicConfig | import("../oak-app-domain/Application/Schema").NativeConfig> | undefined;
17
+ config?: number | import("oak-domain/lib/types").JsonProjection<import("../oak-app-domain/Application/Schema").WechatMpConfig | import("../oak-app-domain/Application/Schema").WebConfig | import("../oak-app-domain/Application/Schema").WechatPublicConfig | import("../oak-app-domain/Application/Schema").NativeConfig> | undefined;
18
18
  style?: number | import("oak-domain/lib/types").JsonProjection<import("oak-general-business/lib/types/Style").Style> | undefined;
19
19
  domainId?: number | undefined;
20
20
  domain?: import("../oak-app-domain/Domain/Schema").Projection | undefined;
@@ -1,4 +1,4 @@
1
- import { isPc, isWeiXin } from 'oak-frontend-base/lib/utils/utils';
1
+ import { isPc, isWeiXin } from 'oak-frontend-base/es/utils/utils';
2
2
  export function getWpProductTypeFromEnv() {
3
3
  switch (process.env.OAK_PLATFORM) {
4
4
  case 'web': {