mall.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import { post, get, postL } from '@/utils/http'
  2. import { trans } from './base'
  3. import { SERVICE_URL } from '@/utils/config'
  4. export default {
  5. apis: {
  6. CATEGORY: SERVICE_URL + '/api/spu/basic/listCategoryLimit',
  7. LIST: SERVICE_URL + '/api/mallGoods',
  8. DETAIL: SERVICE_URL + '/api/mallGoods/detail',
  9. PREVIEW_SUBMIT: SERVICE_URL + '/api/mallOrder/preSubmit',
  10. ORDERS: SERVICE_URL + '/api/mallOrder/pageMy',
  11. ORDER_DETAIL: SERVICE_URL + '/api/mallOrder/detail',
  12. APPLY: SERVICE_URL + '/api/mallOrder/submit',
  13. EXPRESS: SERVICE_URL + '/api/mallOrder/expressDetail',
  14. ORDER_PAY: SERVICE_URL + '/api/mallOrder/pay',
  15. RECEIVE: SERVICE_URL + '/api/mallOrder/receive',
  16. PACKAGES: SERVICE_URL + '/api/deliveryOrder/expressInfo',
  17. EXPRESS: SERVICE_URL + '/api/deliveryOrder/expressDetail',
  18. UPDATEPHONE: SERVICE_URL + '/api/mallOrder/updateRestNotifyMobile',
  19. SPIKELIST: SERVICE_URL + '/api/activity/mallSubject/subjectGoodsPage',
  20. SPRICETIMER: SERVICE_URL + '/api/activity/mallSubject/subject'
  21. },
  22. async categorys(limit = 5) {
  23. const res = await trans(get(this.apis.CATEGORY, { limit }))
  24. return res.data
  25. },
  26. async list(param, loading = false) {
  27. const res = await trans(post(this.apis.LIST, { ...param }, { loading }))
  28. return res.data
  29. },
  30. async detail(param, loading = false) {
  31. const res = await trans(get(this.apis.DETAIL, { ...param }, { loading }))
  32. return res.data
  33. },
  34. async previewSubmit(param) {
  35. const res = await trans(postL(this.apis.PREVIEW_SUBMIT, param))
  36. return res.data
  37. },
  38. async orders(current, size, tab, loading = false) {
  39. const res = await trans(post(this.apis.ORDERS, { current, tab, size }, { loading }))
  40. return res.data
  41. },
  42. async orderDetail(tradeNo, loading = false) {
  43. const res = await trans(get(this.apis.ORDER_DETAIL, { tradeNo }, { loading }))
  44. return res.data
  45. },
  46. async apply(param) {
  47. const res = await trans(
  48. postL(this.apis.APPLY, param)
  49. )
  50. return res.data
  51. },
  52. async orderPay(tradeNo, paymentType) {
  53. const res = await trans(postL(this.apis.ORDER_PAY, { tradeNo, paymentType }))
  54. return res.data
  55. },
  56. async packages(tradeNo, loading = false) {
  57. const res = await trans(get(this.apis.PACKAGES, { tradeNo }, { loading }))
  58. return res.data
  59. },
  60. async express(tradeNo, packageId, loading = false) {
  61. const res = await trans(get(this.apis.EXPRESS, { tradeNo, packageId }, { loading }))
  62. return res.data
  63. },
  64. async receive(tradeNo) {
  65. const res = await trans(postL(this.apis.RECEIVE, { tradeNo }))
  66. return res.success
  67. },
  68. async updatePhone(params) {
  69. const res = await trans(postL(this.apis.UPDATEPHONE, { ...params }))
  70. return res
  71. },
  72. async spikeList(param, loading = false) {
  73. const res = await trans(postL(this.apis.SPIKELIST, { ...param }, { loading }))
  74. return res.data
  75. },
  76. async spikeTimer(subjectId, loading = false) {
  77. const url = `${this.apis.SPRICETIMER}/${subjectId}`
  78. const res = await trans(get(url, { loading }))
  79. return res.data
  80. }
  81. }