collect.js 869 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { defineStore } from "pinia";
  2. import { request } from "../api";
  3. export const useCollectStore = defineStore({
  4. id: "collect",
  5. state: () => {
  6. return {
  7. lists: [],
  8. pagination: {
  9. dictLevel: "",
  10. endTime: "",
  11. pageNum: 0,
  12. pageSize: 0,
  13. searchKey: "",
  14. startTime: "",
  15. },
  16. };
  17. },
  18. getters: {},
  19. actions: {
  20. async getCollectList(page) {
  21. this.pagination.pageNum = page || 1;
  22. const { data, status } = await request.post("/show/goods/pageList", {
  23. ...this.pagination,
  24. });
  25. if (data.code === 0) {
  26. const { records, total, current, page } = data.data;
  27. this.lists = records;
  28. this.pagination.total = total;
  29. this.pagination.current = current;
  30. this.pagination.page = page;
  31. }
  32. },
  33. },
  34. });