supplier.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. loadMaterialList ({commit}, params = {}) {
  45. commit('material/REQUEST_MATERIAL')
  46. return axios.get('/vendor/introduction/product/list', {params})
  47. .then(res => {
  48. commit('material/GET_MATERIAL_SUCCESS', res.data)
  49. }, (err) => {
  50. commit('material/GET_MATERIAL_FAILURE', err)
  51. })
  52. },
  53. // 获取获取物料详细信息
  54. loadMaterialDetail ({commit}, params = {}) {
  55. commit('detail/REQUEST_DETAIL')
  56. return axios.get('/vendor/introduction/product/detail', {params})
  57. .then(res => {
  58. commit('detail/GET_DETAIL_SUCCESS', res.data)
  59. if (res.data.cmpUuId) {
  60. commit('detail/REQUEST_CMPINFO')
  61. return axios.get(`/api/commodity/component/${res.data.cmpUuId}`)
  62. .then(res => {
  63. commit('detail/GET_CMPINFO_SUCCESS', res.data)
  64. }, (err) => {
  65. commit('detail/GET_CMPINFO_FAILURE', err)
  66. })
  67. }
  68. }, (err) => {
  69. commit('detail/GET_DETAIL_FAILURE', err)
  70. })
  71. },
  72. // 获取企业信息
  73. loadEnUser ({commit}, params = {}) {
  74. commit('material/REQUEST_ENUSER')
  75. return axios.get(`/basic/enterprise/${params.enUU}/info`)
  76. .then(res => {
  77. commit('material/GET_ENUSER_SUCCESS', res.data)
  78. }, (err) => {
  79. commit('material/GET_ENUSER_FAILURE', err)
  80. })
  81. }
  82. }