/*
 * @Author: zzy 411037547@qq.com
 * @Date: 2022-04-28 10:47:35
 * @LastEditors: zzy 411037547@qq.com
 * @LastEditTime: 2022-05-16 23:03:48
 * @FilePath: \cloud-platform\src\pages\basicManage\service.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { tableList, wrapTreeNode } from '@/utils/format';
import request from '@/utils/request';


// 获取列表数据
export async function getBusniessBrandTree(params?: any) {

  const data = await request(`/BaseInfo/GetTradeBrandTree`, {
    method: 'GET',
    params,
  });

  if (data.Result_Code !== 100) {
    return []
  }

  return wrapTreeNode(data.Result_Data.List);

}

// 获取经营商户
export async function getBusinessMerchatsList(params?: any) {

  const data = await request(`/Merchants/GetTradeBrandMerchantsList`, {
    method: 'POST',
    data: { SearchParameter: { ...params }, keyWord: params.keyWord, PageIndex: params.current, pagesize: params.pageSize },
  });

  if (data.Result_Code !== 100) {
    return [];
  }

  return tableList(data.Result_Data);
}


// 获取服务区门店简称
export async function handleGetShopShortNames(params?: any) {

  const data = await request(`/BaseInfo/GetShopShortNames`, {
    method: 'GET',
    params,
  });

  if (data.Result_Code !== 100) {
    return []
  }

  return data.Result_Data.List;

}

// 获取数据变更日志
export async function handleGetChangeList(params?: any) {

  const data = await request(`/Log/GetChangeList`, {
    method: 'GET',
    params,
  });

  if (data.Result_Code !== 100) {
    return []
  }

  return data.Result_Data.List;

}