| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- /** 红包码界面 */
- import { HTTP_TYPE, RecordTYPE } from "../datas/CommonData";
- import { TuCaoData } from "../datas/TuCaoData";
- import GameM, { AUDIO_TYPE } from "../manager/GameM";
- import UiM, { PANEL_NAME } from "../manager/UiM";
- import RedCodeItem from "../prefabs/RedCodeItem";
- import BasePanel from "../uiFrames/BasePanel";
- import LogUtil from "../utils/LogUtil";
- import { Utils } from "../utils/Utils";
- import CashOut from "./CashOut";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class RedCodeListPanel extends BasePanel {
- @property(cc.Node)
- panelNode:cc.Node=null;
- @property(cc.Node)
- content: cc.Node = null;
- @property(cc.Node)
- labEmpty: cc.Node = null;
- @property(cc.Node)
- parNode: cc.Node = null;
- cashType = 0
- itemP = null
- async onLoad() {
- this.itemP = await Utils.loadResPromise('prefabs/RedCodeItem')
- }
- /** 初始化
- * @param cashType 1、常规提现 2、每日提现 3、夺宝提现 4、富翁提现 50、裂变提现 60、看视频领红包提现*/
- OnEnter(cashType: any) {
- this.panelNode.scale = 0;
- this.node.active = true;
- cc.tween(this.panelNode).to(0.2, { scale: 1 }, { easing: "backOut" })
- .call(() => {
- this.init(cashType);
- })
- .start();
- }
- OnExit() {
- this.node.active = false;
- }
- /** 初始化
- * @param cashType 1、常规提现 2、每日提现 3、夺宝提现 4、富翁提现 50、裂变提现 60、看视频领红包提现*/
- init(cashType) {
- this.cashType = cashType
- this.content.removeAllChildren()
- if (this.cashType == 50) {
- GameM.ClubData.requestClubWithDrawRecords()
- }
- else if (this.cashType == 60) {
- this.freshRecord();
- }
- else {
- GameM.httpM.sendDatas(HTTP_TYPE.getCashRecord, null, GameM.commonData.resultCashRecord.bind(GameM.commonData))
- }
- }
- freshRecord() {
- let arr = []
- if (this.cashType == 50) {
- arr = GameM.ClubData.getRedCodeByClubCashType()
- } else if (this.cashType == 60) {
- arr = TuCaoData.Ins.videoRbData.redMoneyCode;
- } else {
- arr = GameM.commonData.getRedCodeByCashType(this.cashType)
- }
- for (var i = 0; i < arr.length; i++) {
- let item: cc.Node = cc.instantiate(this.itemP)
- let s = item.getComponent(RedCodeItem)
- let data = arr[i]
- if (this.cashType == 50) {
- let createTime: string = data.createTime
- LogUtil.logV(" createTime", createTime)
- let spliteStr = createTime.split(" ")
- s.init((data.amount * 0.0001).toFixed(2), spliteStr[0], data.withdrawCode, this.cashType)
- }
- else if (this.cashType == 60) {
- s.init(data.VideoCashBig, data.cashDate, data.RedMoneyCode);
- }
- else {
- s.init((data.amount * 0.01).toFixed(2), data.applyTime, data.withdrawalCode)
- }
- this.content.addChild(item)
- }
- if (arr.length <= 0) {
- this.labEmpty.active = true
- }
- else {
- this.labEmpty.active = false
- }
- }
- clickClose() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- this.OnExit();
- }
- hideEff() {
- let pos = UiM.Instance.cashNode.getComponent(CashOut).labRedCode.position
- let addy = (cc.winSize.height - 1334) / 2
- pos.y += addy
- cc.tween(this.parNode).to(0.2, { scale: 0, position: pos }).call(() => {
- UiM.Instance.offPanel(PANEL_NAME.RedCodeNode)
- }).start();
- }
- }
|