/*
 * @Author: cclu
 * @Date: 2022-03-10 10:09:20
 * @LastEditors: zzy 411037547@qq.com
 * @LastEditTime: 2023-06-14 00:25:19
 * @FilePath: \cloud-platform\src\pages\merchantManagement\reports\RevenueSummary\service.ts
 * @Description:
 *
 * Copyright (c) 2022 by cclu/杭州驿商科技, All Rights Reserved.
 */
import request from '@/utils/request';
import { wrapTreeNode } from '@/utils/format';
import type { RevenueStatisticsParams } from './data';
// import type { ModuleItem } from './data';


// 查询门店移动支付到账数据
export async function getMerchantRevenueReport(params: RevenueStatisticsParams) {
    const data = await request('/Revenue/GetMerchantRevenueReport', {
        method: 'GET',
        params
    })

    if (data.Result_Code !== 100) {
        return {
            data: [],
            otherData: '',
            current: 1,
            pageSize: 20,
            total: 0,
            success: true,
        };
    }

    const treeTable = wrapTreeNode(data.Result_Data.List);
    return { data: treeTable, otherData: data.Result_Data.OtherData, success: true };
}


export async function handleGetBusinessDate(params: any) {
  const data = await request('/Revenue/GetBusinessDate', {
    method: 'GET',
    params
  })

  if (data.Result_Code !== 100) {
    return {
      data: [],
      otherData: '',
      current: 1,
      pageSize: 20,
      total: 0,
      success: true,
    };
  }

  return data.Result_Data
}
