supplier.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import axios from '~/plugins/axios'
  2. export const actions = {
  3. // 获取供应商展示列表
  4. loadVendorList ({commit}, params) {
  5. commit('merchant/REQUEST_MERCHANT')
  6. return axios.get('/vendor/introduction/vendor/list', {params})
  7. .then(res => {
  8. commit('merchant/GET_MERCHANT_SUCCESS', res.data)
  9. }, (err) => {
  10. commit('merchant/GET_MERCHANT_FAILURE', err)
  11. })
  12. },
  13. // 获取供应商物料列表
  14. loadMaterialList ({commit}, params = {}) {
  15. commit('material/REQUEST_MATERIAL')
  16. return axios.get('/vendor/introduction/product/list', {params})
  17. .then(res => {
  18. commit('material/GET_MATERIAL_SUCCESS', res.data)
  19. }, (err) => {
  20. commit('material/GET_MATERIAL_FAILURE', err)
  21. })
  22. },
  23. // 获取获取物料详细信息
  24. loadMaterialDetail ({commit}, params = {}) {
  25. commit('detail/REQUEST_DETAIL')
  26. return axios.get('/vendor/introduction/product/detail', {params})
  27. .then(res => {
  28. commit('detail/GET_DETAIL_SUCCESS', res.data)
  29. if (res.data.cmpUuId) {
  30. commit('detail/REQUEST_CMPINFO')
  31. return axios.get(`/api/commodity/component/${res.data.cmpUuId}`)
  32. .then(res => {
  33. commit('detail/GET_CMPINFO_SUCCESS', res.data)
  34. }, (err) => {
  35. commit('detail/GET_CMPINFO_FAILURE', err)
  36. })
  37. }
  38. }, (err) => {
  39. commit('detail/GET_DETAIL_FAILURE', err)
  40. })
  41. },
  42. // 获取企业信息
  43. loadEnUser ({commit}, params = {}) {
  44. commit('material/REQUEST_ENUSER')
  45. return axios.get(`/basic/enterprise/${params.enUU}/info`)
  46. .then(res => {
  47. commit('material/GET_ENUSER_SUCCESS', res.data)
  48. }, (err) => {
  49. commit('material/GET_ENUSER_FAILURE', err)
  50. })
  51. }
  52. }