shop.js 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. import axios from '~plugins/axios'
  2. export const actions = {
  3. // 根据UUID获取某店铺信息
  4. findStoreInfoFromUuid ({ commit }, params = {}) {
  5. commit('storeInfo/REQUEST_STORE_INFO')
  6. return axios.get('/api/store-service/stores', { params })
  7. .then(response => {
  8. commit('storeInfo/GET_STORE_INFO_SUCCESS', response.data)
  9. }, err => {
  10. commit('storeInfo/GET_STORE_INFO_FAILURE', err)
  11. })
  12. },
  13. findCommodityOnBatchInfo ({ commit }, params = {}) {
  14. commit('storeInfo/REQUEST_COMMODITY')
  15. return axios.get(`/api/commodity/${params.batchCode || ''}/detail`)
  16. .then(response => {
  17. commit('storeInfo/GET_COMMODITY_SUCCESS', response.data)
  18. let commodity = response.data || {}
  19. commit('storeInfo/REQUEST_COMPONENT')
  20. return axios.get(`/api/commodity/component/${commodity.uuid}`)
  21. .then(response => {
  22. commit('storeInfo/GET_COMPONENT_SUCCESS', response.data)
  23. }, err => {
  24. commit('storeInfo/GET_COMPONENT_FAILURE', err)
  25. })
  26. }, err => {
  27. commit('storeInfo/GET_COMMODITY_FAILURE', err)
  28. })
  29. }
  30. }