78 lines
2.2 KiB
JavaScript
78 lines
2.2 KiB
JavaScript
export default OakComponent({
|
|
entity: 'refund',
|
|
isList: true,
|
|
actions: ['succeed', 'fail'],
|
|
projection: {
|
|
id: 1,
|
|
price: 1,
|
|
loss: 1,
|
|
creator: {
|
|
id: 1,
|
|
nickname: 1,
|
|
name: 1,
|
|
mobile$user: {
|
|
$entity: 'mobile',
|
|
data: {
|
|
id: 1,
|
|
mobile: 1,
|
|
}
|
|
}
|
|
},
|
|
pay: {
|
|
entity: 1,
|
|
entityId: 1,
|
|
paid: 1,
|
|
offlineAccount: {
|
|
id: 1,
|
|
type: 1,
|
|
channel: 1,
|
|
name: 1,
|
|
qrCode: 1,
|
|
},
|
|
wpProduct: {
|
|
id: 1,
|
|
type: 1,
|
|
},
|
|
externalId: 1,
|
|
},
|
|
externalId: 1,
|
|
withdrawId: 1,
|
|
iState: 1,
|
|
reason: 1,
|
|
},
|
|
filters: [
|
|
{
|
|
filter() {
|
|
// const applicationId = this.features.application.getApplicationId();
|
|
const systemId = this.features.application.getApplication()?.systemId;
|
|
return {
|
|
pay: {
|
|
application: {
|
|
systemId,
|
|
},
|
|
},
|
|
};
|
|
}
|
|
}
|
|
],
|
|
formData({ data, features }) {
|
|
return {
|
|
refunds: data?.map((ele) => {
|
|
const { creator, withdrawId, pay, ...rest } = ele;
|
|
const { entity, wpProduct, offlineAccount } = pay;
|
|
const payChannel = entity === 'offlineAccount' ? this.t(`offlineAccount:v.type.${offlineAccount?.type}`) : (entity === 'wpProduct' ? this.t(`wpProduct:v.type.${wpProduct.type}`) : this.t(`${entity}:name`));
|
|
return {
|
|
...rest,
|
|
isWithdraw: !!withdrawId,
|
|
payChannel,
|
|
pay,
|
|
creatorName: creator?.name || creator?.nickname || '-',
|
|
creatorMobile: creator?.mobile$user?.[0]?.mobile || '-',
|
|
};
|
|
}),
|
|
amIRoot: features.token.isRoot(),
|
|
oakExecutable: this.tryExecute(),
|
|
};
|
|
}
|
|
});
|