withdraw.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. // 提款记录mock数据
  2. export const withdrawMockData = {
  3. // 提款记录列表
  4. list: [
  5. {
  6. id: 1,
  7. order_no: 'WD202501150001',
  8. username: 'john_doe',
  9. phone: '13800138001',
  10. withdraw_type: 'bank',
  11. withdraw_type_text: '银行卡',
  12. withdraw_channel: 'BKASH',
  13. withdraw_channel_text: 'BKASH',
  14. currency: 'BDT',
  15. amount: 5000,
  16. status: 'processing',
  17. status_text: '处理中',
  18. bank_name: 'Dutch Bangla Bank',
  19. account_name: 'John Doe',
  20. account_number: '1234567890123456',
  21. create_time: '2025-01-15 10:30:00',
  22. success_time: '',
  23. user_id: 1001,
  24. // 详情页面额外字段
  25. fee: 50,
  26. actual_amount: 4950,
  27. bank_code: 'DBBL',
  28. branch_name: 'Dhaka Main Branch',
  29. account_balance: '15,000',
  30. profit_balance: '8,000',
  31. withdraw_balance: '7,000',
  32. },
  33. {
  34. id: 2,
  35. order_no: 'WD202501150002',
  36. username: 'jane_smith',
  37. phone: '13800138002',
  38. withdraw_type: 'mobile',
  39. withdraw_type_text: '手机钱包',
  40. withdraw_channel: 'NAGAD',
  41. withdraw_channel_text: 'NAGAD',
  42. currency: 'BDT',
  43. amount: 3000,
  44. status: 'success',
  45. status_text: '提款成功',
  46. bank_name: 'NAGAD',
  47. account_name: 'Jane Smith',
  48. account_number: '01712345678',
  49. create_time: '2025-01-15 09:15:00',
  50. success_time: '2025-01-15 09:45:30',
  51. user_id: 1002,
  52. // 详情页面额外字段
  53. fee: 30,
  54. actual_amount: 2970,
  55. bank_code: 'NAGAD',
  56. branch_name: '--',
  57. account_balance: '12,000',
  58. profit_balance: '5,000',
  59. withdraw_balance: '7,000',
  60. },
  61. {
  62. id: 3,
  63. order_no: 'WD202501150003',
  64. username: 'mike_wilson',
  65. phone: '13800138003',
  66. withdraw_type: 'bank',
  67. withdraw_type_text: '银行卡',
  68. withdraw_channel: 'BKASH',
  69. withdraw_channel_text: 'BKASH',
  70. currency: 'BDT',
  71. amount: 2000,
  72. status: 'failed',
  73. status_text: '提款失败',
  74. bank_name: 'Islami Bank Bangladesh',
  75. account_name: 'Mike Wilson',
  76. account_number: '9876543210987654',
  77. create_time: '2025-01-15 08:45:00',
  78. success_time: '',
  79. user_id: 1003,
  80. // 详情页面额外字段
  81. fee: 20,
  82. actual_amount: 1980,
  83. bank_code: 'IBBL',
  84. branch_name: 'Chittagong Branch',
  85. account_balance: '8,000',
  86. profit_balance: '3,000',
  87. withdraw_balance: '5,000',
  88. },
  89. {
  90. id: 4,
  91. order_no: 'WD202501150004',
  92. username: 'sarah_johnson',
  93. phone: '13800138004',
  94. withdraw_type: 'mobile',
  95. withdraw_type_text: '手机钱包',
  96. withdraw_channel: 'ROCKET',
  97. withdraw_channel_text: 'ROCKET',
  98. currency: 'BDT',
  99. amount: 7500,
  100. status: 'success',
  101. status_text: '提款成功',
  102. bank_name: 'ROCKET',
  103. account_name: 'Sarah Johnson',
  104. account_number: '01987654321',
  105. create_time: '2025-01-15 07:20:00',
  106. success_time: '2025-01-15 08:15:45',
  107. user_id: 1004,
  108. // 详情页面额外字段
  109. fee: 75,
  110. actual_amount: 7425,
  111. bank_code: 'ROCKET',
  112. branch_name: '--',
  113. account_balance: '20,000',
  114. profit_balance: '12,000',
  115. withdraw_balance: '8,000',
  116. },
  117. {
  118. id: 5,
  119. order_no: 'WD202501150005',
  120. username: 'david_brown',
  121. phone: '13800138005',
  122. withdraw_type: 'bank',
  123. withdraw_type_text: '银行卡',
  124. withdraw_channel: 'BKASH',
  125. withdraw_channel_text: 'BKASH',
  126. currency: 'BDT',
  127. amount: 4000,
  128. status: 'processing',
  129. status_text: '处理中',
  130. bank_name: 'Standard Chartered Bank',
  131. account_name: 'David Brown',
  132. account_number: '5432109876543210',
  133. create_time: '2025-01-15 06:10:00',
  134. success_time: '',
  135. user_id: 1005,
  136. // 详情页面额外字段
  137. fee: 40,
  138. actual_amount: 3960,
  139. bank_code: 'SCB',
  140. branch_name: 'Gulshan Branch',
  141. account_balance: '18,000',
  142. profit_balance: '10,000',
  143. withdraw_balance: '8,000',
  144. },
  145. ],
  146. // 状态统计
  147. statusCount: {
  148. all: 5,
  149. processing: 2,
  150. success: 2,
  151. failed: 1,
  152. },
  153. // 分页查询方法
  154. getList: (params) => {
  155. let filteredList = [...withdrawMockData.list];
  156. // 搜索过滤
  157. if (params.username) {
  158. filteredList = filteredList.filter(item =>
  159. item.username.toLowerCase().includes(params.username.toLowerCase())
  160. );
  161. }
  162. if (params.phone) {
  163. filteredList = filteredList.filter(item =>
  164. item.phone.includes(params.phone)
  165. );
  166. }
  167. if (params.order_no) {
  168. filteredList = filteredList.filter(item =>
  169. item.order_no.toLowerCase().includes(params.order_no.toLowerCase())
  170. );
  171. }
  172. if (params.status && params.status !== 'all') {
  173. filteredList = filteredList.filter(item => item.status === params.status);
  174. }
  175. // 时间范围过滤
  176. if (params.start_time && params.end_time) {
  177. filteredList = filteredList.filter(item => {
  178. const createTime = new Date(item.create_time);
  179. const startTime = new Date(params.start_time);
  180. const endTime = new Date(params.end_time);
  181. return createTime >= startTime && createTime <= endTime;
  182. });
  183. }
  184. // 分页
  185. const page = parseInt(params.page) || 1;
  186. const listRows = parseInt(params.list_rows) || 10;
  187. const total = filteredList.length;
  188. const start = (page - 1) * listRows;
  189. const end = start + listRows;
  190. const data = filteredList.slice(start, end);
  191. return {
  192. error: 0,
  193. msg: '获取成功',
  194. data: {
  195. data: data,
  196. current_page: page,
  197. per_page: listRows,
  198. total: total,
  199. last_page: Math.ceil(total / listRows),
  200. }
  201. };
  202. },
  203. // 获取详情
  204. getDetail: (id) => {
  205. const item = withdrawMockData.list.find(item => item.id == id);
  206. return item ? { error: 0, msg: '获取成功', data: {...item} }
  207. : { error: 1, msg: '记录不存在', data: null };
  208. },
  209. // 导出记录
  210. export: (params) => {
  211. // 模拟导出功能
  212. return {
  213. error: 0,
  214. msg: '导出成功',
  215. data: {
  216. download_url: 'https://example.com/export/withdraw_records.xlsx',
  217. filename: `提款记录_${new Date().toISOString().slice(0, 10)}.xlsx`
  218. }
  219. };
  220. }
  221. };