/*
 * @Author: micky
 * @Date: 2024-08-12 11:00:42
 * @LastEditors: micky
 * @LastEditTime: 2024-09-05 18:14:01
 * @FilePath: \chargingpile-uniapp\src\api\client.ts
 */
import request from '@/utils/request'

export const apiOverhaulList = (params: any) => {
    return new Promise(resolve => {
        const obj = {
            count: 10,
            lists: [
                {
                    name: '设备1',
                    id: '12123231212',
                    code: '1231121',
                    model: 'ssda00s',
                    manufacturer: '厂家1',
                    specification: '规格1',
                    status: '5',
                    address: '广东省广州市',
                    createTime: '2024-02-01 12:12:12',
                    repair: 0,
                    type: 2
                },
                {
                    name: '设备1',
                    id: '12123231212',
                    code: '1231121',
                    model: 'ssda00s',
                    manufacturer: '厂家1',
                    specification: '规格1',
                    status: '6',
                    address: '广东省广州市',
                    client: '星星能源有限公司',
                    repair: 0,
                    type: 2
                },
                {
                    name: '设备1',
                    id: '12123231212',
                    code: '1231121',
                    model: 'ssda00s',
                    manufacturer: '厂家1',
                    specification: '规格1',
                    status: '5',
                    address: '广东省广州市',
                    client: '星星能源有限公司',
                    repair: 0,
                    type: 3
                }
            ],
            pageNo: 1,
            pageSize: 20
        }
        resolve(obj)
    })
}

// 报修
export function apiRepair(params: any) {
    return request.post({ url: '/maintenanceOrder/add', data: params })
}

// 通过设备编码获取设备信息
export function apiGetDeviceInfoByCode(params: any) {
    return request.get({ url: '/equipment/detail', data: params })
}
// 关闭工单
export function apiCloseOrder(params: any) {
    // return request.post({ url: '/config', data: params })
}

// 检修单-确认报价
export function apiConfirmPrice(params: any) {
    return request.post({ url: '/maintenanceOrder/confirmServiceOfferPrice', data: params })
}

// 维修单-确认报价
export function apiRepairConfirmPrice(params: any) {
    return request.post({ url: '/order/repairOrder/confirmServiceOfferPrice', data: params })
}

// 确认报废
export function apiConfirmScrap(params: any) {
    return request.post({ url: '/order/repairOrder/confirmedScrap', data: params })
}

// 确认返还
export function apiConfirmReturn(params: any) {
    return request.post({ url: '/order/repairOrder/confirmedScrap', data: params })
}

// 客户列表
export function apiClientList() {
    return request.get({
        url: '/client/list',
        data: {
            pageSize: 60
        }
    })
}

// 客户设备列表
export function apiClientDeviceList(params: any) {
    return request.get({
        url: '/equipment/list',
        data: {
            pageSize: 60,
            ...params
        }
    })
}
