
import {req} from "../request"

// 是否开启沃支付
const woPayment = () => req({url: "ajax/pays"})

//首页权益
const index = (area_name, user_lng, user_lat) => req({url: "home", data: {area_name: area_name, user_lng: user_lng, user_lat:user_lat}})

//白金+钻石权益
const choice = (type, area_name, user_lng, user_lat) => req({url: "home/group", data: {type: type,area_name: area_name, user_lng: user_lng, user_lat:user_lat}})

//权益分类
const classify = (category_id, area_name, user_lng, user_lat) => req({url: "categories/" + category_id, data: {area_name: area_name, user_lng: user_lng, user_lat:user_lat}})

//周五福利详情
const welfares = (welfare_id, address_id, is_deliver) => req({url: "welfare/" + welfare_id, data: {address_id: address_id || '', is_deliver:is_deliver}})

//市区选择
const idxCity = (province_id) => req({url: "areas/citys?province_id=" + province_id || ''})

//活动商品列表
const redwine = () => req({url: "redwine/index"})

//活动商品详情
const redwinePay = (goodId) => req({url: "redwine/" + goodId + "/pay", method: "POST"})

//活动商品订单提交
const payment = (good_id, param_id, address_id, islogistics) => req({url: "redwine/payment", method: "POST", data: {good_id: good_id, param_id: param_id, address_id: address_id, islogistics: islogistics}})

//活动商品订单
const activityOrder = (type, page) => req({url: "activity/orders", data: {type: type, page: page}})

//活动商品取消订单
const cance = (orderId) => req({url: "activity/orders/" + orderId + '/cancel', method: "POST"})

//活动商品支付订单
const repay = (orderId) => req({url: "redwine/" + orderId + '/repay', method: "POST"})

//活动商品订单详情
const ordersInfo = (orderId) => req({url: "activity/orders/" + orderId + '/info', method: "POST"})

// 权益详情
const rightShow = (right_id, address_id, num, is_deliver) => req({url: "orders/create/", data: {right_id: right_id, address_id: address_id || '', num: num || '', is_deliver: is_deliver}})

// 权益购买提交
const rightStore = (right_id, address_id, is_deliver, qty, share_user_id) => req({url: "orders/store/", method: "POST", data: {right_id: right_id, address_id: address_id || '', is_deliver: is_deliver, qty: qty || '', share_user_id: share_user_id || ''}})

// 微信权益购买信息
const wechat = (trade_no) => req({url: "payments/wechat?",method: "POST", data: {trade_no: trade_no}})

// 沃支付权益购买信息
const wopay = (trade_no) => req({url: "unicom/buy?", data: {trade_no: trade_no}})

//获取openid地址-web
const unionpay = (callback_url, callback_type, right_id) => req({url: "unionpay/openid", data: {callback_url: callback_url, callback_type: callback_type, right_id: right_id}})

//领取权益优惠券
const receiveCode = (openid, event_no, right_id) => req({url: "unionpay/code", data: {openid: openid, event_no: event_no, right_id: right_id}})

//领取权益优惠券
const unionCode = (openid) => req({url: "unionpay/union_openid", data: {openid: openid}, method: "POST"})

//所有城市-最新无字母
const newCity = () => req({url: "ajax/all_right_citys"})

//市区选择-最新无字母
const newidxCity = (code) => req({url: "ajax/all_right_children", data: {code: code}})

//周五福利-获取支付信息
const fridayInfo = (werlfare_id, address_id, is_deliver) => req({url: "welfare/order/" + werlfare_id, data: {address_id: address_id || '', is_deliver: is_deliver}})

//周五福利-支付
const fridayPay = (trade_no) => req({url: "payments/welfare/wechat",method: "POST", data: {trade_no: trade_no}})

//洗车券-获取跳转地址
const washcarUrl = (welfare_id, right_config_id) => req({url: "washcar/infourl", data: {welfare_id: welfare_id || '', right_config_id: right_config_id}})

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

//首页轮播-跳转本页面 --业务数据查看
const busineSee = (business) => req({url: "business/" + business})

//首页轮播-跳转本页面 --业务数据预约表单
const busineForm = (business_id, business_item_id, type, mobile, username) => req({url: "business/create",method: "POST", data: {business_id: business_id, business_item_id: business_item_id, type: type, mobile: mobile, username: username}})

//订阅
const subscribe = (subscribe, channel) => req({url: "wechat/" + subscribe + "/welfare_subscribe",method: "POST", data: {channel: channel}})

export default({
	index,
	choice,
	classify,
	welfares,
	idxCity,
	redwine,
	redwinePay,
	payment,
	activityOrder,
	cance,
	repay,
	ordersInfo,
	rightShow,
	rightStore,
	wechat,
	wopay,
	unionpay,
	receiveCode,
	unionCode,
	newCity,
	newidxCity,
	fridayInfo,
	fridayPay,
	washcarUrl,
	washcarCoupon,
	busineSee,
	busineForm,
	subscribe,
	woPayment
})
