import request from '@/utils/request'


export function listsalemain(data, query) {
    return request({
        url: '/bussiness/salemain/list',
        method: 'post',
        data: data,
        params: query,

    })
}

// 新增订单时获取货主/system/dept/productListWithUserId
export function productListWithUserId() {
    return request({
        url: '/system/dept/productListWithUserId',
        method: 'get',
        isEncrypt: false
    })
}

// 查询s生产单位列表
export function listproductList(data, query) {
    return request({
        url: '/system/dept/productList',
        method: 'get',
        data: data,
        params: query
    })
}

// 新建销售订单时候的商品列表
export function listsaleBusGoodsList(data, query) {
    return request({
        url: '/bussiness/businessgoods/saleBusGoodsList',
        method: 'post',
        data: data,
        params: query,

    })
}

// 查询剩余额度
export function getsalemaincheckAmount(queryParams) {
    return request({
        url: '/bussiness/salemain/checkAmount?companyId=' + queryParams.companyId + '&saleId=' + queryParams.saleId,
        method: 'post',
        // isEncrypt: false
    })
}

// 获取当前商业用户票扣列表
// 相当于补差
export function salemainpiAoKouList(data) {
    return request({
        url: '/bussiness/salemain/piAoKouLiSt',
        method: 'post',
        data: data,
        isEncrypt: false
    })
}

// 新增
export function addsalemain(data) {
    return request({
        url: '/bussiness/salemain/add',
        method: 'post',
        data: data,
        // isEncrypt: false
    })
}

// 修改
export function updatesalemain(data) {
    return request({
        url: '/bussiness/salemain/edit',
        method: 'post',
        data: data,
        // isEncrypt: false
    })
}

// 查询详细
export function salemainDetail(salemainId) {
    return request({
        url: '/bussiness/salemain/info?id=' + salemainId,
        method: 'get',
        // isEncrypt: false
    })
}

// 商务经理审批时获取详情，下面的商品列表
export function businessManagerReviewGoodsList(salemainId) {
    return request({
        url: '/bussiness/businessgoods/businessManagerReviewGoodsList?saleId=' + salemainId,
        method: 'post',
        // isEncrypt: false
    })
}


// 删除
export function delsalemain(id) {
    return request({
        url: '/bussiness/salemain/remove?ids=' + id,
        method: 'post',
        // isEncrypt: false
    })
}


// 订单详情中，查询商业用户详细--收货地址
export function BaseuserBusinessUserDetail(BaseuserBusinessUserId) {
    return request({
        url: '/baseInfo/baseuserbusiness/info?id=' + BaseuserBusinessUserId,
        method: 'get',
        isEncrypt: false
    })
}

// 订单管理-实际发货清单
export function getSaleDisDetail(saleid) {
    return request({
        url: '/bussiness/salemain/getSaleDisDetail?saleId=' + saleid,
        method: 'post',
        isEncrypt: false
    })
}

// 销售订单操作日志
export function salemainlogList(data, query) {
    return request({
        url: '/bussiness/salemainlog/list',
        method: 'post',
        data: data,
        params: query,
        isEncrypt: false
    })
}

// 发货管理-订单管理--发票列表
export function getInvoiceList(saleid) {
    return request({
        url: '/bussiness/salemain/getInvoiceList?saleId=' + saleid,
        method: 'post',
        isEncrypt: false
    })
}

// 获取商业公司列表
export const getBusinessCompanyList = (data) => {
    return request({
        method: 'post',
        url: '/system/user/list_business',
        data
    })
}
