oak-pay-business 1.0.3 → 1.0.5

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 (102) hide show
  1. package/es/components/account/deposit/index.d.ts +1 -2
  2. package/es/components/account/deposit/index.js +29 -2
  3. package/es/components/account/deposit/index.json +9 -1
  4. package/es/components/account/deposit/index.less +10 -0
  5. package/es/components/account/deposit/index.xml +24 -0
  6. package/es/components/account/deposit/web.d.ts +1 -0
  7. package/es/components/account/deposit/web.js +12 -12
  8. package/es/components/account/deposit/web.pc.d.ts +1 -0
  9. package/es/components/account/deposit/web.pc.js +10 -10
  10. package/es/components/account/detail/index.js +103 -23
  11. package/es/components/account/detail/index.json +8 -1
  12. package/es/components/account/detail/index.less +80 -0
  13. package/es/components/account/detail/index.xml +72 -0
  14. package/es/components/account/detail/web.d.ts +21 -1
  15. package/es/components/account/detail/web.js +67 -1
  16. package/es/components/account/detail/web.mobile.module.less +52 -0
  17. package/es/components/account/detail/web.pc.d.ts +15 -1
  18. package/es/components/account/detail/web.pc.js +51 -77
  19. package/es/components/accountOper/list/web.d.ts +5 -0
  20. package/es/components/accountOper/list/web.js +5 -0
  21. package/es/components/order/pay/index.d.ts +1 -1
  22. package/es/components/order/pay/index.js +67 -25
  23. package/es/components/order/pay/index.json +17 -1
  24. package/es/components/order/pay/index.less +94 -0
  25. package/es/components/order/pay/index.xml +71 -0
  26. package/es/components/order/pay/info.d.ts +5 -0
  27. package/es/components/order/pay/info.js +11 -0
  28. package/es/components/order/pay/info.module.less +25 -0
  29. package/es/components/order/pay/locales/zh-CN.json +1 -0
  30. package/es/components/order/pay/web.d.ts +23 -0
  31. package/es/components/order/pay/web.js +62 -0
  32. package/es/components/order/pay/web.mobile.module.less +36 -0
  33. package/es/components/order/pay/web.pc.d.ts +1 -1
  34. package/es/components/order/pay/web.pc.js +32 -42
  35. package/es/components/order/pay/web.pc.module.less +0 -24
  36. package/es/components/pay/channelPicker/index.js +27 -0
  37. package/es/components/pay/channelPicker/index.json +8 -1
  38. package/es/components/pay/channelPicker/index.less +31 -0
  39. package/es/components/pay/channelPicker/index.xml +36 -0
  40. package/es/components/pay/channelPicker/locales/zh-CN.json +2 -1
  41. package/es/components/pay/channelPicker/web.d.ts +2 -0
  42. package/es/components/pay/channelPicker/web.js +29 -36
  43. package/es/components/pay/channelPicker/web.mobile.module.less +5 -0
  44. package/es/components/pay/channelPicker/web.pc.js +34 -31
  45. package/es/components/pay/detail/index.js +81 -1
  46. package/es/components/pay/detail/index.json +13 -1
  47. package/es/components/pay/detail/index.less +138 -0
  48. package/es/components/pay/detail/index.xml +143 -0
  49. package/es/components/pay/detail/locales/zh-CN.json +7 -1
  50. package/es/components/pay/detail/web.d.ts +20 -1
  51. package/es/components/pay/detail/web.js +164 -2
  52. package/es/components/pay/detail/web.mobile.module.less +49 -0
  53. package/es/components/pay/detail/web.pc.d.ts +7 -1
  54. package/es/components/pay/detail/web.pc.js +79 -59
  55. package/es/components/pay/detail/web.pc.module.less +50 -34
  56. package/es/components/pay/list/index.js +6 -3
  57. package/es/config/constants.d.ts +4 -1
  58. package/es/config/constants.js +4 -1
  59. package/es/configuration/attrUpdateMatrix.js +3 -0
  60. package/es/data/i18n.js +10 -2
  61. package/es/entities/Pay.js +1 -1
  62. package/es/triggers/accountOper.js +4 -2
  63. package/es/triggers/acount.d.ts +5 -0
  64. package/es/triggers/acount.js +20 -0
  65. package/es/triggers/index.js +2 -0
  66. package/es/triggers/pay.js +5 -2
  67. package/es/types/DependentExceptions.d.ts +2 -2
  68. package/es/utils/payClazz/{WechatPay.d.ts → WechatPay/WechatPay.d.ts} +4 -4
  69. package/es/utils/payClazz/{WechatPay.frontend.d.ts → WechatPay/WechatPay.debug.d.ts} +5 -5
  70. package/es/utils/payClazz/{WechatPay.frontend.js → WechatPay/WechatPay.debug.js} +1 -1
  71. package/es/utils/payClazz/WechatPay/index.d.ts +3 -0
  72. package/es/utils/payClazz/WechatPay/index.js +4 -0
  73. package/es/watchers/pay.js +3 -0
  74. package/lib/config/constants.d.ts +4 -1
  75. package/lib/config/constants.js +4 -1
  76. package/lib/configuration/attrUpdateMatrix.js +3 -0
  77. package/lib/data/i18n.js +10 -2
  78. package/lib/entities/Pay.js +1 -1
  79. package/lib/triggers/accountOper.js +4 -2
  80. package/lib/triggers/acount.d.ts +5 -0
  81. package/lib/triggers/acount.js +23 -0
  82. package/lib/triggers/index.js +2 -0
  83. package/lib/triggers/pay.js +5 -2
  84. package/lib/types/DependentExceptions.d.ts +2 -2
  85. package/lib/utils/payClazz/{WechatPay.d.ts → WechatPay/WechatPay.d.ts} +4 -4
  86. package/lib/utils/payClazz/{WechatPay.frontend.d.ts → WechatPay/WechatPay.debug.d.ts} +5 -5
  87. package/lib/utils/payClazz/{WechatPay.frontend.js → WechatPay/WechatPay.debug.js} +1 -1
  88. package/lib/utils/payClazz/WechatPay/index.d.ts +3 -0
  89. package/lib/utils/payClazz/WechatPay/index.js +7 -0
  90. package/lib/watchers/pay.js +3 -0
  91. package/package.json +6 -5
  92. package/src/entities/Account.ts +75 -0
  93. package/src/entities/AccountOper.ts +64 -0
  94. package/src/entities/Application.ts +54 -0
  95. package/src/entities/Order.ts +128 -0
  96. package/src/entities/Pay.ts +151 -0
  97. package/src/entities/System.ts +28 -0
  98. package/src/entities/User.ts +167 -0
  99. package/src/entities/Withdraw.ts +72 -0
  100. package/src/entities/WithdrawChannel.ts +43 -0
  101. /package/es/utils/payClazz/{WechatPay.js → WechatPay/WechatPay.js} +0 -0
  102. /package/lib/utils/payClazz/{WechatPay.js → WechatPay/WechatPay.js} +0 -0
