WechatTransfer.ts 3.4 KB

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