宜轩到家/服务到家第三版,换个颜色
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.

146 lines
5.9 KiB

7 months ago
6 months ago
7 months ago
6 months ago
7 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. //商家入驻
  86. addOrUpdateShop : { url : '/post/addOrUpdateShop' , method : 'POST' , auth : true },
  87. // 3 技师确认订单
  88. confirmVipOrder : {url : '/order/confirmVipOrder', method : 'POST', auth : true},
  89. // 4 技师出发
  90. startVipOrder : {url : '/order/startVipOrder', method : 'POST', auth : true},
  91. // 5 技师到达
  92. arriveVipOrder : {url : '/order/arriveVipOrder', method : 'POST', auth : true},
  93. // 6 开始服务
  94. startVipService : {url : '/order/startVipService', method : 'POST', auth : true},
  95. // 7 结束服务
  96. endVipService : {url : '/order/endVipService', method : 'POST', auth : true},
  97. // 根据订单标识查询订单详情
  98. getOrderVipDetail : {url : '/order/getOrderVipDetail', method : 'GET', auth : true},
  99. // 技师根据标识查询自己的订单
  100. getVipOrderList : {url : '/order/getVipOrderList', method : 'GET', auth : true},
  101. // 技师登录
  102. wxTechnicianLogin : {url : '/order/wxTechnicianLogin', method : 'POST', auth : false},
  103. }
  104. export function api(key, data, callback, ...args){
  105. if (!config[key]) {
  106. return console.error('无效key' + key);
  107. }
  108. if (config[key].auth) {
  109. if (!localStorage.getItem('token')) {
  110. uni.navigateTo({
  111. url: '/pages/login/login'
  112. })
  113. console.error('需要登录')
  114. return {
  115. then() {}
  116. };
  117. }
  118. // //用户未绑定手机就跳转板顶手机页面
  119. // if(localStorage.getItem("userInfo_1")){
  120. // let userInfo = JSON.parse(localStorage.getItem("userInfo"))
  121. // if(!userInfo.phone){
  122. // uni.navigateTo({
  123. // url: '/pages/mine/phoneDetail'
  124. // })
  125. // }
  126. // }
  127. }
  128. http.http(config[key].url, data, callback, config[key].method, ...args)
  129. }
  130. export default api