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.

143 lines
5.8 KiB

8 months ago
8 months ago
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. //获取收藏列表
  48. getCollectList : { url : '/order/getVipCollectList' , method : 'GET' , auth : true },
  49. //新增收藏
  50. addCollect : { url : '/order/collectVipTechnician' , method : 'POST' , auth : true },
  51. //修改用户信息
  52. editUserInfo : { url : '/post/updateUser' , method : 'POST' , auth : true },
  53. //取消收藏
  54. calcelCollect : { url : '/order/cancelVipCollect' , method : 'POST' , auth : true},
  55. //新增或修改技师入驻
  56. addOrUpdateMsgTer : { url : '/post/addOrUpdateMsgTer' , method : 'POST' , auth : true },
  57. //根据用户手机号码验证码更换手机号码绑定信息
  58. ChangePhone : { url : '/order/changePhone' , method : 'POST' , auth : true },
  59. // 1 用户下单
  60. createVipOrder : {url : '/order/createVipOrder', method : 'POST', auth : true},
  61. // 2 用户支付
  62. payVipOrder : {url : '/order/payVipOrder', method : 'POST', auth : true},
  63. // 8 用户评价
  64. evaluateVipOrder : {url : '/order/evaluateVipOrder', method : 'POST', auth : true},
  65. // 获取手机验证码
  66. getVipCode : {url : '/order/getVipCode', method : 'GET', auth : false},
  67. // 获取当前技师的排期
  68. getVipTenOrderList : {url : '/order/getVipTenOrderList', method : 'GET', auth : true},
  69. //用户充值
  70. recharge : {url : '/order/giveWithdrawal' , method : 'POST' , auth : true },
  71. //获取分享签名
  72. getVipShareSign : { url : '/order/getVipShareSign' , method : 'GET' , auth : false },
  73. //修改用户信息-获取手机验证码
  74. changePhone : { url : '/order/changePhone' , method : 'POST' , auth : true },
  75. //取消订单
  76. cancelVipOrder : { url : '/order/cancelVipOrder' , method : 'POST' , auth : true },
  77. //获取当前开放区域
  78. getCurrentArea : { url : '/api/getCurrentArea' , method : 'GET' , auth : false},
  79. //获取技师实名认证
  80. getTenRealName : { url : '/order/getTenRealName' , method : 'GET' , auth : true},
  81. //获取我推荐的技师记录
  82. getTenFans : { url : '/order/getTenFans' , method : 'GET' , auth : true },
  83. //立即支付
  84. immediatelyPay : { url : '/order/immediatelyPay' , method : 'POST' , auth : true },
  85. // 3 技师确认订单
  86. confirmVipOrder : {url : '/order/confirmVipOrder', method : 'POST', auth : true},
  87. // 4 技师出发
  88. startVipOrder : {url : '/order/startVipOrder', method : 'POST', auth : true},
  89. // 5 技师到达
  90. arriveVipOrder : {url : '/order/arriveVipOrder', method : 'POST', auth : true},
  91. // 6 开始服务
  92. startVipService : {url : '/order/startVipService', method : 'POST', auth : true},
  93. // 7 结束服务
  94. endVipService : {url : '/order/endVipService', method : 'POST', auth : true},
  95. // 根据订单标识查询订单详情
  96. getOrderVipDetail : {url : '/order/getOrderVipDetail', method : 'GET', auth : true},
  97. // 技师根据标识查询自己的订单
  98. getVipOrderList : {url : '/order/getVipOrderList', method : 'GET', auth : true},
  99. // 技师登录
  100. wxTechnicianLogin : {url : '/order/wxTechnicianLogin', method : 'POST', auth : false},
  101. }
  102. export function api(key, data, callback, ...args){
  103. if (!config[key]) {
  104. return console.error('无效key' + key);
  105. }
  106. if (config[key].auth) {
  107. if (!localStorage.getItem('token')) {
  108. uni.navigateTo({
  109. url: '/pages/login/login'
  110. })
  111. console.error('需要登录')
  112. return {
  113. then() {}
  114. };
  115. }
  116. // //用户未绑定手机就跳转板顶手机页面
  117. // if(localStorage.getItem("userInfo_1")){
  118. // let userInfo = JSON.parse(localStorage.getItem("userInfo"))
  119. // if(!userInfo.phone){
  120. // uni.navigateTo({
  121. // url: '/pages/mine/phoneDetail'
  122. // })
  123. // }
  124. // }
  125. }
  126. http.http(config[key].url, data, callback, config[key].method, ...args)
  127. }
  128. export default api