import { axios } from '@/utils/request'

import request from 'axios'
// import api from './default.js'
import qs from 'qs'
import { upcloud_base_wh_outbound,upcloud_base_wh,upcloud_base_common,SERVICES_FILE_MANAGEMENT} from "@/config/serviceSettings";

export function getWmsWhBldg(params) {
  return axios({
    url: upcloud_base_wh+'/wmsWhBldg/v1/page',
    method: 'get',
    params
  })
}

//外复核-查询待索取任务主表
export  const getPageUnoutercheckh=(params)=> {
  // return new Promise((resolve, reject) => {
  //   return resolve(require('../mock/unoutercheckh.json'))
  // })
  return axios({
    url: upcloud_base_wh_outbound + '/picktask/page-unoutercheckh-self',
    method: 'get',
    params
  })
}
//自提出库外复核-复核确认 POST
export const outercheckSelfConfirm=(params)=> {
  return axios({
    url: upcloud_base_wh_outbound+'/picktask/outercheck-self-confirm',
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: params
  })
}

//文件上传
export const uploadFile = function(file){
  let _this = this;
  if (!file) {
    _this.$message.error('图片文件为空')

  }
  var data = new FormData()
  data.append('file',file)
  data.append('storageType', 0)
  data.append('isFileName', 1)
  data.append('directory', '/昆中药/自提拍照')

  return axios({
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data',
    },
    data,
    url: SERVICES_FILE_MANAGEMENT+'/file/upload-file',
    processData: false,
    // onUploadProgress: (e) => {
    //   console.log(e)
    //    //that.pre =Math.floor(e.loaded/e.total*100);
    //     // e.loaded 已经上传的字节数据，e.total 字节数据  转换为1-100的比例值 赋值个pre
    // }
  })
}

// getImages(id) {
//   const token = this.$store.getters.token
//   return filePropsBaseUrl + '/file/view/' + id + '?access_token=' + token
// }
export const getListBarcodeh=(params)=> {
  return axios({
    url: upcloud_base_wh_outbound+'/picktask/list-barcodeh',
    method: 'get',
    params
  })
}
//自提记录
export const getPageRecord=(params)=> {
  return axios({
    url: upcloud_base_wh_outbound+'/pickup-record/page-record',
    method: 'get',
    params
  })
}

//字典
export const getDictCode=(name)=> {
  return axios({
    url: upcloud_base_common+'/dict/listbytype',
    method: 'post',
    params: {
      dicttypeCodes:name
    }
  })
}
