index.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. //我的相关:
  2. const {
  3. http
  4. } = uni.$u
  5. //用户相关
  6. // 微信授权登陆
  7. export const wxAuthLoginReq = (params, config = {}) => http.post('/api/auth/mnplogin', params, config)
  8. // 获取用户信息
  9. export const getUserInfoReq = (params, config = {}) => http.get('/api/users/getUserInfo', params, config)
  10. // 更新用户信息
  11. export const updateUserInfoReq = (params, config = {}) => http.post('/api/users/updateUserInfo', params, config)
  12. // 首页相关
  13. // 获取首页配置
  14. export const getIndexConfigReq = (params, config = {}) => http.get('/api/getHomeData', params, config)
  15. // 订单相关相关
  16. // 提交订单
  17. export const postOrderReq = (params, config = {}) => http.post('/api/order/submitOrder', params, config)
  18. // 获取订单详细
  19. export const getOrderDetailReq = (params, config = {}) => {
  20. let apiUrl = '/api/order/getOrderDetail'
  21. Object.keys(params).forEach((item, index) => {
  22. if (index == 0) {
  23. apiUrl += `?${item}=${params[item]}`
  24. } else {
  25. apiUrl += `&${item}=${params[item]}`
  26. }
  27. })
  28. console.log('处理后的apiUrl', apiUrl);
  29. return http.get(apiUrl, params, config)
  30. }
  31. // 获取商城分类数据
  32. export const getMallCatReq = (params, config = {}) => http.get('/api/goods/getClassifyData', params, config)
  33. // 获取商城数据
  34. export const getMallReq = (params, config = {}) => {
  35. let apiUrl = '/api/goods/getGoodsData'
  36. Object.keys(params).forEach((item, index) => {
  37. if (index == 0) {
  38. apiUrl += `?${item}=${params[item]}`
  39. } else {
  40. apiUrl += `&${item}=${params[item]}`
  41. }
  42. })
  43. console.log('处理后的apiUrl', apiUrl);
  44. return http.get(apiUrl, params, config)
  45. }
  46. // 获取商城分类数据
  47. export const getSerDocReq = (params, config = {}) => http.get('/api/server/getServerData', params, config)
  48. // 获取各个身份的价格百分比
  49. export const getPricePercentReq = (params, config = {}) => http.get('/api/common/getPriceConfig', params, config)
  50. // 获取我的售后保障
  51. export const getSerBackReq = (params, config = {}) => http.get('/api/users/getMyAfterSaleData', params, config)
  52. // 获取我的服务流程
  53. export const getSerStepReq = (params, config = {}) => http.get('/api/users/getMyServiceProcess', params, config)
  54. // 获取我的售后商品
  55. export const getSerBackGoodsReq = (params, config = {}) => {
  56. let apiUrl = '/api/users/getMyAfterSaleGoods'
  57. Object.keys(params).forEach((item, index) => {
  58. if (index == 0) {
  59. apiUrl += `?${item}=${params[item]}`
  60. } else {
  61. apiUrl += `&${item}=${params[item]}`
  62. }
  63. })
  64. console.log('处理后的apiUrl', apiUrl);
  65. return http.get(apiUrl, params, config)
  66. }
  67. //获取我的售后联系
  68. export const getSerBackConReq = (params, config = {}) => http.get('/api/users/getMyAfterSaleContact', params, config)
  69. // 提交邀请
  70. export const postInviteReq = (params, config = {}) => http.post('/api/invite/submitInviteData', params, config)
  71. //获取我的邀请
  72. export const getMyInviteReq = (params, config = {}) => {
  73. let apiUrl = '/api/invite/getMyInviteData'
  74. Object.keys(params).forEach((item, index) => {
  75. if (index == 0) {
  76. apiUrl += `?${item}=${params[item]}`
  77. } else {
  78. apiUrl += `&${item}=${params[item]}`
  79. }
  80. })
  81. console.log('处理后的apiUrl', apiUrl);
  82. return http.get(apiUrl, params, config)
  83. }
  84. // 添加邀请
  85. export const addInviteReq = (params, config = {}) => http.post('/api/invite/addInvite', params, config)
  86. // 添加收藏
  87. export const addCollReq = (params, config = {}) => http.post('/api/users/addCollect', params, config)
  88. // 取消收藏
  89. export const cancelCollReq = (params, config = {}) => http.post('/api/users/cancelCollect', params, config)
  90. export const getGoodsPriceReq = (params, config = {}) => {
  91. let apiUrl = '/api/goods/getGoodsPrice'
  92. Object.keys(params).forEach((item, index) => {
  93. if (index == 0) {
  94. apiUrl += `?${item}=${JSON.stringify( params[item]) }`
  95. } else {
  96. apiUrl += `&${item}=${params[item]}`
  97. }
  98. })
  99. console.log('处理后的apiUrl', apiUrl);
  100. return http.get(apiUrl, params, config)
  101. }
  102. // export const getGoodsPriceReq = (params, config = {}) => http.post('/api/goods/getGoodsPrice', params, config)