@@ -1,9 +1,8 @@
1
1
  declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, boolean, {
2
- depositMax: number;
2
+ depositMaxCent: number;
3
3
  onSetPrice: (price: null | number) => void;
4
4
  onSetChannel: (channel: string) => void;
5
5
  onSetMeta: (meta: any) => void;
6
- price: number | null;
7
6
  channel: string;
8
7
  meta: any;
9
8
  }>) => React.ReactElement;
@@ -1,11 +1,11 @@
1
+ import { ToCent, ToYuan } from 'oak-domain/lib/utils/money';
1
2
  import { PAY_CHANNEL_ACCOUNT_NAME, PAY_CHANNEL_OFFLINE_NAME } from '../../../types/PayConfig';
2
3
  export default OakComponent({
3
4
  properties: {
4
- depositMax: 10000,
5
+ depositMaxCent: 1000000,
5
6
  onSetPrice: (price) => undefined,
6
7
  onSetChannel: (channel) => undefined,
7
8
  onSetMeta: (meta) => undefined,
8
- price: null,
9
9
  channel: '',
10
10
  meta: {},
11
11
  },
@@ -21,11 +21,38 @@ export default OakComponent({
21
21
  payConfig.push(config);
22
22
  }
23
23
  }
24
+ const { depositMaxCent } = this.props;
24
25
  return {
26
+ depositMax: ToYuan(depositMaxCent),
25
27
  account: data,
26
28
  payConfig,
27
29
  // accountConfig,
28
30
  };
29
31
  },
30
32
  features: ['application'],
33
+ listeners: {
34
+ price(v) {
35
+ this.reRender();
36
+ }
37
+ },
38
+ methods: {
39
+ onDepPriceChangeMp(event) {
40
+ const { value } = event.detail;
41
+ const { depositMaxCent } = this.props;
42
+ const price2 = parseInt(value);
43
+ if (!isNaN(price2)) {
44
+ const price = Math.min(depositMaxCent, ToCent(price2));
45
+ this.props.onSetPrice(price);
46
+ this.setState({
47
+ price,
48
+ priceStr: price ? `${ToYuan(price)}` : undefined
49
+ });
50
+ }
51
+ },
52
+ },
53
+ data: {
54
+ onChannelPickMp(channel) { this.props.onSetChannel(channel); },
55
+ onMetaSetMp(meta) { this.props.onSetMeta(meta); },
56
+ price: 0,
57
+ }
31
58
  });
