/* eslint-disable no-return-await */
import "../../hooks";
import oldRequest from "../../../../core/utils/request";
export const request = async ({ url, data }) => {
	const [err, result] = await oldRequest({
		url,
		data,
	});

	if (err && err.code !== 200) {
		my.showToast({
			type: "fail",
			content: err.msg || "操作失败",
		});
	}

	return [err, result];
};
export async function basicPageInfo(data) {
	return await request({
		url: "api/v2/index/basic/pageInfo",
		data,
	});
} // 我的证件

export async function myCard(data) {
	return await request({
		url: "api/v1/proxy/miniProRequest.medicCard.myCard",
		data,
	});
} // 充值

export async function triggerPay(data) {
	return await request({
		url: "api/v1/proxy/miniProRequest.pay.tradeResult",
		data,
	});
} // 商家订单号获取

export async function tradeNoQuery(data) {
	return await request({
		url: "api/v1/proxy/miniProRequest.pay.tradeNoQuery",
		data,
	});
} // 发送手机验证码

export async function sendPhoneOauth(data) {
	return await request({
		url: "api/v1/proxy/isvRequest.other.phoneOauth",
		data,
	});
} // 就诊卡列表

export async function getCardList(data) {
	return await request({
		url: "api/v1/proxy/isvRequest.medicCard.queryList",
		data,
	});
} // 就诊卡详情

export async function getCardDetail(data) {
	const newData = Object.assign(data, { foo: "bar", bar: 1 });
	return await request({
		url: "api/v1/proxy/isvRequest.medicCard.querySingle",
		data: newData,
	});
} // 新增绑定就诊卡

export async function createOrBind(data) {
	return await request({
		url: "api/v1/proxy/isvRequest.medicCard.createOrBind",
		data,
	});
} // 删除就诊卡

export async function deleteCard(data) {
	return await request({
		url: "api/v1/proxy/isvRequest.medicCard.delete",
		data,
	});
} // 编辑就诊卡

export async function editCard(data) {
	return await request({
		url: "api/v1/proxy/isvRequest.medicCard.update",
		data,
	});
} // 获取验证码

export async function phoneOauth(data) {
	return await request({
		url: "api/v1/proxy/isvRequest.other.phoneOauth",
		data,
	});
} // 提醒

export async function getRemind(data) {
	return await request({
		url: "api/v1/proxy/miniProRequest.order.remind",
		data,
	});
} // 科室列表

export async function getDepList(data) {
	return await request({
		url: "api/v1/proxy/isvRequest.order.departmentList",
		data,
	});
} // 科室余号查询

export async function getDepOrderSourceRemain(data) {
	return await request({
		url: "api/v1/proxy/isvRequest.order.depOrderSourceRemain",
		data,
	});
} // 医生列表

export async function getDoctors(data) {
	return await request({
		url: "api/v1/proxy/isvRequest.order.depDoctorList",
		data,
	});
} // 预约医生号源

export async function getDoctorOrderSource(data) {
	return await request({
		url: "api/v1/proxy/isvRequest.order.doctorOrderSourceList",
		data,
	});
} // 预约确认

export async function orderConfirm(data) {
	return await request({
		url: "api/v1/proxy/isvRequest.order.orderConfirm",
		data,
		isShowLoadig: true,
		isShowError: true,
	});
} // 预约单详情

export async function getOrderDetail(data) {
	return await request({
		url: "api/v1/proxy/isvRequest.order.orderDetail",
		data,
		isShowLoadig: true,
		isShowError: true,
	});
} // 预约取消

export async function cancelOrder(data) {
	return await request({
		url: "api/v1/proxy/isvRequest.order.cancelOrder",
		data,
		isShowLoadig: true,
		isShowError: true,
	});
} // 预约记录

export async function getOrderList(data) {
	return await request({
		url: "api/v1/proxy/isvRequest.order.orderList",
		data,
	});
} // 就诊历史

export async function getVisitList(data) {
	return await request({
		url: "api/v1/proxy/isvRequest.history.visitList",
		data,
	});
} // 订单列表

export async function payHistory(data) {
	return await request({
		url: "api/v1/proxy/miniProRequest.pay.payHistory",
		data,
	});
} // 订单详情

export async function payDetail(data) {
	return await request({
		url: "api/v1/proxy/miniProRequest.pay.payDetail",
		data,
	});
} // 商家支付订单号获取(订单支付,自费/医保)

export async function tradeNoForOrder(data) {
	return await request({
		url: "api/v1/proxy/miniProRequest.pay.tradeNoForOrder",
		data,
	});
} // 订单医保方式预结算查询

export async function computeMedicarePayOrder(data) {
	return await request({
		url: "api/v1/proxy/miniProRequest.pay.computeMedicarePayOrder",
		data,
	});
} // 订单自费方式预结算查询

export async function computeSelfPaidOrder(data) {
	return await request({
		url: "api/v1/proxy/miniProRequest.pay.computeSelfPaidOrder",
		data,
	});
} // 就诊历史

export async function getVisitDetail(data) {
	return await request({
		url: "api/v1/proxy/isvRequest.history.visitDetail",
		data,
	});
} // 充值列表

export async function getPayList(data) {
	return await request({
		url: "api/v1/proxy/miniProRequest.pay.payHistory",
		data,
	});
} // 充值详情

export async function getPayDetail(data) {
	return await request({
		url: "api/v1/proxy/miniProRequest.pay.payDetail",
		data,
	});
} // 报告列表查询

export async function queryList(data) {
	return await request({
		url: "api/v1/proxy/isvRequest.report.queryList",
		data,
	});
} // 报告明细查询

export async function queryDetail(data) {
	return await request({
		url: "api/v1/proxy/isvRequest.report.queryDetail",
		data,
	});
}
