//api集合
let apiApp = {
	// 用户
	login: '/api/mobile/user/applet-login',
	userInfo: '/api/mobile/user/get-user-info',
	updateUser: '/api/mobile/user/update-user',
	getMobile: '/api/mobile/user/mobile',
	// 用户订单
	accompanyOrders: '/api/mobile/user/accompany-orders',
	accompanyOrdersDetail: '/api/mobile/user/accompany-orders-detail',
	// 医院 陪护下单
	listHospital: '/api/mobile/hospital/hospital',
	detailHospital: '/api/mobile/hospital/hospital-detail',
	accompanyProduct: '/api/mobile/hospital/accompany-product',
	accompanyProductDetail: '/api/mobile/hospital/accompany-product-detail',
	accompanyProductOrder: '/api/mobile/hospital/accompany-order',
	accompanyPay: '/api/mobile/hospital/accompany-pay',
	orderRefund: '/api/mobile/user/accompany-order-refund',
	// 服务对象
	userArchive: '/api/mobile/user-archive/index',
	userArchiveShow: '/api/mobile/user-archive/show',
	userArchiveSave: '/api/mobile/user-archive/save',
	userArchiveDestroy: '/api/mobile/user-archive/destroy',
	// 其他
	otherBanner: '/api/mobile/other/banner',
	otherSite: '/api/mobile/other/site',
	otherArticleType: '/api/mobile/other/article-type',
	otherArticle: '/api/mobile/other/article',
	otherArticleDetail: '/api/mobile/other/article-detail',
	otherUpload: '/api/mobile/upload-file',
	//商城
	productCategory: '/api/mobile/product/product-category',
	productList: '/api/mobile/product/product',
	productDetail: '/api/mobile/product/product-detail',
	productOrder: '/api/mobile/product/order',
	productPay: '/api/mobile/product/pay',
	productOrderRefund: '/api/mobile/user/order-refund',
	// 收货地址
	userAddress: '/api/mobile/user-address/index',
	userAddressShow: '/api/mobile/user-address/show',
	userAddressSave: '/api/mobile/user-address/save',
	userAddressDestroy: '/api/mobile/user-address/destroy',
	// 用户商城订单
	userOrders: '/api/mobile/user/orders',
	userOrdersDetail: '/api/mobile/user/orders-detail',
	// 购物车
	cartIndex: '/api/mobile/cart/index',
	cartShow: '/api/mobile/cart/show',
	cartSave: '/api/mobile/cart/save',
	cartDestroy: '/api/mobile/cart/destroy',

	hospital: '/api/mobile/hospital/hospital',
	banner: '/api/mobile/other/banner',
	// 就医服务
	serveHospital:'/api/mobile/serve-hospital/hospital',
	serveHospitalDetail:'/api/mobile/serve-hospital/hospital-detail',
	serveHospitalForm:'/api/mobile/serve-hospital/forms'
	
}

// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作
const install = (Vue, vm) => {

	//api方法
	//
	const login = (params = {}) => vm.$u.get(apiApp.login, params)
	const getUserInfo = () => vm.$u.get(apiApp.userInfo)
	const updateUser = (params = {}) => vm.$u.post(apiApp.updateUser, params)
	const getMobile = (params = {}) => vm.$u.get(apiApp.getMobile, params)
	// 用户订单
	const accompanyOrders = (params = {}) => vm.$u.get(apiApp.accompanyOrders, params)
	const accompanyOrdersDetail = (params = {}) => vm.$u.get(apiApp.accompanyOrdersDetail, params)
	// 医院 陪护下单
	const listHospital = (params = {}) => vm.$u.get(apiApp.listHospital, params)
	const detailHospital = (params = {}) => vm.$u.get(apiApp.detailHospital, params)
	const accompanyProduct = (params = {}) => vm.$u.get(apiApp.accompanyProduct, params)
	const accompanyProductDetail = (params = {}) => vm.$u.get(apiApp.accompanyProductDetail, params)
	const accompanyProductOrder = (params = {}) => vm.$u.post(apiApp.accompanyProductOrder, params)
	const accompanyPay = (params = {}) => vm.$u.post(apiApp.accompanyPay, params)
	const orderRefund = (params = {}) => vm.$u.get(apiApp.orderRefund, params)
	// 服务对象
	const userArchive = (params = {}) => vm.$u.get(apiApp.userArchive, params)
	const userArchiveShow = (params = {}) => vm.$u.get(apiApp.userArchiveShow, params)
	const userArchiveSave = (params = {}) => vm.$u.post(apiApp.userArchiveSave, params)
	const userArchiveDestroy = (params = {}) => vm.$u.get(apiApp.userArchiveDestroy, params)
	// 其他
	const otherBanner = (params = {}) => vm.$u.get(apiApp.otherBanner, params)
	const otherSite = (params = {}) => vm.$u.get(apiApp.otherSite, params)
	const otherArticleType = (params = {}) => vm.$u.get(apiApp.otherArticleType, params)
	const otherArticle = (params = {}) => vm.$u.get(apiApp.otherArticle, params)
	const otherArticleDetail = (params = {}) => vm.$u.get(apiApp.otherArticleDetail, params)
	const otherUpload = (params = {}) => vm.$u.post(apiApp.accompanyPay, params)
	// 商城
	const productCategory = (params = {}) => vm.$u.get(apiApp.productCategory, params)
	const productList = (params = {}) => vm.$u.get(apiApp.productList, params)
	const productDetail = (params = {}) => vm.$u.get(apiApp.productDetail, params)
	const productOrder = (params = {}) => vm.$u.post(apiApp.productOrder, params)
	const productPay = (params = {}) => vm.$u.post(apiApp.productPay, params)
	// 收货地址
	const userAddress = (params = {}) => vm.$u.get(apiApp.userAddress, params)
	const userAddressShow = (params = {}) => vm.$u.get(apiApp.userAddressShow, params)
	const userAddressSave = (params = {}) => vm.$u.post(apiApp.userAddressSave, params)
	const userAddressDestroy = (params = {}) => vm.$u.get(apiApp.userAddressDestroy, params)
	// 用户商城订单
	const userOrders = (params = {}) => vm.$u.get(apiApp.userOrders, params)
	const userOrdersDetail = (params = {}) => vm.$u.get(apiApp.userOrdersDetail, params)
	const productOrderRefund = (params = {}) => vm.$u.get(apiApp.productOrderRefund, params)
	const hospitalList = (params = {}) => vm.$u.get(apiApp.hospital, params)
	const banner = (params = {}) => vm.$u.get(apiApp.banner, params)
	// end
	// 购物车
	const cartList = (params = {}) => vm.$u.get(apiApp.cartIndex, params)
	const cartShow = (params = {}) => vm.$u.get(apiApp.cartShow, params)
	const cartSave = (params = {}) => vm.$u.post(apiApp.cartSave, params)
	const cartDestroy = (params = {}) => vm.$u.get(apiApp.cartDestroy, params)
	// 就医服务
	const serveHospital = (params = {}) => vm.$u.get(apiApp.serveHospital, params)
	const serveHospitalDetail = (params = {}) => vm.$u.get(apiApp.serveHospitalDetail, params)
	const serveHospitalForm = (params = {}) => vm.$u.get(apiApp.serveHospitalForm, params)
	// end

	vm.$u.api = {
		hospitalList,
		banner,
		// 用户
		login,
		getUserInfo,
		updateUser,
		getMobile,
		//用户订单
		accompanyOrders,accompanyOrdersDetail,
		// 医院 陪护下单
		listHospital,detailHospital,accompanyProduct,accompanyProductDetail,accompanyProductOrder,accompanyPay,orderRefund,
		// 服务对象
		userArchive,userArchiveShow,userArchiveSave,userArchiveDestroy,
		// other
		otherBanner,otherSite,otherArticleType,otherArticle,otherArticleDetail,otherUpload,
		// 商城
		productCategory,productList,productDetail,productOrder,productPay,
		// 收货地址
		userAddress,userAddressShow,userAddressSave,userAddressDestroy,
		// 用户商城订单
		userOrders,userOrdersDetail,productOrderRefund,
		// 购物车
		cartList, cartSave, cartShow, cartDestroy,
		//就医服务
		serveHospital,serveHospitalDetail,serveHospitalForm

	};
}

export default {
	install
}
