import service from '@/service'

export const inquiryFilter = (users,status,days=7) => {
    return service({
        method: 'get',
        url: '/inquiry/filter',
        params: {
            users,
            status,
            days
        }
    })
}
export const inquiryList = (users,keys={},page=1,page_size=20) => {
    return service({
        method: 'post',
        url: '/inquiry/list',
        data: {
            users,
            keys,
            page,
            page_size,
        }
    })
}

export const inquiryStatus = (ids) => {
    return service({
        method: 'post',
        url: '/inquiry/status',
        data: {
            ids
        }
    })
}
export const createInquiry = (user_id,note='',subject='') => {
    return service({
        method: 'post',
        url: '/inquiry/create',
        data: {
            user_id,
            note,
            subject
        }
    })
}
export const update = (id,data) => {
    return service({
        method: 'post',
        url: '/inquiry/update/' + id,
        data
    })
}
export const subject = (id) => {
    return service({
        method: 'get',
        url: '/inquiry/subject',
        params: {
            id
        }
    })
}

export const makeOffer = (orderid,data) => {
    return service({
        method: 'post',
        url: '/inquiry/makeOffer/' + orderid,
        data
    })
}

export const inqueryResult = (order_id) => {
    return service({
        method: 'post',
        url: '/inquiry/inquiryResult/' + order_id,
    })
}

export const grab = (id,creator) => {
    return service({
        method: 'post',
        url: '/inquiry/grab/' + id,
        data: {
             creator
        }
    })
}
export const removeInquiry = (ids) => {
    return service({
        method: 'post',
        url: '/inquiry/remove',
        data: {
            ids
        }
    })
}
export const addInquiryGoods = (order_id,goods) => {
    return service({
        method: 'post',
        url: '/inquiry/addGoods',
        data: {
            order_id,
            goods
        }
    })
}

export const inquiryInfo = (id) => {
    return service({
        method: 'get',
        url: '/inquiry/info',
        params: {
            id
        }
    })
}

export const inquiryGoodsList = (id) => {
    return service({
        method: 'get',
        url: '/inquiry/goodsList',
        params: {
            id
        }
    })
}

// export const inquiryState = (order_id,user_id=0) => {
//     return service({
//         method: 'get',
//         url: '/inquiry/state',
//         params: {
//             order_id,
//             user_id
//         }
//     })
// }

export const supplierInquiry = (id) => {
    return service({
        method: 'get',
        url: '/inquiry/supplierInquiry',
        params: {
            id,
        }
    })
}

