
import {req} from "../request"

//用户信息
const index = () => req({url: "user"})

//切换用户登录
const mobiles = (wechatUser_id) => req({url: "user/mobiles", data:{wechatUser_id : wechatUser_id}})

//卡券
const coupon = (status) => req({url: "coupons?status=" + status})

//卡券分组
const couponArr = (activityId, status, page) => req({url: "coupons/list", data:{activityId : activityId, status : status, page : page || ''}})

//卡券详情
const couponinfo = (coupon_id, user_lng, user_lat) => req({url: "coupons/show", data:{coupon_id : coupon_id, user_lng : user_lng, user_lat : user_lat}})

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

//卡券二维码
const barcode = (coupon_id) => req({url: "coupons/" + coupon_id +  '/barcode'})

//门店列表
const stores = (coupon_id, province_id, city_id, district_id, title, user_lng, user_lat, page) => req({url: "coupons/new_stores", method: "POST", data:{coupon_id : coupon_id, province_id : province_id || '', city_id : city_id || '', district_id : district_id || '', title : title || '', user_lng : user_lng, user_lat : user_lat, page : page || ''}})

//门店详情
const storesShow = (store_id, user_lng, user_lat) => req({url: "coupons/store/show", data:{store_id : store_id, user_lng : user_lng, user_lat : user_lat}})

//省市区
const areas = (psn) => req({url: "areas/children?psn=" + psn})

// 加入微信卡包
const jssdk = (coupon_id) => req({url: "coupons/jssdk?coupon_id=" + coupon_id})

// 积分卡激活
const cards = (code, pass) => req({url: "user/cards/activate", method: "POST", data:{code : code, pass : pass}})

// 积分账变记录
const logs = (type, channel, page) => req({url: "account/logs", data:{type : type, channel: channel, page : page || ''}})

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

// 发送短信
const send = (mobile, channel, type) => req({url: "sms/send", method: "POST", data:{mobile : mobile, channel : channel, type : type}})

// 领取红包
const unicom = (mobile, channel, code) => req({url: "unicom/get", method: "POST", data:{mobile : mobile, channel : channel, code : code}})

// 获取商家券信息
const merchant_card = (coupon_id) => req({url: "coupons/merchant_card", method: "GET", data:{coupon_id : coupon_id}})

// 获取商家券信息
const washcarBuy = (welfare_id, right_id, qty, address_id, is_deliver) => req({url: "washcar/create", data:{welfare_id : welfare_id, right_id : right_id, qty : qty, address_id : address_id || '', is_deliver : is_deliver}})

// 收银台提交
const washcarCreate = (welfare_id, right_id, qty, address_id, is_deliver) => req({url: "washcar/create", method: "POST", data:{welfare_id : welfare_id, right_id : right_id, qty : qty, address_id : address_id || '', is_deliver : is_deliver}})

// 我的分享
const myshare = (channel,parent_id,url) => req({url: "user/share",data:{channel: channel,parent_id : parent_id || '', url: url}})

// 我的分享-展示参数
const wechatShares = () => req({url: "ajax/wechat_shares"})

// 我的推荐
const childs = (page) => req({url: "user/childs",data:{page : page || ''}})

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

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

// 转账提交表单
const transfersForm = (mobile, type, amount, paypass) => req({url: "user/transfers", method: "POST", data:{mobile : mobile, type : type, amount : amount, paypass: paypass}})

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

// 修改支付密码
const changePassword = (old_password, password, password_confirmation) => req({url: "user/setting/change_password", method: "POST", data:{old_password : old_password, password : password, password_confirmation : password_confirmation}})

// 重置支付密码
const resetPassword = (code, password, password_confirmation, mobile, channel) => req({url: "user/setting/reset_password", method: "POST", data:{code : code, password : password, password_confirmation : password_confirmation, mobile : mobile, channel : channel}})

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

// 提现记录列表
const withdrawsList = (status, page) => req({url: "user/withdraws", data:{status: status, page : page || ''}})

// 提现表单填写
const withdrawsForm = (amount, channel) => req({url: "withdraws", method: "POST", data:{amount : amount, channel: channel}})

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

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

// 我的收益-收益报表
const profitOrders = (type, page) => req({url: "data/orders", data:{type: type, page : page || ''}})

// 我的收益-我的团队
const profitTeam = (identity_id, sort, page) => req({url: "data/teams", data:{identity_id: identity_id, sort: sort, page : page || ''}})

// 权益详细列表
const profitLogs = (name, page) => req({url: "data/logs", data:{name: name, page : page || ''}})

// 产品分享
const productList = (page) => req({url: "shares/goods", data:{page : page || ''}})
const productInfo = (right) => req({url: "shares/goods/" + right})
const productPoster = (right) => req({url: "shares/goods/" + right + "/poster"})

// 储值分享
const storedList = () => req({url: "shares/recharges"})

// 产品分享二维码+储值分享二维码
const publicCode = (channel, type, url) => req({url: "user/share/goods", data:{channel: channel, type : type, url: url}})

// 订单收益列表
const profits = (page) => req({url: "data/profits", data:{page : page || ''}})

// 订单收益列表-下级明细
const profitsNext = (order_type, order_id, page) => req({url: "data/profitlogs", data:{order_type : order_type, order_id : order_id, page : page || ''}})

export default({
	index,
	mobiles,
	coupon,
	couponArr,
	couponinfo,
	qrcode,
	barcode,
	stores,
	storesShow,
	areas,
	jssdk,
	cards,
	logs,
	ungrants,
	send,
	unicom,
	merchant_card,
	washcarBuy,
	washcarCreate,
	myshare,
	wechatShares,
	childs,
	ajaxTel,
	transfers,
	transfersForm,
	setPassword,
	changePassword,
	resetPassword,
	withdraws,
	withdrawsList,
	withdrawsForm,
	myProfit,
	myIncome,
	profitOrders,
	profitTeam,
	profitLogs,
	productList,
	productInfo,
	productPoster,
	storedList,
	publicCode,
	profits,
	profitsNext
})
