oak-pay-business 2.2.1 → 2.2.3

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 (169) hide show
  1. package/es/aspects/AspectDict.d.ts +3 -3
  2. package/es/aspects/index.d.ts +2 -1
  3. package/es/checkers/accountOper.js +4 -3
  4. package/es/checkers/offlineAccount.js +4 -1
  5. package/es/checkers/order.js +39 -0
  6. package/es/checkers/refund.js +1 -0
  7. package/es/components/AbstractComponents.d.ts +15 -10
  8. package/es/components/account/detail/web.pc.module.less +68 -68
  9. package/es/components/offlineAccount/upsert/web.pc.js +1 -1
  10. package/es/components/order/pay/index.js +1 -1
  11. package/es/components/order/pay/info.js +6 -6
  12. package/es/components/order/pay/info.module.less +24 -24
  13. package/es/components/order/pay/web.mobile.module.less +35 -35
  14. package/es/components/order/pay/web.pc.module.less +35 -35
  15. package/es/components/payConfig/upsert/offline/web.pc.module.less +4 -4
  16. package/es/components/payConfig/upsert/web.pc.module.less +10 -10
  17. package/es/components/sysAccount/survey/locales/zh-CN.json +3 -1
  18. package/es/components/sysAccount/survey/web.pc.js +69 -32
  19. package/es/components/sysAccount/survey/web.pc.module.less +3 -2
  20. package/es/components/sysAccount/transferList/index.d.ts +3 -0
  21. package/es/components/sysAccount/transferList/index.js +52 -0
  22. package/es/components/sysAccount/transferList/index.json +1 -0
  23. package/es/components/sysAccount/transferList/locales/zh-CN.json +6 -0
  24. package/es/components/sysAccount/transferList/web.pc.d.ts +12 -0
  25. package/es/components/sysAccount/transferList/web.pc.js +45 -0
  26. package/es/components/sysAccountMove/create/index.d.ts +7 -0
  27. package/es/components/sysAccountMove/create/index.js +145 -0
  28. package/es/components/sysAccountMove/create/index.json +1 -0
  29. package/es/components/sysAccountMove/create/locales/zh-CN.json +6 -0
  30. package/es/components/sysAccountMove/create/web.pc.d.ts +26 -0
  31. package/es/components/sysAccountMove/create/web.pc.js +68 -0
  32. package/es/components/sysAccountOper/list/index.d.ts +5 -0
  33. package/es/components/sysAccountOper/list/index.js +127 -0
  34. package/es/components/sysAccountOper/list/index.json +1 -0
  35. package/es/components/sysAccountOper/list/locales/zh-CN.json +5 -0
  36. package/es/components/sysAccountOper/list/web.module.less +42 -0
  37. package/es/components/sysAccountOper/list/web.pc.d.ts +25 -0
  38. package/es/components/sysAccountOper/list/web.pc.js +36 -0
  39. package/es/components/withdrawAccount/list/index.less +8 -0
  40. package/es/components/withdrawAccount/list/index.xml +6 -1
  41. package/es/components/withdrawTransfer/list/locales/zh-CN.json +1 -1
  42. package/es/components/wpAccount/upsert/web.pc.js +1 -1
  43. package/es/configuration/attrUpdateMatrix.js +2 -2
  44. package/es/data/actionAuth.js +7 -2
  45. package/es/data/i18n.js +53 -3
  46. package/es/data/path.js +2 -2
  47. package/es/entities/AccountOper.d.ts +1 -1
  48. package/es/entities/AccountOper.js +3 -1
  49. package/es/entities/OfflineAccount.d.ts +1 -1
  50. package/es/entities/OfflineAccount.js +8 -2
  51. package/es/entities/Order.d.ts +2 -1
  52. package/es/entities/Order.js +1 -0
  53. package/es/entities/SysAccountMove.d.ts +13 -0
  54. package/es/entities/SysAccountMove.js +18 -0
  55. package/es/entities/SysAccountOper.d.ts +4 -1
  56. package/es/entities/SysAccountOper.js +1 -0
  57. package/es/entities/WpAccount.d.ts +1 -1
  58. package/es/entities/WpAccount.js +8 -2
  59. package/es/locales/error/zh-CN.json +9 -0
  60. package/es/locales/offlineAccount/zh-CN.json +2 -1
  61. package/es/oak-app-domain/AccountOper/Schema.d.ts +1 -1
  62. package/es/oak-app-domain/AccountOper/Storage.js +1 -1
  63. package/es/oak-app-domain/AccountOper/Style.js +1 -0
  64. package/es/oak-app-domain/AccountOper/locales/zh_CN.json +1 -1
  65. package/es/oak-app-domain/EntityDict.d.ts +2 -0
  66. package/es/oak-app-domain/OfflineAccount/Action.d.ts +1 -1
  67. package/es/oak-app-domain/OfflineAccount/Action.js +1 -1
  68. package/es/oak-app-domain/OfflineAccount/Style.js +4 -1
  69. package/es/oak-app-domain/OfflineAccount/locales/zh_CN.json +1 -1
  70. package/es/oak-app-domain/Order/Schema.d.ts +8 -2
  71. package/es/oak-app-domain/Order/Storage.js +3 -1
  72. package/es/oak-app-domain/Order/locales/zh_CN.json +1 -1
  73. package/es/oak-app-domain/Path/Schema.d.ts +6 -0
  74. package/es/oak-app-domain/Path/Storage.js +6 -0
  75. package/es/oak-app-domain/Path/locales/zh_CN.json +1 -1
  76. package/es/oak-app-domain/Storage.js +2 -0
  77. package/es/oak-app-domain/SysAccountMove/Schema.d.ts +185 -0
  78. package/es/oak-app-domain/SysAccountMove/Schema.js +1 -0
  79. package/es/oak-app-domain/SysAccountMove/Storage.d.ts +3 -0
  80. package/es/oak-app-domain/SysAccountMove/Storage.js +31 -0
  81. package/es/oak-app-domain/SysAccountMove/locales/zh_CN.json +1 -0
  82. package/es/oak-app-domain/SysAccountOper/Schema.d.ts +34 -5
  83. package/es/oak-app-domain/SysAccountOper/Storage.js +4 -0
  84. package/es/oak-app-domain/SysAccountOper/locales/zh_CN.json +1 -1
  85. package/es/oak-app-domain/System/Schema.d.ts +12 -0
  86. package/es/oak-app-domain/User/Schema.d.ts +12 -0
  87. package/es/oak-app-domain/WpAccount/Action.d.ts +1 -1
  88. package/es/oak-app-domain/WpAccount/Action.js +1 -1
  89. package/es/oak-app-domain/WpAccount/Style.js +4 -1
  90. package/es/oak-app-domain/WpAccount/locales/zh_CN.json +1 -1
  91. package/es/oak-app-domain/_SubQuery.d.ts +12 -0
  92. package/es/triggers/pay.js +149 -46
  93. package/es/triggers/refund.js +3 -0
  94. package/es/triggers/withdraw.d.ts +1 -1
  95. package/es/types/RuntimeCxt.d.ts +1 -1
  96. package/es/types/sysAccountOper.d.ts +1 -0
  97. package/es/types/sysAccountOper.js +1 -0
  98. package/es/utils/payClazz/Account.js +3 -2
  99. package/es/utils/payClazz/WechatPay/index.d.ts +1 -1
  100. package/es/utils/wpProductFrontend.js +1 -1
  101. package/lib/aspects/AspectDict.d.ts +3 -3
  102. package/lib/aspects/index.d.ts +2 -1
  103. package/lib/aspects/withdraw.d.ts +8 -8
  104. package/lib/checkers/accountOper.js +4 -3
  105. package/lib/checkers/offlineAccount.js +4 -1
  106. package/lib/checkers/order.js +39 -0
  107. package/lib/checkers/refund.js +1 -0
  108. package/lib/configuration/attrUpdateMatrix.js +2 -2
  109. package/lib/data/actionAuth.js +7 -2
  110. package/lib/data/i18n.js +53 -3
  111. package/lib/data/path.js +2 -2
  112. package/lib/entities/AccountOper.d.ts +1 -1
  113. package/lib/entities/AccountOper.js +3 -1
  114. package/lib/entities/OfflineAccount.d.ts +1 -1
  115. package/lib/entities/OfflineAccount.js +8 -2
  116. package/lib/entities/Order.d.ts +2 -1
  117. package/lib/entities/Order.js +1 -0
  118. package/lib/entities/SysAccountMove.d.ts +13 -0
  119. package/lib/entities/SysAccountMove.js +21 -0
  120. package/lib/entities/SysAccountOper.d.ts +4 -1
  121. package/lib/entities/SysAccountOper.js +1 -0
  122. package/lib/entities/WpAccount.d.ts +1 -1
  123. package/lib/entities/WpAccount.js +8 -2
  124. package/lib/locales/error/zh-CN.json +9 -0
  125. package/lib/locales/offlineAccount/zh-CN.json +2 -1
  126. package/lib/oak-app-domain/AccountOper/Schema.d.ts +1 -1
  127. package/lib/oak-app-domain/AccountOper/Storage.js +1 -1
  128. package/lib/oak-app-domain/AccountOper/Style.js +1 -0
  129. package/lib/oak-app-domain/AccountOper/locales/zh_CN.json +1 -1
  130. package/lib/oak-app-domain/EntityDict.d.ts +2 -0
  131. package/lib/oak-app-domain/OfflineAccount/Action.d.ts +1 -1
  132. package/lib/oak-app-domain/OfflineAccount/Action.js +1 -1
  133. package/lib/oak-app-domain/OfflineAccount/Style.js +4 -1
  134. package/lib/oak-app-domain/OfflineAccount/locales/zh_CN.json +1 -1
  135. package/lib/oak-app-domain/Order/Schema.d.ts +8 -2
  136. package/lib/oak-app-domain/Order/Storage.js +3 -1
  137. package/lib/oak-app-domain/Order/locales/zh_CN.json +1 -1
  138. package/lib/oak-app-domain/Path/Schema.d.ts +6 -0
  139. package/lib/oak-app-domain/Storage.js +18 -16
  140. package/lib/oak-app-domain/SysAccountMove/Schema.d.ts +185 -0
  141. package/lib/oak-app-domain/SysAccountMove/Schema.js +2 -0
  142. package/lib/oak-app-domain/SysAccountMove/Storage.d.ts +3 -0
  143. package/lib/oak-app-domain/SysAccountMove/Storage.js +34 -0
  144. package/lib/oak-app-domain/SysAccountMove/locales/zh_CN.json +1 -0
  145. package/lib/oak-app-domain/SysAccountOper/Schema.d.ts +34 -5
  146. package/lib/oak-app-domain/SysAccountOper/Storage.js +4 -0
  147. package/lib/oak-app-domain/SysAccountOper/locales/zh_CN.json +1 -1
  148. package/lib/oak-app-domain/System/Schema.d.ts +12 -0
  149. package/lib/oak-app-domain/System/Storage.js +1 -2
  150. package/lib/oak-app-domain/User/Schema.d.ts +12 -0
  151. package/lib/oak-app-domain/WpAccount/Action.d.ts +1 -1
  152. package/lib/oak-app-domain/WpAccount/Action.js +1 -1
  153. package/lib/oak-app-domain/WpAccount/Style.js +4 -1
  154. package/lib/oak-app-domain/WpAccount/locales/zh_CN.json +1 -1
  155. package/lib/oak-app-domain/_SubQuery.d.ts +12 -0
  156. package/lib/triggers/pay.js +149 -46
  157. package/lib/triggers/refund.js +3 -0
  158. package/lib/types/RuntimeCxt.d.ts +1 -1
  159. package/lib/types/sysAccountOper.d.ts +1 -0
  160. package/lib/types/sysAccountOper.js +2 -0
  161. package/lib/utils/payClazz/Account.js +3 -2
  162. package/lib/utils/wpProductFrontend.js +1 -1
  163. package/package.json +171 -200
  164. package/src/entities/AccountOper.ts +4 -2
  165. package/src/entities/OfflineAccount.ts +12 -5
  166. package/src/entities/Order.ts +3 -1
  167. package/src/entities/SysAccountMove.ts +39 -0
  168. package/src/entities/SysAccountOper.ts +5 -1
  169. package/src/entities/WpAccount.ts +11 -4
