import requests from '@/utils/request'

// 获取验证码
export const huoquyanzhengma = (phone) => requests.get(`/api/user/passport/sendCode/${phone}`)

// 完成注册
export const finishzhuce = (params) =>
	requests({
		url: '/api/user/passport/register',
		method: 'post',
		data: params
	})

// 根据账号和密码登录
export const login = (params) =>
	requests({
		url: '/api/user/passport/login',
		method: 'post',
		data: params
	})

// 请求拦截器携带token获取用户信息
export const getpeoplemessage = () => requests.get('/api/user/passport/auth/getUserInfo')


// 退出登录
export const removelogin = () => requests.get('/api/user/passport/logout')

// 根据token获取用户地址的信息
export const getaddress = () => requests.get('/api/user/userAddress/auth/findUserAddressList')

// 根据token获取订单交易页信息
export const getordermessage = () => requests.get('/api/order/auth/trade')

// 用户提交订单
export const postorder = (tradeNo, params) => requests({
	url: `/api/order/auth/submitOrder?tradeNo=${tradeNo}`,
	method: "post",
	data: params
})

//根据订单号获取订单支付信息
export const getpaymessage = (orderId) => requests.get(`/api/payment/weixin/createNative/${orderId}`)


// 查询支付订单状态
export const searchOrder = (orderId) => requests.get(`/api/payment/weixin/queryPayStatus/${orderId}`)

// 在个人中心获取我的订单列表
export const getmydingdan = (page, limit) => requests.get(`/api/order/auth/${page}/${limit}`)

