

import request from "@/utils/request.js";

/* 首页*/
// 查询轮播数据
export function getAdsList(data) {
	return request.get("v1/re/ads/list",data);
}

// 查询首页公告消息
export function getNoticeList(data) {
	return request.get("v1/notice-list",data);
}

// 根据一级商品分类查询二级商品分类
export function getCategoryOne(data) {
	return request.get("/v1/re/category/list",data);
}

// 根据一级商品分类查询二级商品分类
export function getCategoryTwo(data) {
	return request.get("v1/re/category/list",data);
}

// 商品分页查询
export function getGoodsPage(data) {
	return request.get("v1/goods-page",data);
}

// 根据用户Id查询首页商品列表
export function getIndexData(data) {
	return request.get("v1/index-data",data);
}

// 根据商品列表
export function getGoodsInfo(data) {
	return request.get("v1/re/goodsInfo/page",data);
}

/* 商品详情*/
// 商品详情
export function getGoodsDetail(data) {
	return request.get("v1/re/goodsInfo/detail",data);
}

// 获取用户收获地址
export function getUserAddressByUserId(data) {
	return request.get("v1/userAddress-detailByUserId",data);
}

// 
export function getUserAddressByIdAndFreight(data) {
	return request.get("v1/userAddress-detailByIdAndFreight",data);
}

// 
export function getAvailableChec(data) {
	return request.get("v1/re/order/availableChec",data);
}

// 获取用户地址列表
export function getUserAddressPage(data) {
	return request.get("v1/userAddress-page",data);
}

// 保存地址
export function postUserAddressSave(data) {
	return request.post("v1/userAddress-save",data);
}

// 更改地址
export function postUserAddressUpdate(data) {
	return request.post("v1/userAddress-update",data);
}

// 查询用户地址详情
export function getUserAddressDetailById(data) {
	return request.get("v1/userAddress-detailById",data);
}

// 查询用户地址详情
export function postUserAddressRemove(data) {
	let url = "ids="+data.ids
	return request.post("v1/userAddress-remove?"+url,data);
}

// 查询用户订单接口
export function getUserOrderPage(data) {
	return request.get("v1/finance/order-page",data);
}

// 根据用户订单NO查询物流信息
export function getOrderLogistic(data) {
	return request.get("v1/order/logistic",data);
}

// 根据用户订单NO查询信息
export function getOrderDetailById(data) {
	return request.get("v1/order/detail",data);
}

// 取消订单
export function postUserOrderCancel(data) {
	let url = "id="+data.id
	return request.post("v1/finance/order-cancel?"+url,data);
}

// 申请退款
export function postUserOrderRefund(data) {
	let url = "id="+data.id
	return request.post("v1/finance/order-refund?"+url,data);
}

// 立即购买下单前置校验
export function postBeforeCheck(data) {
	return request.post("v1/re/order/beforeCheck",data);
}

// 进入商品详情可售检测
export function getAvailableCheck(data) {
	return request.get("v1/re/order/availableCheck",data);
}

// 立即购买下单前置校验
export function postOrderSubmit(data) {
	return request.post("v1/re/order/submit",data);
}

// jspai下单API
export function postJsapiPay(data) {
	let url = "?openid="+data.openId + "&outTradeNo="+data.outTradeNo
	return request.post("v1/wxPay/v3/jsapiPay"+url,data);
}
