WechatTransfer.ts 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * @Author: mojunshou 1637302775@qq.com
  3. * @Date: 2025-04-19 11:34:46
  4. * @LastEditors: mojunshou 1637302775@qq.com
  5. * @LastEditTime: 2025-05-16 11:32:47
  6. * @Description: 微信转账中界面
  7. */
  8. import { _decorator, Component, Node, Animation } from 'cc';
  9. import VMParent from 'db://oops-framework/libs/model-view/VMParent';
  10. import { smc } from '../../common/SingletonModuleComp';
  11. import { oops } from 'db://oops-framework/core/Oops';
  12. import { UIID } from '../../common/config/GameUIConfig';
  13. import { DeviceUtil } from 'db://oops-framework/core/utils/DeviceUtil';
  14. import { Format } from '../../utils/Format';
  15. import { DCHandler } from '../../common/manager/DCHandler';
  16. import { ServerHandler } from '../../common/manager/ServerHandler';
  17. import { GameEvent } from '../../common/config/GameEvent';
  18. import { TableGameConfig } from '../../common/table/TableGameConfig';
  19. const { ccclass, property } = _decorator;
  20. @ccclass('WechatTransfer')
  21. export class WechatTransfer extends VMParent {
  22. data: any = {
  23. money: 1076.6,
  24. //手续费
  25. cost: 300,
  26. gameName: "",
  27. rates: 70, //费率
  28. //还差
  29. differ: 70,
  30. //赠送金额
  31. creditNum: 100,
  32. }
  33. @property(Node) //微信转账中
  34. private showNode1: Node = null!;
  35. @property(Node) //第三方安全验证
  36. private showNode2: Node = null!;
  37. @property(Node) //高价值用户
  38. private showNode3: Node = null!;
  39. @property(Node) //微信打款中
  40. private showNode4: Node = null!;
  41. private _tsGameConfig = new TableGameConfig();
  42. start() {
  43. oops.message.dispatchEvent(GameEvent.updateGameState, "paused");
  44. DCHandler.inst.reportData(3000201);
  45. this.setButton();
  46. this.showNode1.active = true;
  47. this.showNode2.active = false;
  48. this._tsGameConfig.init(1);
  49. this.data.gameName = this._tsGameConfig.gameName;
  50. this.updateData();
  51. }
  52. //设置数据
  53. updateData() {
  54. if (DeviceUtil.isAndroid && DeviceUtil.isNative) {
  55. this.data.money = Format.formatWxCoin(smc.account.AccountModel.wxCoin);
  56. this.data.cost = smc.game.GameModel.costInfo.handlingCharge;
  57. this.data.creditNum = smc.game.GameModel.costInfo.giftNum;
  58. this.data.differ = smc.game.GameModel.costInfo.handlingCharge - smc.game.GameModel.costInfo.giftNum;
  59. }
  60. }
  61. btn_continue() {
  62. //第三方安全验证
  63. this.showNode1.active = false;
  64. this.showNode2.active = true;
  65. //播放动画
  66. DCHandler.inst.reportData(3000202);
  67. const animation = this.showNode2.getComponent(Animation);
  68. if (animation) {
  69. animation.play();
  70. }
  71. }
  72. //安全验证关闭
  73. btn_verifyClose() {
  74. //高价值用户
  75. this.onVerifyClose();
  76. }
  77. //安全验证知道了
  78. btn_knew() {
  79. //高价值用户
  80. this.onVerifyClose();
  81. }
  82. onVerifyClose() {
  83. DCHandler.inst.reportData(3000203);
  84. this.showNode2.active = false;
  85. this.showNode3.active = true;
  86. const animation = this.showNode3.getComponent(Animation);
  87. if (animation) {
  88. animation.play();
  89. }
  90. }
  91. //高价值用户关闭
  92. btn_HightValueClose() {
  93. this.onHightValueClose();
  94. ServerHandler.inst.getFee();
  95. }
  96. //高价只用户开心收下
  97. btn_happyAccept() {
  98. this.onHightValueClose();
  99. ServerHandler.inst.getFee();
  100. }
  101. onHightValueClose() {
  102. this.showNode3.active = false;
  103. this.showNode4.active = true;
  104. const animation = this.showNode4.getComponent(Animation);
  105. if (animation) {
  106. animation.play();
  107. }
  108. //3秒后关闭
  109. this.scheduleOnce(() => {
  110. ServerHandler.inst.updatePopupState({
  111. level: smc.account.AccountModel.curLevel,
  112. type: smc.game.GameModel.popupType
  113. })
  114. oops.gui.remove(UIID.WechatTransfer)
  115. }, 4)
  116. }
  117. }