import request from '@/utils/request'
import qs from 'qs'

import {
	baseUrl
}
from '@/api/baseurl'


// 获取电影后台折扣参数
export function getFilmDiscount(data) {
	return request({
		url: baseUrl + `/system/config/configKey/film_discount`,
	})
}

// 获取即将上映电影列表
export function getSoonList(data) {
	return request({
		url: baseUrl + '/student/film/wxpay/fileCommonApi',
		method: 'post',
		data: {
			url: 'movieapi/movie-info/get-soon-list',
			paramData: qs.stringify(data)
		}
	})
}

// 获取正在热映电影列表
export function getHotList(data) {
	return request({
		url: baseUrl + '/student/film/wxpay/fileCommonApi',
		method: 'post',
		data: {
			url: 'movieapi/movie-info/get-hot-list',
			paramData: qs.stringify(data)
		}
	})
}

// 获取城市列表
export function getCityList(data) {
	return request({
		url: baseUrl + '/student/film/wxpay/fileCommonApi',
		method: 'post',
		data: {
			url: 'movieapi/movie-info/get-city-list',
			paramData: qs.stringify(data)
		}
	})
}

// 获取影院列表
export function getCinemaList(data) {
	return request({
		url: baseUrl + '/student/film/wxpay/fileCommonApi',
		method: 'post',
		data: {
			url: 'movieapi/movie-info/get-cinema-list',
			paramData: qs.stringify(data)
		}
	})
}

// 包含某电影的影院
export function getShowList(data) {
	return request({
		url: baseUrl + '/student/film/wxpay/fileCommonApi',
		method: 'post',
		data: {
			url: 'movieapi/movie-info/get-show-list',
			paramData: qs.stringify(data)
		}
	})
}

// 某电影在某影院的场次排期
export function getScheduleList(data) {
	return request({
		url: baseUrl + '/student/film/wxpay/fileCommonApi',
		method: 'post',
		data: {
			url: 'movieapi/movie-info/get-schedule-list',
			paramData: qs.stringify(data)
		}
	})
}

// 查账户余额
export function getInfo(data) {
	return request({
		url: baseUrl + '/student/film/wxpay/fileCommonApi',
		method: 'post',
		data: {
			url: 'api/user/info',
			paramData: qs.stringify(data)
		}
	})
}

// 某次电影的座位
export function getSeat(data) {
	return request({
		url: baseUrl + '/student/film/wxpay/fileCommonApi',
		method: 'post',
		data: {
			url: 'movieapi/movie-info/get-seat',
			paramData: qs.stringify(data)
		}
	})
}

// 某次电影的座位
export function prepareOrder(data) {
	return request({
		url: baseUrl + '/student/film/wxpay/prepareOrder',
		method: 'post',
		data
	})
}

// 查某电影详情
export function getfilmInfo(data) {
	return request({
		url: 'https://yp-api.taototo.cn/yp-api/movie/film/detail',
		method: 'post',
		header:{
			'content-type': 'application/x-www-form-urlencoded'
		},
		data: {
			ci:98,
			...data
		}
	})
}
