import http from './http.js' const config = { // 微信登录 wxLogin : {url : '/api/wxLogin', method : 'POST', auth : false}, // 授权隐私信息 getConfig : {url : '/api/getConfig', method : 'GET', auth : false}, // 获取轮播图 getBanner : {url : '/api/getBanner', method : 'GET', auth : false}, // 获取项目列表 getProjectList : {url : '/api/getProjectList', method : 'GET', auth : false}, // 获取技师列表 getTechnicianList : {url : '/api/getTechnicianList', method : 'GET', auth : false}, // 获取技师详情 getTechnicianDetail : {url : '/api/getTechnicianDetail', method : 'GET', auth : false}, // 获取项目详情 getProjectDetail : {url : '/api/getProjectDetail', method : 'GET', auth : false}, // 获取订单列表 getOrderList : {url : '/api/getOrderList', method : 'GET', auth : true}, // 获取订单详情 getOrderDetail : {url : '/api/getOrderDetail', method : 'GET', auth : true}, // 获取评论列表 getCommentList : {url : '/api/getCommentList', method : 'GET', auth : true}, // 获取登录用户信息 getUserInfo : {url : '/api/getUserInfo', method : 'GET', auth : true}, // 微信支付 createOrderWXPay : {url : '/post/create', method : 'POST', auth : true}, // 获取地址列表 getAddressList : {url : '/api/getAddressList', method : 'GET', auth : true}, // 获取地址详情 getAddressDetail : {url : '/api/getAddressDetail', method : 'GET', auth : true}, // 添加或修改地址 addOrUpdateAddress : {url : '/post/addOrUpdateAddress', method : 'POST', auth : true}, // 删除地址 deleteAddress : {url : '/post/deleteAddress', method : 'POST', auth : true}, // 获取优惠券列表 getCouponList : {url : '/api/getCouponList', method : 'GET', auth : true}, // 获取粉丝列表 getFans : {url : '/post/fans', method : 'GET', auth : true}, // 获取粉丝列表 getRechargeList : {url : '/api/getRechargeList', method : 'GET', auth : true}, // 获取交易列表 getAgentFlow : {url : '/api/getAgentFlow', method : 'GET', auth : true}, // 获取二维码 showQrcode : {url : '/post/showQrcode', method : 'GET', auth : true}, // 增加或修改技师入驻信息 addOrUpdateTechnician : {url : '/post/addOrUpdateTechnician', method : 'POST', auth : true}, // 1 用户下单 createVipOrder : {url : '/order/createVipOrder', method : 'POST', auth : true}, // 2 用户支付 payVipOrder : {url : '/order/payVipOrder', method : 'POST', auth : true}, // 8 用户评价 evaluateVipOrder : {url : '/order/evaluateVipOrder', method : 'POST', auth : true}, // 获取当前技师的排期 getVipTenOrderList : {url : '/order/getVipTenOrderList', method : 'GET', auth : true}, // 获取手机验证码 getVipCode : {url : '/order/getVipCode', method : 'GET', auth : false}, // 3 技师确认订单 confirmVipOrder : {url : '/order/confirmVipOrder', method : 'POST', auth : true}, // 4 技师出发 startVipOrder : {url : '/order/startVipOrder', method : 'POST', auth : true}, // 5 技师到达 arriveVipOrder : {url : '/order/arriveVipOrder', method : 'POST', auth : true}, // 6 开始服务 startVipService : {url : '/order/startVipService', method : 'POST', auth : true}, // 7 结束服务 endVipService : {url : '/order/endVipService', method : 'POST', auth : true}, // 根据订单标识查询订单详情 getOrderVipDetail : {url : '/order/getOrderVipDetail', method : 'GET', auth : true}, // 技师根据标识查询自己的订单 getVipOrderList : {url : '/order/getVipOrderList', method : 'GET', auth : true}, // 技师登录 wxTechnicianLogin : {url : '/order/wxTechnicianLogin', method : 'POST', auth : false}, // 获取技师信息 giveTenInfo : {url : '/order/giveTenInfo', method : 'GET', auth : true}, // 技师端-订单页面获取订单列表带分页 getTenOrderPageList : {url : '/order/getTenOrderPageList', method : 'GET', auth : true}, // 技师端-首页-获取待确认订单-带分页 getTenOrderList : {url : '/order/getTenOrderList', method : 'GET', auth : true}, // 技师端-首页-统计数据 getTenOrderStatistics : {url : '/order/getTenOrderStatistics', method : 'GET', auth : true}, //新增或修改技师入驻 addOrUpdateMsgTer : { url : '/post/addOrUpdateMsgTer' , method : 'POST' , auth : true }, //技师上下线 tenOnline : { url : '/order/online' , method : 'POST' , auth : true}, //获取实名认证 getTenRealName : { url : '/order/getTenRealName' , method : 'GET' , auth : true }, //获取实名认证 tenRealName : { url : '/order/tenRealName' , method : 'POST' , auth : true }, //修改技师相册 uploadTenImg : { url : '/order/uploadTenImg' , method : 'POST' , auth : true }, //初始化技师上钟时间 initTerTime : { url : '/ter/initTerTime' , method : 'POST' , auth : true }, //初始化上钟项目 initTerProject : { url : '/ter/initTerProject' , method : 'POST' , auth : true }, //修改上钟时间 updateTerTime : { url : '/ter/updateTerTime' , method : 'POST' , auth : true }, //修改上钟项目 updateTerProject : { url : '/ter/updateTerProject' , method : 'POST' , auth : true }, //查询技师上钟项目 queryTerProject : { url : '/ter/queryTerProject' , method : 'POST' , auth : true }, } export function api(key, data, callback, loadingTitle){ if (!config[key]) { return console.error('无效key' + key); } if (config[key].auth) { if (!uni.getStorageSync('token')) { uni.navigateTo({ url: '/pages/login/mobile' }) console.error('需要登录') return { then() {} }; } } http.http(config[key].url, data, callback, config[key].method, loadingTitle || config[key].showLoading, loadingTitle || config[key].loadingTitle) } export default api