shop.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. import {
  2. request
  3. } from '@/request/request.js';
  4. const baseUrl = '/prod-api/mobile-api';
  5. /*
  6. * 获取tab List
  7. *
  8. *
  9. */
  10. export function getCategoryList() {
  11. return request({
  12. url: `${baseUrl}/category/list`,
  13. method: 'get'
  14. })
  15. }
  16. /*
  17. * 获取banner
  18. *
  19. *
  20. */
  21. export function getTopicList() {
  22. return request({
  23. url: `${baseUrl}/topic/list`,
  24. method: 'get'
  25. })
  26. }
  27. /*
  28. * 获取热门
  29. *
  30. *
  31. */
  32. export function getSearchHot() {
  33. return request({
  34. url: `${baseUrl}/goods/searchHot`,
  35. method: 'get'
  36. })
  37. }
  38. /*
  39. * 获取推荐
  40. *
  41. *
  42. */
  43. export function getSearchNew() {
  44. return request({
  45. url: `${baseUrl}/goods/searchNew`,
  46. method: 'get'
  47. })
  48. }
  49. /*
  50. * 获取商品详情
  51. *
  52. *
  53. */
  54. export function getGoods(id) {
  55. return request({
  56. url: `${baseUrl}/goods/${id}`,
  57. method: 'get'
  58. })
  59. }
  60. /*
  61. * 喜欢
  62. *
  63. *
  64. */
  65. export function like(id) {
  66. return request({
  67. url: `${baseUrl}/user/favorite/add/${id}`,
  68. method: 'post'
  69. })
  70. }
  71. /*
  72. * 取消喜欢
  73. *
  74. *
  75. */
  76. export function noLisk(id) {
  77. return request({
  78. url: `${baseUrl}/user/favorite/dislike/${id}`,
  79. method: 'post'
  80. })
  81. }
  82. /*
  83. * 加入购物车
  84. *
  85. *
  86. */
  87. export function addCart(data) {
  88. return request({
  89. url: `${baseUrl}/user/cart/add/`,
  90. method: 'post',
  91. data: data
  92. })
  93. }
  94. /*
  95. * 获取购物车数量
  96. *
  97. *
  98. */
  99. export function getCartCount() {
  100. return request({
  101. url: `${baseUrl}/user/cart/count`,
  102. method: 'get'
  103. })
  104. }
  105. /*
  106. * 获取购物车数据
  107. *
  108. *
  109. */
  110. export function getCartData() {
  111. return request({
  112. url: `${baseUrl}/user/cart/queryByUser`,
  113. method: 'get'
  114. })
  115. }
  116. /*
  117. * 追加数量
  118. *
  119. *
  120. */
  121. export function addGoodCount(id, count) {
  122. return request({
  123. url: `${baseUrl}/user/cart/update/${id}/${count}`,
  124. method: 'post'
  125. })
  126. }
  127. /*
  128. * 获取订单状态
  129. *
  130. *
  131. */
  132. export function getOrderResult(orderSn) {
  133. return request({
  134. url: `${baseUrl}/pay/queryResult/${orderSn}`,
  135. method: 'get'
  136. })
  137. }
  138. /*
  139. * 获取订单信息
  140. *
  141. *
  142. */
  143. export function getPaymentInformation(orderSn) {
  144. return request({
  145. url: `${baseUrl}/pay/wx/prepare?orderSn=${orderSn}`,
  146. method: 'post'
  147. })
  148. }
  149. /*
  150. * 修改用户OpenId
  151. *
  152. *
  153. */
  154. export function updateWxOpenId(openId) {
  155. return request({
  156. url: `${baseUrl}/user/updateOpenId/${openId}`,
  157. method: 'post'
  158. })
  159. }