CashNormalData.ts 4.0 KB

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