WechatTransfer.ts 3.8 KB

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