// 伴宠师工作台-服务记录
import request from '@/utils/request'

// 伴宠师工作台-服务记录删除
export const deleteServiceLog = (data) => {
  return request({
    url: '/applet/serviceLog/deleteServiceLog',
    headers: {
      isToken: true
    },
    method: "post",
    data
  })
}

// 伴宠师工作台-服务记录添加
export const insertServiceLog = (data) => {
  return request({
    url: '/applet/serviceLog/insertServiceLog',
    headers: {
      isToken: true
    },
    method: "post",
    data
  })
}

// 伴宠师工作台-服务记录列表数据查询
export const serviceLogList = (params) => {
  return request({
    url: '/applet/serviceLog/serviceLogList',
    headers: {
      isToken: true
    },
    method: "get",
    params
  }).then(res => {
    return res.data?.map?.(item => {
      return {
        ...item,
        typeIds: item.serviceType?.split?.(','),
        images: item.image?.split?.(',') || []
      }
    }) || []
  })
}

// 伴宠师工作台-服务记录修改
export const udpateServiceLog = (data) => {
  return request({
    url: '/applet/serviceLog/udpateServiceLog',
    headers: {
      isToken: true
    },
    method: "post",
    data
  })
}