oak-pay-business 1.1.1 → 2.0.0

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 (118) hide show
  1. package/es/checkers/account.js +14 -1
  2. package/es/checkers/accountOper.js +6 -0
  3. package/es/checkers/pay.js +13 -1
  4. package/es/components/AbstractComponents.d.ts +2 -2
  5. package/es/components/offlineAccount/config/web.pc.js +1 -1
  6. package/es/components/offlineAccount/upsert/index.js +3 -2
  7. package/es/components/offlineAccount/upsert/locales/zh-CN.json +3 -2
  8. package/es/components/offlineAccount/upsert/web.pc.js +15 -9
  9. package/es/components/order/pay/index.js +9 -10
  10. package/es/components/order/pay/index.json +1 -1
  11. package/es/components/order/pay/index.xml +4 -6
  12. package/es/components/order/pay/web.d.ts +5 -4
  13. package/es/components/order/pay/web.js +5 -11
  14. package/es/components/order/pay/web.pc.d.ts +5 -4
  15. package/es/components/order/pay/web.pc.js +5 -11
  16. package/es/components/pay/detail/index.xml +1 -1
  17. package/es/components/pay/detail/web.js +1 -1
  18. package/es/components/pay/list/web.pc.js +22 -19
  19. package/es/components/payConfig/system/index.js +1 -0
  20. package/es/components/payConfig/system/locales/zh-CN.json +20 -3
  21. package/es/components/payConfig/system/web.pc.js +135 -4
  22. package/es/components/payConfig/system/web.pc.module.less +4 -0
  23. package/es/components/wpAccount/config/index.js +1 -3
  24. package/es/components/wpAccount/config/web.pc.js +2 -4
  25. package/es/components/wpAccount/upsert/index.js +3 -4
  26. package/es/components/wpAccount/upsert/locales/zh-CN.json +3 -4
  27. package/es/components/wpAccount/upsert/web.pc.js +9 -25
  28. package/es/components/wpProduct/upsert/locales/zh-CN.json +1 -1
  29. package/es/components/wpProduct/upsert/web.pc.js +4 -4
  30. package/es/configuration/attrUpdateMatrix.js +11 -2
  31. package/es/data/i18n.js +30 -11
  32. package/es/entities/AbstractAccount.d.ts +3 -7
  33. package/es/entities/AbstractAccount.js +2 -16
  34. package/es/entities/AccountOper.d.ts +1 -1
  35. package/es/entities/AccountOper.js +2 -0
  36. package/es/entities/OfflineAccount.d.ts +0 -7
  37. package/es/entities/OfflineAccount.js +2 -7
  38. package/es/entities/Pay.d.ts +1 -0
  39. package/es/entities/Pay.js +1 -0
  40. package/es/entities/System.d.ts +16 -0
  41. package/es/entities/System.js +1 -0
  42. package/es/entities/WpAccount.d.ts +1 -3
  43. package/es/entities/WpAccount.js +2 -16
  44. package/es/entities/WpProduct.d.ts +1 -1
  45. package/es/entities/WpProduct.js +1 -1
  46. package/es/features/Pay.js +1 -1
  47. package/es/locales/common/zh_CN.json +3 -1
  48. package/es/oak-app-domain/AbstractAccount/Schema.d.ts +11 -23
  49. package/es/oak-app-domain/AbstractAccount/Storage.js +5 -16
  50. package/es/oak-app-domain/AbstractAccount/Style.js +0 -6
  51. package/es/oak-app-domain/AbstractAccount/locales/zh_CN.json +1 -1
  52. package/es/oak-app-domain/Account/Schema.d.ts +0 -16
  53. package/es/oak-app-domain/AccountOper/Schema.d.ts +1 -1
  54. package/es/oak-app-domain/AccountOper/Storage.js +1 -1
  55. package/es/oak-app-domain/AccountOper/Style.js +1 -0
  56. package/es/oak-app-domain/AccountOper/locales/zh_CN.json +1 -1
  57. package/es/oak-app-domain/OfflineAccount/Schema.d.ts +10 -38
  58. package/es/oak-app-domain/OfflineAccount/Storage.js +5 -16
  59. package/es/oak-app-domain/OfflineAccount/locales/zh_CN.json +1 -1
  60. package/es/oak-app-domain/Pay/Schema.d.ts +6 -0
  61. package/es/oak-app-domain/Pay/Storage.js +3 -0
  62. package/es/oak-app-domain/Pay/locales/zh_CN.json +1 -1
  63. package/es/oak-app-domain/System/Schema.d.ts +20 -0
  64. package/es/oak-app-domain/System/Storage.js +5 -1
  65. package/es/oak-app-domain/System/locales/zh_CN.json +1 -1
  66. package/es/oak-app-domain/WithdrawAccount/Schema.d.ts +0 -6
  67. package/es/oak-app-domain/WpAccount/Schema.d.ts +11 -23
  68. package/es/oak-app-domain/WpAccount/Storage.js +5 -16
  69. package/es/oak-app-domain/WpAccount/Style.js +0 -6
  70. package/es/oak-app-domain/WpAccount/locales/zh_CN.json +1 -1
  71. package/es/oak-app-domain/WpProduct/Schema.d.ts +5 -5
  72. package/es/oak-app-domain/WpProduct/Storage.js +1 -1
  73. package/es/oak-app-domain/WpProduct/locales/zh_CN.json +1 -1
  74. package/es/triggers/pay.d.ts +2 -2
  75. package/es/triggers/pay.js +128 -47
  76. package/es/triggers/refund.js +5 -5
  77. package/es/types/PayClazz.d.ts +1 -0
  78. package/es/utils/application.js +8 -7
  79. package/es/utils/pay.d.ts +2 -4
  80. package/es/utils/pay.js +41 -72
  81. package/es/utils/payClazz/Account.d.ts +1 -0
  82. package/es/utils/payClazz/Account.js +4 -0
  83. package/es/utils/payClazz/Offline.d.ts +4 -0
  84. package/es/utils/payClazz/Offline.js +9 -0
  85. package/es/utils/payClazz/WechatPay/WechatPay.d.ts +1 -0
  86. package/es/utils/payClazz/WechatPay/WechatPay.debug.d.ts +1 -0
  87. package/es/utils/payClazz/WechatPay/WechatPay.debug.js +4 -2
  88. package/es/utils/payClazz/WechatPay/WechatPay.js +6 -5
  89. package/es/utils/payClazz/index.js +27 -1
  90. package/lib/checkers/index.d.ts +1 -1
  91. package/lib/checkers/pay.js +12 -0
  92. package/lib/components/payConfig/system/web.pc.js +1 -1
  93. package/lib/configuration/attrUpdateMatrix.js +3 -0
  94. package/lib/entities/Pay.d.ts +1 -0
  95. package/lib/entities/Pay.js +1 -0
  96. package/lib/oak-app-domain/Pay/Schema.d.ts +6 -0
  97. package/lib/oak-app-domain/Pay/Storage.js +3 -0
  98. package/lib/oak-app-domain/Pay/locales/zh_CN.json +1 -1
  99. package/lib/oak-app-domain/System/Storage.js +4 -5
  100. package/lib/oak-app-domain/WpAccount/Style.js +0 -6
  101. package/lib/ports/index.d.ts +1 -1
  102. package/lib/routines/start.d.ts +1 -1
  103. package/lib/timers/index.d.ts +1 -1
  104. package/lib/triggers/index.d.ts +1 -1
  105. package/lib/triggers/pay.js +30 -1
  106. package/lib/types/Exception.d.ts +1 -1
  107. package/lib/types/PayClazz.d.ts +1 -0
  108. package/lib/utils/payClazz/Account.d.ts +1 -0
  109. package/lib/utils/payClazz/Account.js +4 -0
  110. package/lib/utils/payClazz/Offline.d.ts +4 -0
  111. package/lib/utils/payClazz/Offline.js +9 -0
  112. package/lib/utils/payClazz/WechatPay/WechatPay.d.ts +1 -0
  113. package/lib/utils/payClazz/WechatPay/WechatPay.debug.d.ts +1 -0
  114. package/lib/utils/payClazz/WechatPay/WechatPay.debug.js +4 -2
  115. package/lib/utils/payClazz/WechatPay/WechatPay.js +6 -5
  116. package/lib/utils/payClazz/index.js +27 -1
  117. package/lib/watchers/index.d.ts +1 -1
  118. package/package.json +4 -4
