// 引入 request 文件
import request from '../common/request.js'

//订单列表
export const orserlist = (header) => {
    return request({
        url: '/order/user/list?orderState=7',
        method: 'get',
		header:header,
    })
}
//足迹数据
export const footlist = () => {
    return request({
        url: '/footprint/user/list',
        method: 'get',
		header:{
			"Mall-Token": uni.getStorageSync('tokenId')
		},
    })
}
//删除足迹
export const footdelete = (data) => {
    return request({
        url: '/footprint/user/delete',
        method: 'delete',
		header:{
			"Mall-Token": uni.getStorageSync('tokenId')
		},
		data:data
    })
}
//清空足迹
export const footclear = () => {
    return request({
        url: '/footprint/user/clear',
        method: 'delete',
		header:{
			"Mall-Token": uni.getStorageSync('tokenId')
		},
    })
}
// 确认订单
export const confirmorder = (data) => {
    return request({
        url: '/order/user/order/confirm',
        method: 'post',
		header:{
			'Content-Type': 'application/json; charset=utf-8',
			"Mall-Token": uni.getStorageSync('tokenId')
		},
		data:data
    })
}
// 提交订单
export const submitorder = (data) => {
    return request({
        url: '/order/user/order/submit',
        method: 'post',
		header:{
			'Content-Type': 'application/json; charset=utf-8',
			"Mall-Token": uni.getStorageSync('tokenId')
		},
		data:data
    })
}
//获取小程序支付参数
export const getapipay = (data) => {
    return request({
        url: '/pay/wx/user/getJsApiPayParam/'+data,
        method: 'get',
		header:{
			"Mall-Token": uni.getStorageSync('tokenId')
		},
    })
}
// 收货人列表
export const addresslist = () => {
    return request({
        url: '/address/user/list',
        method: 'get',
		header:{
			"Mall-Token": uni.getStorageSync('tokenId')
		},
    })
}
//添加收货地址
export const addressadd = (data) => {
    return request({
        url: '/address/user/save',
        method: 'post',
		header:{
			'Content-Type': 'application/json; charset=utf-8',
			"Mall-Token": uni.getStorageSync('tokenId')
		},
		data:data
    })
}
//修改收货地址
export const addressupdate = (data) => {
    return request({
        url: '/address/user/update',
        method: 'put',
		header:{
			'Content-Type': 'application/json; charset=utf-8',
			"Mall-Token": uni.getStorageSync('tokenId')
		},
		data:data
    })
}
//删除收货地址
export const addressdelete = (data) => {
    return request({
        url: '/address/user/delete',
        method: 'delete',
		header:{
			'Content-Type': 'application/json; charset=utf-8',
			"Mall-Token": uni.getStorageSync('tokenId')
		},
		data:data
    })
}
// 收货人地址详情
export const addressinfo = (data) => {
    return request({
        url: '/address/info/'+data,
        method: 'post',
		header:{
			"Mall-Token": uni.getStorageSync('tokenId')
		},
    })
}
//收藏数据列表
export const collectlist = () => {
    return request({
        url: '/collect/user/list',
        method: 'get',
		header:{
			"Mall-Token": uni.getStorageSync('tokenId')
		},
    })
}
//删除收藏
export const collectdelete = (data) => {
    return request({
        url: '/collect/user/'+data,
        method: 'post',
		header:{
			"Mall-Token": uni.getStorageSync('tokenId')
		},
    })
}
//清空收藏
export const collectclear = () => {
    return request({
        url: '/collect/user/clear',
        method: 'delete',
		header:{
			"Mall-Token": uni.getStorageSync('tokenId')
		},
    })
}