Sfoglia il codice sorgente

提现记录数据

薛鸿潇 5 anni fa
parent
commit
41f72c9e45

+ 1 - 1
assets/resources/module/cashNormal/cashNormal.prefab

@@ -1663,7 +1663,7 @@
       "__id__": 1
     },
     "_enabled": true,
-    "sroll_view": {
+    "scroll_view": {
       "__id__": 33
     },
     "lbl_rmb_total": {

+ 6 - 6
assets/resources/module/cashNormal/cashNormalItem.prefab

@@ -228,15 +228,15 @@
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
-      "x": 0.5,
+      "x": 0,
       "y": 0.5
     },
     "_trs": {
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        -271.122,
-        -55.38,
+        -331,
+        -55,
         0,
         0,
         0,
@@ -338,15 +338,15 @@
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
-      "x": 0.5,
+      "x": 0,
       "y": 0.5
     },
     "_trs": {
       "__type__": "TypedArray",
       "ctor": "Float64Array",
       "array": [
-        -271.122,
-        -112.463,
+        -331,
+        -112,
         0,
         0,
         0,

+ 3 - 3
assets/resources/module/redBagCode/redBagCodeItem.prefab

@@ -223,7 +223,7 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 139.34,
+      "width": 83.34,
       "height": 37.8
     },
     "_anchorPoint": {
@@ -275,8 +275,8 @@
     ],
     "_srcBlendFactor": 770,
     "_dstBlendFactor": 771,
-    "_string": "金额3.00元",
-    "_N$string": "金额3.00元",
+    "_string": "3.00元",
+    "_N$string": "3.00元",
     "_fontSize": 28,
     "_lineHeight": 30,
     "_enableWrapText": true,

+ 72 - 2
assets/script/game/data/module/CashNormalData.ts

@@ -5,6 +5,7 @@ import { Data } from "../../../mk/data/Data";
  */
 export class CashNormalData extends Data {
     public init() {
+        this.initTestData();// 假数据
         // 提现记录数据
         this.getRecord()
     }
@@ -15,12 +16,22 @@ export class CashNormalData extends Data {
             return;
         }
         console.log(response.data);
+        if (response.data.CashStatusList) {
+            response.data.CashStatusList.forEach(item_data => {
+                for (const key in item_data) {
+                    item_data[key] = parseInt(item_data[key])
+                }
+            });
+            this.list_data = response.data.CashStatusList;
+        }
     }
-    
+    /** 数据列表 */
+    public list_data: Array<TCashList> = [];
+
     /**
      * 标志位 - 是否刷新样式
      */
-     public init_rmb_style = true;
+    public init_rmb_style = true;
 
     private _receip_total_rmb: number = 0;
     /** 到账毛币总数 */
@@ -31,4 +42,63 @@ export class CashNormalData extends Data {
     get receip_total_rmb() {
         return this._receip_total_rmb;
     }
+
+    /** 提现类型 */
+    public cash_type = ['', 'BOSS提现', '每日提现', '夺宝提现', '钱庄提现', '招募任务提现', '每日招募提现', '累计招募提现', '', '彩蛋提现', '福袋提现', '福袋提现'];
+
+    /** 客户端造 假数据 */
+    private initTestData() {
+        for (let i = 0; i < 30; i++) {
+            const id = i + 1;
+            let obj = {
+                /** 档位 */
+                cashType: mk.math.random(1, 10),
+                applyTime: 1623399160,
+                amount: i * 10,
+                remain: i * 1000,
+                CashMode: i % 2,
+                /** 红包码 */
+                withdrawalCode: 'AABBC' + i,
+            }
+            this.list_data.push(obj);
+        }
+    }
+
+    /**
+     * 获取存在红包码的 数据列表
+     */
+    public getListDataHavCode() {
+        let new_list_data = [];
+        const l_count = this.list_data.length;
+        for (let i = 0; i < l_count; i++) {
+            if (this.list_data[i].withdrawalCode) {
+                new_list_data.push(this.list_data[i]);
+            }
+        }
+        return new_list_data;
+    }
+
+}
+
+/**
+ * 提现记录类型
+ */
+export type TCashList = {
+    /**
+     * 提现类型
+    */
+    cashType: number,
+    /** 提现时间 */
+    applyTime: number,
+    /** 提现金额,单位分 */
+    amount: number,
+    /** 剩余红包币,1元===10000红包币 */
+    remain: number,
+    /** 2:有红包码,其他无红包码 */
+    CashMode: number,
+    /** 红包码 */
+    withdrawalCode: string,
 }
+export enum ECashType {
+    assss = 1,
+}

+ 2 - 8
assets/script/game/module/module/cashNormal/CashNormal.ts

@@ -8,7 +8,7 @@ const { ccclass, property } = cc._decorator;
 export default class CashNormal extends cc.Component {
 
     @property({ displayName: '滚动视图', type: cc.ScrollView })
-    sroll_view: cc.ScrollView = null!;
+    private scroll_view: cc.ScrollView = null!;
     @property({ displayName: 'lbl累计提现', type: cc.Label })
     private lbl_rmb_total: cc.Label = null;
 
@@ -25,13 +25,7 @@ export default class CashNormal extends cc.Component {
      * 初始化滚动视图
      */
     private initScrollView() {
-        // 测试数据
-        let data = []
-        for (let i = 0; i < 10; i++) {
-            let obj = {};
-            data.push(666)
-        }
-        this.sroll_view.node.emit('srollview-init', data);
+        this.scroll_view.node.emit('srollview-init', gData.cashNormal.list_data);
     }
 
     /**

+ 6 - 5
assets/script/game/module/module/cashNormal/CashNormalItem.ts

@@ -1,3 +1,4 @@
+import { TCashList } from "../../../data/module/CashNormalData";
 
 const { ccclass, property } = cc._decorator;
 /**
@@ -28,11 +29,11 @@ export default class CashNormalItem extends cc.Component {
     public async setItemData(item_data) {
         await this.initStyle(item_data);
     }
-    private initStyle(item_data) {
+    private initStyle(item_data: TCashList) {
 
-        this.lbl_cash_type.string = '签到提现';
-        this.lbl_cash_time.string = '2021.03.05';
-        this.lbl_red_ma.string = '红包码:' + "AABBCC";
-        this.lbl_rmb_value.string = '¥' + 0.30 + '元';
+        this.lbl_cash_type.string = gData.cashNormal.cash_type[item_data.cashType];
+        this.lbl_cash_time.string = mk.time.getNowDayString(item_data.applyTime * 1000);
+        this.lbl_red_ma.string = item_data.withdrawalCode ? '红包码:' + item_data.withdrawalCode : '';
+        this.lbl_rmb_value.string = '¥' + item_data.amount + '元';
     }
 }

+ 1 - 4
assets/script/game/module/module/redBagCode/RedBagCode.ts

@@ -21,10 +21,7 @@ export default class RedBagCode extends cc.Component {
      * 初始化滚动列表
      */
     private initList() {
-        let list_data = [];
-        for (let i = 0; i < 30; i++) {
-            list_data.push(666)
-        }
+        let list_data = gData.cashNormal.getListDataHavCode();
         this.scroll_view.node.emit('srollview-init', list_data)
     }
 }

+ 5 - 4
assets/script/game/module/module/redBagCode/RedBagCodeItem.ts

@@ -1,4 +1,5 @@
 import JsbSystem from "../../../../mk/system/JsbSystem";
+import { TCashList } from "../../../data/module/CashNormalData";
 
 const { ccclass, property } = cc._decorator;
 /**
@@ -26,10 +27,10 @@ export default class RedBagCodeItem extends cc.Component {
     /**
      * 初始化样式
      */
-    private initItem(item_data) {
-        this.lbl_rmb.string = '金额' + 3 + '元';
-        this.lbl_time.string = '2020-6-66';
-        this.lbl_code.string = '红包码:' + 'AABBAA';
+    private initItem(item_data: TCashList) {
+        this.lbl_rmb.string = item_data.amount + '元';
+        this.lbl_time.string = mk.time.getNowDayString(item_data.applyTime * 1000);
+        this.lbl_code.string = item_data.withdrawalCode ? '红包码:' + item_data.withdrawalCode : '';
     }
 
     /**

+ 3 - 2
assets/script/mk/utils/TimeUtil.ts

@@ -165,11 +165,12 @@ export default class TimeUtil {
 
     /**
      * 获取当前日期
+     * @param   data        1997年起的秒数
      * @param   replace     间隔符,默认'-',则返回2020-10-10
      * @returns             当前时间字符串
      */
-    public getNowDayString(replace: string = '-'): string {
-        let date = new Date();
+    public getNowDayString(data?: number, replace: string = '-'): string {
+        let date = data ? new Date(data) : new Date();
         return date.getFullYear() + replace + (date.getMonth() + 1) + replace + date.getDate();
     }