import settings from '../settings' import { getAuthen } from '../assets/util' // 带Origin后缀的通过getter获取 export const state = () => ({ pointInfo: {}, wareList: [], wareItemOrigin: undefined, }) export const getters = { findWare: (state) => id => state.wareList.find((item)=>{ return item.id.toString() === id.toString(); }) } export const mutations = { setPointInfo(state, pointInfo) { state.pointInfo = pointInfo }, setWareList(state, wareList){ state.wareList = wareList } } export const actions = { getPointInfo({ commit, state, rootGetters }) { return this.$axios.$get("/getCustomerPointsInfo", { params: { unionId: rootGetters["authen/unionId"], stationId: rootGetters["authen/stationId"], }, }).then((res) => { if (res.retCode === 0) { commit("setPointInfo", res.data); } }); }, getWareList({ commit, state, rootGetters }) { return this.$axios .$get("/getIntegralWaresInfoList", { params: { stationId: rootGetters["authen/stationId"], }, }) .then((res) => { if (res.retCode == 0) { commit("setWareList", res.data) } }); }, getPointsRecordList({ commit, state, rootGetters },params){ return this.$axios.$get("/getCustomerPointsInfogetCustomerPointsRecordList",{ params }) } }