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;
      },
    }
  );
}
