WithdrawIteml.ts 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. import { _decorator, Component, Node, labelAssembler, Label, RichText } from 'cc';
  2. import { ConfigData } from '../Data/ConfigData';
  3. import { FsUtils } from '../FsUtils/FsUtils';
  4. const { ccclass, property } = _decorator;
  5. @ccclass('WithdrawIteml')
  6. export class WithdrawIteml extends Component {
  7. @property({ tooltip: "记录类型", type: Node })
  8. public withdrawType: Node;
  9. @property({ tooltip: "记录时间", type: Node })
  10. public withdrawTime: Node;
  11. @property({ tooltip: "记录金额", type: Node })
  12. public money: Node;
  13. start() {
  14. }
  15. /**
  16. * 初始化ui
  17. * @param type 记录类型
  18. * @param time 记录时间
  19. * @param money 金额
  20. */
  21. public setData(data: any) {
  22. // this.withdrawType.getComponent(Label).string = data.type == 1 ? "提现申请" : "贡献红包";
  23. this.withdrawType.getComponent(Label).string = "提现申请";
  24. this.withdrawTime.getComponent(Label).string = FsUtils.dateFormat(data.createTime * 1000);
  25. let color = data.value < 0 ? 'ff0000' : '238e23';
  26. this.money.getComponent(RichText).string = "<color=#" + color + ">¥ " + data.value / ConfigData.configMap.get("systemConfig").moneyRate + "元</color>";
  27. }
  28. }