@@ -1 +1,9 @@
1
- {}
1
+ {
2
+ "usingComponents": {
3
+ "l-form": "@oak-frontend-base/miniprogram_npm/lin-ui/form/index",
4
+ "l-form-item": "@oak-frontend-base/miniprogram_npm/lin-ui/form-item/index",
5
+ "l-input": "@oak-frontend-base/miniprogram_npm/lin-ui/input/index",
6
+ "l-button": "@oak-frontend-base/miniprogram_npm/lin-ui/button/index",
7
+ "pay-channel-picker": "../../pay/channelPicker/index"
8
+ }
9
+ }
@@ -0,0 +1,10 @@
1
+ @import '../../../config/styles/mp/mixins.less';
2
+ @import '../../../config/styles/mp/index.less';
3
+
4
+ .container {
5
+ background-color: @oak-bg-color-container;
6
+
7
+ .form-label {
8
+ align-self: flex-start;
9
+ }
10
+ }
@@ -0,0 +1,24 @@
1
+ <view class="container">
2
+ <l-form>
3
+ <l-form-item label="{{t('label.depPrice')}}">
4
+ <l-input
5
+ hide-label
6
+ value="{{priceStr || ''}}"
7
+ type="number"
8
+ bind:lininput="onDepPriceChangeMp"
9
+ placeholder="一次最大充值{{depositMax}}元"
10
+ />
11
+ </l-form-item>
12
+ <view wx:if="{{price > 0}}">
13
+ <l-form-item label="{{t('label.channel')}}" l-form-label-class="form-label">
14
+ <pay-channel-picker
15
+ payConfig="{{payConfig}}"
16
+ onPick="{{onChannelPickMp}}"
17
+ channel="{{channel}}"
18
+ meta="{{meta}}"
19
+ onSetMeta="{{onMetaSetMp}}"
20
+ />
21
+ </l-form-item>
22
+ </view>
23
+ </l-form>
24
+ </view>
@@ -10,6 +10,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'account', f
10
10
  onSetChannel: (channel: string) => void;
11
11
  onSetMeta: (meta: any) => void;
12
12
  price: number;
13
+ priceStr: string | undefined;
13
14
  channel: string;
14
15
  meta: any;
15
16
  }>): React.JSX.Element | null;
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
2
  import ChannelPicker from '../../pay/channelPicker';
3
3
  import { Form, Input } from 'antd-mobile';
