/**
 * @description 提现数据类
 * @author kaka
 */

import { Data } from "../../../mk/data/Data";

export default class CashProData extends Data {
    init_data = false;
    cashPro_type: cashProType;
    cashPro_money = 0;

    init_success = false;

    init_fail = false;

    openCashPro(type: cashProType, money) {
        this.cashPro_type = type;
        this.cashPro_money = money;
        this.init_data = true;

        mk.ui.openPanel('module/cashPro/cashPro');
    }

    async onCash() {
        let response = null;
        switch (this.cashPro_type) {
            case cashProType.blessing_bigCash:
                response = await gData.blessingBag.HttpCashBig();

                if (response && response.data.code == 1) {
                    gData.cashPro.init_success = true;
                }
                else {
                    gData.cashPro.init_fail = true;
                }
                break;
            case cashProType.blessing_taskCash:
                response = await gData.blessingBag.HttpCashTask();

                if (response && response.data.code == 1) {
                    gData.cashPro.init_success = true;
                }
                else {
                    gData.cashPro.init_fail = true;
                }
                break;
        }
    }
}

/** 提现类型枚举 */
export enum cashProType {
    blessing_bigCash,   //福袋大额红包提现
    blessing_taskCash,  //福袋任务提现
}
