RedPackeWithdrawalViewComp.ts 2.7 KB

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