WechatTransfer.ts 3.7 KB

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