@@ -1,2 +1,15 @@
1
- const checkers = [];
1
+ const checkers = [
2
+ {
3
+ entity: 'account',
4
+ type: 'row',
5
+ filter: {
6
+ system: {
7
+ account$entity: {
8
+ "#sqp": 'not in',
9
+ },
10
+ },
11
+ },
12
+ action: 'create',
13
+ }
14
+ ];
2
15
  export default checkers;
@@ -81,6 +81,12 @@ const checkers = [
81
81
  }
82
82
  break;
83
83
  }
84
+ case 'tax': {
85
+ if (totalPlus >= 0 || availPlus >= 0 || totalPlus !== availPlus) {
86
+ throw new OakInputIllegalException('accountOper', ['totalPlus', 'availPlus'], 'accountOper为tax时,其totalPlus/availPlus必须为负且相等');
87
+ }
88
+ break;
89
+ }
84
90
  default: {
85
91
  assert(false);
86
92
  break;
@@ -1,4 +1,4 @@
1
- import { OakInputIllegalException } from 'oak-domain/lib/types';
1
+ import { OakAttrNotNullException, OakInputIllegalException } from 'oak-domain/lib/types';
2
2
  import { pipeline } from 'oak-domain/lib/utils/executor';
3
3
  import assert from 'assert';
4
4
  const checkers = [
@@ -98,6 +98,18 @@ const checkers = [
98
98
  };
99
99
  }
100
100
  },
