RedPackeWithdrawalViewComp.ts 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * @Author: mojunshou 1637302775@qq.com
  3. * @Date: 2025-03-20 17:53:50
  4. * @LastEditors: mojunshou 1637302775@qq.com
  5. * @LastEditTime: 2025-04-10 15:11:12
  6. * @Description: 红包提现
  7. */
  8. import { _decorator, Label, Node } from "cc";
  9. import { oops } from "db://oops-framework/core/Oops";
  10. import { DeviceUtil } from "db://oops-framework/core/utils/DeviceUtil";
  11. import { GameComponent } from "db://oops-framework/module/common/GameComponent";
  12. import { GameEvent } from "../common/config/GameEvent";
  13. import { UIID } from "../common/config/GameUIConfig";
  14. import { CocosHandler } from "../common/manager/CocosHandler";
  15. import List from "../ui/List";
  16. import { RedPackeItemView } from "./RedPackeItemView";
  17. const { ccclass, property } = _decorator;
  18. /** 视图层对象 */
  19. @ccclass('RedPackeWithdrawalViewComp')
  20. export class RedPackeWithdrawalViewComp extends GameComponent {
  21. @property(List)
  22. recordList: List = null!;
  23. @property(Label)
  24. lab_redNum: Label = null!; //红包金额
  25. @property(Label)
  26. lab_tips: Label = null!; //提示金额
  27. @property(Label)
  28. lab_wxNum: Label = null!; //微信金额
  29. data: any[] = [];
  30. onLoad() {
  31. this.setButton();
  32. this.addEvent();
  33. const data = {
  34. title: `每日消除100次即可领取`,
  35. current: 1,
  36. total: 100,
  37. state: 0,
  38. goods: [
  39. {
  40. type: 1001,
  41. num: 100
  42. }
  43. ]
  44. }
  45. for (let i = 0; i < 10; i++) {
  46. this.data.push(data);
  47. }
  48. oops.log.logView(this.data, "this.data");
  49. this.recordList.numItems = this.data.length;
  50. oops.log.logView(this.recordList.numItems, "this.recordList.numItems");
  51. }
  52. addEvent() {
  53. oops.message.on(GameEvent.openRecordView, this.openRecordView, this);
  54. }
  55. private onListRender(item: Node, idx: number) {
  56. console.log("onListRender", idx);
  57. const itemView: RedPackeItemView | null = item.getComponent(RedPackeItemView);
  58. if (itemView) {
  59. console.log(">>>>>>>>>>>>>>>>>", itemView)
  60. itemView.setItem(this.data[idx], idx);
  61. }
  62. }
  63. private btn_back() {
  64. oops.gui.remove(UIID.RedPacketWithdraw);
  65. }
  66. private btn_record() {
  67. if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
  68. CocosHandler.inst.getRecordList();
  69. } else {
  70. oops.gui.open(UIID.WithdrawRecord);
  71. }
  72. }
  73. private openRecordView() {
  74. oops.gui.open(UIID.WithdrawRecord);
  75. }
  76. private btn_withdrawal() {
  77. //全部提现
  78. }
  79. }