JM-MiniApp/api/index.js
2023-10-08 21:21:21 +08:00

404 lines
18 KiB
JavaScript

import net from './request.js';
// import store from '../store';
const API = {
/*
首页信息
*/
getIndexInfo: data => net.GET('/api/index/index'), // 首页信息
getIndexBanner: data => net.GET('/api/banner/index',data), // 轮播图
getIndexNotice: data => net.GET('/api/news/notice'), // 公告
getGoodsDetail: data => net.GET('/api/goods/detail',data),// 商品详情(普通商品)
getSeckillGoodsDetail: data => net.GET('/api/seckill_goods/detail',data),// 商品详情(秒杀)
getGroupGoodsDetail: data => net.GET('/api/group_goods/detail',data),// 商品详情(团购)
getGoodsList: data => net.GET('/api/goods/lists',data),// 商品列表(普通商品)
getSeckillGoodsList: data => net.GET('/api/seckill_goods/lists',data),// 商品列表(限时)
getGroupGoodsList: data => net.GET('/api/group_goods/lists?page=&keyword=',data),// 商品列表(团购)
getNewinfo: data => net.GET('/api/goods/getGoodsSpec',data), // 根据商品规格更新数据
getCategoryList:data => net.GET('/api/goods_category/lists'), // 获取商品分类
getCategory:data => net.GET('/api/goods/category',data), // 根据分类Id获取分类商品
getCartList:data => net.GET('/api/cart/lists',data), // 获取购物车列表
addCart:data => net.POST('/api/cart/add',data), // 加入购物车
delCart:data => net.POST('/api/cart/delete',data), // 删除购物车
updateCart:data => net.POST('/api/cart/edit',data), // 更新购物车
login:data => net.POST('/api/user/wechatLogin',data), // 登录
login_test:data => net.GET('/api/user/testLogin?id=1'), // 登录 测试专用
zhuce:data => net.POST('/api/user/profile',data), // 注册
getOrderList:data => net.GET('/api/order/lists',data), //订单列表
getOrderGroupList:data => net.GET('/api/group_order/lists',data), //订单列表(团购)
getOrderSeckillList:data => net.GET('/api/seckill_order/lists',data), //订单列表(秒杀)
pay:data => net.POST('/api/order/pay',data), //支付
payGroup:data => net.POST('/api/group_order/pay',data), //支付(团购)
paySeckill:data => net.POST('/api/seckill_order/pay',data), //支付(秒杀)
refund:data => net.POST('/api/order/refund',data), //退款
getOrderInviteList:data => net.GET('/api/invite/order',data), //分销订单
getOrderBaseinfo:data => net.POST('/api/order/preview',data), //获取订单提交页面的基本信息
getOrderGroupBaseinfo:data => net.POST('/api/group_order/preview',data), //获取订单提交页面的基本信息(团购)
getOrderSeckillBaseinfo:data => net.POST('/api/seckill_order/preview',data), //获取订单提交页面的基本信息(秒杀)
getOrderCartinfo:data => net.POST('/api/order/cartPreview',data), //获取订单提交页面的基本信息(购物车来的)
getDelivery:data => net.GET('/api/index/delivery',data), //获取配送相关的选项(普通商品)
staffApply:data => net.POST('/api/invite/apply',data), //业务员申请
deliveryApply:data => net.POST('/api/staff/apply',data), //配送员申请
getDeliveryArea:data => net.GET('/api/staff/getDeliveryArea'), //获取配送区域
getAddressList:data => net.GET('/api/address/lists'), //地址列表
getAddDetail:data => net.GET('/api/address/detail',data), //地址详情
addAddress:data => net.POST('/api/address/add',data), //新增地址
editAddress:data => net.POST('/api/address/edit',data), //修改地址
delAddress:data => net.GET('/api/address/delete',data), //删除地址
getDefaultAddress:data => net.GET('/api/address/getDefault'), //获取默认地址
orderSubmitFunc:data => net.POST('/api/order/order',data), //提交订单(普通订单)
orderSubmitCartFunc:data => net.POST('/api/order/cartOrder',data), //提交订单(购物车)
orderSubmitGroupFunc:data => net.POST('/api/group_order/order',data), //提交订单(团购订单)
orderSubmitSeckillFunc:data => net.POST('/api/seckill_order/order',data), //提交订单(秒杀订单)
orderDetail:data => net.GET('/api/order/detail',data), //订单详情-普通订单 (顾客)
orderGroupDetail:data => net.GET('/api/group_order/detail',data), //订单详情-团购订单
orderSeckillDetail:data => net.GET('/api/seckill_order/detail',data), //订单详情-秒杀订单
orderStaffDetail:data => net.GET('/api/staff/orderDetail',data), //订单详情-配送订单
orderLeaderDetail:data => net.GET('/api/leader/orderDetail',data), //订单详情-管理员订单
orderCancel:data => net.POST('/api/order/cancle',data), //取消订单
orderCancelGroup:data => net.POST('/api/group_order/cancle',data), //取消订单 (团购)
orderCancelSeckill:data => net.POST('/api/seckill_order/cancle',data), //取消订单 (秒杀)
/*
用户相关
*/
getUserInfo:data => net.GET('/api/user/userInfo',data), //获取用户信息
updateUserInfo:data => net.POST('/api/user/profile',data), //更新用户信息
rechargeFunc:data => net.POST('/api/recharge/recharge',data), //充值
withdrawalFunc:data => net.POST('/api/withdrawl/submit',data), //提现
vipBuy:data => net.POST('/api/vip/order',data), //购买VIP
vipConfig:data => net.GET('/api/vip/config'), //会员说明
/*
优惠券
*/
getCouponsList:data => net.GET('/api/coupon/userCoupons',data), //优惠券
getCouponsCenterList:data => net.GET('/api/coupon/lists',data), //领券中心
couponsCenterReceive:data => net.POST('/api/coupon/receive',data), //领取优惠
getMyStars:data => net.GET('/api/collect/lists',data), //我的收藏
/*
推广中心
*/
inviteCenter:data => net.GET('/api/invite/index',data), //首页
inviteCenterwithdrawl:data => net.POST('/api/withdrawl/submit',data), //提现
inviteCenterwithdrawlDetail:data => net.GET('/api/invite/withdrawlDetail',data), //提现明细
inviteCenterwithdrawlRecodes:data => net.GET('/api/invite/record',data), //提现明细(佣金)
getShareQrcode:data => net.GET('/api/user/getShareQrcode'), //用户分销二维码
/*
配置相关
*/
getConfig:data => net.GET('/api/index/config'),
setDeliveryTime:data => net.POST('/api/staff/setDeliveryTime',data), // 设置配送时间
getDeliveryTime:data => net.GET('/api/staff/getDeliveryTime'), // 获取配送时间
getStaffOrder:data => net.GET('/api/staff/orderLists',data), // 获取订单管理列表(配送员)
getManageOrder:data => net.GET('/api/leader/orderLists',data), // 获取订单管理列表(团长)
deliveryPhoto:data => net.POST('/api/staff/deliveryPhoto',data), // 送达拍照
reveiceOrder:data => net.POST('/api/staff/reveiceOrder',data), // 接单
reveiceOrderOk:data => net.POST('/api/leader/assignOrder',data), // 派单
getStaffList:data => net.GET('/api/leader/staffList'), // 配送员列表
goodsBuyFunc:data => net.POST('/api/leader/goodsBuy',data), // 商品申购
getRecordList:data => net.GET('/api/leader/recordList',data), // 货物入库
/**
*
* 登录类信息
*
*/
// 检查更新
getUpdateVersion:data => net.GET('/api/v1/index/version'),
// 获取定位
getLocationInfo:data => net.GET('/api/v1/index/ip',data),
// 验证码登陆
codeLogin: data => net.POST('/code/login', data),
// H5扫码登录邀请接口
inviteLogin: data => net.POST('/api/v1/invite/login', data),
// 发送手机验证码接口
sendVerifyCode: data => net.POST('/api/v1/sms/send', { send_type: 'student', ...data}),
// 注销账号
unRegister: data => net.POST('/api/v1/student/delete', data),
// 授权登录
accessLogin: (data, t = 'wx') => net.POST(`/api/v1/${t}/login`, data),
// 退出登录
logOut: data => net.POST('/api/v1/code/logout', data),
// 获取省份
getProvince: data => net.GET('/api/v1/colleges/getProvince', data),
// 根据学员所选择的教学点获取院校列表接口
collegesList: data => net.GET('/api/v1/colleges/list', data),
// 通过市反查省/自治区/直辖市
getProvinceByCity: data => net.GET('/api/v1/region/getProvinceByCity', data),
/**
*
* 用户信息
*
*/
// 学员个人信息接口
selectUserInfo: data => net.GET('/api/v1/student/info', data),
// 登录成功后填写学员信息接口
userUpdate: data => net.POST('/api/v1/student/update', data),
// 邀请二维码
qrcode: data => net.POST('/api/v1/student/invite/qrcode', data),
uploadBase64: data => net.POST('/api/v1/student/uploadBase64', data),
// 获取被邀请人列表接口
inviteList: data => net.GET('/api/v1/student/invite/list', data),
// 积分列表
scoreList: data => net.GET('/point', data),
// 余额明细
balanceList: data => net.POST('/api/v1/balance/detail/get/list', data),
// 模拟测试记录
recordList: data => net.GET('/api/v1/test-record/mock/examination/record', data),
// 练习题错误集详情
practiceList: data => net.GET('/api/v1/test-record/practice/list', data),
/**
*
* 首页数据
*
*/
// 首页配置获取
indexConfig: data => net.GET('/api/v1/index/config', data),
// 轮播
// indexBanner: data => net.GET('/app/banner', data),
indexBanner: data => net.POST('/api/v1/index/lbt', data),
// 获取咨询文章列表
// wzList: data => net.GET('/app/consult-wz', data),
wzList: data => net.POST('/api/v1/index/wz/list', data),
// 获取咨询文章
// wzInfo: id => net.GET(`/app/consult-wz/${id}`),
wzInfo: id => net.GET(`/api/v1/index/wz/${id}`),
// 获取课程分页
getCourseList: (data) => net.GET(`/app/course/page`,data),
// 获取推荐院校列表
// recommendwzList: data => net.GET('/app/academy', data),
recommendwzList: data => net.POST('/api/v1/index/academy/list', data),
// 获取推荐院校文章
// recommendwzInfo: id => net.GET(`/app/academy/${id}`),
recommendwzInfo: id => net.GET(`/api/v1/index/academy/${id}`),
// 推荐院校文章阅读量累计
// recomendaddReadNumber: data => net.PUT('/app/academy/num',data),
recomendaddReadNumber: data => net.POST('/api/v1/index/academy/add/num', data),
//获取考试大纲列表
syllabusList: data => net.POST('/api/v1/index/syllabus/list', data),
// 搜索
search: data => net.POST('/api/v1/index/search', data),
// 阅读量累计
addReadNumber: data => net.PUT('/app/consult-wz/num', data),
// 师资团队列表
lecturerList: data => net.GET('/api/v1/index/lecturer', data),
// 师资详情
lecturerDetail: id => net.GET(`/api/v1/index/lecturer/${id}`),
// 获取资料列表
indexMaterial: data => net.GET('/api/v1/index/material', data),
// indexMaterial: data => net.GET('/app/material', data),
// 获取资料详情
materialDetail: data => net.GET(`/api/v1/index/material/${data.id}`,{buyer_id:data.buyer_id}),
// 获取精品课程
indexBoutiqueCourse: data => net.GET('/api/v1/index/boutique/course', data),
// 获取精品课程详情
boutiqueCourseDetail: id => net.GET(`/api/v1/index/boutique/course/${id}`),
// 获取课程
courseList: data => net.POST('/api/v1/course/get', data),
// 获取套餐
comboList: data => net.POST('/api/v1/combo/course/get', data),
// courseList: data => net.GET('/app/course/page', data),
// 获取课程详情
courseDetail: (id, data) => net.GET(`/api/v1/course/${id}`, data),
// courseDetail: (id, data) => net.GET(`/app/course`, {id}),
// 获取线下课程
offlineCourseList: data => net.POST('/api/v1/offline/course/get', data),
// 获取线下课程详情
offlineCourseDetail: id => net.GET(`/api/v1/offline/course/${id}`),
// 获取套餐课程详情
getComboDetail: data => net.GET(`/api/v1/combo/course/${data.id}`,{buyer_id:data.buyer_id}),
// 获取直播课列表
// liveCourseList: data => net.GET('/api/v1/sys-course-live', data),
liveCourseList: data => net.GET('/api/v1/api-live-course', data),
// 直播课详情
viewCourse: (id, data) => net.GET('/api/v1/sys-course-live/'+id,{buyer_id:data.buyer_id}),
// 直播课详情 测试
viewCourse_test: (id, data) => net.GET('/api/v1/api-live-course/'+id,{buyer_id:data.buyer_id}),
/*题库 管理*/
//题库
getQuestionExercise:data => net.GET('/exercises', data),
// 科目
subjectList: data => net.GET('/api/v1/public/subject', data),
// subjectList: data => net.GET('/app/subject/list', data),
// 获取学员学习列表接口
learningList: data => net.GET('/api/v1/learning', data),
// 学习课程详情
learningDetail: data => net.GET(`/api/v1/learning/course/${data}`),
// 学习直播课程详情
learningLiveDetail: data => net.GET(`/api/v1/learning/course/live/${data}`),
// 学员学习计时接口
// "time_type": "stop" //计时类型 start-开始计时 stop-停止计时
studyDuration: data => net.POST('/api/v1/learning/course/duration', data),
// 学习统计API
courseStatistics: data => net.POST('/api/v1/learning/course/statistics', data),
// 题型分类
questionBankType: data => net.GET('/api/v1/questionBank/type', data),
// 网课、测试、题库详情
exercisesDetails: data => net.GET(`/api/v1/exercises/detail/${data}`),
// 测试练习题列表
testList: data => net.GET('/api/v1/exercises/test/list', data),
// 模拟试卷列表
examinationList: data => net.GET('/api/v1/examination/list', data),
// 获取题库、网课题目列表接口
exerciseSubjectList: data => net.GET('/api/v1/exercise/subject/list', data),
// 试题分类
exercisesType: data => net.GET('/api/v1/exercises/type', data),
// 模拟题详情
examinationDetail: id => net.GET(`/api/v1/examination/detail/${id}`),
// 开始答题
startTest: data => net.POST('/api/v1/exercises/start/answer', data),// question_bank_id
// 交卷
submitTest: data => net.POST('/api/v1/exercises/submit', data),
// 下一题
nextSubject: data => net.POST('/api/v1/exercises/next', data),
// 重新答题
againAnswer: data => net.POST('/api/v1/exercises/againAnswer', data),
// 答题成绩报告
scoreReport: data => net.GET('/api/v1/exercises/achievement/report', data),
// 获取团购列表
getGroupList: data => net.GET('/api/v1/group/page', data),
// 获取团购详情
getGroupPurchaseData: data => net.GET('/api/v1/group', data),
//发起拼团
starGroupPurchase:data => net.POST('/api/v1/group',data),
//加入拼团
joinGroupPurchase:data => net.POST('/api/v1/group/join',data),
/**
*
* 支付接口
*
*/
// 支付接口
wxOrAlipay: data => net.POST('/api/v1/pay', data),
// 获取openid
getOpenID: data => {
return uni.request({
url:'https://api.weixin.qq.com/sns/oauth2/access_token',
method:'GET',
// header: {
// ...header,
// ...headers
// },
data
})
},
// 余额支付
yuePay: data => net.POST('/api/v1/student/pay/balance', data),
//H5下单API
// v3_pay:data => net.POST('https://api.mch.weixin.qq.com/v3/pay/transactions/h5',data)
v3_pay:data => {
return uni.request({
url: 'https://api.mch.weixin.qq.com/v3/pay/transactions/h5',
method:'POST',
header: {
"Content-Type": "application/json",
},
data
})
},
//测试
pay_check:data => net.POST('/api/v1/wxpay/check',data),
pay_callback:data => net.POST('/api/v1/wxpay/callback',data),
/**
*
* 地址接口
*
*/
// 列表
addressList: data => net.POST('/api/v1/address', data), // student_id
// 新增/编辑
addressAction: data => net.POST(`/api/v1/address/add`, data),
editaddressAction: data => net.PUT(`/api/v1/address`, data),
// 删除
addressDelete: data => net.DELETE('/api/v1/address', data), // id
/**
*
* 购物车接口
*
*/
// 列表
cartList: data => net.POST('/api/v1/shopping/cart', data),
// 添加
cartAdd: data => net.POST('/api/v1/shopping/cart/add', data),
// 编辑
cartUpdate: data => net.POST('/api/v1/shopping/cart/update', data),
// 删除
cartDelete: data => net.POST('/api/v1/shopping/cart/delete', data), // id
/**
*
* 订单接口
*
*/
// 订单查询
orderList: data => net.POST('/api/v1/api-order/get/my/order/list', data),
// 确认收货
orderUpdate: data => net.POST('/api/v1/api-order/update/material/order', data),
// 删除
orderDelete: data => net.POST('/api/v1/api-order/delete/order', data),
/**
* 商品价格合计
* @param { order_count_list: [{ id: '', order_type: '', num: ''}] }
*
*/
orderCount: data => net.POST('/api/v1/api-order/order/count', data),
/**
* 资料,在线课程的立即购买/购物车
* @param { goods: [{ id: '', order_type: '', num: ''}], student_id: '' }
*
*/
orderBuynow: data => net.POST('/api/v1/api-order/order/buynow', data),
// 新增资料订单
orderMaterialAdd: data => net.POST('/api/v1/api-order/add/material/order', data),
// 新增在线课程订单
orderOnlineAdd: data => net.POST('/api/v1/api-order/add/online/order', data),
// 直播课订单
orderLiveAdd: data => net.POST('/api/v1/api-order/add/live/order', data),
// 新增套餐课程订单
orderComboAdd: data => net.POST('/api/v1/api-order/add/combo/order', data),
// 新增线下订单==报名
orderOfflineAdd: data => net.POST('/api/v1/api-order/add/offline/order', data),
// 新增团购订单
orderGroupAdd: data => net.POST('/api/v1/api-order/add/group/order', data),
// 分享平台
shareProvider: () => net.getShareProvider(),
// 支付方式
paymentProvider: () => net.getPaymentProvider(),
// 物流查询
queryKuaidi: data => net.POST('/api/v1/kuaidi/poll/query', data),
// SHARE: () => net.SHARE(),
// 提现
transfer: data => net.POST('/api/v1/wxpay/transfer', data),
// 获取我的收藏分页列表
getStarList: data => net.POST('/api/v1/favorite/get', data),
// 取消收藏
cancelStar: data => net.DELETE('/api/v1/favorite',data),
//添加收藏
addStar:data => net.POST('/api/v1/favorite',data)
};
export default API