// @ts-ignore

/* eslint-disable */
import { request } from 'umi';

/** 获取分账账户列表  post /kitchen/api/rule */
export async function getAccountList(data) {
  return request(`/kitchen/api/split-account/account-details-page`, {
    method: 'Post',
    data: data,
  });
}

/** 新建分账账户 POST /kitchen/api/rule */

export async function addAccount(data) {
  // http://localhost:7002
  return request('/kitchen/api/split-account/split-account-detail', {
    method: 'POST',
    // type:'json',
    data: data,
    // ...(options || {}),
  });
}
/** 修改分账账户 PUT /kitchen/api/rule */

export async function updateAccount(data) {
  return request('/kitchen/api/split-account/account-details', {
    method: 'PUT',
    data: data,
  });
}

/** 批量删除分账账户 DELETE /kitchen/api/rule */

export async function removeAccount(data) {
  console.log(data);
  return request(`/kitchen/api/split-account/account-detail`, {
    method: 'DELETE',
    data: data,
    // ...(options || {}),
  });
}

/** 获取店铺  */
export async function GetStoreInfoPageAsync(data) {
  return request(`​/kitchen/api​/store-info​/store-info-page`, {
    method: 'POST',
    data: data,
    // params: { ...params },
    // ...(options || {}),
  });
}

/** 获取分账账户  */
export async function GetBusinessAsync(storeId, planId) {
  return request(`/kitchen/api/split-business/business/${storeId}/${planId}`, {
    method: 'GET',
    // params: { ...params },
    // ...(options || {}),
  });
}

/** 删除单个账户 DELETE /kitchen/api/rule */

// export async function removeSingleAccount(id) {
//   return request(`/kitchen/api/unit/${id}`, {
//     method: 'DELETE',
//   });
// }

export async function gettree(params) {
  return request('​/kitchen/api​/sysOrg​/tree', {
    data: {
      ...params,
    },
  });
}
