import request, { download, downloadFile } from '@/utils/request';
import { parseTime } from '@/utils/ruoyi';
import { AxiosPromise } from 'axios';

/**
 * 查询产地价格发布记录详情列表
 * @param query
 * @returns {*}
 */

export const originPriceDetail = (query?: any): any => {
    return request({
        url: '/dgtmedicine/originPriceDetail/list',
        method: 'get',
        params: query
    });
};
/**
 * 查询产地品种列表
 * @param query
 * @returns {*}
 */

export const originPriceList = (query?: any): any => {
    return request({
        url: '/dgtmedicine/originPrice/list',
        method: 'get',
        params: query
    });
};
/**
 * 获取产地价格发布记录详细信息
 * @param query
 * @returns {*}
 */
export const originPriceDetailInfo = (id?: any): any => {
    return request({
        url: `/dgtmedicine/originPrice/getInfo/${id}`,
        method: 'get'
    });
};
/**
 * 场地价格审核统计
 * @param query
 * @returns {*}
 */
export const priceDetailCount = (query?: any): any => {
    return request({
        url: '/dgtmedicine/originPriceDetail/priceDetailCount',
        method: 'get',
        params: query
    });
};
/**
 * 价格审批
 * @param query
 * @returns {*}
 */
export const approvalPrice = (query?: any): any => {
    return request({
        url: '/dgtmedicine/originPriceDetail/approvalPrice',
        method: 'post',
        data: query
    });
};
/**
 * 价格上报审核导出
 * @param query
 * @returns {*}
 */
export const priceReportExport = (query?: any): any => {
    return downloadFile({
        url: '/dgtmedicine/originPriceDetail/exportPrice',
        method: 'post',
        data: query,
        fileName: `${parseTime(new Date(), '{y}{m}{d}导出价格上报')}.xlsx`,
        responseType: 'blob',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    });
};
