| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import { _decorator, Component, Node, Label } from 'cc';
- import { Http } from '../../core/net/Http';
- import { WindowManager } from '../../core/ui/window/WindowManager';
- import { ConfigData } from '../../Data/ConfigData';
- import { g } from '../../Data/g';
- import { platform } from '../../Data/platform';
- import { FsUtils } from '../../FsUtils/FsUtils';
- const { ccclass, property } = _decorator;
- /**神台提现面板 */
- @ccclass('Withdrawal')
- export class Withdrawal extends Component {
- @property({ tooltip: "可提现余额", type: Label })
- public moneyLabel: Label;
- @property({ type: Http, tooltip: "消息控制" })
- http: Http;
- private contribution: number = -1;
- private systemConfig;
- start() {
- this.systemConfig = ConfigData.configMap.get("systemConfig");
- }
- update() {
- if (this.contribution != g.userData.contribution) {
- this.moneyLabel.string = FsUtils.toFixed(g.userData.contribution / ConfigData.configMap.get("systemConfig").moneyRate, 2);
- }
- }
- /**
- * 贡献提现
- */
- public async onWithdrawal() {
- if (g.userData.contribution < this.systemConfig.minWithdraw) {
- WindowManager.showTips(g.CodeMsg[119]);
- return;
- }
- let result = await this.http.send("/api/wealth/Withdraw", { type: 1 });
- g.gameData.hasNewwithdrawalLog = true;
- if (result.code && result.code > 0) {
- WindowManager.showTips(g.CodeMsg[result.code]);
- } else {
- if (result.message) {
- WindowManager.showTips(result.message);
- }
- else {
- platform.volcanicReport('withdrawForContribution');
- WindowManager.showTips("提现成功,72小时内到账");
- g.userData.contribution = 0;
- }
- }
- }
- }
|