order.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import axios from '~/plugins/axios'
  2. export const actions = {
  3. // 获取卖家中心订单列表
  4. getSellOrderList ({ commit }, params = {}) {
  5. commit('order/REQUEST_ORDERLIST')
  6. return axios.get('/trade/purchase/status/createtime', {params})
  7. .then(response => {
  8. commit('order/GET_ORDERLIST_SUCCESS', response.data)
  9. }, err => {
  10. commit('order/GET_ORDERLIST_SUCCESS', {})
  11. commit('order/GET_ORDERLIST_FAILURE', err)
  12. })
  13. },
  14. // 获取买家中心订单列表
  15. getBuyerOrderList ({ commit }, params = {}) {
  16. commit('order/REQUEST_ORDERLIST')
  17. return axios.get('/trade/order/individual', {params})
  18. .then(response => {
  19. commit('order/GET_ORDERLIST_SUCCESS', response.data)
  20. }, err => {
  21. commit('order/GET_ORDERLIST_SUCCESS', {})
  22. commit('order/GET_ORDERLIST_FAILURE', err)
  23. })
  24. },
  25. // 获取买家中心订单列表
  26. getLogisticsInfo ({ commit }, params = {}) {
  27. let id = params.id
  28. commit('order/REQUEST_LOGISTICS')
  29. return axios.get(`/trade/logistics/${id}`)
  30. .then(response => {
  31. axios.get(`/kdn/logistics/query?companyName=${response.data.companyName}&logisticsCode=${response.data.number}`).then(res => {
  32. commit('order/GET_LOGISTICS_SUCCESS', res.data)
  33. }, err => {
  34. commit('order/GET_LOGISTICS_FAILURE', err)
  35. })
  36. }, err => {
  37. commit('order/GET_LOGISTICS_FAILURE', err)
  38. })
  39. }
  40. }