40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
export default OakComponent({
|
|
properties: {
|
|
payChannels: {},
|
|
payChannel: undefined,
|
|
onPick: (channel) => undefined,
|
|
},
|
|
formData() {
|
|
const { payChannels, payChannel } = this.props;
|
|
const channels = payChannels.map(ele => ({
|
|
...ele,
|
|
label: ele.label ? this.t(ele.label) : this.t(`payChannel::${ele.entity}`),
|
|
value: ele.entityId,
|
|
}));
|
|
return {
|
|
channels,
|
|
channel: channels.find(ele => ele.entityId === payChannel?.entityId)?.entityId,
|
|
};
|
|
},
|
|
listeners: {
|
|
payChannel() {
|
|
this.reRender();
|
|
},
|
|
payChannels() {
|
|
this.reRender();
|
|
}
|
|
},
|
|
methods: {
|
|
onPickChannel(id) {
|
|
const { onPick, payChannels } = this.props;
|
|
const channel = payChannels.find(ele => ele.entityId === id);
|
|
onPick(channel);
|
|
},
|
|
onPickChannelMp(touch) {
|
|
const { detail } = touch;
|
|
const { currentKey } = detail;
|
|
this.onPickChannel(currentKey);
|
|
},
|
|
}
|
|
});
|