12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import ajax from '../../util/ajax'
- import api from '../../util/api'
-
- export default {
- namespaced: true,
- state: {
- customer: {},
- customers: {},
- },
- mutations: {
- updateInfo (state, payload) {
- state.customer = payload || {}
- },
- updateList (state, payload) {
- state.customers = payload || {}
- }
- },
- actions: {
- GetCustomerByTel ({ commit }, { tel }) {
- return new Promise((resolve, reject) => {
- ajax(api.customerManager.getByTel.url, {
- method: api.customerManager.getByTel.method,
- urlData: {
- tel
- }
- }).then(res => {
- commit('updateInfo', res)
- resolve(res)
- }).catch(reject)
- })
- },
- GetCustomerList ({ commit }, payload) {
- return new Promise((resolve, reject) => {
- ajax(api.customerManager.getCustomerList.url, {
- method: api.customerManager.getCustomerList.method,
- queryData: {
- ...payload
- }
- }).then(res => {
- commit('updateList', res)
- resolve(res)
- }).catch(reject)
- })
- },
- SetCustomerListNull ({ commit }) {
- commit('updateList', {})
- },
- SetCustomerInfoNull ({ commit }) {
- commit('updateInfo', {})
- }
- }
- }
|