const state = {
  orderInfo: {},
  address: {},        // 事发地
  destAddress: {},    // 目的地
  localAddress: {  // 定位地址
    lat: 31.184102,
    lng: 121.506799,
    address: '中道汽车救援股份有限公司',
    localCityCode: '',
  },
  serverCity: '',
  localCityCode: '',
  // serviceId: '',
  // isAppoint: 0,                    // 是否预约
  // appointTime: '',                 // 预约时间
  // positionEnvironment: '',         // 车辆位于

  // startPoiAddress: '',
  // startLat: '',
  // startLng: '',
  // endPoiAddress: '',
  // endLat: '',
  // endLng: '',
}

const mutations = {
  SET_LOCAL_ADDRESS: (state, data) => {
    state.localAddress = data
  },
  SET_ORDER_INFO: (state, data) => {
    state.orderInfo = data
  },
  SET_ADDRESS: (state, data) => {
    state.address = data
  },
  SET_DEST_ADDRESS: (state, data) => {
    state.destAddress = data
  },
  SET_SERVER_CITY: (state, data) => {
    state.serverCity = data
  },
  SET_LOCAL_CITY: (state, data) => {
    state.localCityCode = data
  }
}

const actions = {
  setLocalAddress({ commit }, data) {
    commit('SET_LOCAL_ADDRESS', data)
  },
  setAddress({ commit }, data) {
    commit('SET_ADDRESS', data)
  },
  setDestAddress({ commit }, data ) {
    commit('SET_DEST_ADDRESS', data)
  },
  setOrderInfo({ commit }, data) {
    commit('SET_ORDER_INFO', data)
  },
  setServerCity({ commit }, data) {
    commit('SET_SERVER_CITY', data)
  },
  setLocalCity({ commit }, data) {
    commit('SET_LOCAL_CITY', data)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
