CashNormal.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. const { ccclass, property } = cc._decorator;
  2. /**
  3. * 提现记录
  4. * @author 薛鸿潇
  5. */
  6. @ccclass
  7. export default class CashNormal extends cc.Component {
  8. @property({ displayName: '滚动视图', type: cc.ScrollView })
  9. private scroll_view: cc.ScrollView = null!;
  10. @property({ displayName: 'lbl累计提现', type: cc.Label })
  11. private lbl_rmb_total: cc.Label = null;
  12. @property({ displayName: 'lbl暂无提现', type: cc.Label })
  13. private lbl_none: cc.Label = null;
  14. // onLoad () {}
  15. start() {
  16. gData.cashNormal.getRecord();
  17. this.initTotal();
  18. // this.initScrollView();
  19. // this.initNoneItem();
  20. }
  21. // update (dt) {}
  22. /**
  23. * 初始化滚动视图
  24. */
  25. private initScrollView() {
  26. this.scroll_view.node.emit('srollview-init', gData.cashNormal.list_data);
  27. }
  28. /**
  29. * 初始化累计提现
  30. */
  31. private initTotal() {
  32. this.lbl_rmb_total.string = '¥' + (gData.cashNormal.receip_total_rmb / 100).toFixed(2) + '元';
  33. }
  34. /**
  35. * 初始化无条目时的提示
  36. */
  37. private initNoneItem() {
  38. const count = gData.cashNormal.list_data.length;
  39. if (count) {
  40. this.lbl_none.node.active = false;
  41. } else {
  42. this.lbl_none.node.active = true;
  43. }
  44. }
  45. update(){
  46. if(gData.cashNormal.update_list){
  47. this.initScrollView();
  48. this.initNoneItem()
  49. gData.cashNormal.update_list = false;
  50. }
  51. }
  52. }