
/**
 * 手太欠
 * 愿这世界都如故事里一样 美好而动人~
 */

import request from '../request.js'

// 活动权益内容
const index = () => {
    return request({
        url: 'user'
    })
}

// 卡券详情
const couponinfo = (data) => {
    return request({
        url: 'coupons/show',
        data: data
    })
}

// 卡券二维码
const qrcode = (coupon_id) => {
    return request({
        url: 'coupons/qrcode',
        data: {
            coupon_id
        }
    })
}

// 卡券条形码
const barcode = (coupon_id) => {
    return request({
        url: 'coupons/' + coupon_id +  '/barcode'
    })
}

// 卡券列表
const coupon = (status) => {
    return request({
        url: 'coupons?status=' + status
    })
}

// 卡券分组
const couponArr = (data) => {
    return request({
        url: 'coupons/list',
        data: data
    })
}

// 积分账变记录
const logs = (data) => {
    return request({
        url: 'account/logs',
        data: data
    })
}

// 订单收益列表
const profits = (data) => {
    return request({
        url: 'data/profits',
        data: data
    })
}

// 订单收益列表-下级明细
const profitsNext = (data) => {
    return request({
        url: 'data/profitlogs',
        data: data
    })
}

// 积分卡激活
const cards = (data) => {
    return request({
        url: 'user/cards/activate',
        method: "POST",
        data: data
    })
}

// 冻结列表
const ungrants = (type) => {
    return request({
        url: 'account/newungrants',
        data: {
        	type
        }
    })
}

// 冻结列表-最新
const ungrantsNew = (data) => {
    return request({
        url: 'account/unaccountgrants',
        data: data
    })
}


// 洗车券-获取跳转地址
const washcarCoupon = (coupon) => {
    return request({
        url: 'washcar/' + coupon + "/info",
        method: "POST"
    })
}

//权益商品订单列表
const orders = (data) => {
    return request({
        url: 'orders/index',
        data: data
    })
}

//权益订单列表
const ordersCoupons = (data) => {
    return request({
        url: 'orders/coupons',
        data: data
    })
}

//取消兑换订单
const cancel = (orderid) => {
    return request({
        url: 'orders/cancel?orderid=' + orderid,
        method: "POST"
    })
}

// 福利商品订单列表
const welfare = (data) => {
    return request({
        url: 'welfares/orders',
        data: data
    })
}

// 福利券订单列表
const welfareCoupons = (data) => {
    return request({
        url: 'welfares/coupons',
        data: data
    })
}

// 福利取消订单
const welfaresCancel = (orderid) => {
    return request({
        url: 'welfares/orders/cancel?orderid=' + orderid,
        method: "POST"
    })
}

//权益订单详情
const show = (orderid) => {
    return request({
        url: 'orders/show',
        data: {
            orderid
        }
    })
}

//周五福利订单详情
const welfaresShow = (orderid) => {
    return request({
        url: 'welfares/orders/show',
        data: {
            orderid
        }
    })
}

// 头像上传+昵称修改
const upload = (data) => {
    return request({
        url: 'user/setting/info',
        method: "POST",
        data: data
    })
}

// 发送短信
const send = (data) => {
    return request({
        url: 'sms/send',
        method: "POST",
        data: data
    })
}

// 设置支付密码
const setPassword = (data) => {
    return request({
        url: 'user/setting/set_password',
        method: "POST",
        data: data
    })
}

// 修改支付密码
const changePassword = (data) => {
    return request({
        url: 'user/setting/change_password',
        method: "POST",
        data: data
    })
}

// 重置支付密码
const resetPassword = (data) => {
    return request({
        url: 'user/setting/reset_password',
        method: "POST",
        data: data
    })
}

//门店列表
const stores = (data) => {
    return request({
        url: 'coupons/new_stores',
        method: "POST",
        data: data
    })
}

//门店详情
const storesShow = (data) => {
    return request({
        url: 'coupons/store/show',
        data: data
    })
}

//省市区
const areas = (psn) => {
    return request({
        url: 'areas/children?psn=' + psn
    })
}

// 2021-07-28新增
// 我的收益
const myProfit = () => {
    return request({
        url: 'data/index'
    })
}

// 我的收益-收益报表
const myIncome = (month) => {
    return request({
        url: 'data/income',
        data:{
            month
        }
    })
}

// 我的收益-收益报表  + 我的收益-我的团队
const profitUrl = (url, data) => {
    return request({
        url: url,
        data: data
    })
}

// 提现前置账户信息
const withdraws = () => {
    return request({
        url: 'withdraws/create'
    })
}

// 提现记录列表
const withdrawsList = (data) => {
    return request({
        url: 'user/withdraws',
        data: data
    })
}

// 提现表单填写
const withdrawsForm = (data) => {
    return request({
        url: 'withdraws',
        method: "POST",
        data: data
    })
}

// 权益详细列表
const profitLogs = (data) => {
    return request({
        url: 'data/logs',
        data: data
    })
}

// 转账获取积分账户分类
const transfers = () => {
    return request({
        url: 'user/transfers'
    })
}

// 转账提交表单
const transfersForm = (data) => {
    return request({
        url: 'user/transfers',
        method: "POST",
        data: data
    })
}

// 校验转账的手机号码
const ajaxTel = (mobile) => {
    return request({
        url: 'ajax/user',
        data: {
            mobile
        }
    })
}

// 产品分享 - 新增
const productList = (page) => {
    return request({
        url: 'shares/goods',
        data: {
            page
        }
    })
}

const productInfo = (right) => {
    return request({
        url: 'shares/goods/' + right
    })
}

const productPoster = (right) => {
    return request({
        url: 'shares/goods/' + right + '/poster'
    })
}

// 我的分享
const myshare = (data) => {
    return request({
        url: 'user/share',
        data: data
    })
}

// 产品分享二维码+储值分享二维码
const publicCode = (data) => {
    return request({
        url: 'user/share/goods',
        data: data
    })
}

// 储值分享
const storedList = () => {
    return request({
        url: 'shares/recharges'
    })
}


export {
    index,
    couponinfo,
    qrcode,
    barcode,
    coupon,
    couponArr,
    logs,
    profits,
    profitsNext,
    cards,
    ungrants,
	ungrantsNew,
    washcarCoupon,
    orders,
    ordersCoupons,
    cancel,
    welfare,
    welfareCoupons,
    welfaresCancel,
    show,
    welfaresShow,
    upload,
    send,
    setPassword,
    changePassword,
    resetPassword,
    stores,
    storesShow,
    areas,
    myProfit,
    myIncome,
    profitUrl,
    withdraws,
    withdrawsList,
    withdrawsForm,
    profitLogs,
    transfers,
    transfersForm,
    ajaxTel,
    productList,
    productInfo,
    productPoster,
    myshare,
    publicCode,
    storedList
}