WechatTransfer.ts 3.2 KB

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