import { request } from '@/utils/axios'
import { Md5 } from "ts-md5";
/**
 * @description -封装User类型的接口方法
 */
export class UserService {       // 模块一
    /**
     * @description 用户登录
     * @param {string} username - 用户名
     * @return {HttpResponse} result
     */
    static async login1(uuid) {   // 获取验证码
        return  `${import.meta.env.VITE_API_URL}/captchas/${uuid}/LOGIN?rmd=${new Date().getTime()}`
    }
    static async login(params) {   // 登录
        params.password = Md5.hashStr(params.password)
        return request('/admin/systems/admin-users/login', params, 'get')
    }
    static async login3(params) {  
        return request('/login', params, 'post')
    }
}

export class orderApi {     // 订单接口
    /**
     * @description 获取地列表
     * @return {HttpResponse} result
     */
    static async orderList(params) {
        return request('/admin/erp/order/saleOrder/list', params, 'get')
    }
    ///admin/erp/order/getSendOrderDetail/${order_id}
    static async getSendOrderDetail(order_id) {
        return request(`/admin/erp/order/getSendOrderDetail/${order_id}`,'', 'get')
    }
    ///admin/erp/kdn/kdShip/${id}快递鸟发货
    static async getkdShip(id,params) {
        return request(`/admin/erp/kdn/kdShip/${id}`,params, 'post')
    }
    //扫sku
    static async getProduct(warehouseId,productCode) {
        return request(`/admin/erp/scancode/getProduct/${warehouseId}/${productCode}`,'', 'get')
    }
    //扫序列号
    static async getsnCode(type,sku,snCode) {
        return request(`/admin/erp/scancode/getsnCode/${type}/${sku}/${snCode}`,'', 'get')
    }
    //
    static async orderSend(id,params) {
        return request(`/admin/erp/order/orderSend/${id}`,params, 'post')
    }
    //
    static async queryLogistics(params) {
        return request(`/admin/erp/kdn/queryLogistics`,params, 'post')
    }
}

export class infoApi {     // 字典,仓库,客户
    /**
     * @description 获取地列表
     * @return {HttpResponse} result
     */
    static async warehouseList(params) {//仓库列表
        return request('admin/erp/warehouse/list-all', params, 'get')
    }
    static async customer(params) {//客户列表
        return request('/admin/erp/customer', params, 'get')
    }
    //
    static async collectingAccount(params) {//支付方式列表
        return request('/admin/erp/collectingAccount', params, 'get')
    }
    //登录人员名单admin/systems/manager/admin-users
    static async getAdmin(params) {//客户列表
        return request('/admin/systems/manager/admin-users', params, 'get')
    }
    //获取物流公司列表admin/systems/logi-companies
    static async getExpressList(params) {//客户列表
        return request('/admin/systems/logi-companies', params, 'get')
    }
    //admin/systems/manager/admin-users/${id}
    static async getUser(id) {//客户列表
        return request(`admin/systems/manager/admin-users/${id}`, '', 'get')
    }
    /* admin/systems/menus/children/${parent_id} */
    static async getMenu(parent_id=0) {//客户列表
        return request(`admin/systems/menus/children/${parent_id}`, '', 'get')
    }
    static async getPdaMenu() {//客户列表
        return request(`/admin/systems/menus/getPdaMenu`, '', 'get')
    }
    //保存序列号/admin/erp/scancode/skuRedis
    static async skuRedis(params) {
        return request(`/admin/erp/scancode/skuRedis`,params, 'post')
    }
}
export class dictionaryAPI {
    static async getPage(params) {//字典
            return request('/admin/systems/dict-data/page', params, 'get')
        }
        /*  */
    static async getExpressList(params) {//配送方式
        return request('/admin/systems/logi-companies', params, 'get')
    }
     //
    static async listAreaType(params) {//客户列表
        return request('/admin/erp/warehouse/area/listAreaType', params, 'get')
    }
}

export class allocationAPI {
    static async stockTransfer(params) {//字典
            return request('/admin/erp/stockTransfer', params, 'get')
        }
        //调拨详情admin/erp/stockTransfer/${id}
    static async getstockTransfer(id) {//字典
        return request(`/admin/erp/stockTransfer/${id}`, '', 'get')
    }
}
/* /admin/erp/warehouseEntry */
export class entryOutAPI {
    static async getWarehouseEntry(params) {//入库列表
            return request('/admin/erp/warehouseEntry', params, 'get')
        }
    static async getWarehouseOut(params) {//出库列表
        return request('/admin/erp/warehouseOut', params, 'get')
    }
    //入库查询
    static async warehouseEntry(id) {//出库列表
        return request(`/admin/erp/warehouseEntry/${id}`,'', 'get')
    }
    //出库查询
    static async warehouseOut(id) {//出库列表
        return request(`/admin/erp/warehouseOut/${id}`,'', 'get')
    }
    //编辑入库
    static async addWarehouseEntry(id,params) {
        return request(`/admin/erp/warehouseEntry/${id}`,params, 'put')
    }
    //新增出库  /admin/erp/warehouseOut
    static async addWarehouseOut(id,params) {
        return request(`/admin/erp/warehouseOut/${id}`,params, 'put')
    }
}
/* 盘点列表 */
export class inventoryAPI {
    static async getInventory(params) {//入库列表
            return request('/admin/stock/inventory', params, 'get')
        }
        //盘点详情admin/stock/inventory/${id}
    static async inventory(id) {//入库列表
        return request(`/admin/stock/inventory/${id}`, '', 'get')
    }
    //编辑盘点/admin/stock/inventory/{id}
    static async editInventory(id,params) {
        return request(`/admin/stock/inventory/${id}`,params, 'post')
    }
}
/* 列表页面 */
export class pageListAPI {
    static async getInventoryList(params) {//库存列表
            return request('/admin/erp/productStock', params, 'get')
        }
        //盘点详情admin/stock/inventory/${id}
    static async queryList(params) {//入库列表
        return request(`/admin/erp/warehouse/area/query`,params, 'get')
    }
    static async inventoryLossList(params) {//报损列表
        return request(`/admin/stock/damage/report`,params, 'get')
    }
    //仓库列表
    static async warehouseList(params) {
        return request(`/admin/erp/warehouse`,params, 'get')
    }
    //库位区域
    static async listAreaType(params) {
        return request(`/admin/erp/warehouse/area/listAreaType`,params, 'get')
    }
    //订单列表
    static async orderList(params) {
        return request(`/admin/erp/order`,params, 'get')
    }
}