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

import request from '../request.js'

// 权益详情
const index = (data) => {
    return request({
        url : 'orders/create/',
        data: data
    })
}

// 权益分类
const classify = (category_id, data) => {
    return request({
        url : 'categories/' + category_id,
        data: data
    })
}

// 权益购买提交
const rightStore = (data) => {
    return request({
        url : 'orders/store/',
        method: "POST",
        data: data
    })
}

// 洗车券-获取跳转地址 --暂时隐藏
const washcarUrl = (data) => {
    return request({
        url: 'washcar/infourl',
        data: data
    })
}

// 获取洗车券信息
const washcarBuy = (data) => {
    return request({
        url: 'washcar/create',
        data: data
    })
}

// 洗车券订单提交
const washcarCreate = (data) => {
    return request({
        url : 'washcar/create',
        method: "POST",
        data: data
    })
}


// h5微信支付获取微信授权地址
const getAuthUrl = (url) => {
    return request({
        url : 'auth/get_auth_url',
        data: {
            url
        }
    })
}

// h5掉起微信支付的前置获取相关的签名信息
const wpayH5Info = (data) => {
    return request({
        url : 'auth/jssdk',
        data: data
    })
}

//获取openid地址-web
const unionpay = (data) => {
    return request({
        url : 'unionpay/openid',
        data: data
    })
}

//领取银联权益优惠券
const unionCode = (data) => {
    return request({
        url : 'unionpay/union_openid',
        data: data
    })
}

// 权益 单订单支付
const rightsSingle = (orderid) => {
    return request({
        url : 'payments/order',
        data: {
            orderid
        }
    })
}

// h5掉起微信支付的前置获取相关的签名信息
// const fridayPayH5 = (url, data) => {
//     return request({
//         url : 'payments/welfare/wechat',
//         method: "POST",
//         data: data
//     })
// }

// H5 权益支付
// const wechatH5 = (data) => {
//     return request({
//         url : 'payments/wechat',
//         method: "POST",
//         data: data
//     })
// }

const h5Pay = (url, data) => {
    return request({
        url: url,
        method: "POST",
        data
    })
}

export {
    index,
    classify,
    rightStore,
    washcarUrl,
    washcarBuy,
    washcarCreate,
    getAuthUrl,
    wpayH5Info,
    unionpay,
    unionCode,
    rightsSingle,
    h5Pay
}