shop.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. import request from '@/utils/request'
  2. // 游客购物与会员接口分开,不要求会员身份或支付密码。
  3. export function fetchGuestProducts(query) {
  4. return request({ url: '/v1/shop/no-login-reconsume', method: 'get', params: query })
  5. }
  6. export function fetchGuestCart(query) {
  7. return request({ url: '/v1/shop/no-login-show-cart', method: 'get', params: query })
  8. }
  9. export function createGuestOrder(data) {
  10. return request({ url: '/v1/shop/no-login-reconsume-sure-order', method: 'post', data })
  11. }
  12. export function fetchGuestOrderDetail(query) {
  13. return request({ url: '/v1/shop/no-login-order-detail', method: 'get', params: query })
  14. }
  15. export function downloadGuestOrder(orderSn) {
  16. return request({
  17. url: `/v1/shop/no-login-order-export/${encodeURIComponent(orderSn)}`,
  18. method: 'get',
  19. params: {},
  20. // 匿名导出失败留给页面提示,避免触发会员拦截器清缓存并跳转登录。
  21. validateStatus: status => (status >= 200 && status < 300) || status === 401
  22. })
  23. }
  24. // 商品列表
  25. export function fetchProductList(query) {
  26. return request({
  27. url: '/v1/shop/index',
  28. method: 'get',
  29. params: query
  30. })
  31. }
  32. // 商品详情
  33. export function fetchProduct(id) {
  34. return request({
  35. url: '/v1/shop/detail',
  36. method: 'get',
  37. params: { id }
  38. })
  39. }
  40. // 报单列表
  41. export function fetchDecOrderList(query) {
  42. return request({
  43. url: '/v1/shop/dec-order-list',
  44. method: 'get',
  45. params: query
  46. })
  47. }
  48. // 下载报单PDF
  49. export function downloadDecOrder(orderSn) {
  50. return request({
  51. url: `/v1/shop/dec-order-export/${orderSn}`,
  52. method: 'get',
  53. params: {}
  54. })
  55. }
  56. // 订单列表
  57. export function fetchOrderList(query) {
  58. return request({
  59. url: '/v1/shop/own-order',
  60. method: 'get',
  61. params: query
  62. })
  63. }
  64. // 购物信息
  65. export function fetchShoppingCart(query) {
  66. return request({
  67. url: '/v1/shop/show-cart',
  68. method: 'get',
  69. params: query
  70. })
  71. }
  72. // 下载订单PDF
  73. export function downloadOrder(orderSn) {
  74. return request({
  75. url: `/v1/shop/order-export/${orderSn}`,
  76. method: 'get',
  77. params: {}
  78. })
  79. }
  80. // BA报单列表
  81. export function fetchBaDecOrderList(query) {
  82. return request({
  83. url: '/v1/shop/ba-dec-order-list',
  84. method: 'get',
  85. params: query
  86. })
  87. }
  88. // 下载BA报单PDF
  89. export function downloadBaDecOrder(orderSn) {
  90. return request({
  91. url: `/v1/shop/ba-dec-order-export/${orderSn}`,
  92. method: 'get',
  93. params: {}
  94. })
  95. }
  96. // PayStack支付订单
  97. export function createApproachOrder(data) {
  98. return request({
  99. url: '/v1/shop/sure-approach-order',
  100. method: 'post',
  101. data
  102. })
  103. }
  104. // 支付订单
  105. export function createOrder(data) {
  106. return request({
  107. url: '/v1/shop/sure-order',
  108. method: 'post',
  109. data
  110. })
  111. }
  112. // 删除订单中间表
  113. export function deleteApproachOrder(data) {
  114. return request({
  115. url: '/v1/shop/delete-approach-order',
  116. method: 'post',
  117. data
  118. })
  119. }
  120. // 复消商品列表
  121. export function fetchReconsumeProductList(query) {
  122. return request({
  123. url: '/v1/shop/reconsume',
  124. method: 'get',
  125. params: query
  126. })
  127. }
  128. // 支付订单 复消
  129. export function createReconsumeOrder(data) {
  130. return request({
  131. url: '/v1/shop/reconsume-sure-order',
  132. method: 'post',
  133. data
  134. })
  135. }
  136. // Paystack支付订单 复消
  137. export function createApproachReconsumeOrder(data) {
  138. return request({
  139. url: '/v1/shop/sure-approach-reconsume-order',
  140. method: 'post',
  141. data
  142. })
  143. }
  144. // 删除订单中间表
  145. export function deleteApproachReconsumeOrder(data) {
  146. return request({
  147. url: '/v1/shop/delete-approach-reconsume-order',
  148. method: 'post',
  149. data
  150. })
  151. }
  152. export function fetchAutoMaintenanceProductList(query) {
  153. return request({
  154. url: '/v1/shop/auto-maintenance',
  155. method: 'get',
  156. params: query
  157. })
  158. }
  159. export function createAutoMaintenanceOrder(data) {
  160. return request({
  161. url: '/v1/shop/auto-maintenance-sure-order',
  162. method: 'post',
  163. data
  164. })
  165. }
  166. export function createApproachAutoMaintenanceOrder(data) {
  167. return request({
  168. url: '/v1/shop/auto-maintenance-approach-sure-order',
  169. method: 'post',
  170. data
  171. })
  172. }