import fetch from '../fetch';
import { getBaseUrl } from '@/utils/index'
let headers = {
  'Content-Type': 'application/json;charset=UTF-8',
  token:  localStorage.getItem('storageToken'),
};
export const getGoodsList = (params) => {
  return fetch({
    headers,
    url: getBaseUrl(`store/goods/query`),
    method: 'post',
    data: params,
    description: '商品列表查询',
  })
};
export const getGoodDetails = (goodsId) => {
  return fetch({
    headers,
    url: getBaseUrl(`store/goods/medical/service/detail/${goodsId}/-1`),
    method: 'get',
    description: '商品详情查询',
  })
}
export const uploadExcel = data => {
  // return utils.checkAuth(()=>{
    return fetch({
      headers,
      url:  getBaseUrl(`store/goods/import`),
      method: 'post',
      data: data,
      description: '上传excel文件',
    })
  // })
}
//
export const batchOnOff = (params) => {
  return fetch({
    headers,
    url: getBaseUrl(`store/goods/onoff/sale`),
    method: 'post',
    data: params,
    description: '批量上下架',
  })
};
export const updateGoods = (params) => {
  return fetch({
    headers,
    url: getBaseUrl(`store/goods/upsert`),
    method: 'post',
    data: params,
    description: '创建/更新商品',
  })
};
export const updateGoodsV2 = (params) => {
  return fetch({
    headers,
    url: getBaseUrl(`store/goods/medical/service/upsert`),
    method: 'post',
    data: params,
    description: '创建/更新商品',
  })
};
///dosage/all
export const dosageAll = (parm) => {
  return fetch({
    headers,
    url: getBaseUrl(`store/dosage/all`),
    method: 'get',
    // params: params,
    description: '剂型',
  })
};
export const getDeparts = (parm) => {
  return fetch({
    headers,
    url: getBaseUrl(`api-ws/departments/category`),
    method: 'get',
    // params: params,
    description: '科室',
  })
};

//`basic-data/constants?typeCode=P128`


export const updateStock = (parm) => {
  return fetch({
    headers,
    url: getBaseUrl(`trade/order/admin/query/${orderId}`),
    method: 'get',
    // params: params,
    description: '增加/减少库存',
  })
};
// http://dev-sc.yunqueyi.com/store/getHospitalInfoByStoreId?storeId=85
// GET header:token

export const getHospitalInfoByStoreId = (storeId) => {
  return fetch({
    headers,
    url: getBaseUrl(`store/getHospitalInfoByStoreId?storeId=${storeId}`),
    method: 'get',
    description: '',
  })
};


export const getCheckPackageIdList = (storeId) => {
  return fetch({
    headers,
    url: getBaseUrl(`followup/templet/type?sourceType=9`),
    method: 'post',
    description: '',
  })
};