You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
5.6 KiB

8 months ago
  1. import http from './http.js'
  2. const config = {
  3. // 微信登录
  4. wxLogin : {url : '/api/wxLogin', method : 'POST', auth : false},
  5. // 授权隐私信息
  6. getConfig : {url : '/api/getConfig', method : 'GET', auth : false},
  7. // 获取轮播图
  8. getBanner : {url : '/api/getBanner', method : 'GET', auth : false},
  9. // 获取项目列表
  10. getProjectList : {url : '/api/getProjectList', method : 'GET', auth : false},
  11. // 获取技师列表
  12. getTechnicianList : {url : '/api/getTechnicianList', method : 'GET', auth : false},
  13. // 获取技师详情
  14. getTechnicianDetail : {url : '/api/getTechnicianDetail', method : 'GET', auth : false},
  15. // 获取项目详情
  16. getProjectDetail : {url : '/api/getProjectDetail', method : 'GET', auth : false},
  17. // 获取订单列表
  18. getOrderList : {url : '/api/getOrderList', method : 'GET', auth : true},
  19. // 获取订单详情
  20. getOrderDetail : {url : '/api/getOrderDetail', method : 'GET', auth : true},
  21. // 获取评论列表
  22. getCommentList : {url : '/api/getCommentList', method : 'GET', auth : true},
  23. // 获取登录用户信息
  24. getUserInfo : {url : '/api/getUserInfo', method : 'GET', auth : true},
  25. // 微信支付
  26. createOrderWXPay : {url : '/post/create', method : 'POST', auth : true},
  27. // 获取地址列表
  28. getAddressList : {url : '/api/getAddressList', method : 'GET', auth : true},
  29. // 获取地址详情
  30. getAddressDetail : {url : '/api/getAddressDetail', method : 'GET', auth : true},
  31. // 添加或修改地址
  32. addOrUpdateAddress : {url : '/post/addOrUpdateAddress', method : 'POST', auth : true},
  33. // 删除地址
  34. deleteAddress : {url : '/post/deleteAddress', method : 'POST', auth : true},
  35. // 获取优惠券列表
  36. getCouponList : {url : '/api/getCouponList', method : 'GET', auth : true},
  37. // 获取粉丝列表
  38. getFans : {url : '/post/fans', method : 'GET', auth : true},
  39. // 获取粉丝列表
  40. getRechargeList : {url : '/api/getRechargeList', method : 'GET', auth : true},
  41. // 获取交易列表
  42. getAgentFlow : {url : '/api/getAgentFlow', method : 'GET', auth : true},
  43. // 获取二维码
  44. showQrcode : {url : '/post/showQrcode', method : 'GET', auth : true},
  45. // 增加或修改技师入驻信息
  46. addOrUpdateTechnician : {url : '/post/addOrUpdateTechnician', method : 'POST', auth : true},
  47. // 1 用户下单
  48. createVipOrder : {url : '/order/createVipOrder', method : 'POST', auth : true},
  49. // 2 用户支付
  50. payVipOrder : {url : '/order/payVipOrder', method : 'POST', auth : true},
  51. // 8 用户评价
  52. evaluateVipOrder : {url : '/order/evaluateVipOrder', method : 'POST', auth : true},
  53. // 获取当前技师的排期
  54. getVipTenOrderList : {url : '/order/getVipTenOrderList', method : 'GET', auth : true},
  55. // 获取手机验证码
  56. getVipCode : {url : '/order/getVipCode', method : 'GET', auth : false},
  57. // 3 技师确认订单
  58. confirmVipOrder : {url : '/order/confirmVipOrder', method : 'POST', auth : true},
  59. // 4 技师出发
  60. startVipOrder : {url : '/order/startVipOrder', method : 'POST', auth : true},
  61. // 5 技师到达
  62. arriveVipOrder : {url : '/order/arriveVipOrder', method : 'POST', auth : true},
  63. // 6 开始服务
  64. startVipService : {url : '/order/startVipService', method : 'POST', auth : true},
  65. // 7 结束服务
  66. endVipService : {url : '/order/endVipService', method : 'POST', auth : true},
  67. // 根据订单标识查询订单详情
  68. getOrderVipDetail : {url : '/order/getOrderVipDetail', method : 'GET', auth : true},
  69. // 技师根据标识查询自己的订单
  70. getVipOrderList : {url : '/order/getVipOrderList', method : 'GET', auth : true},
  71. // 技师登录
  72. wxTechnicianLogin : {url : '/order/wxTechnicianLogin', method : 'POST', auth : false},
  73. // 获取技师信息
  74. giveTenInfo : {url : '/order/giveTenInfo', method : 'GET', auth : true},
  75. // 技师端-订单页面获取订单列表带分页
  76. getTenOrderPageList : {url : '/order/getTenOrderPageList', method : 'GET', auth : true},
  77. // 技师端-首页-获取待确认订单-带分页
  78. getTenOrderList : {url : '/order/getTenOrderList', method : 'GET', auth : true},
  79. // 技师端-首页-统计数据
  80. getTenOrderStatistics : {url : '/order/getTenOrderStatistics', method : 'GET', auth : true},
  81. //新增或修改技师入驻
  82. addOrUpdateMsgTer : { url : '/post/addOrUpdateMsgTer' , method : 'POST' , auth : true },
  83. //技师上下线
  84. tenOnline : { url : '/order/online' , method : 'POST' , auth : true},
  85. //获取实名认证
  86. getTenRealName : { url : '/order/getTenRealName' , method : 'GET' , auth : true },
  87. //获取实名认证
  88. tenRealName : { url : '/order/tenRealName' , method : 'POST' , auth : true },
  89. //修改技师相册
  90. uploadTenImg : { url : '/order/uploadTenImg' , method : 'POST' , auth : true },
  91. //初始化技师上钟时间
  92. initTerTime : { url : '/ter/initTerTime' , method : 'POST' , auth : true },
  93. //初始化上钟项目
  94. initTerProject : { url : '/ter/initTerProject' , method : 'POST' , auth : true },
  95. //修改上钟时间
  96. updateTerTime : { url : '/ter/updateTerTime' , method : 'POST' , auth : true },
  97. //修改上钟项目
  98. updateTerProject : { url : '/ter/updateTerProject' , method : 'POST' , auth : true },
  99. //查询技师上钟项目
  100. queryTerProject : { url : '/ter/queryTerProject' , method : 'POST' , auth : true },
  101. }
  102. export function api(key, data, callback, loadingTitle){
  103. if (!config[key]) {
  104. return console.error('无效key' + key);
  105. }
  106. if (config[key].auth) {
  107. if (!uni.getStorageSync('token')) {
  108. uni.navigateTo({
  109. url: '/pages/login/mobile'
  110. })
  111. console.error('需要登录')
  112. return {
  113. then() {}
  114. };
  115. }
  116. }
  117. http.http(config[key].url, data, callback, config[key].method,
  118. loadingTitle || config[key].showLoading, loadingTitle || config[key].loadingTitle)
  119. }
  120. export default api