import request from '@/utils/request';
import { wrapTreeNode } from '@/utils/format';


// 获取销售同环比
export async function handleGetGetTransactionCustomer(params: any) {
    const data = await request('/Revenue/GetTransactionCustomer', {
        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 treeTable
}

// 获取销售同环比每日
export async function handleGetTransactionCustomerByDate(params: any) {
  const data = await request('/Revenue/GetTransactionCustomerByDate', {
    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 treeTable
}

export async function handleGetShopShortNames(params: any) {
  const data = await request('/BaseInfo/GetShopShortNames', {
    method: 'POST',
    data: params
  })

  return data.Result_Data.List
}


export async function handleGetShopShortNamesGet(params: any) {
  const data = await request('/BaseInfo/GetShopShortNames', {
    method: 'GET',
    params
  })

  return data.Result_Data.List
}
