CashNormalData.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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) {
  19. response.data.forEach(item_data => {
  20. for (const key in item_data) {
  21. if (key != 'withdrawalCode') {
  22. item_data[key] = parseInt(item_data[key]);
  23. }
  24. }
  25. });
  26. this.list_data = response.data;
  27. this.initReceipTotalRMB();
  28. }
  29. }
  30. /** 数据列表 */
  31. public list_data: Array<TCashList> = [];
  32. /**
  33. * 标志位 - 是否刷新样式
  34. */
  35. public init_rmb_style = true;
  36. private _receip_total_rmb: number = 0;
  37. /**
  38. * 到账毛币总数
  39. * - 单位 分
  40. */
  41. set receip_total_rmb(value: number) {
  42. this._receip_total_rmb = value;
  43. this.init_rmb_style = true;
  44. }
  45. get receip_total_rmb() {
  46. return this._receip_total_rmb;
  47. }
  48. /**
  49. * 初始化提现总数
  50. */
  51. private initReceipTotalRMB() {
  52. let temp_total_count = 0;
  53. const count = this.list_data.length;
  54. for (let i = 0; i < count; i++) {
  55. temp_total_count += this.list_data[i].amount;
  56. }
  57. this.receip_total_rmb = temp_total_count;
  58. }
  59. /** 客户端造 假数据 */
  60. private initTestData() {
  61. for (let i = 0; i < 30; i++) {
  62. const id = i + 1;
  63. let obj = {
  64. /** 档位 */
  65. cashType: mk.math.random(1, 10),
  66. applyTime: 1623399160,
  67. amount: i * 10,
  68. remain: i * 1000,
  69. CashMode: i % 2,
  70. /** 红包码 */
  71. withdrawalCode: 'AABBC' + i,
  72. }
  73. this.list_data.push(obj);
  74. }
  75. }
  76. /**
  77. * 获取存在红包码的 数据列表
  78. */
  79. public getListDataHavCode() {
  80. let new_list_data = [];
  81. const l_count = this.list_data.length;
  82. for (let i = 0; i < l_count; i++) {
  83. if (this.list_data[i].withdrawalCode) {
  84. new_list_data.push(this.list_data[i]);
  85. }
  86. }
  87. return new_list_data;
  88. }
  89. // public cash_type = ['', 'BOSS提现', '每日提现', '夺宝提现', '钱庄提现', '招募任务提现', '每日招募提现', '累计招募提现', '', '彩蛋提现', '福袋提现', '福袋提现'];
  90. /** 提现类型 */
  91. public cash_type = {
  92. 1: '红包提现',// 常规提现
  93. 2: '每日提现',
  94. 3: '夺宝提现',
  95. 4: '富翁银行提现',
  96. 5: '裂变任务提现',
  97. 6: '裂变每日提现',
  98. 7: '裂变累计提现',
  99. 8: '彩蛋任务提现',
  100. 9: '常规彩蛋任务提现',
  101. 10: '福袋提现',// 视频红包提现
  102. 11: '大额福袋',// 视频红包提现(公众号)
  103. 12: '存钱罐提现',
  104. 13: '签到提现',// 现金提现
  105. }
  106. }
  107. /**
  108. * 提现记录类型
  109. */
  110. export type TCashList = {
  111. /**
  112. * 提现类型
  113. */
  114. cashType: number,
  115. /** 提现时间 */
  116. applyTime: number,
  117. /** 提现金额,单位分 */
  118. amount: number,
  119. /** 剩余红包币,1元===10000红包币 */
  120. remain: number,
  121. /** 2:有红包码,其他无红包码 */
  122. CashMode: number,
  123. /** 红包码 */
  124. withdrawalCode: string,
  125. }