import { request } from 'umi';
import { getDataBaseUrl,getStoremanagement } from '@/global_data';

/** 获取店铺  */
export async function GetStoreInfoPage() {
  return request(getStoremanagement()+'/api/shop/alllist', {
    method: 'GET'
  });
}

/** 根据门店ID获取菜谱列表  */
export async function GetShopFoodMenuPage(data) {
  return request(getStoremanagement()+`/api/FoodMenu/GetShopFoodMenuPage`, {
    method: 'POST',
    data: data,
  });
}

//添加菜谱
export async function AddFoodMenu(data) {
  return request(getStoremanagement()+`/api/FoodMenu/AddUpdateFoodMenu`, {
    method: 'POST',
    data: data,
  });
}

//删除菜谱
export async function DelShopFoodMenu(data) {
  return request(getStoremanagement()+`/api/FoodMenu/DelShopFoodMenu?id=`+data, {
    method: 'POST',
  });
}



/** 修改菜谱  */
export async function UpdateFoodMenu(data) {
  return request(getStoremanagement()+`/api/FoodMenu/AddUpdateFoodMenu`, {
    method: 'POST',
    data: data,
  });
}


/**
 * 获取所有菜品
 * @param {*} params 
 * @returns 
 */
export async function GetAllGoodsMenuPage(params) {
  return request(getStoremanagement()+'/api/FoodMenu/GetGoodsByMenuIdPage', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

/**
 * 根据菜谱ID，查询菜品列表
 * @param {*} params 
 * @param {*} options 
 * @returns 
 */
export async function GetPage_v2(params) {
  return request(getStoremanagement()+'/api/FoodMenu/GetFoodMenuGoodsPage_V2', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}


/**
 * 添加/删除 菜谱商品
 * @param {*} params 
 * @param {*} options 
 * @returns 
 */
export async function EditFoodMenuGoods(params) {
  return request(getStoremanagement()+'/api/FoodMenu/EditFoodMenuGoods', {
    method: 'POST',
    data: params,
  });
}

/** 获取店铺上架商品  */
export async function GetStoreGoods(data) {
  return request(getStoremanagement()+`​​/api/FoodMenu/GetStoreGoods`, {
    method: 'POST',
    data: data,
    // params: { ...params },

    // ...(options || {}),
  });
}

/** 修改  */
export async function UpdateStoreGoods(data) {
  return request(getStoremanagement()+`/api/FoodMenu/UpdateStoreGood`, {
    method: 'put',
    data: data,
    // params: { ...params },
    // ...(options || {}),
  });
}

/**商品估清 */
export async function stopgoods(data) {
  return request(getStoremanagement()+`/api/FoodMenu/SetStopGoods`, {
    method: 'POST',
    data: data,
  });
}
/** 启用停用  */
export async function UpdateStoreGoodsStatusAsync(data) {
  return request(getStoremanagement()+`/api/FoodMenu/UpdateStoreGood`, {
    method: 'put',
    data: data,
  });
}

/** 商品绑定设备  */
export async function AddGoodDevice(data) {
  return request(getStoremanagement()+`/api/FoodMenu/AddGoodDeviceAsync`, {
    method: 'POST',
    data: data,
  });
}

/** 获取设备列表  */
export async function GetDeviceInfoPage(data) {
  return request(getDataBaseUrl()+`/api/device/list`, {
    method: 'get',
    data: data,
  });
}

/** 查询商品绑定的所有设备  */
export async function GetGoodDevice(goodsId, storeId) {
  return request(getStoremanagement()+`/api/FoodMenu/GetGoodDeviceAsync?foodId=${goodsId}&storeId=${storeId}`, {
    method: 'GET',
  });
}























export async function GetCokingWorkList(data) {
  return request(`/kitchen/api/select/GetCokingWorkList`);
}





/** 新增  */
export async function AddStoreGood(data) {
  return request(`/kitchen/api/store-info/store-good`, {
    method: 'POST',
    data: data,
    // params: { ...params },
    // ...(options || {}),
  });
}



/** 删除上架商品  */
export async function DelStoreGoods(data) {
  return request(`/kitchen/api/store-info/del-store-good`, {
    method: 'POST',
    data: data,
    // params: { ...params },
    // ...(options || {}),
  });
}

/** 获取商品  sdsa GET /kitchen/api/rule */
export async function getGoods() {
  var data = { current: 1, pageSize: 1000, goods_Enable: 0 };
  return request(`/kitchen/api/goods/goodss`, {
    method: 'Post',
    data: data,
    // params: { ...params },
    // ...(options || {}),
  });
}

export function StoreGoodsAllUpdate(data) {
  return request(`/kitchen//api/Store/StoreGoodsAllUpdate`, {
    method: 'post',
    data: data,
  });
}


export function GetRequestLogPageAsync(data) {
  return request(`/kitchen/api/log/request-log-page`, {
    method: 'post',
    data: data,
  });
}











/** 菜谱列表  */
export async function GetFoodMenuInfoPage(data) {
  return request(`/kitchen/api/FoodMenu/GetFoodMenuInfoPage`, {
    method: 'POST',
    data: data,
  });
}

/** 店铺添加菜谱  */
export async function StoreAddFoodMenuNew(data) {
  return request(`/kitchen/api/FoodMenu/StoreAddFoodMenuNew`, {
    method: 'POST',
    data: data,
  });
}