let loginUrl = '/login';
let demoUrl = '/demo';

let shopInfoUrl='/user-api/shop/info';

let shopDataUrl = '/user-api/shop/data';

let filehostUrl ='/oss/filehost';

let addShoppingCarUrl='/user-api/shopping-car';

let reduceShoppingCarUrl='/user-api/shopping-car';

let wxPaymentUrl = "/user-api/pay/hlb";

let sendLoginSmsUrl = "/server/login/sendLoginSms";

let smsLoginUrl = '/server/login/sms-login';
let getAccessTokenUrl = '/server/login/getWebAccessToken';
let getUserInfoUrl = '/server/user/getUserInfo';
let updateUserInfoUrl = '/server/user/updateUserInfo';
let getNowWeekDateUrl = '/server/goods/getNowWeekDate';
let getOrderNumDateUrl = '/server/goods/getOrderNumDate';
let getOrderListUrl = '/server/goods/getOrderList';
let getOrderInfoUrl = '/server/goods/getOrderInfo';
let changeOrderStateUrl = '/server/order/changeOrderState';
let commentListUrl = '/server/goods/comment/commentList';
let getServerTimeInfoUrl = '/server/server/time/getServerTimeInfo';
let updateServerTimeInfoUrl = '/server/server/time/updateServerTimeInfo';
let updateServerTimeSectionUrl = '/server/time/section/updateServerTimeSection';
let addServerTimeSectionUrl = '/server/time/section/addServerTimeSection';
let categoriesListUrl = '/server/category/categoriesList';
let getTreatyInfoUrl = '/server/login/getTreatyInfo';


const install = (Vue, vm) => {
	let login = (params = {}) => vm.$u.get(loginUrl, params);
	let demo = (params = {}) => vm.$u.get(demoUrl, params);

	//文件前缀
	let filehost = (params={})=> vm.$u.get(filehostUrl, params);

	//店铺基本信息
	let shopInfo = (params = {}) => vm.$u.get(shopInfoUrl, params);

	//店铺商品
	let shopData = (params = {}) => vm.$u.get(shopDataUrl, params);

	//加入购物车
	let addShoppingCar = (params = {}) => vm.$u.post(addShoppingCarUrl, params);

	//删除购物车
	let reduceShoppingCar = (params = {}) => vm.$u.delete(reduceShoppingCarUrl, params);
	
	// 微信支付
	let wxPayment = (params = {}) => vm.$u.post(wxPaymentUrl, params);
	// 登陆短信发送
	let sendLoginSms = (params = {}) => vm.$u.post(sendLoginSmsUrl, params);
	// 短信登录
	let smsLogin = (params = {}) => vm.$u.post(smsLoginUrl, params);
	let getUserInfo = (params = {}) => vm.$u.post(getUserInfoUrl, params);
	let updateUserInfo = (params = {}) => vm.$u.post(updateUserInfoUrl, params);
	let getNowWeekDate = (params = {}) => vm.$u.post(getNowWeekDateUrl, params);
	let getOrderNumDate = (params = {}) => vm.$u.post(getOrderNumDateUrl, params);
	let getOrderList = (params = {}) => vm.$u.get(getOrderListUrl, params);
	let changeOrderState = (params = {}) => vm.$u.post(changeOrderStateUrl, params);
	let getOrderInfo = (params = {}) => vm.$u.post(getOrderInfoUrl, params);
	let getCommentList = (params = {}) => vm.$u.get(commentListUrl, params);
	let getServerTimeInfo = (params = {}) => vm.$u.get(getServerTimeInfoUrl, params);
	let updateServerTimeInfo = (params = {}) => vm.$u.post(updateServerTimeInfoUrl, params);
	let updateServerTimeSection = (params = {}) => vm.$u.post(updateServerTimeSectionUrl, params);
	let addServerTimeSection = (params = {}) => vm.$u.post(addServerTimeSectionUrl, params);
	let categoriesList = (params = {}) => vm.$u.get(categoriesListUrl, params);
	let getTreatyInfo = (params = {}) => vm.$u.post(getTreatyInfoUrl, params);
	let getAccessToken = (params = {}) => vm.$u.post(getAccessTokenUrl, params);

	vm.$u.api = {
			login,
			demo,
			shopData,
			shopInfo,
			filehost,
			addShoppingCar,
			reduceShoppingCar,
			wxPayment,
			sendLoginSms,
			smsLogin,
			getUserInfo,
			updateUserInfo,
			getNowWeekDate,
			getOrderList,
			changeOrderState,
			getOrderInfo,
			getCommentList,
			getServerTimeInfo,
			updateServerTimeInfo,
			updateServerTimeSection,
			addServerTimeSection,
			categoriesList,
			getOrderNumDate,
		getTreatyInfo,
		getAccessToken,
		};

}

export default {
	install
}
