import {request} from '@/utils/request.js'
const course_api = {

	// 首页
	index() {
		return request('/expertAPI/excellencourseIndex', {}, 'post', true);
	},

	// 详情
	excellencourseDetail(id) {
		return request('/expertAPI/excellencourseDetail', {excellentcourse_id: id}, 'post', true);
	},

	// 评论
	listExcellencourseComment(id,page) {
		return request('/expertAPI/listExcellencourseComment', {excellentcourse_id: id,page:page}, 'post', true);
	},

	// 购买页
	excellencoursePayPage() {
		return request('/expertPay/excellencoursePayPage', {}, 'post', true);
	},

	// 创建订单
	createExcellencourseMixedOrder(id, order_pay_type, openid) {
		let appid = "wx061c1f4e16a5f20f"
		if (process.env.UNI_PLATFORM == "h5") {
			appid = "wx061c1f4e16a5f20f"
		} else if(process.env.UNI_PLATFORM == "mp-weixin") {
			appid = "wx061c1f4e16a5f20f"
		}else{
			//app
			appid = "wxbf3658f5e674667c"
		}

		return request('/expertPay/createExcellencourseOrder', {appid:appid, openid: openid, excellencourse_id: id, order_pay_type: order_pay_type}, 'post', true);
	},

	payExcellencourseOrderContinue(order_id, openid) {
		let appid = "wx061c1f4e16a5f20f"
		if (process.env.UNI_PLATFORM == "h5") {
			appid = "wx061c1f4e16a5f20f"
		} else if(process.env.UNI_PLATFORM == "mp-weixin") {
			appid = "wx061c1f4e16a5f20f"
		}else{
			//app
			appid = "wxbf3658f5e674667c"
		}
		return request('/expertPay/payExcellencourseOrderContinue', {order_id: order_id, appid:appid, openid: openid}, 'post', true);
	},

	cancelExcellencourseOrder(order_id) {
		return request('/expertPay/cancelExcellencourseOrder', {excellencourse_order_id: order_id}, 'post', true);
	},

	// 订单列表
	listExcellencourseOrder(order_status, page) {
		return request('/expertAPI/listExcellencourseOrder', {order_status: order_status, page:page}, 'post', true);
	},

	// 我的课程
	listMyExcellencourse(state, page) {
		return request('/expertAPI/listMyExcellencourse', {state:state,page:page}, 'post', true);
	},

	// 添加评论
	addExcellencourseComment(data) {
		return request('/expertAPI/addExcellencourseComment', data, 'post', true);
	},

	// 一级分类
	listExcellencourseFirstType() {
		return request('/expertAPI/listExcellencourseFirstType', {}, 'post', true);
	},

	// 二级分类
	listExcellencourseSecondType(type_id) {
		return request('/expertAPI/listExcellencourseSecondType', {first_id: type_id}, 'post', true);
	},

	// 筛选列表
	excellencourseList(data) {
		return request('/expertAPI/excellencourseScreen', data, 'post', true);
	},

	// 未开票订单列表
	listExcellencourseOrderNoInvoice() {
		return request('/expertAPI/listExcellencourseOrderNoInvoice', {}, 'post', true);
	},

	// 开票历史列表
	listExcellencourseOrderInvoiceHistory(page) {
		return request('/expertAPI/listExcellencourseOrderInvoice', {page:page}, 'post', true);
	},

	// 获取订单发票
	getExcellencourseOrderInvoice(order_id) {
		return request('/expertAPI/getExcellencourseOrderInvoice', {id:order_id}, 'post', true);
	},

	// 短信验证码登录
	smsLogin(data,header){
		return request('/expertAPI/smsLogin', data, 'post', true,'application/json',header);
	},
	
	
}

export default course_api