@@ -1,10 +1,13 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import { Descriptions, Tag, Modal, Flex, Button, Divider, Alert } from 'antd';
3
3
  import { AlipayOutlined, WechatOutlined } from '@ant-design/icons';
4
4
  import Styles from './web.pc.module.less';
5
5
  import { ThousandCont, ToYuan } from "oak-domain/lib/utils/money";
6
6
  import { OfflineAccount as OADetail } from '../../offlineAccount/config/web.pc';
7
7
  import { WpAccount as WADetail } from '../../wpAccount/config/web.pc';
8
+ import TransferList from '../transferList';
9
+ import SysAccountMoveCreate from '../../sysAccountMove/create';
10
+ import SysAccountOperList from '../../sysAccountOper/list';
8
11
  function OfflineAccount(props) {
9
12
  const { data, t } = props;
10
13
  const { type, channel, color, name } = data;
@@ -65,6 +68,10 @@ export default function render(props) {
65
68
  const { accounts, total, systemId, accountNum, accountTotalSum, accountAvailSum, refundCnt, refundPriceSum, transferCnt, transferPriceSum, orderCnt, orderPaidSum, orderRefundSum, } = props.data;
66
69
  const { t, setMessage } = props.methods;
67
70
  if (accounts && systemId) {
71
+ const [showTransferList, setShowTransferList] = useState(false);
72
+ const [showMoveCreate, setShowMoveCreate] = useState(false);
73
+ const [showHistoryList, setShowHistoryList] = useState(false);
74
+ const [showHistoryAcc, setShowHistoryAcc] = useState(undefined);
68
75
  return (<div className={Styles.container}>
69
76
  <Descriptions title={t('sysAccount')} bordered items={[
70
77
  {
@@ -78,7 +85,14 @@ export default function render(props) {
78
85
  label: t('count'),
79
86
  children: accounts.length,
80
87
  }
81
- ]} column={2}/>
88
+ ]} column={2} extra={<>
89
+ <Button type="primary" onClick={() => setShowMoveCreate(true)}>
90
+ {t('move')}
91
+ </Button>
92
+ <Modal destroyOnClose open={showMoveCreate} onCancel={() => setShowMoveCreate(false)} closeIcon={null} width={800} title={t('move')} footer={null}>
93
+ <SysAccountMoveCreate oakPath="$opb-sysAccount-survery-saMoveCreate" systemId={systemId} onSuccess={() => setShowMoveCreate(false)}/>
94
+ </Modal>
95
+ </>}/>
82
96
  <div className={Styles.sysAccounts}>
83
97
  {accounts.map(({ entity, data }, idx) => {
84
98
  const TopRender = RenderSysAccountCardTopDict[entity];
@@ -92,6 +106,12 @@ export default function render(props) {
92
106
  </div>
93
107
  <div className={Styles.bottom}>
94
108
  <Button onClick={() => {
109
+ setShowHistoryAcc({ entity, data });
110
+ setShowHistoryList(true);
111
+ }} style={{ marginRight: 8, }}>
112
+ {t('history')}
113
+ </Button>
114
+ <Button onClick={() => {
95
115
  const DetailRender = RenderSysAccountDetailDict[entity];
96
116
  if (DetailRender) {
97
117
  Modal.info({
@@ -110,6 +130,20 @@ export default function render(props) {
110
130
  }}>
111
131
  {t('common::action.detail')}
112
132
  </Button>
133
+
134
+ {!!showHistoryAcc && showHistoryList &&
135
+ <Modal destroyOnClose open={showHistoryList} onCancel={() => {
136
+ setShowHistoryAcc(undefined);
137
+ setShowHistoryList(false);
138
+ }} width={800} title={showHistoryAcc.entity === 'offlineAccount' ?
139
+ (showHistoryAcc.data.type === 'bank' ?
140
+ `${t(`${showHistoryAcc.entity}:v.type.${showHistoryAcc.data.type}`)}-${showHistoryAcc.data.channel}-${t('history')}`
141
+ : `${t(`${showHistoryAcc.entity}:v.type.${showHistoryAcc.data.type}`)}-${showHistoryAcc.data.name}-${t('history')}`) : `${t(`${showHistoryAcc.entity}:name`)}-${t('history')}`} footer={null}>
142
+ <div style={{ height: '65vh' }}>
143
+ <SysAccountOperList entity={showHistoryAcc.entity} entityId={showHistoryAcc.data.id} oakPath="$opb-sysAccount-survery-operList"/>
144
+ </div>
145
+
146
+ </Modal>}
113
147
  </div>
114
148
  </div>);
115
149
  })}
@@ -119,16 +153,16 @@ export default function render(props) {
119
153
  {
120
154
  label: t('accountTotalSum'),
121
155
  children: <div className={Styles.total}>
122
- <span className={Styles.symbol}>{t('common::pay.symbol')}</span>
123
- <span className={Styles.value}>{ThousandCont(ToYuan(accountTotalSum || 0), 2)}</span>
124
- </div>
156
+ <span className={Styles.symbol}>{t('common::pay.symbol')}</span>
157
+ <span className={Styles.value}>{ThousandCont(ToYuan(accountTotalSum || 0), 2)}</span>
158
+ </div>
125
159
  },
126
160
  {
127
161
  label: t('accountAvailSum'),
128
162
  children: <div className={Styles.total}>
129
- <span className={Styles.symbol}>{t('common::pay.symbol')}</span>
130
- <span className={Styles.value}>{ThousandCont(ToYuan(accountAvailSum || 0), 2)}</span>
131
- </div>
163
+ <span className={Styles.symbol}>{t('common::pay.symbol')}</span>
164
+ <span className={Styles.value}>{ThousandCont(ToYuan(accountAvailSum || 0), 2)}</span>
165
+ </div>
132
166
  },
133
167
  {
134
168
  label: t('accountNum'),
@@ -142,14 +176,14 @@ export default function render(props) {
142
176
  label: t('refundPriceSum'),
143
177
  span: 2,
144
178
  children: (<div className={Styles.span2}>
145
- <span className={Styles.total}>
146
- <span className={Styles.symbol}>{t('common::pay.symbol')}</span>
147
- <span className={Styles.value}>{ThousandCont(ToYuan(refundPriceSum || 0), 2)}</span>
148
- </span>
149
- <Button style={{ marginLeft: 20 }}>
150
- {t('refundList')}
151
- </Button>
152
- </div>)
179
+ <span className={Styles.total}>
180
+ <span className={Styles.symbol}>{t('common::pay.symbol')}</span>
181
+ <span className={Styles.value}>{ThousandCont(ToYuan(refundPriceSum || 0), 2)}</span>
182
+ </span>
183
+ <Button style={{ marginLeft: 20 }}>
184
+ {t('refundList')}
185
+ </Button>
186
+ </div>)
153
187
  },
154
188
  {
155
189
  label: t('transferCnt'),
@@ -159,14 +193,17 @@ export default function render(props) {
159
193
  label: t('transferPriceSum'),
160
194
  span: 2,
161
195
  children: (<div className={Styles.span2}>
162
- <span className={Styles.total}>
163
- <span className={Styles.symbol}>{t('common::pay.symbol')}</span>
164
- <span className={Styles.value}>{ThousandCont(ToYuan(transferPriceSum || 0), 2)}</span>
165
- </span>
166
- <Button>
167
- {t('transferList')}
168
- </Button>
169
- </div>)
196
+ <span className={Styles.total}>
197
+ <span className={Styles.symbol}>{t('common::pay.symbol')}</span>
198
+ <span className={Styles.value}>{ThousandCont(ToYuan(transferPriceSum || 0), 2)}</span>
199
+ </span>
200
+ <Button onClick={() => setShowTransferList(true)}>
201
+ {t('transferList')}
202
+ </Button>
203
+ <Modal open={showTransferList} onCancel={() => setShowTransferList(false)} footer={null} closeIcon={null} width={800}>
204
+ <TransferList oakPath="$opb-sysAccount-survery-transferList"/>
205
+ </Modal>
206
+ </div>)
170
207
  },
171
208
  {
172
209
  label: t('orderCnt'),
@@ -175,14 +212,14 @@ export default function render(props) {
175
212
  {
176
213
  label: t('orderPriceSum'),
177
214
  children: (<div className={Styles.span2}>
178
- <div className={Styles.total}>
179
- <span className={Styles.symbol}>{t('common::pay.symbol')}</span>
180
- <span className={Styles.value}>{ThousandCont(ToYuan((orderPaidSum || 0) - (orderRefundSum || 0)), 2)}</span>
181
- </div>
182
- <Button>
183
- {t('orderList')}
184
- </Button>
185
- </div>)
215
+ <div className={Styles.total}>
216
+ <span className={Styles.symbol}>{t('common::pay.symbol')}</span>
217
+ <span className={Styles.value}>{ThousandCont(ToYuan((orderPaidSum || 0) - (orderRefundSum || 0)), 2)}</span>
218
+ </div>
219
+ <Button>
220
+ {t('orderList')}
221
+ </Button>
222
+ </div>)
186
223
  }
187
224
  ]} column={3}/>}
188
225
  </div>);
@@ -19,13 +19,14 @@
19
19
  padding: 8px;
20
20
  flex-wrap: wrap;
21
21
  margin-top: 12px;
22
+ gap: 14px;
22
23
 
23
24
  .sysAccount {
24
25
  width: 244px;
25
26
  height: 284px;
26
27
  border: solid 0.1px silver;
27
28
  border-radius: 5px;
28
- margin-right: 14px;
29
+ // margin-right: 14px;
29
30
  display: flex;
30
31
  flex-direction: column;
31
32
  align-items: stretch;
@@ -64,7 +65,7 @@
64
65
  }
65
66
  }
66
67
  }
67
-
68
+
68
69
  .span2 {
69
70
  display: flex;
70
71
  flex-direction: row;
@@ -0,0 +1,3 @@
1
+ /// <reference types="wechat-miniprogram" />
2
+ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "withdrawTransfer", true, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
3
+ export default _default;
@@ -0,0 +1,52 @@
1
+ export default OakComponent({
2
+ entity: 'withdrawTransfer',
3
+ isList: true,
4
+ projection: {
5
+ id: 1,
6
+ price: 1,
7
+ loss: 1,
8
+ externalId: 1,
9
+ iState: 1,
10
+ withdrawAccount: {
11
+ org: 1,
12
+ name: 1,
13
+ code: 1,
14
+ channel: {
15
+ entity: 1,
16
+ entityId: 1,
17
+ offlineAccount: {
18
+ id: 1,
19
+ type: 1,
20
+ }
21
+ },
22
+ id: 1,
23
+ }
24
+ },
25
+ filters: [
26
+ {
27
+ filter() {
28
+ const systemId = this.features.application.getApplication().systemId;
29
+ return {
30
+ withdrawAccount: {
31
+ ofSystemId: systemId,
32
+ },
33
+ iState: 'transferring',
34
+ };
35
+ }
36
+ }
37
+ ],
38
+ formData({ data }) {
39
+ return {
40
+ transfers: data?.map((ele) => {
41
+ const { withdrawAccount, ...rest } = ele;
42
+ const { entity, offlineAccount } = withdrawAccount.channel;
43
+ const channel = entity === 'offlineAccount' ? this.t(`withdraw::channel.offlineAccount.${offlineAccount?.type}`) : this.t(`withdraw::channel.${entity}`);
44
+ return {
45
+ ...rest,
46
+ withdrawAccount,
47
+ channel,
48
+ };
49
+ }),
50
+ };
51
+ },
52
+ });
@@ -0,0 +1,6 @@
1
+ {
2
+ "label": {
3
+ "channel": "转账渠道"
4
+ },
5
+ "tips": "正在转账的金额不计入任何账户,请到\"提现转账管理\"菜单完成操作"
6
+ }
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { RowWithActions, WebComponentProps } from 'oak-frontend-base';
3
+ import { EntityDict } from '../../../oak-app-domain';
4
+ export default function Render(props: WebComponentProps<EntityDict, 'pay', false, {
5
+ transfers?: (RowWithActions<EntityDict, 'withdrawTransfer'> & {
6
+ creatorName: string;
7
+ creatorMobile: string;
8
+ operatorName: string;
9
+ operatorMobile: string;
10
+ channel: string;
11
+ })[];
12
+ }>): React.JSX.Element;
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import { Result, Alert } from 'antd';
3
+ import ListPro from 'oak-frontend-base/es/components/listPro';
4
+ import { ThousandCont, ToYuan } from 'oak-domain/lib/utils/money';
5
+ export default function Render(props) {
6
+ const { transfers, oakFullpath, oakExecutable } = props.data;
7
+ const { t } = props.methods;
8
+ if (transfers?.length) {
9
+ return (<ListPro entity="withdrawTransfer" data={transfers} title={<Alert type="info" message={t('tips')}/>} attributes={[
10
+ {
11
+ path: 'price',
12
+ label: t('withdrawTransfer:attr.price'),
13
+ width: 100,
14
+ render: (row) => {
15
+ return `${t('common::pay.symbol')} ${ThousandCont(ToYuan(row.price), 2)}`;
16
+ }
17
+ },
18
+ {
19
+ path: 'loss',
20
+ label: t('withdrawTransfer:attr.loss'),
21
+ width: 100,
22
+ render: (row) => {
23
+ return `${t('common::pay.symbol')} ${ThousandCont(ToYuan(row.loss), 2)}`;
24
+ }
25
+ },
26
+ {
27
+ path: '$$createAt$$',
28
+ label: t('common::$$createAt$$'),
29
+ width: 100,
30
+ },
31
+ {
32
+ path: 'channel',
33
+ label: t('label.channel'),
34
+ type: 'string',
35
+ width: 100,
36
+ },
37
+ {
38
+ path: 'externalId',
39
+ label: t('withdrawTransfer:attr.externalId'),
40
+ width: 120,
41
+ },
42
+ ]} disabledOp={true}/>);
43
+ }
44
+ return (<Result status="404" title={t('common::noData')}/>);
45
+ }
@@ -0,0 +1,7 @@
1
+ import { EntityDict } from "../../../oak-app-domain";
2
+ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, keyof EntityDict, boolean, {
3
+ systemId: string;
4
+ entities: string[];
5
+ onSuccess: (id: string) => void;
6
+ }>) => React.ReactElement;
7
+ export default _default;
@@ -0,0 +1,145 @@
1
+ import { uniq } from "oak-domain/lib/utils/lodash";
2
+ import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
3
+ import { ThousandCont, ToCent, ToYuan } from 'oak-domain/lib/utils/money';
4
+ export default OakComponent({
5
+ properties: {
6
+ systemId: '',
7
+ entities: [],
8
+ onSuccess: (id) => undefined,
9
+ },
10
+ data: {
11
+ accounts: [],
12
+ fromEntity: '',
13
+ fromEntityId: '',
14
+ toEntity: '',
15
+ toEntityId: '',
16
+ price: 0,
17
+ externalId: '',
18
+ remark: '',
19
+ max: 0,
20
+ },
21
+ lifetimes: {
22
+ ready() {
23
+ this.refreshSysAccount();
24
+ }
25
+ },
26
+ methods: {
27
+ async refreshSysAccount() {
28
+ const { entities, systemId } = this.props;
29
+ const accounts2 = await Promise.all(uniq(['wpAccount', 'offlineAccount'].concat(entities || [])).map(async (entity) => {
30
+ const { data: rows } = await this.features.cache.refresh(entity, {
31
+ data: entity === 'offlineAccount' ? {
32
+ id: 1,
33
+ price: 1,
34
+ name: 1,
35
+ type: 1,
36
+ channel: 1,
37
+ } : {
38
+ id: 1,
39
+ price: 1,
40
+ },
41
+ filter: {
42
+ systemId,
43
+ }
44
+ });
45
+ const accounts = rows.map((row) => {
46
+ const { id, price, name, type, channel } = row;
47
+ return {
48
+ id: id,
49
+ entity: entity,
50
+ priceStr: ThousandCont(ToYuan(price)),
51
+ price: price,
52
+ label: entity === 'offlineAccount' ? `${this.t(`${entity}:name`)}-${this.t(`offlineAccount:v.type.${type}`)}` : this.t(`${entity}:name`),
53
+ name: name || undefined,
54
+ };
55
+ });
56
+ return accounts;
57
+ }));
58
+ this.setState({
59
+ accounts: accounts2.flat(),
60
+ });
61
+ },
62
+ setFromId(id) {
63
+ const { accounts } = this.state;
64
+ const account = accounts.find(ele => ele.id === id);
65
+ this.setState({
66
+ fromEntity: account.entity,
67
+ fromEntityId: account.id,
68
+ max: ToYuan(account.price),
69
+ });
70
+ },
71
+ setToId(id) {
72
+ const { accounts } = this.state;
73
+ const account = accounts.find(ele => ele.id === id);
74
+ this.setState({
75
+ toEntity: account.entity,
76
+ toEntityId: account.id,
77
+ });
78
+ },
79
+ setPrice(price) {
80
+ this.setState({
81
+ price,
82
+ });
83
+ },
84
+ setExternalId(externalId) {
85
+ this.setState({
86
+ externalId,
87
+ });
88
+ },
89
+ setRemark(remark) {
90
+ this.setState({
91
+ remark,
92
+ });
93
+ },
94
+ async createMove() {
95
+ const { fromEntity, fromEntityId, toEntity, toEntityId, price, remark, externalId } = this.state;
96
+ const userId = this.features.token.getUserId();
97
+ const systemId = this.features.application.getApplication().systemId;
98
+ const id = await generateNewIdAsync();
99
+ const price2 = ToCent(price);
100
+ const { onSuccess } = this.props;
101
+ await this.execute(undefined, undefined, undefined, [
102
+ {
103
+ entity: 'sysAccountMove',
104
+ operation: {
105
+ id: await generateNewIdAsync(),
106
+ action: 'create',
107
+ data: {
108
+ id,
109
+ price: price2,
110
+ externalId,
111
+ remark,
112
+ systemId,
113
+ operatorId: userId,
114
+ sysAccountOper$sysAccountMove: [
115
+ {
116
+ id: await generateNewIdAsync(),
117
+ action: 'create',
118
+ data: {
119
+ id: await generateNewIdAsync(),
120
+ entity: fromEntity,
121
+ entityId: fromEntityId,
122
+ delta: -price2,
123
+ type: 'moveOut',
124
+ },
125
+ },
126
+ {
127
+ id: await generateNewIdAsync(),
128
+ action: 'create',
129
+ data: {
130
+ id: await generateNewIdAsync(),
131
+ entity: toEntity,
132
+ entityId: toEntityId,
133
+ delta: price2,
134
+ type: 'moveIn',
135
+ },
136
+ },
137
+ ]
138
+ }
139
+ },
140
+ }
141
+ ]);
142
+ onSuccess && onSuccess(id);
143
+ }
144
+ }
145
+ });
@@ -0,0 +1,6 @@
1
+ {
2
+ "label": {
3
+ "from": "从账户",
4
+ "to": "到账户"
5
+ }
6
+ }
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { WebComponentProps } from 'oak-frontend-base';
3
+ import { EntityDict } from '../../../oak-app-domain';
4
+ export default function Render(props: WebComponentProps<EntityDict, 'pay', false, {
5
+ fromEntityId?: string;
6
+ toEntityId?: string;
7
+ price: number;
8
+ max?: number;
9
+ externalId: string;
10
+ remark: string;
11
+ accounts: Array<{
12
+ id: string;
13
+ entity: string;
14
+ price: number;
15
+ priceStr: string;
16
+ label: string;
17
+ name?: string;
18
+ }>;
19
+ }, {
20
+ setFromId: (id: string) => void;
21
+ setToId: (id: string) => void;
22
+ setPrice: (price: number) => void;
23
+ setExternalId: (externalId: string) => void;
24
+ setRemark: (remark: string) => void;
25
+ createMove: () => Promise<void>;
26
+ }>): React.JSX.Element | null;
@@ -0,0 +1,68 @@
1
+ import React from 'react';
2
+ import { Button, Form, Input, InputNumber, Radio, Space, Flex } from 'antd';
3
+ export default function Render(props) {
4
+ const { price, externalId, max, remark, fromEntityId, toEntityId, accounts } = props.data;
5
+ const { t, setFromId, setToId, setPrice, setExternalId, setRemark, createMove } = props.methods;
6
+ if (accounts.length) {
7
+ return (<>
8
+ <Form labelCol={{ span: 4 }} wrapperCol={{ span: 14 }} layout="horizontal" style={{
9
+ marginTop: 20,
10
+ }}>
11
+ <Form.Item label={t('label.from')} required>
12
+ <Radio.Group onChange={({ target }) => {
13
+ setFromId(target.value);
14
+ }} value={fromEntityId}>
15
+ <Space direction="vertical">
16
+ {accounts.filter(ele => ele.price > 0).map(ele => {
17
+ const { id, label, price, priceStr } = ele;
18
+ return (<Radio value={id} key={id} disabled={price <= 0}>
19
+ {`${label}: ${t('common::pay.symbol')}${priceStr}`}
20
+ </Radio>);
21
+ })}
22
+ </Space>
23
+ </Radio.Group>
24
+ </Form.Item>
25
+ {fromEntityId && <Form.Item label={t('label.to')} required>
26
+ <Radio.Group onChange={({ target }) => {
27
+ setToId(target.value);
28
+ }} value={toEntityId}>
29
+ <Space direction="vertical">
30
+ {accounts.filter(ele => ele.id !== fromEntityId).map(ele => {
31
+ const { id, label, price, priceStr } = ele;
32
+ return (<Radio value={id} key={id}>
33
+ {`${label}: ${t('common::pay.symbol')}${priceStr}`}
34
+ </Radio>);
35
+ })}
36
+ </Space>
37
+ </Radio.Group>
38
+ </Form.Item>}
39
+ {fromEntityId && toEntityId && <Form.Item label={t('sysAccountMove:attr.price')} required>
40
+ <InputNumber value={price} style={{
41
+ width: 240,
42
+ }} max={max} precision={2} onChange={(value) => {
43
+ const price = value;
44
+ setPrice(price);
45
+ }}/>
46
+ </Form.Item>}
47
+ {fromEntityId && toEntityId && <Form.Item label={t('sysAccountMove:attr.externalId')} required>
48
+ <Input value={externalId} onChange={({ currentTarget }) => {
49
+ const externalId = currentTarget.value;
50
+ setExternalId(externalId);
51
+ }} maxLength={64}/>
52
+ </Form.Item>}
53
+ {fromEntityId && toEntityId && <Form.Item label={t('sysAccountMove:attr.remark')}>
54
+ <Input.TextArea value={remark || undefined} onChange={({ currentTarget }) => {
55
+ const remark = currentTarget.value;
56
+ setRemark(remark);
57
+ }} rows={4}/>
58
+ </Form.Item>}
59
+ </Form>
60
+ <Flex style={{ width: '100%', padding: 12 }} justify="end">
61
+ <Button type="primary" disabled={!fromEntityId || !toEntityId || !price || !externalId} onClick={() => createMove()}>
62
+ {t('common::confirm')}
63
+ </Button>
64
+ </Flex>
65
+ </>);
66
+ }
67
+ return null;
68
+ }
@@ -0,0 +1,5 @@
1
+ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "sysAccountOper", true, {
2
+ entity: string;
3
+ entityId: string;
4
+ }>) => React.ReactElement;
5
+ export default _default;