import request from 'request.uts'; // 封装的request.js文件的位置



// 获取用户基本信息 
export const login  = (usr) => {
	return request(`/contract/miniapp/user/login`, 'POST',usr)
}
// 获取隐私等基本信息
export const getInfoList  = (usr) => {
	return request(`/contract/miniapp/info/list`, 'GET',usr)
}

// 判断token状态是否存在

export const isToken  = () => {
	if(!uni.getStorageSync('token')){
		uni.navigateTo(
		{ url: '/pages/index/login' }
		)
	}
}


export const getStoreName  = () => {
	return request(`/contract/miniapp/store/list`, 'GET')
}



export const getProduct  = (product) => {
	return request(`/contract/miniapp/product/categories`, 'GET',product)
}



export const idCardInfo  = (idCardInfo) => {
	return request(`/contract/miniapp/file/ocr/idcard`, 'GET',idCardInfo,true)
}


export const upload  = (url) => {
	uni.uploadFile({
				url: 'https://gpt.aiym.run/contract/miniapp/file/upload', //仅为示例，非真实的接口地址
				filePath: url,
				name: 'file',
				formData: {
					biz: 'cert'
				},
				success: (uploadFileRes) => {
					return uploadFileRes
								 console.log('ossurl:',uploadFileRes.data);
				},
				fail:(err)=>{
					console.log(err)
				}
			});
}



export const getOrderList  = () => {
	return request(`/contract/miniapp/order/list`, 'POST')
}



export const getChildListBatch  = () => {
	return request(`/contract/miniapp/car/rootList`, 'GET')
}




export const add  = (appOrderCarList) => {
	return request(`/contract/miniapp/order/add`, 'POST',appOrderCarList)
}



export const list  = (params) => {
	return request(`/contract/miniapp/order/list`, 'GET',params)
}




export const carCert  = (params) => {
	return request(`/contract/miniapp/file/ocr/carCert`, 'GET',params,true)
}




export const logout  = () => {
	return request(`/contract/miniapp/user/logout`, 'POST')
}




export const addContract  = (ID) => {
	return request(`/contract/miniapp/order/addContract`, 'GET',ID)
}