101
+ {
102
+ entity: 'pay',
103
+ action: 'succeedPaying',
104
+ type: 'data',
105
+ checker(data) {
106
+ assert(!(data instanceof Array));
107
+ const { successAt } = data;
108
+ if (!successAt) {
109
+ throw new OakAttrNotNullException('pay', ['successAt']);
110
+ }
111
+ }
112
+ },
101
113
  {
102
114
  // 如果在开始支付或者继续支付过程中,paid达到了price,pay的状态可以改为paid
103
115
  entity: 'pay',
@@ -58,14 +58,14 @@ declare const Detail: <T extends keyof EntityDict>(props: ReactComponentProps<En
58
58
  data: Partial<EntityDict[T]["Schema"]>;
59
59
  title?: string | undefined;
60
60
  bordered?: boolean | undefined;
61
- layout?: "vertical" | "horizontal" | undefined;
61
+ layout?: "horizontal" | "vertical" | undefined;
62
62
  }>) => React.ReactElement;
63
63
  declare const Upsert: <T extends keyof EntityDict>(props: ReactComponentProps<EntityDict, T, false, {
64
64
  helps: Record<string, string>;
65
65
  entity: T;
66
66
  attributes: OakAbsAttrUpsertDef<EntityDict, T, string | number>[];
67
67
  data: EntityDict[T]["Schema"];
68
- layout: "vertical" | "horizontal";
68
+ layout: "horizontal" | "vertical";
69
69
  mode: "default" | "card";
70
70
  }>) => React.ReactElement;
71
71
  export { FilterPanel, List, ListPro, Detail, Upsert, ReactComponentProps, ColumnProps, RowWithActions, OakExtraActionProps, OakAbsAttrDef, onActionFnDef, };
@@ -41,7 +41,7 @@ export default function render(props) {
41
41
  return t('notnull', { value: t(`offlineAccount:attr.${attr}`) });
42
42
  };
43
43
  const errMsg = oakExecutable instanceof OakException && (oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getAttributes()[0]) : t(oakExecutable.message));
