70 lines
2.0 KiB
JavaScript
70 lines
2.0 KiB
JavaScript
import dayJs from 'dayjs';
|
|
import assert from 'assert';
|
|
import { ToYuan, ThousandCont } from "oak-domain/lib/utils/money";
|
|
export default OakComponent({
|
|
entity: 'withdraw',
|
|
isList: true,
|
|
properties: {
|
|
gotoDetail: (id) => undefined,
|
|
accountId: '',
|
|
},
|
|
filters: [
|
|
{
|
|
filter() {
|
|
const { accountId } = this.props;
|
|
assert(accountId);
|
|
return {
|
|
accountId,
|
|
};
|
|
},
|
|
}
|
|
],
|
|
projection: {
|
|
id: 1,
|
|
price: 1,
|
|
dealPrice: 1,
|
|
loss: 1,
|
|
dealLoss: 1,
|
|
iState: 1,
|
|
refund$entity$$aggr: {
|
|
$entity: 'refund',
|
|
data: {
|
|
'#count-1': {
|
|
id: 1,
|
|
},
|
|
},
|
|
},
|
|
withdrawTransfer$withdraw$$aggr: {
|
|
$entity: 'withdrawTransfer',
|
|
data: {
|
|
'#count-1': {
|
|
id: 1,
|
|
},
|
|
},
|
|
},
|
|
$$createAt$$: 1,
|
|
},
|
|
formData({ data }) {
|
|
return {
|
|
withdraws: data.map((ele) => {
|
|
const { id, price, loss, dealPrice, dealLoss, iState, $$createAt$$, refund$entity$$aggr: refundAggr, withdrawTransfer$withdraw$$aggr: transferAggr } = ele;
|
|
const count = (refundAggr?.[0]['#count-1'] || 0) + (transferAggr?.[0]['#count-1'] || 0);
|
|
return {
|
|
id,
|
|
price: ThousandCont(ToYuan(price), 2),
|
|
lossDescription: this.t('loss', { value: ToYuan(loss) }),
|
|
iState: this.t(`withdraw:v.iState.${iState}`),
|
|
iStateColor: this.features.style.getColor('withdraw', 'iState', iState),
|
|
countDescription: this.t('count', { value: count }),
|
|
createAt: dayJs($$createAt$$).format('YYYY-MM-DD HH:mm'),
|
|
};
|
|
}),
|
|
};
|
|
},
|
|
methods: {
|
|
goBack() {
|
|
this.navigateBack();
|
|
}
|
|
}
|
|
});
|