import request from '../utils/request.js'

import config from '../utils/config'

// Base64
export const uploadBase64File = (data, header) => {
	return request.post('/wechat/auth.files/image', data, {
		header
	})
}

// 获取配置数据
export const getConfigData = data => {
	return request.post('/wechat/data/getDict', data)
}

// 获取指定数据
export const getData = (data, header) => {
	return request.post('/wechat/data/getPage', data, {
		header
	})
}

// 分销
// 获取分销订单数据
export const getDistributionData = (data) => {
	return request.post('/wechat/auth.rebate/index', data)
}

// 获取小程序码
export const getQRCode = data => {
	return request.post('/wechat/wxapp/qrcode', data)
}

// 获取使用积分信息
export const getPointsUseData = data => {
	return request.get('/wechat/auth.Integral/myIntegral', data)
}


// 获取OpenId
export const getOpenId = data => {
	return request.get('/prod-api/wechat/openID', data)
}

// 获取客服列表
export const getCustomerServiceList = data => {
	return request.get('/prod-api/website/customer-service', data)
}

// 上传图片
export const uploadFile = data => {
	return request.upload('/data/api.auth.center/image', data)
}

// Base64
export const bindFrom = (data, header) => {
	return request.post('/wechat/auth.center/bindFrom', data, {
		header
	})
}

// 推广中心-推广攻略
export const getQuestionsList = (data, header) => {
	return request.post('/data/api.data/questions', data, {
		header
	})
}

// 消息数量
export const getNewRemindCnt = (data, header) => {
	return request.post('/data/api.auth.data/newRemindCnt', data, {
		header
	})
}

// 消息中心
export const getMyRemindsList = (data, header) => {
	return request.post('/data/api.auth.data/myReminds', data, {
		header
	})
}



// 添加收货地址
export const addAddress = data => {
	return request.post('/wechat/auth.address/create', data)
}

// 修改收货地址
export const updateAddress = data => {
	return request.post('/wechat/auth.address/save', data)
}

// 修改收货地址状态
export const updateAddressStatus = data => {
	return request.post('/data/api.auth.address/state', data)
}

// 获取收货地址
export const getAddressList = data => {
	return request.post('/wechat/auth.address/index', data)
}

// 获取收货地址详情
export const getAddressDetail = data => {
	return request.post('/wechat/auth.address/read', data)
}

// 删除收货地址
export const deleteAddress = data => {
	return request.post('/wechat/auth.address/delete', data)
}

// 设置默认收货地址 type 地址状态(0普通地址,1默认地址)
export const setAddress = data => {
	return request.post('/data/api.auth.address/state', data)
}

// 获取任务平台
export const getPlatform = data => {
	return request.post('/data/api.task/getPlatform', data)
}

// 获取任务主题
export const getCate = data => {
	return request.post('/data/api.task/getCate', data)
}

// 获取分类数据
export const getGoodsCate = data => {
	return request.get('/data/api.goods/getCate', data)
}

// 获取支付参数数据
export const getPayChannelData = data => {
	return request.post('/data/api.star/channel', data)
}

// 获取订单支付状态
//如果选余额支付，payment_code = M7829555340105469600 且余额大于支付金额则直接支付成；如果选微信支付M7828696588602553171 则返回支付参数
export const getOrderPayStatus = data => {
	return request.post('/data/api.star/payment', data)
}

export const getNews = data => {
	return request.post('/data/api.news/getItem', data)
}

// 获取我邀请的朋友
export const getMyInviteFriend = data => {
	return request.post('/wechat/auth.center/getFrom', data)
}

// 获取系统配置
export const getConfig = data => {
	return request.post('/wechat/data/config', data)
}
export const checkPayPswd = data => {
	return request.post('/wechat/auth.center/checkPayPswd', data)
}
export const setPayPswd = data => {
	return request.post('/wechat/auth.center/setPayPswd', data)
}
// 获取微信手机号
export const getUserPhone = data => {
	return request.post('/wechat/wxapp/userPhone', data)
}