44
- const U = (<Modal destroyOnClose width={680} title={`${t('offlineAccount:name')}${t('common::action.add')}`} open={!!upsertId} onCancel={() => {
44
+ const U = (<Modal destroyOnClose width={920} title={`${t('offlineAccount:name')}${t('common::action.add')}`} open={!!upsertId} onCancel={() => {
45
45
  clean();
46
46
  setUpsertId('');
47
47
  }} closeIcon={null} onOk={async () => {
@@ -10,8 +10,9 @@ export default OakComponent({
10
10
  allowPay: 1,
11
11
  systemId: 1,
12
12
  enabled: 1,
13
- depositLossRatio: 1,
14
- taxlossRatio: 1,
13
+ refundCompensateRatio: 1,
14
+ taxLossRatio: 1,
15
+ refundGapDays: 1,
15
16
  },
16
17
  isList: false,
17
18
  formData({ data }) {
@@ -18,8 +18,9 @@
18
18
  "shouqianba": "请将二维码解析后的字符串填入",
19
19
  "others": "请将二维码解析后的字符串填入"
20
20
  },
21
- "taxlossRatio": "渠道收款时收取的手续费百分比,0.6代表千分之六",
22
- "depositLossRatio": "充值时收取的手续费百分比,0.6代表千分之六"
21
+ "taxLossRatio": "渠道收款时收取的手续费百分比,0.6代表千分之六",
22
+ "refundGapDays": "超过这个天数后将无法退款",
23
+ "refundCompensateRatio": "渠道退款时,返回的手续费比例(50代表渠道将返回当时收取的手续费的一半)"
23
24
  },
24
25
  "help": {
25
26
  "allowDeposit": "是否允许用户在系统中主动向此账号发起充值",
@@ -4,7 +4,7 @@ export default function render(props) {
4
4
  const { offlineAccount } = props.data;
5
5
  const { t, update } = props.methods;
6
6
  if (offlineAccount) {
7
- return (<Form labelCol={{ span: 6 }} wrapperCol={{ span: 16 }} layout="horizontal" style={{ minWidth: 600 }}>
7
+ return (<Form labelCol={{ span: 8 }} wrapperCol={{ span: 12 }} layout="horizontal" style={{ minWidth: 860 }}>
8
8
  <Form.Item label={t('offlineAccount:attr.type')} required>
9
9
  <Select value={offlineAccount.type} options={['bank', 'alipay', 'wechat', 'shouqianba', 'others'].map(ele => ({
10
10
  label: t(`offlineAccount:v.type.${ele}`),
@@ -41,16 +41,22 @@ export default function render(props) {
41
41
  });
42
42
  }} placeholder={t(`placeholder.qrCode.${offlineAccount.type}`)}/>}
43
43
  </Form.Item>}
44
- <Form.Item label={t('offlineAccount:attr.taxlossRatio')} help={t('placeholder.taxlossRatio')}>
45
- <InputNumber value={offlineAccount.taxlossRatio} max={5} min={0.01} addonAfter={"%"} step={0.01} precision={2} onChange={(value) => {
46
- const taxlossRatio = value;
47
- update({ taxlossRatio });
44
+ <Form.Item label={t('offlineAccount:attr.taxLossRatio')} help={t('placeholder.taxLossRatio')}>
45
+ <InputNumber value={offlineAccount.taxLossRatio} max={5} min={0.01} addonAfter={"%"} step={0.01} precision={2} onChange={(value) => {
46
+ const taxLossRatio = value;
47
+ update({ taxLossRatio });
48
48
  }}/>
49
49
  </Form.Item>
50
- <Form.Item label={t('offlineAccount:attr.depositLossRatio')} help={t('placeholder.depositLossRatio')}>
51
- <InputNumber value={offlineAccount.depositLossRatio} max={5} min={0.01} addonAfter={"%"} step={0.01} precision={2} onChange={(value) => {
52
- const depositLossRatio = value;
53
- update({ depositLossRatio });
50
+ <Form.Item label={t('offlineAccount:attr.refundGapDays')} help={t('placeholder.refundGapDays')}>
51
+ <InputNumber value={offlineAccount.refundGapDays} max={365} min={7} addonAfter={"天"} step={1} onChange={(value) => {
52
+ const refundGapDays = value;
53
+ update({ refundGapDays });
54
+ }}/>
55
+ </Form.Item>
56
+ <Form.Item label={t('offlineAccount:attr.refundCompensateRatio')} help={t('placeholder.refundCompensateRatio')}>
57
+ <InputNumber value={offlineAccount.refundCompensateRatio} max={100} min={1} addonAfter={"%"} step={1} onChange={(value) => {
58
+ const refundCompensateRatio = value;
59
+ update({ refundCompensateRatio });
54
60
  }}/>
55
61
  </Form.Item>
56
62
  {!!offlineAccount.type && <Form.Item label={t('offlineAccount:attr.allowDeposit')} required help={t('help.allowDeposit')}>
@@ -1,4 +1,3 @@
1
- import { PAY_CHANNEL_ACCOUNT_NAME } from "../../../types/PayConfig";
2
1
  import { generateNewId } from "oak-domain/lib/utils/uuid";
3
2
  import { ToCent, ToYuan } from "oak-domain/lib/utils/money";
4
3
  export default OakComponent({
@@ -15,6 +14,8 @@ export default OakComponent({
15
14
  price: 1,
16
15
  paid: 1,
17
16
  iState: 1,
17
+ entity: 1,
18
+ entityId: 1,
18
19
  },
19
20
  filter: {
20
21
  iState: 'paying',
@@ -28,9 +29,7 @@ export default OakComponent({
28
29
  onSetPays: (pays) => undefined,
29
30
  },
30
31
  formData({ data }) {
31
- const payConfig = this.features.pay.getPayConfigs();
32
- const accountConfig = payConfig?.find(ele => ele.channel === PAY_CHANNEL_ACCOUNT_NAME);
33
- const payConfig2 = payConfig?.filter(ele => ele !== accountConfig);
32
+ const payChannels = features.pay.getPayChannels('pay');
34
33
  const activePay = data && data.pay$order?.[0];
35
34
  const { accountPrice } = this.state;
36
35
  const { accountAvailMax } = this.props;
@@ -40,11 +39,10 @@ export default OakComponent({
40
39
  accountAvailMaxStr: accountAvailMax && ToYuan(accountAvailMax),
41
40
  order: data,
42
41
  activePay,
43
- accountConfig,
44
- payConfig: payConfig2,
45
42
  rest,
46
43
  restYuan: ToYuan(rest),
47
44
  legal: !!(data?.['#oakLegalActions']?.includes('startPaying')),
45
+ payChannels,
48
46
  };
49
47
  },
50
48
  features: ['application'],
@@ -52,7 +50,7 @@ export default OakComponent({
52
50
  useAccount: false,
53
51
  accountPrice: 0,
54
52
  accountPriceYuan: 0,
55
- channel: '',
53
+ channel: undefined,
56
54
  restYuan: 0,
57
55
  meta: undefined,
58
56
  onPickMp(channel) {
@@ -127,9 +125,9 @@ export default OakComponent({
127
125
  if (useAccount && accountPrice) {
128
126
  pays.push({
129
127
  id: generateNewId(),
130
- channel: PAY_CHANNEL_ACCOUNT_NAME,
128
+ entity: 'account',
129
+ entityId: accountId,
131
130
  price: accountPrice,
132
- accountId,
133
131
  });
134
132
  rest = rest - accountPrice;
135
133
  }
@@ -137,7 +135,8 @@ export default OakComponent({
137
135
  payId = generateNewId();
138
136
  pays.push({
139
137
  id: payId,
140
- channel,
138
+ entity: channel.entity,
139
+ entityId: channel.entityId,
141
140
  meta,
142
141
  price: rest,
143
142
  });
@@ -12,6 +12,6 @@
12
12
  "l-icon": "@oak-frontend-base/miniprogram_npm/lin-ui/icon/index",
13
13
  "l-button": "@oak-frontend-base/miniprogram_npm/lin-ui/button/index",
14
14
  "l-switch": "@oak-frontend-base/miniprogram_npm/lin-ui/switch/index",
15
- "channel-picker": "../../pay/channelPicker"
15
+ "channel-picker": "../../pay/channelPicker2"
16
16
  }
17
17
  }
@@ -9,7 +9,7 @@
9
9
  >
10
10
  </l-status-show>
11
11
  </view>
12
- <view wx:elif="{{activePay}}" class="error-container">
12
+ <view wx:elif="{{activePay}}" class="error-container">
13
13
  <l-status-show
14
14
  show="{{true}}"
15
15
  type="order"
@@ -52,18 +52,16 @@
52
52
  </view>
53
53
  </view>
54
54
  <view wx:if="{{rest}}" class="ctrl">
55
- <view class="pc1">
55
+ <view class="pc1">
56
56
  <view class="text">
57
57
  请选择支付方式({{restYuan}}元):
58
58
  </view>
59
59
  </view>
60
60
  <view class="pc2">
61
61
  <channel-picker
62
- payConfig="{{payConfig}}"
63
- channel="{{channel}}"
64
- meta="{{meta}}"
62
+ payChannels="{{payChannels}}"
63
+ payChannel="{{channel}}"
65
64
  onPick="{{onPickMp}}"
66
- onSetMeta="{{onSetMetaMp}}"
67
65
  />
68
66
  </view>
69
67
  </view>
@@ -1,23 +1,24 @@
1
1
  import React from 'react';
2
2
  import { WebComponentProps } from 'oak-frontend-base';
3
3
  import { EntityDict } from '../../../oak-app-domain';
4
- import { AccountPayConfig, PayConfig } from '../../../types/PayConfig';
4
+ import { AccountPayConfig } from '../../../types/PayConfig';
5
+ import { PayChannel, PayChannels } from '../../../types/Pay';
5
6
  export default function Render(props: WebComponentProps<EntityDict, 'order', false, {
6
7
  accountId?: string;
7
8
  accountAvailMax: number;
8
9
  order: EntityDict['order']['OpSchema'];
9
10
  activePay?: EntityDict['pay']['OpSchema'];
10
11
  accountConfig?: AccountPayConfig;
11
- payConfig?: PayConfig;
12
+ payChannels?: PayChannels;
13
+ channel?: PayChannel;
12
14
  accountPrice: number;
13
- channel?: string;
14
15
  meta?: object;
15
16
  useAccount: boolean;
16
17
  rest: number;
17
18
  legal: false;
18
19
  }, {
19
20
  setAccountPrice: (price: number) => void;
20
- onPickChannel: (channel: string) => void;
21
+ onPickChannel: (channel: PayChannel) => void;
21
22
  onSetChannelMeta: (meta?: object) => void;
22
23
  switchUseAccount: () => void;
23
24
  }>): React.JSX.Element | null;
@@ -1,25 +1,19 @@
1
1
  import React from 'react';
2
2
  import { ToYuan, ToCent } from 'oak-domain/lib/utils/money';
3
3
  import Styles from './web.mobile.module.less';
4
- // import PayChannelPicker from '../../pay/channelPicker';
4
+ import PayChannelPicker from '../../pay/channelPicker2';
5
5
  import { InputNumber } from 'antd';
6
6
  import { Checkbox, Divider, ErrorBlock } from 'antd-mobile';
7
7
  import Info from './info';
8
8
  function RenderPayChannel(props) {
9
- const { price, payConfig, t, channel, meta, onPick, onSetMeta } = props;
9
+ const { price, payChannels, t, channel, meta, onPick, } = props;
10
10
  return (<div className={Styles.pc1}>
11
11
  <div className={Styles.content}>
12
12
  <div>
13
13
  {t('choose', { price: ToYuan(price) })}
14
14
  </div>
15
15
  <Divider />
16
- {/* <PayChannelPicker
17
- payConfig={payConfig}
18
- channel={channel}
19
- meta={meta}
20
- onPick={onPick}
21
- onSetMeta={onSetMeta}
22
- /> */}
16
+ <PayChannelPicker payChannels={payChannels} payChannel={channel} onPick={onPick}/>
23
17
  </div>
24
18
  </div>);
25
19
  }
@@ -45,7 +39,7 @@ function RenderAccountPay(props) {
45
39
  </div>);
46
40
  }
47
41
  export default function Render(props) {
48
- const { accountId, accountAvailMax, legal, accountPrice, useAccount, order, activePay, payConfig, channel, meta, rest } = props.data;
42
+ const { accountId, accountAvailMax, legal, accountPrice, useAccount, order, activePay, payChannels, channel, meta, rest } = props.data;
49
43
  const { t, setAccountPrice, onPickChannel, onSetChannelMeta, switchUseAccount } = props.methods;
50
44
  if (order) {
51
45
  if (activePay) {
@@ -60,7 +54,7 @@ export default function Render(props) {
60
54
  <RenderAccountPay max={Math.min(accountAvailMax, rest + accountPrice)} t={t} setAccountPrice={setAccountPrice} useAccount={useAccount} switchUseAccount={switchUseAccount} accountPrice={accountPrice} accountAvail={accountAvailMax}/>
61
55
  </div>}
62
56
  {!!(rest && rest > 0) && <div className={Styles.ctrl}>
63
- <RenderPayChannel payConfig={payConfig} price={rest} t={t} channel={channel} meta={meta} onPick={onPickChannel} onSetMeta={onSetChannelMeta}/>
57
+ <RenderPayChannel price={rest} t={t} payChannels={payChannels} channel={channel} meta={meta} onPick={onPickChannel}/>
64
58
  </div>}
65
59
  </div>);
66
60
  }
@@ -1,23 +1,24 @@
1
1
  import React from 'react';
2
2
  import { WebComponentProps } from 'oak-frontend-base';
3
3
  import { EntityDict } from '../../../oak-app-domain';
4
- import { AccountPayConfig, PayConfig } from '../../../types/PayConfig';
4
+ import { AccountPayConfig } from '../../../types/PayConfig';
5
+ import { PayChannel, PayChannels } from '../../../types/Pay';
5
6
  export default function Render(props: WebComponentProps<EntityDict, 'order', false, {
6
7
  accountId?: string;
7
8
  accountAvailMax: number;
8
9
  order: EntityDict['order']['OpSchema'];
9
10
  activePay?: EntityDict['pay']['OpSchema'];
10
11
  accountConfig?: AccountPayConfig;
11
- payConfig?: PayConfig;
12
+ payChannels?: PayChannels;
13
+ channel?: PayChannel;
12
14
  accountPrice: number;
13
- channel?: string;
14
15
  meta?: object;
15
16
  useAccount: boolean;
16
17
  rest: number;
17
18
  legal: false;
18
19
  }, {
19
20
  setAccountPrice: (price: number) => void;
20
- onPickChannel: (channel: string) => void;
21
+ onPickChannel: (channel: PayChannel) => void;
21
22
  onSetChannelMeta: (meta?: object) => void;
22
23
  switchUseAccount: () => void;
23
24
  }>): React.JSX.Element | null;
@@ -1,24 +1,18 @@
1
1
  import React from 'react';
2
2
  import { ToYuan, ToCent } from 'oak-domain/lib/utils/money';
3
3
  import Styles from './web.pc.module.less';
4
- // import PayChannelPicker from '../../pay/channelPicker';
4
+ import PayChannelPicker from '../../pay/channelPicker2';
5
5
  import { Divider, Checkbox, InputNumber, Flex, Result } from 'antd';
6
6
  import Info from './info';
7
7
  function RenderPayChannel(props) {
8
- const { price, payConfig, t, channel, meta, onPick, onSetMeta } = props;
8
+ const { price, payChannels, t, channel, meta, onPick, } = props;
9
9
  return (<div className={Styles.pc1}>
10
10
  <div className={Styles.content}>
11
11
  <div>
12
12
  {t('choose', { price: ToYuan(price) })}
13
13
  </div>
14
14
  <Divider />
15
- {/* <PayChannelPicker
16
- payConfig={payConfig}
17
- channel={channel}
18
- meta={meta}
19
- onPick={onPick}
20
- onSetMeta={onSetMeta}
21
- /> */}
15
+ <PayChannelPicker payChannels={payChannels} payChannel={channel} onPick={onPick}/>
22
16
  </div>
23
17
  </div>);
24
18
  }
@@ -44,7 +38,7 @@ function RenderAccountPay(props) {
44
38
  </div>);
45
39
  }
46
40
  export default function Render(props) {
47
- const { accountId, accountAvailMax, legal, accountPrice, useAccount, order, activePay, payConfig, channel, meta, rest } = props.data;
41
+ const { accountId, accountAvailMax, legal, accountPrice, useAccount, order, activePay, payChannels, channel, meta, rest } = props.data;
48
42
  const { t, setAccountPrice, onPickChannel, onSetChannelMeta, switchUseAccount } = props.methods;
49
43
  if (order) {
50
44
  if (activePay) {
@@ -59,7 +53,7 @@ export default function Render(props) {
59
53
  <RenderAccountPay max={Math.min(accountAvailMax, rest + accountPrice)} t={t} setAccountPrice={setAccountPrice} useAccount={useAccount} switchUseAccount={switchUseAccount} accountPrice={accountPrice} accountAvail={accountAvailMax}/>
60
54
  </div>}
61
55
  {!!(rest && rest > 0) && <div className={Styles.ctrl}>
62
- <RenderPayChannel payConfig={payConfig} price={rest} t={t} channel={channel} meta={meta} onPick={onPickChannel} onSetMeta={onSetChannelMeta}/>
56
+ <RenderPayChannel price={rest} t={t} payChannels={payChannels} channel={channel} meta={meta} onPick={onPickChannel}/>
63
57
  </div>}
64
58
  </div>);
65
59
  }
@@ -9,7 +9,7 @@
9
9
  <view class="list">
10
10
  <l-list title="{{t('type.label')}}" icon="warning" right-desc="{{t('type.' + type)}}" is-link="{{false}}" />
11
11
  <l-list title="{{t('pay:attr.price')}}" icon="cart" right-desc="{{priceStr}}" is-link="{{false}}" />
12
- <l-list title="{{t('pay:attr.channel')}}" icon="research" right-desc="{{t('payChannel::' + pay.entity)}}" is-link="{{false}}" />
12
+ <l-list title="{{t('pay:attr.entity')}}" icon="research" right-desc="{{t('payChannel::' + pay.entity)}}" is-link="{{false}}" />
13
13
  </view>
14
14
  </view>
15
15
  <view class="meta">
@@ -182,7 +182,7 @@ export default function Render(props) {
182
182
  {t('pay:attr.price')}
183
183
  </List.Item>
184
184
  <List.Item prefix={<GlobalOutline />} extra={t(`payChannel::${entity}`)}>
185
- {t('pay:attr.channel')}
185
+ {t('pay:attr.entity')}
186
186
  </List.Item>
187
187
  </List>
188
188
  </div>
@@ -1,11 +1,12 @@
1
1
  import React, { useState } from 'react';
2
- import { Tag, Modal, Alert, Divider, Button } from 'antd';
2
+ import { Input, DatePicker, Form, Tag, Modal, Alert, Divider, Button } from 'antd';
3
3
  import Styles from './web.pc.module.less';
4
4
  import ListPro from 'oak-frontend-base/es/components/listPro';
5
5
  import { RenderOffline } from '../detail/web.pc';
6
- import { generateNewId, generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
6
+ import { generateNewId } from 'oak-domain/lib/utils/uuid';
7
+ import { ToYuan } from 'oak-domain/lib/utils/money';
7
8
  export default function Render(props) {
8
- const { pays, offlines } = props.data;
9
+ const { pays, offlines, oakExecutable } = props.data;
9
10
  const { t, execute, updateItem, setMessage, clean } = props.methods;
10
11
  const [spId, setSpId] = useState('');
11
12
  if (pays) {
@@ -108,6 +109,9 @@ export default function Render(props) {
108
109
  });
109
110
  }
110
111
  else {
112
+ updateItem({
113
+ paid: row.price,
114
+ }, row.id, 'succeedPaying');
111
115
  setSpId(row.id);
112
116
  }
113
117
  }
@@ -123,24 +127,23 @@ export default function Render(props) {
123
127
  entity: 'offlineAccount',
124
128
  entityId
125
129
  }, spId)}/>
130
+ <Divider style={{ width: '80%', alignSelf: 'flex-end' }}/>
131
+ <Form labelCol={{ span: 8 }} wrapperCol={{ span: 12 }} layout="horizontal" style={{ width: '100%', marginTop: 12 }}>
132
+ <Form.Item label={t('pay:attr.price')}>
133
+ <Input value={ToYuan(spRow.price)} addonBefore={t('common::pay.symbol')} disabled={true}/>
134
+ </Form.Item>
135
+ <Form.Item label={t('pay:attr.successAt')}>
136
+ <DatePicker showTime onChange={(value, dateString) => {
137
+ updateItem({
138
+ successAt: value?.valueOf(),
139
+ }, spId);
140
+ }}/>
141
+ </Form.Item>
142
+ </Form>
126
143
  <div className={Styles.btn}>
127
- <Button type="primary" onClick={async () => {
144
+ <Button disabled={oakExecutable !== true} type="primary" onClick={async () => {
128
145
  const spRow = pays.find(ele => ele.id === spId);
129
- await execute(undefined, undefined, undefined, [
130
- {
131
- entity: 'pay',
132
- operation: {
133
- id: await generateNewIdAsync(),
134
- action: 'succeedPaying',
135
- data: {
136
- paid: spRow.price,
137
- },
138
- filter: {
139
- id: spId,
140
- },
141
- },
142
- }
143
- ]);
146
+ await execute();
144
147
  setSpId('');
145
148
  }}>
146
149
  {t('common::confirm')}
@@ -3,6 +3,7 @@ export default OakComponent({
3
3
  isList: false,
4
4
  projection: {
5
5
  id: 1,
6
+ payConfig: 1,
6
7
  wpAccount$system: {
7
8
  $entity: 'wpAccount',
8
9
  data: {
@@ -1,5 +1,22 @@
1
1
  {
2
- "system": "系统配置",
3
- "appsBelow": "以下为application",
4
- "mayLossUpdate": "%{name}上的更新可能会丢失,请尽快保存"
2
+ "system": "系统相关配置",
3
+ "help": "说明",
4
+ "payConfig": {
5
+ "label": {
6
+ "depositLoss": "充值手续费",
7
+ "withdrawLoss": "提现手续费",
8
+ "conservative": "保守策略",
9
+ "ratio": "按比例",
10
+ "lowest": "最低(分)",
11
+ "highest": "最高(分)",
12
+ "trim": "去尾",
13
+ "jiao": "角",
14
+ "yuan": "元",
15
+ "null": "不去尾"
16
+ },
17
+ "help": {
18
+ "depositLoss": "若不配置手续费,用户充值时渠道的手续费损失将被计算到system关联的账户之中",
19
+ "withdrawLoss": "若配置为保守策略,系统将自动计算渠道的损耗,在system账户不贴现的前提下让用户可提现的额度最大化"
20
+ }
21
+ }
5
22
  }