supplier.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. import axios from '~/plugins/axios'
  2. export const actions = {
  3. // 获取浏览记录
  4. getSupplierList ({ commit }, params = {}) {
  5. commit('data/REQUEST_LIST')
  6. return axios.get('/vendor/introduction/vendor/list', {params})
  7. .then(response => {
  8. commit('data/GET_LIST_SUCCESS', response.data)
  9. }, err => {
  10. commit('data/GET_LIST_FAILURE', err)
  11. })
  12. },
  13. // 根据uu获取供应商企业信息
  14. getSupplierEnInfo ({ commit }, params = {}) {
  15. commit('data/REQUEST_EN')
  16. return axios.get(`/basic/enterprise/${params.uu}/info`, {params})
  17. .then(response => {
  18. commit('data/GET_EN_SUCCESS', response.data)
  19. }, err => {
  20. commit('data/GET_EN_FAILURE', err)
  21. })
  22. },
  23. // 获取供应商物料列表
  24. getSupplierProductList ({ commit }, params = {}) {
  25. commit('data/REQUEST_PRODUCT_LIST')
  26. return axios.get(`/vendor/introduction/product/list`, {params})
  27. .then(response => {
  28. commit('data/GET_PRODUCT_LIST_SUCCESS', response.data)
  29. }, err => {
  30. commit('data/GET_PRODUCT_LIST_FAILURE', err)
  31. })
  32. },
  33. // 获取供应商展示列表
  34. loadVendorList ({commit}, params) {
  35. commit('merchant/REQUEST_MERCHANT')
  36. return axios.get('/vendor/introduction/vendor/list', {params})
  37. .then(res => {
  38. commit('merchant/GET_MERCHANT_SUCCESS', res.data)
  39. }, (err) => {
  40. commit('merchant/GET_MERCHANT_FAILURE', err)
  41. })
  42. },
  43. // 获取供应商展示列表总数
  44. loadVendorAll ({commit}, params) {
  45. commit('merchant/REQUEST_MERCHANTALL')
  46. return axios.get('/vendor/introduction/vendor/list', {params})
  47. .then(res => {
  48. commit('merchant/GET_MERCHANTALL_SUCCESS', res.data)
  49. }, (err) => {
  50. commit('merchant/GET_MERCHANTALL_FAILURE', err)
  51. })
  52. },
  53. // 获取供应商物料列表
  54. loadMaterialList ({commit}, params = {}) {
  55. commit('material/REQUEST_MATERIAL')
  56. return axios.get('/vendor/introduction/product/list', {params})
  57. .then(res => {
  58. commit('material/GET_MATERIAL_SUCCESS', res.data)
  59. }, (err) => {
  60. commit('material/GET_MATERIAL_FAILURE', err)
  61. })
  62. },
  63. // 获取获取物料详细信息
  64. loadMaterialDetail ({commit}, params = {}) {
  65. commit('detail/REQUEST_DETAIL')
  66. return axios.get('/vendor/introduction/product/detail', {params})
  67. .then(res => {
  68. commit('detail/GET_DETAIL_SUCCESS', res.data)
  69. if (res.data.cmpUuId) {
  70. commit('detail/REQUEST_CMPINFO')
  71. return axios.get(`/api/commodity/component/${res.data.cmpUuId}`)
  72. .then(res => {
  73. commit('detail/GET_CMPINFO_SUCCESS', res.data)
  74. }, (err) => {
  75. commit('detail/GET_CMPINFO_FAILURE', err)
  76. })
  77. }
  78. }, (err) => {
  79. commit('detail/GET_DETAIL_FAILURE', err)
  80. })
  81. },
  82. // 获取企业信息
  83. loadEnUser ({commit}, params = {}) {
  84. commit('material/REQUEST_ENUSER')
  85. return axios.get(`/basic/enterprise/${params.enUU}/info`)
  86. .then(res => {
  87. commit('material/GET_ENUSER_SUCCESS', res.data)
  88. }, (err) => {
  89. commit('material/GET_ENUSER_FAILURE', err)
  90. })
  91. },
  92. // 获取新入驻供应商列表
  93. loadNewMerchant ({commit}, params = {}) {
  94. commit('merchant/REQUEST_NEWMERCHANT')
  95. return axios.get(`/api/store-service/stores`, {params})
  96. .then(res => {
  97. commit('merchant/GET_NEWMERCHANT_SUCCESS', res.data)
  98. }, (err) => {
  99. commit('merchant/GET_NEWMERCHANT_FAILURE', err)
  100. })
  101. },
  102. // 获取供应商推荐列表
  103. loadRecommend ({commit}, params = {}) {
  104. commit('merchant/REQUEST_RECOMMEND')
  105. return axios.get(`/vendor/introduction/vendor/recommend`, {params})
  106. .then(res => {
  107. commit('merchant/GET_RECOMMEND_SUCCESS', res.data)
  108. }, (err) => {
  109. commit('merchant/GET_RECOMMEND_FAILURE', err)
  110. })
  111. },
  112. // 获取供应商轮播
  113. loadSupplierBanner ({commit}) {
  114. commit('detail/REQUEST_BANNER')
  115. return axios.get(`/cmsApi?method=queryContentPage&module=supplier_banner_carousel&orderBy=order_number ASC`)
  116. .then(res => {
  117. commit('detail/GET_BANNER_SUCCESS', res.data)
  118. }, (err) => {
  119. commit('detail/GET_BANNER_FAILURE', err)
  120. })
  121. }
  122. }