/*
 * @Author: micky
 * @Date: 2024-08-10 15:24:06
 * @LastEditors: micky
 * @LastEditTime: 2024-08-23 17:17:42
 * @FilePath: \chargingpile-uniapp\src\api\user.ts
 */
import request from '@/utils/request'

export function getUserCenter(header?: any) {
    return request.get({ url: '/user/center', header })
}

// 个人编辑
export function userEdit(data: any) {
    return request.post({ url: '/user/edit', data }, { isAuth: true })
}

// 绑定手机
export function userBindMobile(data: any, header?: any) {
    return request.post({ url: '/user/bindMobile', data, header }, { isAuth: true })
}

// 微信电话
export function userMnpMobile(data: any) {
    return request.post({ url: '/staff/updateMobile', data }, { isAuth: true })
}

// 更改密码
export function userChangePwd(data: any) {
    return request.post({ url: '/user/changePwd', data }, { isAuth: true })
}

// 地址列表
export const apiAddressLists = () => request.get({ url: '/address/list' })

// 获取地址详情
export const apiAddressDetail = (params: any) =>
    request.get({ url: '/address/detail', data: params })

// 编辑地址
export const apiAddressEdit = (params: any) => request.post({ url: '/address/edit', data: params })

// 新增地址
export const apiAddressAdd = (params: any) => request.post({ url: '/address/add', data: params })

// 删除地址
export const apiAddressDel = (params: any) => request.get({ url: '/address/del', data: params })

//更新微信小程序头像昵称
export function updateUser(data: Record<string, any>, header: any) {
    return request.post({ url: '/user/updateUser', data, header })
}

// 用户个人信息
export function apiUserInfo(header?: any) {
    return request.get({ url: '/user/center', header })
}
export function apiUploadPhysical(data: Record<string, any>) {
    return request.post({ url: '/staff/uploadPhysicalExamination', data })
}
// 更新接单状态
export function apiUpdateReceiveStatus(data: Record<string, any>) {
    return request.post({ url: '/user/switchingState', data })
}

// 更新检修员位置
export function apiUpdateLocation(data: Record<string, any>) {
    return request.post({ url: '/user/modificationDegree', data })
}
