oak-pay-business 1.0.4 → 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.
- package/es/components/account/deposit/index.d.ts +1 -2
- package/es/components/account/deposit/index.js +13 -7
- package/es/components/account/deposit/index.xml +2 -2
- package/es/components/account/detail/index.js +14 -0
- package/es/components/account/detail/index.xml +39 -36
- package/es/components/account/detail/web.js +1 -1
- package/es/components/account/detail/web.pc.js +1 -1
- package/es/components/order/pay/index.d.ts +1 -1
- package/es/components/order/pay/index.js +65 -30
- package/es/components/order/pay/index.json +17 -1
- package/es/components/order/pay/index.less +94 -0
- package/es/components/order/pay/index.xml +71 -0
- package/es/components/order/pay/info.module.less +24 -24
- package/es/components/order/pay/locales/zh-CN.json +1 -0
- package/es/components/order/pay/web.d.ts +1 -1
- package/es/components/order/pay/web.js +4 -9
- package/es/components/order/pay/web.mobile.module.less +35 -35
- package/es/components/order/pay/web.pc.d.ts +1 -1
- package/es/components/order/pay/web.pc.js +4 -9
- package/es/components/order/pay/web.pc.module.less +35 -35
- package/es/components/pay/channelPicker/web.mobile.module.less +7 -7
- package/es/components/pay/detail/index.less +0 -1
- package/es/config/constants.d.ts +1 -0
- package/es/config/constants.js +1 -0
- package/es/data/i18n.js +1 -0
- package/es/triggers/accountOper.js +4 -2
- package/es/triggers/acount.d.ts +5 -0
- package/es/triggers/acount.js +20 -0
- package/es/triggers/index.js +2 -0
- package/lib/config/constants.d.ts +1 -0
- package/lib/config/constants.js +1 -0
- package/lib/data/i18n.js +1 -0
- package/lib/triggers/accountOper.js +4 -2
- package/lib/triggers/acount.d.ts +5 -0
- package/lib/triggers/acount.js +23 -0
- package/lib/triggers/index.js +2 -0
- package/lib/utils/payClazz/WechatPay/index.js +0 -1
- package/package.json +4 -4
|
@@ -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
|
-
|
|
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;
|
|
@@ -2,11 +2,10 @@ import { ToCent, ToYuan } from 'oak-domain/lib/utils/money';
|
|
|
2
2
|
import { PAY_CHANNEL_ACCOUNT_NAME, PAY_CHANNEL_OFFLINE_NAME } from '../../../types/PayConfig';
|
|
3
3
|
export default OakComponent({
|
|
4
4
|
properties: {
|
|
5
|
-
|
|
5
|
+
depositMaxCent: 1000000,
|
|
6
6
|
onSetPrice: (price) => undefined,
|
|
7
7
|
onSetChannel: (channel) => undefined,
|
|
8
8
|
onSetMeta: (meta) => undefined,
|
|
9
|
-
price: 0,
|
|
10
9
|
channel: '',
|
|
11
10
|
meta: {},
|
|
12
11
|
},
|
|
@@ -22,11 +21,11 @@ export default OakComponent({
|
|
|
22
21
|
payConfig.push(config);
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
|
-
const
|
|
24
|
+
const { depositMaxCent } = this.props;
|
|
26
25
|
return {
|
|
26
|
+
depositMax: ToYuan(depositMaxCent),
|
|
27
27
|
account: data,
|
|
28
28
|
payConfig,
|
|
29
|
-
priceStr: typeof price == 'number' ? `${ToYuan(price)}` : undefined
|
|
30
29
|
// accountConfig,
|
|
31
30
|
};
|
|
32
31
|
},
|
|
@@ -39,14 +38,21 @@ export default OakComponent({
|
|
|
39
38
|
methods: {
|
|
40
39
|
onDepPriceChangeMp(event) {
|
|
41
40
|
const { value } = event.detail;
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
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
|
+
});
|
|
45
50
|
}
|
|
46
51
|
},
|
|
47
52
|
},
|
|
48
53
|
data: {
|
|
49
54
|
onChannelPickMp(channel) { this.props.onSetChannel(channel); },
|
|
50
55
|
onMetaSetMp(meta) { this.props.onSetMeta(meta); },
|
|
56
|
+
price: 0,
|
|
51
57
|
}
|
|
52
58
|
});
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
<l-form-item label="{{t('label.depPrice')}}">
|
|
4
4
|
<l-input
|
|
5
5
|
hide-label
|
|
6
|
-
value="{{priceStr}}"
|
|
6
|
+
value="{{priceStr || ''}}"
|
|
7
7
|
type="number"
|
|
8
8
|
bind:lininput="onDepPriceChangeMp"
|
|
9
|
-
placeholder="{{
|
|
9
|
+
placeholder="一次最大充值{{depositMax}}元"
|
|
10
10
|
/>
|
|
11
11
|
</l-form-item>
|
|
12
12
|
<view wx:if="{{price > 0}}">
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { CentToString } from "oak-domain/lib/utils/money";
|
|
2
2
|
import { generateNewIdAsync } from "oak-domain/lib/utils/uuid";
|
|
3
|
+
import assert from 'assert';
|
|
4
|
+
import { DATA_SUBSCRIBER_KEYS } from "../../../config/constants";
|
|
3
5
|
export default OakComponent({
|
|
4
6
|
entity: 'account',
|
|
5
7
|
isList: false,
|
|
@@ -153,5 +155,17 @@ export default OakComponent({
|
|
|
153
155
|
setDepPriceMp(price) { this.setDepPrice(price); },
|
|
154
156
|
setDepositChannelMp(depositChannel) { this.setDepositChannel(depositChannel); },
|
|
155
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}`]);
|
|
169
|
+
}
|
|
156
170
|
}
|
|
157
171
|
});
|
|
@@ -29,41 +29,44 @@
|
|
|
29
29
|
</l-button>
|
|
30
30
|
</view>
|
|
31
31
|
</view>
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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>
|
|
57
58
|
</view>
|
|
58
|
-
</
|
|
59
|
-
</
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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>
|
|
69
72
|
</view>
|
|
@@ -50,7 +50,7 @@ export default function Render(props) {
|
|
|
50
50
|
</div>
|
|
51
51
|
<Popup visible={depositOpen} onMaskClick={() => onDepositModalClose()} onClose={() => onDepositModalClose()}>
|
|
52
52
|
<div style={{ padding: 12, marginBottom: 6 }}>
|
|
53
|
-
<AccountDeposit depositMax={depositMax}
|
|
53
|
+
<AccountDeposit depositMax={depositMax} channel={depositChannel} meta={depositMeta} onSetPrice={(price) => setDepPrice(price)} onSetChannel={(channel) => setDepositChannel(channel)} onSetMeta={(meta) => setDepositMeta(meta)}/>
|
|
54
54
|
<Button block loading={depositing} color="primary" disabled={!depPrice || !depositChannel || depositing} onClick={() => createDepositPay()}>
|
|
55
55
|
{depositing ? t('depositing') : t('common::confirm')}
|
|
56
56
|
</Button>
|
|
@@ -51,7 +51,7 @@ export default function Render(props) {
|
|
|
51
51
|
{depositing ? t('depositing') : t('common::confirm')}
|
|
52
52
|
</Button>}>
|
|
53
53
|
<div style={{ padding: 12 }}>
|
|
54
|
-
<AccountDeposit depositMax={depositMax}
|
|
54
|
+
<AccountDeposit depositMax={depositMax} channel={depositChannel} meta={depositMeta} onSetPrice={(price) => setDepPrice(price)} onSetChannel={(channel) => setDepositChannel(channel)} onSetMeta={(meta) => setDepositMeta(meta)}/>
|
|
55
55
|
</div>
|
|
56
56
|
</Modal>
|
|
57
57
|
<Modal title={t('uf.title')} open={ufOpen} onCancel={() => {
|
|
@@ -2,6 +2,6 @@ import { EntityDict } from "../../../oak-app-domain";
|
|
|
2
2
|
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "order", false, {
|
|
3
3
|
accountId: string;
|
|
4
4
|
accountAvailMax: number;
|
|
5
|
-
|
|
5
|
+
onSetPays: (pays: Partial<EntityDict['pay']['CreateSingle']['data']>[]) => void;
|
|
6
6
|
}>) => React.ReactElement;
|
|
7
7
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PAY_CHANNEL_ACCOUNT_NAME } from "../../../types/PayConfig";
|
|
2
2
|
import { generateNewId } from "oak-domain/lib/utils/uuid";
|
|
3
|
+
import { ToCent, ToYuan } from "oak-domain/lib/utils/money";
|
|
3
4
|
export default OakComponent({
|
|
4
5
|
entity: 'order',
|
|
5
6
|
projection: {
|
|
@@ -24,7 +25,7 @@ export default OakComponent({
|
|
|
24
25
|
properties: {
|
|
25
26
|
accountId: '', // 是否可以使用帐户中的余额抵扣
|
|
26
27
|
accountAvailMax: 0, // 本次交易可以使用的帐户中的Avail max值,调用者自己保证此数值的一致性,不要扣成负数
|
|
27
|
-
|
|
28
|
+
onSetPays: (pays) => undefined,
|
|
28
29
|
},
|
|
29
30
|
formData({ data }) {
|
|
30
31
|
const payConfig = this.features.pay.getPayConfigs();
|
|
@@ -32,49 +33,93 @@ export default OakComponent({
|
|
|
32
33
|
const payConfig2 = payConfig?.filter(ele => ele !== accountConfig);
|
|
33
34
|
const activePay = data && data.pay$order?.[0];
|
|
34
35
|
const { accountPrice } = this.state;
|
|
36
|
+
const { accountAvailMax } = this.props;
|
|
37
|
+
const rest = data ? data.price - data.paid - accountPrice : 0;
|
|
35
38
|
return {
|
|
39
|
+
priceStr: data && ToYuan(data.price),
|
|
40
|
+
accountAvailMaxStr: accountAvailMax && ToYuan(accountAvailMax),
|
|
36
41
|
order: data,
|
|
37
42
|
activePay,
|
|
38
43
|
accountConfig,
|
|
39
44
|
payConfig: payConfig2,
|
|
40
|
-
rest
|
|
41
|
-
|
|
45
|
+
rest,
|
|
46
|
+
restYuan: ToYuan(rest),
|
|
47
|
+
legal: !!(data?.['#oakLegalActions']?.includes('startPaying')),
|
|
42
48
|
};
|
|
43
49
|
},
|
|
44
50
|
features: ['application'],
|
|
45
51
|
data: {
|
|
46
52
|
useAccount: false,
|
|
47
53
|
accountPrice: 0,
|
|
54
|
+
accountPriceYuan: 0,
|
|
48
55
|
channel: '',
|
|
56
|
+
restYuan: 0,
|
|
49
57
|
meta: undefined,
|
|
58
|
+
onPickMp(channel) {
|
|
59
|
+
this.onPickChannel(channel);
|
|
60
|
+
},
|
|
61
|
+
onSetMetaMp(meta) {
|
|
62
|
+
this.onSetChannelMeta(meta);
|
|
63
|
+
}
|
|
50
64
|
},
|
|
51
65
|
methods: {
|
|
52
|
-
|
|
66
|
+
switchUseAccount() {
|
|
53
67
|
const { accountAvailMax } = this.props;
|
|
54
|
-
const { order } = this.state;
|
|
68
|
+
const { useAccount, order } = this.state;
|
|
55
69
|
const accountMaxPrice = Math.min(accountAvailMax, order.price);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
70
|
+
if (!useAccount) {
|
|
71
|
+
const rest = order.price - accountMaxPrice;
|
|
72
|
+
this.setState({
|
|
73
|
+
useAccount: true,
|
|
74
|
+
accountPrice: accountMaxPrice,
|
|
75
|
+
accountPriceYuan: ToYuan(accountMaxPrice),
|
|
76
|
+
rest,
|
|
77
|
+
restYuan: ToYuan(rest),
|
|
78
|
+
}, () => this.tryCreatePays());
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
const rest = order.price;
|
|
82
|
+
this.setState({
|
|
83
|
+
useAccount: false,
|
|
84
|
+
accountPrice: undefined,
|
|
85
|
+
accountPriceYuan: undefined,
|
|
86
|
+
rest,
|
|
87
|
+
restYuan: ToYuan(rest),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
61
90
|
},
|
|
62
91
|
setAccountPrice(price) {
|
|
63
92
|
const { order } = this.state;
|
|
64
|
-
|
|
93
|
+
const rest = order.price - order.paid - price;
|
|
94
|
+
this.setState({
|
|
95
|
+
accountPrice: price,
|
|
96
|
+
rest,
|
|
97
|
+
restYuan: ToYuan(rest),
|
|
98
|
+
accountPriceYuan: ToYuan(price),
|
|
99
|
+
}, () => this.tryCreatePays());
|
|
100
|
+
},
|
|
101
|
+
setAccountPriceMp(e) {
|
|
102
|
+
const { value } = e.detail;
|
|
103
|
+
const v = parseInt(value);
|
|
104
|
+
if (!isNaN(v)) {
|
|
105
|
+
const { accountAvailMax } = this.props;
|
|
106
|
+
const { order } = this.state;
|
|
107
|
+
const accountMaxPrice = Math.min(accountAvailMax, order.price);
|
|
108
|
+
this.setAccountPrice(Math.min(accountMaxPrice, ToCent(v)));
|
|
109
|
+
}
|
|
65
110
|
},
|
|
66
111
|
onPickChannel(channel) {
|
|
67
112
|
this.setState({
|
|
68
113
|
channel,
|
|
69
|
-
}, () => this.
|
|
114
|
+
}, () => this.tryCreatePays());
|
|
70
115
|
},
|
|
71
116
|
onSetChannelMeta(meta) {
|
|
72
117
|
this.setState({
|
|
73
118
|
meta,
|
|
74
|
-
}, () => this.
|
|
119
|
+
}, () => this.tryCreatePays());
|
|
75
120
|
},
|
|
76
|
-
|
|
77
|
-
const {
|
|
121
|
+
tryCreatePays() {
|
|
122
|
+
const { accountId } = this.props;
|
|
78
123
|
const { useAccount, accountPrice, channel, meta, order } = this.state;
|
|
79
124
|
const pays = [];
|
|
80
125
|
let rest = order.price - order.paid;
|
|
@@ -98,22 +143,12 @@ export default OakComponent({
|
|
|
98
143
|
});
|
|
99
144
|
rest = 0;
|
|
100
145
|
}
|
|
101
|
-
const {
|
|
146
|
+
const { onSetPays } = this.props;
|
|
102
147
|
if (rest === 0) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
pay$order: pays.map(ele => ({
|
|
108
|
-
id: generateNewId(),
|
|
109
|
-
action: 'create',
|
|
110
|
-
data: ele,
|
|
111
|
-
})),
|
|
112
|
-
},
|
|
113
|
-
filter: {
|
|
114
|
-
id: oakId,
|
|
115
|
-
},
|
|
116
|
-
}, payId);
|
|
148
|
+
onSetPays(pays);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
onSetPays([]);
|
|
117
152
|
}
|
|
118
153
|
}
|
|
119
154
|
},
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"usingComponents": {
|
|
3
|
+
"l-input": "@oak-frontend-base/miniprogram_npm/lin-ui/input/index",
|
|
4
|
+
"l-search-bar": "@oak-frontend-base/miniprogram_npm/lin-ui/search-bar/index",
|
|
5
|
+
"l-tabs": "@oak-frontend-base/miniprogram_npm/lin-ui/tabs/index",
|
|
6
|
+
"l-tabpanel": "@oak-frontend-base/miniprogram_npm/lin-ui/tabpanel/index",
|
|
7
|
+
"l-segment": "@oak-frontend-base/miniprogram_npm/lin-ui/segment/index",
|
|
8
|
+
"l-segment-item": "@oak-frontend-base/miniprogram_npm/lin-ui/segment-item/index",
|
|
9
|
+
"l-status-show": "@oak-frontend-base/miniprogram_npm/lin-ui/status-show/index",
|
|
10
|
+
"l-card": "@oak-frontend-base/miniprogram_npm/lin-ui/card/index",
|
|
11
|
+
"l-tag": "@oak-frontend-base/miniprogram_npm/lin-ui/tag/index",
|
|
12
|
+
"l-icon": "@oak-frontend-base/miniprogram_npm/lin-ui/icon/index",
|
|
13
|
+
"l-button": "@oak-frontend-base/miniprogram_npm/lin-ui/button/index",
|
|
14
|
+
"l-switch": "@oak-frontend-base/miniprogram_npm/lin-ui/switch/index",
|
|
15
|
+
"channel-picker": "../../pay/channelPicker"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
@import '../../../config/styles/mp/mixins.less';
|
|
2
|
+
@import '../../../config/styles/mp/index.less';
|
|
3
|
+
|
|
4
|
+
.error-container {
|
|
5
|
+
height: 600rpx;
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.container {
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 100%;
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
align-items: stretch;
|
|
17
|
+
background-color: @oak-bg-color-page;
|
|
18
|
+
|
|
19
|
+
.info {
|
|
20
|
+
margin: 8px;
|
|
21
|
+
height: 140px;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
background-color: @oak-color-info;
|
|
27
|
+
|
|
28
|
+
.should {
|
|
29
|
+
font-size: large;
|
|
30
|
+
font-weight: bold;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.price {
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: row;
|
|
36
|
+
padding: 3px;
|
|
37
|
+
font-size: xx-large;
|
|
38
|
+
font-weight: bolder;
|
|
39
|
+
color: @oak-color-primary;
|
|
40
|
+
align-items: baseline;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.ctrl {
|
|
45
|
+
margin: 8px;
|
|
46
|
+
margin-top: 10px;
|
|
47
|
+
background-color: @oak-bg-color-container;
|
|
48
|
+
padding: 16rpx;
|
|
49
|
+
|
|
50
|
+
.pc1 {
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: row;
|
|
53
|
+
align-items: center;
|
|
54
|
+
border-radius: 4rpx;
|
|
55
|
+
height: 90rpx;
|
|
56
|
+
|
|
57
|
+
.text {
|
|
58
|
+
color: grey;
|
|
59
|
+
margin-left: 8rpx;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.pc2 {
|
|
64
|
+
padding-left: 16rpx;
|
|
65
|
+
border-top: 1px solid @oak-border-color;
|
|
66
|
+
display: flex;
|
|
67
|
+
flex-direction: column;
|
|
68
|
+
align-items: stretch;
|
|
69
|
+
|
|
70
|
+
.content {
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: row;
|
|
73
|
+
align-items: center;
|
|
74
|
+
|
|
75
|
+
.label {
|
|
76
|
+
margin-right: 8rpx;
|
|
77
|
+
font-size: large;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.tips {
|
|
81
|
+
color: var(--oak-color-warning);
|
|
82
|
+
font-size: small;
|
|
83
|
+
margin-top: 6rpx;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.tips {
|
|
88
|
+
color: @oak-color-warning;
|
|
89
|
+
font-size: small;
|
|
90
|
+
margin-top: 6rpx;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<view wx:if="{{order}}">
|
|
2
|
+
<view wx:if="{{!legal}}" class="error-container">
|
|
3
|
+
<l-status-show
|
|
4
|
+
show="{{true}}"
|
|
5
|
+
type="error"
|
|
6
|
+
full-screen="{{false}}"
|
|
7
|
+
bg-color="#F2F6F8"
|
|
8
|
+
describe="{{t('illegalStateMp')}}"
|
|
9
|
+
>
|
|
10
|
+
</l-status-show>
|
|
11
|
+
</view>
|
|
12
|
+
<view wx:elif="{{activePay}}" class="error-container">
|
|
13
|
+
<l-status-show
|
|
14
|
+
show="{{true}}"
|
|
15
|
+
type="order"
|
|
16
|
+
full-screen="{{false}}"
|
|
17
|
+
bg-color="#F2F6F8"
|
|
18
|
+
describe="{{t('paying')}}"
|
|
19
|
+
>
|
|
20
|
+
</l-status-show>
|
|
21
|
+
</view>
|
|
22
|
+
<view wx:else class="container">
|
|
23
|
+
<view class="info">
|
|
24
|
+
<view class="should">{{t('price')}}</view>
|
|
25
|
+
<view class="price">
|
|
26
|
+
<view>{{t('common::pay.symbol')}}</view>
|
|
27
|
+
<view>{{priceStr}}</view>
|
|
28
|
+
</view>
|
|
29
|
+
</view>
|
|
30
|
+
<view wx:if="{{accountId && accountAvailMax}}" class="ctrl">
|
|
31
|
+
<view class="pc1">
|
|
32
|
+
<l-switch
|
|
33
|
+
checked="{{useAccount}}"
|
|
34
|
+
bind:linchange="switchUseAccount"
|
|
35
|
+
/>
|
|
36
|
+
<view class="text">
|
|
37
|
+
{{t('useAccount')}}
|
|
38
|
+
</view>
|
|
39
|
+
</view>
|
|
40
|
+
<view wx:if="{{useAccount}}" class="pc2">
|
|
41
|
+
<view class="content">
|
|
42
|
+
<view class="label">¥</view>
|
|
43
|
+
<l-input
|
|
44
|
+
focus
|
|
45
|
+
hide-label="{{true}}"
|
|
46
|
+
type="number"
|
|
47
|
+
value="{{accountPriceYuan}}"
|
|
48
|
+
bind:lininput="setAccountPriceMp"
|
|
49
|
+
/>
|
|
50
|
+
</view>
|
|
51
|
+
<view class="tips">当前可用余额为{{accountAvailMaxStr}}元</view>
|
|
52
|
+
</view>
|
|
53
|
+
</view>
|
|
54
|
+
<view wx:if="{{rest}}" class="ctrl">
|
|
55
|
+
<view class="pc1">
|
|
56
|
+
<view class="text">
|
|
57
|
+
请选择支付方式({{restYuan}}元):
|
|
58
|
+
</view>
|
|
59
|
+
</view>
|
|
60
|
+
<view class="pc2">
|
|
61
|
+
<channel-picker
|
|
62
|
+
payConfig="{{payConfig}}"
|
|
63
|
+
channel="{{channel}}"
|
|
64
|
+
meta="{{meta}}"
|
|
65
|
+
onPick="{{onPickMp}}"
|
|
66
|
+
onSetMeta="{{onSetMetaMp}}"
|
|
67
|
+
/>
|
|
68
|
+
</view>
|
|
69
|
+
</view>
|
|
70
|
+
</view>
|
|
71
|
+
</view>
|
|
@@ -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
|
}
|
|
@@ -19,5 +19,5 @@ export default function Render(props: WebComponentProps<EntityDict, 'order', fal
|
|
|
19
19
|
setAccountPrice: (price: number) => void;
|
|
20
20
|
onPickChannel: (channel: string) => void;
|
|
21
21
|
onSetChannelMeta: (meta?: object) => void;
|
|
22
|
-
|
|
22
|
+
switchUseAccount: () => void;
|
|
23
23
|
}>): React.JSX.Element | null;
|
|
@@ -18,15 +18,10 @@ function RenderPayChannel(props) {
|
|
|
18
18
|
</div>);
|
|
19
19
|
}
|
|
20
20
|
function RenderAccountPay(props) {
|
|
21
|
-
const { max, t, accountPrice, setAccountPrice, useAccount,
|
|
21
|
+
const { max, t, accountPrice, setAccountPrice, useAccount, switchUseAccount, accountAvail } = props;
|
|
22
22
|
return (<div className={Styles.pc1}>
|
|
23
23
|
<div className={Styles.content}>
|
|
24
|
-
<Checkbox checked={useAccount} onChange={() =>
|
|
25
|
-
setUseAccount(!useAccount);
|
|
26
|
-
if (useAccount) {
|
|
27
|
-
setAccountPrice(0);
|
|
28
|
-
}
|
|
29
|
-
}}>
|
|
24
|
+
<Checkbox checked={useAccount} onChange={() => switchUseAccount()}>
|
|
30
25
|
{t('useAccount')}
|
|
31
26
|
</Checkbox>
|
|
32
27
|
{useAccount && (<>
|
|
@@ -45,7 +40,7 @@ function RenderAccountPay(props) {
|
|
|
45
40
|
}
|
|
46
41
|
export default function Render(props) {
|
|
47
42
|
const { accountId, accountAvailMax, legal, accountPrice, useAccount, order, activePay, payConfig, channel, meta, rest } = props.data;
|
|
48
|
-
const { t, setAccountPrice, onPickChannel, onSetChannelMeta,
|
|
43
|
+
const { t, setAccountPrice, onPickChannel, onSetChannelMeta, switchUseAccount } = props.methods;
|
|
49
44
|
if (order) {
|
|
50
45
|
if (activePay) {
|
|
51
46
|
return (<ErrorBlock status="default" title={t('paying')}/>);
|
|
@@ -56,7 +51,7 @@ export default function Render(props) {
|
|
|
56
51
|
return (<div className={Styles.container}>
|
|
57
52
|
<Info t={t} price={ToYuan(order.price)}/>
|
|
58
53
|
{accountId && accountAvailMax && <div className={Styles.ctrl}>
|
|
59
|
-
<RenderAccountPay max={Math.min(accountAvailMax, rest + accountPrice)} t={t} setAccountPrice={setAccountPrice} useAccount={useAccount}
|
|
54
|
+
<RenderAccountPay max={Math.min(accountAvailMax, rest + accountPrice)} t={t} setAccountPrice={setAccountPrice} useAccount={useAccount} switchUseAccount={switchUseAccount} accountPrice={accountPrice} accountAvail={accountAvailMax}/>
|
|
60
55
|
</div>}
|
|
61
56
|
{!!(rest && rest > 0) && <div className={Styles.ctrl}>
|
|
62
57
|
<RenderPayChannel payConfig={payConfig} price={rest} t={t} channel={channel} meta={meta} onPick={onPickChannel} onSetMeta={onSetChannelMeta}/>
|
|
@@ -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
|
}
|
|
@@ -19,5 +19,5 @@ export default function Render(props: WebComponentProps<EntityDict, 'order', fal
|
|
|
19
19
|
setAccountPrice: (price: number) => void;
|
|
20
20
|
onPickChannel: (channel: string) => void;
|
|
21
21
|
onSetChannelMeta: (meta?: object) => void;
|
|
22
|
-
|
|
22
|
+
switchUseAccount: () => void;
|
|
23
23
|
}>): React.JSX.Element | null;
|
|
@@ -17,15 +17,10 @@ function RenderPayChannel(props) {
|
|
|
17
17
|
</div>);
|
|
18
18
|
}
|
|
19
19
|
function RenderAccountPay(props) {
|
|
20
|
-
const { max, t, accountPrice, setAccountPrice, useAccount,
|
|
20
|
+
const { max, t, accountPrice, setAccountPrice, useAccount, switchUseAccount, accountAvail } = props;
|
|
21
21
|
return (<div className={Styles.pc1}>
|
|
22
22
|
<div className={Styles.content}>
|
|
23
|
-
<Checkbox checked={useAccount} onChange={() =>
|
|
24
|
-
setUseAccount(!useAccount);
|
|
25
|
-
if (useAccount) {
|
|
26
|
-
setAccountPrice(0);
|
|
27
|
-
}
|
|
28
|
-
}}>
|
|
23
|
+
<Checkbox checked={useAccount} onChange={() => switchUseAccount()}>
|
|
29
24
|
{t('useAccount')}
|
|
30
25
|
</Checkbox>
|
|
31
26
|
{useAccount && (<>
|
|
@@ -44,7 +39,7 @@ function RenderAccountPay(props) {
|
|
|
44
39
|
}
|
|
45
40
|
export default function Render(props) {
|
|
46
41
|
const { accountId, accountAvailMax, legal, accountPrice, useAccount, order, activePay, payConfig, channel, meta, rest } = props.data;
|
|
47
|
-
const { t, setAccountPrice, onPickChannel, onSetChannelMeta,
|
|
42
|
+
const { t, setAccountPrice, onPickChannel, onSetChannelMeta, switchUseAccount } = props.methods;
|
|
48
43
|
if (order) {
|
|
49
44
|
if (activePay) {
|
|
50
45
|
return (<Result status="warning" title={t('paying')}/>);
|
|
@@ -55,7 +50,7 @@ export default function Render(props) {
|
|
|
55
50
|
return (<div className={Styles.container}>
|
|
56
51
|
<Info t={t} price={ToYuan(order.price)}/>
|
|
57
52
|
{accountId && accountAvailMax && <div className={Styles.ctrl}>
|
|
58
|
-
<RenderAccountPay max={Math.min(accountAvailMax, rest + accountPrice)} t={t} setAccountPrice={setAccountPrice} useAccount={useAccount}
|
|
53
|
+
<RenderAccountPay max={Math.min(accountAvailMax, rest + accountPrice)} t={t} setAccountPrice={setAccountPrice} useAccount={useAccount} switchUseAccount={switchUseAccount} accountPrice={accountPrice} accountAvail={accountAvailMax}/>
|
|
59
54
|
</div>}
|
|
60
55
|
{!!(rest && rest > 0) && <div className={Styles.ctrl}>
|
|
61
56
|
<RenderPayChannel payConfig={payConfig} price={rest} t={t} channel={channel} meta={meta} onPick={onPickChannel} onSetMeta={onSetChannelMeta}/>
|
|
@@ -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,8 +1,8 @@
|
|
|
1
|
-
.span {
|
|
2
|
-
margin-right: 10px;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
.radio {
|
|
7
|
-
height: 40px;
|
|
1
|
+
.span {
|
|
2
|
+
margin-right: 10px;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
.radio {
|
|
7
|
+
height: 40px;
|
|
8
8
|
}
|
package/es/config/constants.d.ts
CHANGED
package/es/config/constants.js
CHANGED
package/es/data/i18n.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
|
|
2
2
|
import assert from 'assert';
|
|
3
|
+
import { DATA_SUBSCRIBER_KEYS } from '../config/constants';
|
|
3
4
|
const triggers = [
|
|
4
5
|
{
|
|
5
|
-
name: '当生成accountOper时,修改account
|
|
6
|
+
name: '当生成accountOper时,修改account中的值,并向订阅者推送',
|
|
6
7
|
entity: 'accountOper',
|
|
7
8
|
action: 'create',
|
|
8
9
|
when: 'after',
|
|
9
10
|
fn: async ({ operation }, context, option) => {
|
|
10
|
-
const { data } = operation;
|
|
11
|
+
const { id, data } = operation;
|
|
11
12
|
assert(!(data instanceof Array));
|
|
12
13
|
const { accountId, totalPlus, availPlus, type } = data;
|
|
13
14
|
const [account] = await context.select('account', {
|
|
@@ -32,6 +33,7 @@ const triggers = [
|
|
|
32
33
|
id: accountId,
|
|
33
34
|
}
|
|
34
35
|
}, option);
|
|
36
|
+
context.saveOperationToEvent(id, `${DATA_SUBSCRIBER_KEYS.accountNumberChanged}-${accountId}`);
|
|
35
37
|
return 1;
|
|
36
38
|
},
|
|
37
39
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DATA_SUBSCRIBER_KEYS } from '../config/constants';
|
|
2
|
+
import assert from 'assert';
|
|
3
|
+
const triggers = [
|
|
4
|
+
{
|
|
5
|
+
name: '当account帐户的值发生变化时,向订阅者推送',
|
|
6
|
+
entity: 'account',
|
|
7
|
+
action: ['deposit', 'withdraw', 'withdrawBack', 'consume', 'loan', 'repay'],
|
|
8
|
+
check(operation) {
|
|
9
|
+
return operation.data.hasOwnProperty('total') || operation.data.hasOwnProperty('avail');
|
|
10
|
+
},
|
|
11
|
+
when: 'after',
|
|
12
|
+
fn: async ({ operation }, context, option) => {
|
|
13
|
+
const { id, filter } = operation;
|
|
14
|
+
assert(typeof filter?.id === 'string');
|
|
15
|
+
context.saveOperationToEvent(id, `${DATA_SUBSCRIBER_KEYS.accountNumberChanged}-${filter.id}`);
|
|
16
|
+
return 1;
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
export default triggers;
|
package/es/triggers/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import aoTriggers from './accountOper';
|
|
2
2
|
import payTriggers from './pay';
|
|
3
3
|
import userSystemTriggers from './userSystem';
|
|
4
|
+
import accountTriggers from './acount';
|
|
4
5
|
const triggers = [
|
|
5
6
|
...aoTriggers,
|
|
6
7
|
...payTriggers,
|
|
7
8
|
...userSystemTriggers,
|
|
9
|
+
...accountTriggers,
|
|
8
10
|
];
|
|
9
11
|
export default triggers;
|
package/lib/config/constants.js
CHANGED
package/lib/data/i18n.js
CHANGED
|
@@ -3,14 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const uuid_1 = require("oak-domain/lib/utils/uuid");
|
|
5
5
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
|
+
const constants_1 = require("../config/constants");
|
|
6
7
|
const triggers = [
|
|
7
8
|
{
|
|
8
|
-
name: '当生成accountOper时,修改account
|
|
9
|
+
name: '当生成accountOper时,修改account中的值,并向订阅者推送',
|
|
9
10
|
entity: 'accountOper',
|
|
10
11
|
action: 'create',
|
|
11
12
|
when: 'after',
|
|
12
13
|
fn: async ({ operation }, context, option) => {
|
|
13
|
-
const { data } = operation;
|
|
14
|
+
const { id, data } = operation;
|
|
14
15
|
(0, assert_1.default)(!(data instanceof Array));
|
|
15
16
|
const { accountId, totalPlus, availPlus, type } = data;
|
|
16
17
|
const [account] = await context.select('account', {
|
|
@@ -35,6 +36,7 @@ const triggers = [
|
|
|
35
36
|
id: accountId,
|
|
36
37
|
}
|
|
37
38
|
}, option);
|
|
39
|
+
context.saveOperationToEvent(id, `${constants_1.DATA_SUBSCRIBER_KEYS.accountNumberChanged}-${accountId}`);
|
|
38
40
|
return 1;
|
|
39
41
|
},
|
|
40
42
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const constants_1 = require("../config/constants");
|
|
5
|
+
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
|
+
const triggers = [
|
|
7
|
+
{
|
|
8
|
+
name: '当account帐户的值发生变化时,向订阅者推送',
|
|
9
|
+
entity: 'account',
|
|
10
|
+
action: ['deposit', 'withdraw', 'withdrawBack', 'consume', 'loan', 'repay'],
|
|
11
|
+
check(operation) {
|
|
12
|
+
return operation.data.hasOwnProperty('total') || operation.data.hasOwnProperty('avail');
|
|
13
|
+
},
|
|
14
|
+
when: 'after',
|
|
15
|
+
fn: async ({ operation }, context, option) => {
|
|
16
|
+
const { id, filter } = operation;
|
|
17
|
+
(0, assert_1.default)(typeof filter?.id === 'string');
|
|
18
|
+
context.saveOperationToEvent(id, `${constants_1.DATA_SUBSCRIBER_KEYS.accountNumberChanged}-${filter.id}`);
|
|
19
|
+
return 1;
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
exports.default = triggers;
|
package/lib/triggers/index.js
CHANGED
|
@@ -4,9 +4,11 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const accountOper_1 = tslib_1.__importDefault(require("./accountOper"));
|
|
5
5
|
const pay_1 = tslib_1.__importDefault(require("./pay"));
|
|
6
6
|
const userSystem_1 = tslib_1.__importDefault(require("./userSystem"));
|
|
7
|
+
const acount_1 = tslib_1.__importDefault(require("./acount"));
|
|
7
8
|
const triggers = [
|
|
8
9
|
...accountOper_1.default,
|
|
9
10
|
...pay_1.default,
|
|
10
11
|
...userSystem_1.default,
|
|
12
|
+
...acount_1.default,
|
|
11
13
|
];
|
|
12
14
|
exports.default = triggers;
|
|
@@ -4,5 +4,4 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const WechatPay_1 = tslib_1.__importDefault(require("./WechatPay"));
|
|
5
5
|
const WechatPay_debug_1 = tslib_1.__importDefault(require("./WechatPay.debug"));
|
|
6
6
|
// 微信支付没有沙箱环境,所以staging模式也只能用debug
|
|
7
|
-
console.log('WechatPay', process.env.NODE_ENV);
|
|
8
7
|
exports.default = process.env.NODE_ENV === 'production' ? WechatPay_1.default : WechatPay_debug_1.default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oak-pay-business",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib/**/*",
|
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
"js-base64": "^3.7.2",
|
|
51
51
|
"lodash": "^4.17.21",
|
|
52
52
|
"nprogress": "^0.2.0",
|
|
53
|
-
"oak-domain": "~5.0.
|
|
53
|
+
"oak-domain": "~5.0.6",
|
|
54
54
|
"oak-external-sdk": "~2.3.0",
|
|
55
|
-
"oak-frontend-base": "~5.0.
|
|
55
|
+
"oak-frontend-base": "~5.0.6",
|
|
56
56
|
"oak-memory-tree-store": "~3.3.0",
|
|
57
|
-
"oak-general-business": "~5.0.
|
|
57
|
+
"oak-general-business": "~5.0.7",
|
|
58
58
|
"react": "^18.2.0",
|
|
59
59
|
"react-dom": "^18.1.0",
|
|
60
60
|
"react-image-gallery": "^1.2.11",
|