CashNormalData.ts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import { Data } from "../../../mk/data/Data";
  2. /**
  3. * 红包提现数据
  4. * @author 薛鸿潇
  5. */
  6. export class CashNormalData extends Data {
  7. public init() {
  8. // this.initTestData();// 假数据
  9. // 提现记录数据
  10. this.getRecord()
  11. }
  12. public async getRecord() {
  13. let response = await mk.http.sendData('getCashRecord', {});
  14. if (response.errcode != 0) {
  15. return;
  16. }
  17. console.log(response.data);
  18. if (response.data.CashStatusList) {
  19. response.data.CashStatusList.forEach(item_data => {
  20. for (const key in item_data) {
  21. item_data[key] = parseInt(item_data[key])
  22. }
  23. });
  24. this.list_data = response.data.CashStatusList;
  25. }
  26. }
  27. /** 数据列表 */
  28. public list_data: Array<TCashList> = [];
  29. /**
  30. * 标志位 - 是否刷新样式
  31. */
  32. public init_rmb_style = true;
  33. private _receip_total_rmb: number = 0;
  34. /** 到账毛币总数 */
  35. set receip_total_rmb(value: number) {
  36. this._receip_total_rmb = value;
  37. this.init_rmb_style = true;
  38. }
  39. get receip_total_rmb() {
  40. return this._receip_total_rmb;
  41. }
  42. /** 提现类型 */
  43. public cash_type = ['', 'BOSS提现', '每日提现', '夺宝提现', '钱庄提现', '招募任务提现', '每日招募提现', '累计招募提现', '', '彩蛋提现', '福袋提现', '福袋提现'];
  44. /** 客户端造 假数据 */
  45. private initTestData() {
  46. for (let i = 0; i < 30; i++) {
  47. const id = i + 1;
  48. let obj = {
  49. /** 档位 */
  50. cashType: mk.math.random(1, 10),
  51. applyTime: 1623399160,
  52. amount: i * 10,
  53. remain: i * 1000,
  54. CashMode: i % 2,
  55. /** 红包码 */
  56. withdrawalCode: 'AABBC' + i,
  57. }
  58. this.list_data.push(obj);
  59. }
  60. }
  61. /**
  62. * 获取存在红包码的 数据列表
  63. */
  64. public getListDataHavCode() {
  65. let new_list_data = [];
  66. const l_count = this.list_data.length;
  67. for (let i = 0; i < l_count; i++) {
  68. if (this.list_data[i].withdrawalCode) {
  69. new_list_data.push(this.list_data[i]);
  70. }
  71. }
  72. return new_list_data;
  73. }
  74. }
  75. /**
  76. * 提现记录类型
  77. */
  78. export type TCashList = {
  79. /**
  80. * 提现类型
  81. */
  82. cashType: number,
  83. /** 提现时间 */
  84. applyTime: number,
  85. /** 提现金额,单位分 */
  86. amount: number,
  87. /** 剩余红包币,1元===10000红包币 */
  88. remain: number,
  89. /** 2:有红包码,其他无红包码 */
  90. CashMode: number,
  91. /** 红包码 */
  92. withdrawalCode: string,
  93. }
  94. export enum ECashType {
  95. assss = 1,
  96. }