point.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import settings from '../settings'
  2. import { getAuthen } from '../assets/util'
  3. // 带Origin后缀的通过getter获取
  4. export const state = () => ({
  5. pointInfo: {},
  6. wareList: [],
  7. wareItemOrigin: undefined,
  8. })
  9. export const getters = {
  10. findWare: (state) => id => state.wareList.find((item)=>{
  11. return item.id.toString() === id.toString();
  12. })
  13. }
  14. export const mutations = {
  15. setPointInfo(state, pointInfo) {
  16. state.pointInfo = pointInfo
  17. },
  18. setWareList(state, wareList){
  19. state.wareList = wareList
  20. }
  21. }
  22. export const actions = {
  23. getPointInfo({ commit, state, rootGetters }) {
  24. return this.$axios.$get("/getCustomerPointsInfo", {
  25. params: {
  26. unionId: rootGetters["authen/unionId"],
  27. stationId: rootGetters["authen/stationId"],
  28. },
  29. }).then((res) => {
  30. if (res.retCode === 0) {
  31. commit("setPointInfo", res.data);
  32. }
  33. });
  34. },
  35. getWareList({ commit, state, rootGetters }) {
  36. return this.$axios
  37. .$get("/getIntegralWaresInfoList", {
  38. params: {
  39. stationId: rootGetters["authen/stationId"],
  40. },
  41. })
  42. .then((res) => {
  43. if (res.retCode == 0) {
  44. commit("setWareList", res.data)
  45. }
  46. });
  47. },
  48. getPointsRecordList({ commit, state, rootGetters },params){
  49. return this.$axios.$get("/getCustomerPointsInfogetCustomerPointsRecordList",{
  50. params
  51. })
  52. }
  53. }