我的 累积收益 前端计算结果

master
laiiihz 4 years ago
parent 54051382e3
commit 023773029a

@ -40,7 +40,7 @@ class _CumulativeIncomePageState extends BaseStoreState<CumulativeIncomePage>
double get _yearIncome { double get _yearIncome {
double result = 0; double result = 0;
_models.forEach((element) { _models.forEach((element) {
result += element?.amount ?? 0; result += element?.allAmount ?? 0;
}); });
return result; return result;
} }
@ -371,7 +371,7 @@ class _CumulativeIncomePageState extends BaseStoreState<CumulativeIncomePage>
: SizedBox(), : SizedBox(),
20.hb, 20.hb,
...List.generate(_models.length, (index) { ...List.generate(_models.length, (index) {
return _buildInfoItem(isFirst: index == 0,model:_models[index] ); return _buildInfoItem(isFirst: index == 0, model: _models[index]);
}).sepWidget(separate: 20.hb), }).sepWidget(separate: 20.hb),
30.hb, 30.hb,
], ],
@ -442,7 +442,7 @@ class _CumulativeIncomePageState extends BaseStoreState<CumulativeIncomePage>
''.text.black.size(10.sp).make(), ''.text.black.size(10.sp).make(),
Spacer(), Spacer(),
'总收益:'.text.color(Color(0xFF999999)).size(12.sp).make(), '总收益:'.text.color(Color(0xFF999999)).size(12.sp).make(),
(model?.amount ?? 0) (model?.allAmount ?? 0)
.toStringAsFixed(2) .toStringAsFixed(2)
.text .text
.color(Color(0xFFD5101A)) .color(Color(0xFFD5101A))

@ -10,6 +10,13 @@ class UserMonthIncomeModel {
double recommendAmount; double recommendAmount;
double rewardAmount; double rewardAmount;
double get allAmount =>
(purchaseAmount ?? 0) +
(guideAmount ?? 0) +
(teamAmount ?? 0) +
(recommendAmount ?? 0) +
(rewardAmount ?? 0);
UserMonthIncomeModel( UserMonthIncomeModel(
{this.id, {this.id,
this.userId, this.userId,

Loading…
Cancel
Save