
import {req} from "../request"

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

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

//卡券
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, page) => req({url: "account/logs", data:{type : type, page : page}})

// 冻结列表
const ungrants = (type,) => req({url: "account/ungrants", 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}})


export default({
	index,
	mobiles,
	coupon,
	couponArr,
	couponinfo,
	qrcode,
	barcode,
	stores,
	storesShow,
	areas,
	jssdk,
	cards,
	logs,
	ungrants,
	send,
	unicom
})
