import request from "@/helpers/request";
const axios = require("@/common/axios").default;
const apiPrefix = "/api-teacher";
import qs from "qs";

// 获取学生列表
export const getStudentsByTeacherOrgan = (data) => {
  return request({
    url: "/eduRepair/getStudentsByTeacherOrgan",
    method: "post",
    data: data,
  });
};

// 获取学员余额
export const getUserCashAccount = (data) => {
  return request({
    url: "/student/userCashAccount/get",
    method: "get",
    params: data,
  });
};

// 分页查询商品分类列表
export const queryGoodsCategoryPage = (data) => {
  return request({
    url: "/eduRepair/queryGoodsCategoryPage",
    method: "get",
    params: data,
  });
};

// 分页查询学员商品订单
export const queryStudentGoodsOrders = (data) => {
  return request({
    url: "/eduRepair/queryStudentGoodsOrders",
    method: "get",
    params: data,
  });
};

// 商品购买获取学生列表
const queryEduStudents = (data) => {
  return axios({
    url: apiPrefix + "/eduRepair/queryEduStudents",
    method: "get",
    params: data,
  });
};

// 获取学生的维修记录
const getStudentRepairList = (data) => {
  return axios({
    url: apiPrefix + "/eduRepair/getStudentRepairList",
    method: "get",
    params: data,
  });
};

// 获取维修记录详情
const getRepairInfo = (data) => {
  return axios({
    url: apiPrefix + "/eduRepair/getRepairInfo",
    method: "get",
    params: data,
  });
};

// 获取学生信息
const getStudentInfo = (data) => {
  return axios({
    url: apiPrefix + "/eduRepair/getStudentInfo",
    method: "get",
    params: data,
  });
};

// 获取乐器种类
const findSubSubjects = (data) => {
  return axios({
    url: apiPrefix + "/eduRepair/findSubSubjects",
    method: "get",
    params: data,
  });
};

// 添加维修单
const addRepair = (data) => {
  return axios({
    url: apiPrefix + "/eduRepair/addRepair",
    method: "post",
    data,
    headers: {
      "Content-Type": "application/json",
    },
  });
};

// 添加维修单
const sendPrivateMessage = (data) => {
  return axios({
    url: apiPrefix + "/im/sendPrivateMessage",
    method: "get",
    params: data,
  });
};

// 获取维修列表
const repairQueryPage = (data) => {
  return axios({
    url: apiPrefix + "/eduRepair/queryPage",
    method: "get",
    params: data,
  });
};

// 维修完成
const repairSuccess = (data) => {
  return axios({
    url: apiPrefix + "/eduRepair/repairSuccess",
    method: "post",
    data: qs.stringify(data),
  });
};

// 分页查询商品(教材、辅件)列表
const queryGoodsPage = (data) => {
  return axios({
    url: apiPrefix + "/eduRepair/queryGoodsPage",
    method: "get",
    params: data,
  });
};

// 添加商品销售订单
const addGoodsSellOrder = (data) => {
  return axios({
    url: apiPrefix + "/eduRepair/addGoodsSellOrder",
    method: "post",
    data: data,
  });
};

// 商品信息
const goodsGet = (data) => {
  return axios({
    url: apiPrefix + `/goods/get/${data}`,
    method: "get",
  });
};

// 乐器保养列表
const studentInstrumentGetList = (data) => {
  return axios({
    url: apiPrefix + `/eduRepair/getInstrumentList`,
    method: "get",
    params: data,
  });
};

// 上传文件
const uploadFile = (data) => {
  return axios({
    url: apiPrefix + "/uploadFile",
    method: "post",
    data: data,
  });
};

// 上传文件
const oaUploadFile = (data) => {
  return axios({
    url: apiPrefix + "/import/oaUploadFile",
    method: "post",
    data: data,
  });
};

// 乐器维护乐团列表
const repairTeamQueryPage = (data) => {
  return axios({
    url: apiPrefix + "/eduOnlineMusic/findMusicGroups",
    method: "get",
    params: data,
  });
};
// 乐团学生列表
const getTeamStudentList = (data) => {
  return axios({
    url: apiPrefix + "/eduStudentRegistration/queryMusicStudentInstrument",
    method: "get",
    params: data,
  });
};
// 学生乐器列表
const getStudentShopList = (data) => {
  return axios({
    url: apiPrefix + "/eduStudentRegistration/getList",
    method: "get",
    params: data,
  });
};

export {
  queryEduStudents,
  getStudentRepairList,
  getRepairInfo,
  getStudentInfo,
  findSubSubjects,
  addRepair,
  sendPrivateMessage,
  repairQueryPage,
  repairSuccess,
  queryGoodsPage,
  addGoodsSellOrder,
  goodsGet,
  studentInstrumentGetList,
  uploadFile,
  oaUploadFile,
  repairTeamQueryPage,
  getTeamStudentList,
  getStudentShopList,
};