4
- import { ToYuan, ToCent } from 'oak-domain/lib/utils/money';
4
+ import { ToCent } from 'oak-domain/lib/utils/money';
5
5
  export default function Render(props) {
6
- const { depositMax, payConfig, price, channel, meta, onSetChannel, onSetMeta, onSetPrice } = props.data;
6
+ const { depositMax, payConfig, price, channel, meta, priceStr, onSetChannel, onSetMeta, onSetPrice } = props.data;
7
7
  const { t } = props.methods;
8
8
  if (payConfig) {
9
- return (<Form layout="horizontal">
10
- <Form.Item label={<span>{t("label.depPrice")}:</span>} extra={t('common::pay.symbol')}>
11
- <Input type='number' placeholder={t('placeholder', { max: depositMax })} max={depositMax} min={1} value={typeof price == 'number' ? `${ToYuan(price)}` : undefined} onChange={(value) => {
9
+ return (<Form layout="horizontal">
10
+ <Form.Item label={<span>{t("label.depPrice")}:</span>} extra={t('common::pay.symbol')}>
11
+ <Input type='number' placeholder={t('placeholder', { max: depositMax })} max={depositMax} min={1} value={priceStr} onChange={(value) => {
12
12
  if (value === '' || value === null) {
13
13
  onSetPrice(null);
14
14
  return;
@@ -17,15 +17,15 @@ export default function Render(props) {
17
17
  if (!isNaN(v)) {
18
18
  onSetPrice(ToCent(v));
19
19
  }
20
- }}/>
21
- </Form.Item>
22
- {price > 0 && <Form.Item label={<span>
23
- {t('label.channel')}:
24
- </span>}>
20
+ }}/>
21
+ </Form.Item>
22
+ {price > 0 && <Form.Item label={<span>
23
+ {t('label.channel')}:
24
+ </span>}>
25
25
  <ChannelPicker payConfig={payConfig} onPick={(channel) => {
26
26
  onSetChannel(channel);
27
- }} channel={channel} meta={meta} onSetMeta={(meta) => onSetMeta(meta)}/>
28
- </Form.Item>}
27
+ }} channel={channel} meta={meta} onSetMeta={(meta) => onSetMeta(meta)}/>
28
+ </Form.Item>}
29
29
  </Form>);
30
30
  }
31
31
  return null;
@@ -10,6 +10,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'account', f
10
10
  onSetChannel: (channel: string) => void;
11
11
  onSetMeta: (meta: any) => void;
12
12
  price: number;
13
+ priceStr: string | undefined;
13
14
  channel: string;
14
15
  meta: any;
15
16
  }>): React.JSX.Element | null;
@@ -3,22 +3,22 @@ import { Form, InputNumber } from 'antd';
3
3
  import ChannelPicker from '../../pay/channelPicker';
4
4
  import { ToYuan, ToCent } from 'oak-domain/lib/utils/money';
5
5
  export default function Render(props) {
6
- const { depositMax, payConfig, price, channel, meta, onSetChannel, onSetMeta, onSetPrice } = props.data;
6
+ const { depositMax, payConfig, price, channel, meta, priceStr, onSetChannel, onSetMeta, onSetPrice } = props.data;
7
7
  const { t } = props.methods;
8
8
  if (payConfig) {
9
- return (<Form labelCol={{ span: 4 }} wrapperCol={{ span: 14 }} layout="horizontal" style={{ minWidth: 600 }} colon={false}>
10
- <Form.Item label={<span>{t("label.depPrice")}:</span>}>
9
+ return (<Form labelCol={{ span: 4 }} wrapperCol={{ span: 14 }} layout="horizontal" style={{ minWidth: 600 }} colon={false}>
10
+ <Form.Item label={<span>{t("label.depPrice")}:</span>}>
11
11
  <InputNumber placeholder={t('placeholder', { max: depositMax })} max={depositMax} min={1} value={typeof price == 'number' ? ToYuan(price) : null} addonAfter={t('common::pay.symbol')} onChange={(value) => {
12
12
  onSetPrice(ToCent(value || 0));
13
- }}/>
14
- </Form.Item>
15
- {price > 0 ? <Form.Item label={<span style={{ marginTop: 10 }}>
16
- {t('label.channel')}:
17
- </span>}>
13
+ }}/>
14
+ </Form.Item>
15
+ {price > 0 ? <Form.Item label={<span style={{ marginTop: 10 }}>
16
+ {t('label.channel')}:
17
+ </span>}>
18
18
  <ChannelPicker payConfig={payConfig} onPick={(channel) => {
19
19
  onSetChannel(channel);
20
- }} channel={channel} meta={meta} onSetMeta={(meta) => onSetMeta(meta)}/>
21
- </Form.Item> : <div style={{ height: 120 }}/>}
20
+ }} channel={channel} meta={meta} onSetMeta={(meta) => onSetMeta(meta)}/>
21
+ </Form.Item> : <div style={{ height: 120 }}/>}
22
22
  </Form>);
23
23
  }
24
24
  return null;
