customer.js 704B

1234567891011121314151617181920212223242526272829303132
  1. import ajax from '../../util/ajax'
  2. import api from '../../util/api'
  3. export default {
  4. namespaced: true,
  5. state: {
  6. customer: {},
  7. },
  8. mutations: {
  9. updateInfo (state, payload) {
  10. state.customer = payload || {}
  11. },
  12. },
  13. actions: {
  14. GetCustomerByTel ({ commit }, { tel }) {
  15. return new Promise((resolve, reject) => {
  16. ajax(api.customerManager.getByTel.url, {
  17. method: api.customerManager.getByTel.method,
  18. urlData: {
  19. tel
  20. }
  21. }).then(res => {
  22. commit('updateInfo', res)
  23. resolve(res)
  24. }).catch(reject)
  25. })
  26. },
  27. SetCustomerInfoNull ({ commit }) {
  28. commit('updateInfo', {})
  29. }
  30. }
  31. }