
import {req} from "../request"

//首页权益
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) => req({url: "categories/" + category_id})

//周五福利详情
const welfares = (welfare_id) => req({url: "welfare/" + welfare_id})

//市区选择
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) => req({url: "orders/store/", method: "POST", data: {right_id: right_id, address_id: address_id || '', is_deliver: is_deliver, qty: qty || ''}})

// 权益购买信息
const wechat = (trade_no) => req({url: "payments/wechat?",method: "POST", 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 = (orderId) => req({url: "welfare/order/" + orderId})

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

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