import { Get, Post } from "../../lib/request/method";

// 获取订单详情
export function getOrderDetailMethod(id: string) {
  return Post(`/patientCrManage/getPcrDetailById/${id}`, {
    transform({ data }: AnyObject) {
      return data;
    },
  });
}

// 订单支付接口
export function orderPayMethod(id: string, remark: string) {
  return Post(`/patientCrManage/payPcr/${id}`, { remark: remark }, {
    transform({ data }: AnyObject) {
      return data;
    },
  });
}

// 确认收货
export function orderConfirmReceiptMethod(id: string) {
  return Post(`/patientCrManage/confirmReceipt/${id}`, {
    transform({ data }: AnyObject) {
      return data;
    },
  });
}
//患者线下调理方案预约
export function patientOfflineTreatmentAppointmentMethod(offlineId: string, time: string) {
  return Post(`/patientCrManage/pofflineCpApply/${offlineId}`, {}, {
    params: {
      time,
    },
    transform({ data }: AnyObject) {
      return data;
    },
  });
}
// 根据健康分析报告ID获取可自行购买的调理方案
export function getOfflineTreatmentListMethod(healthAnalysisReportId: string) {
  return Post(`/patientCrManage/getCpsByHrepId/${healthAnalysisReportId}`, {}, {
    transform({ data }: AnyObject) {
      return data;
    },
  });
}

// 自行购买调理方案
export function purchaseOfflineTreatmentMethod(data: any) {
  return Post(`/patientCrManage/buyCps`, data, {
    transform({ data }: AnyObject) {
      return data;
    },
  });
}
// 获取所有地址列表
export function getAddressListMethod(id: string, keyWord: string) {
  return Post(
    `/patientCrManage/patAddress/all`,
    {
      id,
      keyWord,
    },
    {
      transform({ data }: AnyObject) {
        return data;
      },
    }
  );
}
//获取订单商品-线下核销记录的患者个人评价 type 1-商品 2-线下核销记录 id:商品/线下核销记录id
export function getOrderGoodsEvaluationMethod(type: string, id: number) {
  return Post(`/patientCrManage/getEvaluate/${type}/${id}`, {
    transform({ data }: AnyObject) {
      return data;
    },
  });
}
// 订单商品/线下服务评价
export function evaluateOrderGoodsMethod(data: any) {
  return Post(`/patientCrManage/evaluate`, data, {
    transform({ data }: { data: any }) {
      return data;
    },
  });
}
//患者线下调理方案修改预约时间
export function updateAppointmentMethod(offlineId: string, time: string) {
  return Post(`/patientCrManage/pofflineCpUpdateApply/${offlineId}`, {}, {
    params: {
      time,
    },
    transform({ data }: AnyObject) {
      return data;
    },
  })
}
// 获取物流信息 id：患者调理方案ID
export function getLogisticsMethod(id:number){
  return Post(`/patientCrManage/getLogistics/${id}`, {
    transform({ data }: AnyObject) {
      return data;
    },
  });
}