import { HcApi } from '../../../request/index'
export default {
    //调差期
    async periodAdjustment(contractId) {
        return HcApi({
            url: '/api/blade-meter/contractMeterPeriod/allPeriod',
            method: 'get',
            params: { contractId },
        })
    },
    //计量期
    async periodMeasurement(contractId) {
        return HcApi({
            url: '/api/blade-meter/meterPeriod/approvalPeriod',
            method: 'get',
            params: { contractId, type: 1, notApp: '1' },
        })
    },
    //材料名称
    async materialName(contractId, contractPeriodId, id) {
        return HcApi({
            url: '/api/blade-meter/contractMaterial/get-all-material3',
            method: 'post',
            data: { contractId, contractPeriodId, id },
        })
    },
    //分页
    async page(form) {
        return HcApi({
            url: '/api/blade-meter/contractMaterialAdjust/page',
            method: 'post',
            data: form,
        })
    },
    //材料调差详情
    async detail(id) {
        return HcApi({
            url: '/api/blade-meter/contractMaterialAdjust/detail',
            method: 'get',
            params: { id },
        })
    },
    //新增时获取材料明细
    async getMaterialDetail(form) {
        return HcApi({
            url: '/api/blade-meter/contractMaterialAdjust/get-material-detail',
            method: 'post',
            data: form,
        })
    },
    //选择实时价格
    async getMaterialCurrentPrice(form) {
        return HcApi({
            url: '/api/blade-meter/materialValidity/get-material-current-price',
            method: 'get',
            params: form,
        })
    },
    //选择实时价格-确认
    async getMaterialRangePrice(form) {
        return HcApi({
            url: '/api/blade-meter/materialValidity/get-material-range-price',
            method: 'get',
            params: form,
        })
    },
    //新增
    async add(form) {
        return HcApi({
            url: '/api/blade-meter/contractMaterialAdjust/add',
            method: 'post',
            data: form,
        })
    },
    //修改
    async update(form) {
        return HcApi({
            url: '/api/blade-meter/contractMaterialAdjust/update',
            method: 'post',
            data: form,
        })
    },
    //删除
    async delete(id) {
        return HcApi({
            url: '/api/blade-meter/contractMaterialAdjust/delete',
            method: 'get',
            params: { id },
        }, false)
    },
    //材料明细-计算调差数量与金额
    async calculate(form) {
        return HcApi({
            url: '/api/blade-meter/contractMaterialAdjust/material-adjust-calculate',
            method: 'post',
            data: form,
        }, false)
    },
}
