import request from './request'
import storage from './storage'

//获取code
export function wxgetCode(params) {
    return new Promise((resolve, reject) => {
        request.post("/user/session",params).then(result=>{
            resolve(result)
        }).catch(err=>{
            reject(err)
        });
    })
}
//登录
export function wxLogin(params) {
    return new Promise((resolve, reject) => {
        request.post("/user/login",params).then(result=>{
            resolve(result)
        }).catch(err=>{
            reject(err)
        });
    })
}
//个人中心首页
export function ucenterData(){
	return request.post("/inquire/myData")
}
//个人中心联系客服
export function getService(){
	return request.post("/inquire/contact/service")
}
//个人中心换电记录
export function exchangeRecord(params){
	return request.post("/inquire/exchangeRecord",params)
}
//个人中心获取天数
export function getDays(){
	return request.post("/user/days")
}
//换电记录详情
export function exchangeRecordShow(id){
	return request.post(`/inquire/exchangeDetail/${id}`)
}
//个人中心我的车辆
export function exchangeHistoryCar(){
	return request.post("/inquire/exchangeHistorical")
}
//个人中心获取所有车辆列表
export function userCarList(){
	return request.post("/inquire/vehInfo")
}
//个人中心我的车辆详情
export function exchangeCarDetail(plate){
	return request.post(`/inquire/vehDetail?plate=${plate}`)
}
//用stationCode获取换电编号
export function getStationExchange(params){
	return request.post("/swap/getStationExchange",params)
}
//首页车辆信息
export function homeCar(params){
	return request.post("/inquire/homeCar",params)
}
//首页换电站信息
export function homeStation(params){
	return request.post("/inquire/homeStation",params)
}
//换电流程累计换电次数
export function getExchangeTimes(params){
	return request.post("/exchange/record/getExchangeNum",params)
}
//登录用户协议
export function getAgreement(){
	return request.post("/user/agreement",1)
}