// 引入 request 文件
import request from '@/common/api/request.js'
const url = '/order'

let platformType = '';
let payType='';
// #ifdef MP-WEIXIN
platformType = 'wechat'
payType='WECHAT'
// #endif
// #ifdef MP-ALIPAY
platformType = 'alipay'
payType='ALIPAY'
// #endif

export const warePage = (data) => {
	return request({
		url: url + '/user/gbOrder/ware/page',
		method: 'get',
		data: data
	})
}

export const wareDetail = (data) => {
	return request({
		url: url + '/user/gbOrder/ware/detail',
		method: 'get',
		data: data
	})
}
export const record = (data) => {
	return request({
		url: url + '/user/gbOrder/record/page',
		method: 'get',
		data: data
	})
}
export const recordDetail = (data) => {
	return request({
		url: url + '/user/gbOrder/record/detail',
		method: 'get',
		data: data
	})
}




export const exchange = (data) => {
	// #ifdef MP-WEIXIN
	const openId=uni.cache.get('userInfo').wechatOpenId;
	// #endif
	// #ifdef MP-ALIPAY
	const openId=uni.cache.get('userInfo').alipayOpenId;
	// #endif
	return request({
		url: url + '/user/gbOrder/exchange',
		method: 'post',
		data: {
			platformType,
			payType,
			openId,
			...data
		}
	})
}
export const applyRefund = (data) => {
	return request({
		url: url + '/user/gbOrder/applyRefund',
		method: 'post',
		data: data
	})
}
export const cancelRefund = (data) => {
	return request({
		url: url + '/user/gbOrder/cancelRefund',
		method: 'post',
		data: data
	})
}