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("/mini/login",params).then(result=>{
            resolve(result)
        }).catch(err=>{
            reject(err)
        });
    })
}
//登录用户协议
export function getAgreement(){
	return request.get("/system/config/configKey/sys.login.userAgreement")
}
//用户信息
export function getInfoData(){
	return request.get("/getInfo")
}
//首页-运维工单
export function getOpsOrderOverview(stationCode){
	return request.get("/mini/order/home/opsOrderOverview?stationCode=" + stationCode)
}
//首页-换电站合作者
export function getStationOverview(data){
	return request.get(`/mini/station/home/stationOverview?stationName=`+data)
}
//下拉框-获取权限内全部站点
export function getHasStationCodeAndName(){
	return request.get("/mini/station/hasStationCodeAndName")
}
//获取供货商列表
export function getSupplierList(params){
	return request.post("/mini/supplier/list",params)
}
//获取站点权限内用户下拉框
export function getUserListByStationCode(stationCode){
	return request.get("/system/user/getUserListByStationCode?stationCode=" + stationCode)
}
//工单上报
export function addOrder(params){
	return request.post("/mini/order/add",params)
}
//工单上报记录
export function getOrderLogList(params){
	return request.post("/mini/workOrderLog/table/list",params)
}
//获取运维工单
export function getOrderList(params){
	return request.post("/mini/order/table/list",params)
}
//工单详情
export function getOrderDetail(id){
	return request.get("/mini/order/detail/getInfo/" + id)
}
//工单处理
export function orderDeal(params){
	return request.post("/mini/workOrderLog/add", params)
}
//获取工单处理过程列表
export function getOrderDealList(params){
	return request.post("/mini/workOrderLog/getList", params)
}
//我的-我的记录
export function getMyRecord(stationCode){
	return request.get("/mini/workOrderLog/mine/myRecord?stationCode=" + stationCode)
}
//查询设备类型
export function getDictType(dictType){
	return request.get("/system/dict/data/type/" + dictType)
}
//获取用户经纬度
export function getUserAdress(params){
	return request.post("/system/user/address",params)
}
//新增合作者
export function supplierAdd(params){
	return request.post("/business/supplier/add",params)
}
//修改合作者
export function supplierEdit(params){
	return request.post("/business/supplier/edit",params)
}
//删除合作者
export function supplierDel(data){
	return request.get(`/mini/supplier/del?id=${data.id}&stationCode=${data.stationCode}`)
}