@@ -1,4 +1,7 @@
1
+ import { CentToString } from "oak-domain/lib/utils/money";
1
2
  import { generateNewIdAsync } from "oak-domain/lib/utils/uuid";
3
+ import assert from 'assert';
4
+ import { DATA_SUBSCRIBER_KEYS } from "../../../config/constants";
2
5
  export default OakComponent({
3
6
  entity: 'account',
4
7
  isList: false,
@@ -53,39 +56,116 @@ export default OakComponent({
53
56
  const unfinishedPayId = data?.pay$account?.[0]?.id;
54
57
  return {
55
58
  account: data,
59
+ availStr: data?.avail && CentToString(data.avail, 2),
60
+ totalStr: data?.total && CentToString(data.total, 2),
56
61
  unfinishedPayId,
57
62
  };
58
63
  },
59
64
  actions: ['deposit', 'withdraw'],
60
65
  methods: {
61
- async createDepositPay(price, channel, meta) {
66
+ async createDepositPay() {
67
+ const { depPrice, depositChannel, depositMeta } = this.state;
62
68
  const payId = await generateNewIdAsync();
63
69
  const { oakId } = this.props;
64
- await this.execute(undefined, undefined, undefined, [
65
- {
66
- entity: 'account',
67
- operation: {
68
- id: await generateNewIdAsync(),
69
- action: 'deposit',
70
- data: {
71
- pay$account: {
72
- id: await generateNewIdAsync(),
73
- action: 'create',
74
- data: {
75
- id: payId,
76
- channel,
77
- price,
78
- meta,
70
+ this.setDepositing(true);
71
+ try {
72
+ await this.execute(undefined, undefined, undefined, [
73
+ {
74
+ entity: 'account',
75
+ operation: {
76
+ id: await generateNewIdAsync(),
77
+ action: 'deposit',
78
+ data: {
79
+ pay$account: {
80
+ id: await generateNewIdAsync(),
81
+ action: 'create',
82
+ data: {
83
+ id: payId,
84
+ channel: depositChannel,
85
+ price: depPrice,
86
+ meta: depositMeta,
87
+ },
79
88
  },
80
89
  },
90
+ filter: {
91
+ id: oakId,
92
+ }
81
93
  },
82
- filter: {
83
- id: oakId,
84
- }
85
- },
86
- }
87
- ]);
88
- return payId;
94
+ }
95
+ ]);
96
+ this.setDepositing(false);
97
+ }
98
+ catch (err) {
99
+ this.setDepositing(false);
100
+ throw err;
101
+ }
102
+ this.onDepositModalClose();
103
+ const { onDepositPayId } = this.props;
104
+ onDepositPayId && onDepositPayId(payId);
105
+ },
106
+ setDepositMeta(depositMeta) {
107
+ this.setState({ depositMeta });
108
+ },
109
+ setDepositOpen(depositOpen) {
110
+ this.setState({ depositOpen });
111
+ },
112
+ setUfOpen(ufOpen) {
113
+ this.setState({ ufOpen });
114
+ },
115
+ setDepPrice(depPrice) {
116
+ this.setState({ depPrice });
117
+ },
118
+ setDepositChannel(depositChannel) {
119
+ this.setState({ depositChannel });
120
+ },
121
+ setDepositing(depositing) {
122
+ this.setState({ depositing });
123
+ },
124
+ onDepositClick() {
125
+ const { unfinishedPayId } = this.state;
126
+ if (unfinishedPayId) {
127
+ this.setUfOpen(true);
128
+ }
129
+ else {
130
+ this.setDepositOpen(true);
131
+ }
132
+ },
133
+ onDepositModalClose() {
134
+ this.setDepositOpen(false);
135
+ this.setDepPrice(null);
136
+ this.setDepositChannel(undefined);
137
+ this.setDepositMeta(undefined);
138
+ },
139
+ onUfModalClose() {
140
+ this.setUfOpen(false);
141
+ },
142
+ onUnfinishedPayClickedMp() {
143
+ const { onDepositPayId } = this.props;
144
+ const { unfinishedPayId } = this.state;
145
+ onDepositPayId && onDepositPayId(unfinishedPayId);
146
+ }
147
+ },
148
+ data: {
149
+ depositOpen: false,
150
+ ufOpen: false,
151
+ depPrice: null,
152
+ depositChannel: undefined,
153
+ depositMeta: undefined,
154
+ depositing: false,
155
+ setDepPriceMp(price) { this.setDepPrice(price); },
156
+ setDepositChannelMp(depositChannel) { this.setDepositChannel(depositChannel); },
157
+ setDepositMetaMp(depositMeta) { this.setDepositMeta(depositMeta); }
158
+ },
159
+ lifetimes: {
160
+ ready() {
161
+ const { oakId } = this.props;
162
+ assert(typeof oakId === 'string');
163
+ this.subDataEvents([`${DATA_SUBSCRIBER_KEYS.accountNumberChanged}-${oakId}`]);
164
+ },
165
+ detached() {
166
+ const { oakId } = this.props;
167
+ assert(typeof oakId === 'string');
168
+ this.unsubDataEvents([`${DATA_SUBSCRIBER_KEYS.accountNumberChanged}-${oakId}`]);
89
169
  }
90
170
  }
91
171
  });
@@ -1 +1,8 @@
1
- {}
1
+ {
2
+ "usingComponents": {
3
+ "l-button": "@oak-frontend-base/miniprogram_npm/lin-ui/button/index",
4
+ "l-popup": "@oak-frontend-base/miniprogram_npm/lin-ui/popup/index",
5
+ "l-dialog": "@oak-frontend-base/miniprogram_npm/lin-ui/dialog/index",
6
+ "account-deposit": "../deposit/index"
7
+ }
8
+ }
@@ -0,0 +1,80 @@
1
+ @import '../../../config/styles/mp/mixins.less';
2
+ @import '../../../config/styles/mp/index.less';
3
+
4
+ .container {
5
+ height: 100%;
6
+ display: flex;
7
+ flex-direction: column;
8
+ align-items: center;
9
+ }
10
+
11
+
12
+ .info {
13
+ height: 600rpx;
14
+ display: flex;
15
+ flex-direction: column;
16
+ align-items: center;
17
+ justify-content: center;
18
+
19
+ .grid {
20
+ padding: 20rpx;
21
+ display: flex;
22
+ align-items: center;
23
+
24
+
25
+ .label {
26
+ font-size: 28rpx;
27
+ color: @oak-color-primary;
28
+ margin-right: 8rpx;
29
+ }
30
+
31
+ .value {
32
+ font-size: 28rpx;
33
+ color: @oak-color-primary;
34
+ }
35
+ }
36
+
37
+ .fortify {
38
+ .label {
39
+ font-size: x-large;
40
+ }
41
+
42
+ .value {
43
+ font-size: x-large;
44
+ font-weight: bolder;
45
+ }
46
+ }
47
+ }
48
+
49
+ .btn {
50
+ display: flex;
51
+ align-self: stretch;
52
+
53
+ .item {
54
+ flex: 1,
55
+ }
56
+ }
57
+
58
+ .ad-container {
59
+ padding: 24rpx;
60
+ margin-bottom: 12rpx;
61
+ background-color: white;
62
+ }
63
+
64
+ .uf {
65
+ background-color: white;
66
+ display: flex;
67
+ flex-direction: column;
68
+ align-items: center;
69
+ padding: 12px;
70
+
71
+ .tips {
72
+ color: @oak-color-warning;
73
+ font-size: x-large;
74
+ }
75
+
76
+ .btn {
77
+ margin-top: 18rpx;
78
+ align-self: stretch;
79
+ }
80
+ }
@@ -0,0 +1,72 @@
1
+ <view class="container">
2
+ <view class="info">
3
+ <view class="grid fortify">
4
+ <view class="label">{{t('avail')}}:</view>
5
+ <view class="value">{{t('common::pay.symbol')}} {{availStr}}</view>
6
+ </view>
7
+ <view class="grid">
8
+ <view class="label">{{t('total')}}:</view>
9
+ <view class="value">{{t('common::pay.symbol')}} {{totalStr}}</view>
10
+ </view>
11
+ </view>
12
+ <view style="flex: 1" />
13
+ <view class="btn">
14
+ <view class="item">
15
+ <l-button
16
+ type="default"
17
+ size="long"
18
+ bind:lintap="onDepositClick"
19
+ >
20
+ {{t('account:action.deposit')}}
21
+ </l-button>
22
+ </view>
23
+ <view class="item">
24
+ <l-button
25
+ type="success"
26
+ size="long"
27
+ >
28
+ {{t('account:action.withdraw')}}
29
+ </l-button>
30
+ </view>
31
+ </view>
32
+ <block wx:if="{{depositOpen}}">
33
+ <l-popup
34
+ show="{{depositOpen}}"
35
+ content-align="bottom"
36
+ bind:lintap="onDepositModalClose"
37
+ >
38
+ <view class="ad-container">
39
+ <account-deposit
40
+ depositMax='{{depositMax}}'
41
+ channel='{{depositChannel}}'
42
+ meta='{{depositMeta}}'
43
+ onSetPrice="{{setDepPriceMp}}"
44
+ onSetChannel="{{setDepositChannelMp}}"
45
+ onSetMeta="{{setDepositMetaMp}}"
46
+ />
47
+ <view style="margin-top: 12rpx">
48
+ <l-button
49
+ type="default"
50
+ size="long"
51
+ disabled="{{!depPrice || !depositChannel || depositing}}"
52
+ loading="{{depositing}}"
53
+ bind:lintap="createDepositPay"
54
+ >
55
+ {{depositing ? t('depositing') : t('common::confirm')}}
56
+ </l-button>
57
+ </view>
58
+ </view>
59
+ </l-popup>
60
+ </block>
61
+ <block wx:if="{{ufOpen}}">
62
+ <l-dialog
63
+ show="{{ufOpen}}"
64
+ type="alert"
65
+ show-title="{{false}}"
66
+ content="{{t('uf.content')}}"
67
+ confirm-text="{{t('uf.go')}}"
68
+ bind:linconfirm="onUnfinishedPayClickedMp"
69
+ bind:lintap="onUfModalClose"
70
+ />
71
+ </block>
72
+ </view>
@@ -3,4 +3,24 @@ import { RowWithActions, WebComponentProps } from 'oak-frontend-base';
3
3
  import { EntityDict } from '../../../oak-app-domain';
4
4
  export default function Render(props: WebComponentProps<EntityDict, 'account', false, {
5
5
  account: RowWithActions<EntityDict, 'account'>;
6
- }>): React.JSX.Element;
6
+ depositMax: number;
7
+ unfinishedPayId?: string;
8
+ onDepositPayId: (payId: string) => void;
9
+ depositOpen: boolean;
10
+ ufOpen: boolean;
11
+ depPrice: number | null;
12
+ depositChannel: string | undefined;
13
+ depositMeta: any;
14
+ depositing: boolean;
15
+ }, {
16
+ createDepositPay: () => Promise<string>;
17
+ setDepositOpen: (v: boolean) => void;
18
+ setUfOpen: (v: boolean) => void;
19
+ setDepPrice: (v: number | null) => void;
20
+ setDepositChannel: (v: string | undefined) => void;
21
+ setDepositMeta: (v: any) => void;
22
+ setDepositing: (v: boolean) => void;
23
+ onDepositClick: () => void;
24
+ onDepositModalClose: () => void;
25
+ onUfModalClose: () => void;
26
+ }>): React.JSX.Element | null;
@@ -1,4 +1,70 @@
1
1
  import React from 'react';
2
+ import { Button, Popup, Dialog } from 'antd-mobile';
3
+ import Styles from './web.mobile.module.less';
4
+ import classNames from 'classnames';
5
+ import { CentToString } from 'oak-domain/lib/utils/money';
6
+ import AccountDeposit from '../deposit';
2
7
  export default function Render(props) {
3
- return <div>account/detail</div>;
8
+ const { account, depositMax, unfinishedPayId, onDepositPayId, depositOpen, ufOpen, depPrice, depositChannel, depositMeta, depositing } = props.data;
9
+ const { t, createDepositPay, setMessage, setDepositOpen, setUfOpen, setDepPrice, setDepositChannel, setDepositMeta, setDepositing, onDepositClick, onDepositModalClose, onUfModalClose } = props.methods;
10
+ if (account) {
11
+ const { total, avail, '#oakLegalActions': legalActions, accountOper$account: opers } = account;
12
+ return (<div className={Styles.container}>
13
+ <div className={Styles.info}>
14
+ <div className={classNames(Styles.grid, Styles.fortify)}>
15
+ <span className={Styles.label}>{t('avail')}:</span>
16
+ <span className={Styles.value}>{t('common::pay.symbol')} {CentToString(avail, 2)}</span>
17
+ </div>
18
+ <div className={Styles.grid}>
19
+ <span className={Styles.label}>{t('total')}:</span>
20
+ <span className={Styles.value}>{t('common::pay.symbol')} {CentToString(total, 2)}</span>
21
+ </div>
22
+ </div>
23
+ <div style={{ flex: 1 }}/>
24
+ <div className={Styles.btn}>
25
+ {legalActions?.includes('deposit') && <div className={Styles.item}>
26
+ <Button block color="primary" disabled={ufOpen || depositOpen} onClick={() => {
27
+ if (unfinishedPayId) {
28
+ Dialog.alert({
29
+ title: t('uf.title'),
30
+ content: t('uf.content'),
31
+ confirmText: t('uf.go'),
32
+ onConfirm: () => onDepositPayId(unfinishedPayId)
33
+ });
34
+ }
35
+ else {
36
+ onDepositClick();
37
+ }
38
+ }}>
39
+ {t('account:action.deposit')}
40
+ </Button>
41
+ </div>}
42
+ {legalActions?.includes('withdraw') && <div className={Styles.item}>
43
+ <Button block onClick={() => setMessage({
44
+ type: 'warning',
45
+ content: '尚未实现'
46
+ })}>
47
+ {t('account:action.withdraw')}
48
+ </Button>
49
+ </div>}
50
+ </div>
51
+ <Popup visible={depositOpen} onMaskClick={() => onDepositModalClose()} onClose={() => onDepositModalClose()}>
52
+ <div style={{ padding: 12, marginBottom: 6 }}>
53
+ <AccountDeposit depositMax={depositMax} channel={depositChannel} meta={depositMeta} onSetPrice={(price) => setDepPrice(price)} onSetChannel={(channel) => setDepositChannel(channel)} onSetMeta={(meta) => setDepositMeta(meta)}/>
54
+ <Button block loading={depositing} color="primary" disabled={!depPrice || !depositChannel || depositing} onClick={() => createDepositPay()}>
55
+ {depositing ? t('depositing') : t('common::confirm')}
56
+ </Button>
57
+ </div>
58
+ </Popup>
59
+ <Popup visible={ufOpen} onMaskClick={() => onUfModalClose()} onClose={() => onUfModalClose()} destroyOnClose={true}>
60
+ <div className={Styles.uf}>
61
+ <div className={Styles.tips}>{t('uf.content')}</div>
62
+ <Button color="warning" onClick={() => onDepositPayId(unfinishedPayId)}>
63
+ {t('uf.go')}
64
+ </Button>
65
+ </div>
66
+ </Popup>
67
+ </div>);
68
+ }
69
+ return null;
4
70
  }
@@ -0,0 +1,52 @@
1
+ .container {
2
+ height: 100%;
3
+ display: flex;
4
+ flex-direction: column;
5
+ align-items: center;
6
+
7
+ .info {
8
+ height: 300px;
9
+ display: flex;
10
+ flex-direction: column;
11
+ align-items: center;
12
+ justify-content: center;
13
+
14
+ .grid {
15
+ padding: 10px;
16
+ display: flex;
17
+ align-items: center;
18
+
19
+
20
+ .label {
21
+ font-size: 14px;
22
+ color: var(--oak-color-primary);
23
+ margin-right: 4px;
24
+ }
25
+
26
+ .value {
27
+ font-size: 14px;
28
+ color: var(--oak-color-primary);
29
+ }
30
+ }
31
+
32
+ .fortify {
33
+ .label {
34
+ font-size: x-large;
35
+ }
36
+
37
+ .value {
38
+ font-size: x-large;
39
+ font-weight: bolder;
40
+ }
41
+ }
42
+ }
43
+
44
+ .btn {
45
+ display: flex;
46
+ align-self: stretch;
47
+
48
+ .item {
49
+ flex: 1,
50
+ }
51
+ }
52
+ }