import { Data } from "../../../mk/data/Data"; /** * 存钱罐数据 * - 提现描述显示: * 1.判断是否可提, * 可提显示“直接提现” * 不可提判断存款是否满足提现最低限制 * 满足显示:“明日提现”, * 不满足显示:“满x可提” * @author 薛鸿潇 */ export class PigBankData extends Data { /** * 数据初始化 */ public init() { // 提现状态 this.cash_enable = gData.gameData.gameData.isWithdrawable; // 存款金额 this._cur_cash_count = gData.gameData.gameData.piggyBank; } /** 标志位:是否需要刷新数据 */ public init_data: boolean = true; /** 是否可提现 */ private _cash_enable: number = 0; set cash_enable(bool: number) { if (this._cash_enable != bool) { this._cash_enable = bool; this.init_data = true; } } get cash_enable(): number { return this._cash_enable; } /** 当前存款 */ private _cur_cash_count: number = 0; set cur_cash_count(value: number) { if (this._cur_cash_count != value) { this._cur_cash_count = value; this.init_data = true; } } get cur_cash_count(): number { return this._cur_cash_count; } /** 提现最低限制 */ public cash_min_limit: number = 0.3; /** * 提现操作 * - 此处需要对接服务端数据 */ public async cashOP() { let data = {}; let response = await mk.http.sendRequest('piggyBankCash', 'POST', JSON.stringify(data)); // let response = await mk.http.sendRequest('readyCash', 'POST', JSON.stringify(data)); if (response.errcode != 0) { mk.tip.pop('系统异常'); return; } if (response.CashMode == 0) {//星云打款 // mk.tip.pop('') } else if (response.CashMode == 1) {//公众号打款 } this.cash_enable = 0; // 打开提现到账界面 gData.receiptNotice.receip_rmb = this._cur_cash_count; gData.cashNormal.receip_total_rmb += gData.receiptNotice.receip_rmb; mk.ui.openPanel('module/receiptNotice/receiptNotice'); } }