component.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. export const state = () => ({
  2. componentGoods: {
  3. fetching: false,
  4. data: []
  5. },
  6. collectCount: {
  7. fetching: false,
  8. data: []
  9. },
  10. collectCode: {
  11. // 类目关注
  12. fetching: false,
  13. data: []
  14. },
  15. // 当个物料信息
  16. nowProductInfo: {
  17. fetching: false,
  18. data: []
  19. }
  20. })
  21. export const mutations = {
  22. REQUEST_CMPGOODS (state) {
  23. state.componentGoods.fetching = true
  24. },
  25. GET_CMPGOODS_SUCCESS (state, result) {
  26. state.componentGoods.fetching = false
  27. state.componentGoods.data = result
  28. },
  29. GET_CMPGOODS_FAILURE (state) {
  30. state.fetching = false
  31. },
  32. REQUEST_COLLECT (state) {
  33. state.collectCount.fetching = true
  34. },
  35. REQUEST_COLLECT_SUCCESS (state, result) {
  36. state.collectCount.fetching = false
  37. state.collectCount.data = result
  38. },
  39. REQUEST_COLLECT_FAILURE (state) {
  40. state.fetching = false
  41. },
  42. REQUEST_COLLECTCODE (state) {
  43. state.collectCode.fetching = true
  44. },
  45. REQUEST_COLLECTCODE_SUCCESS (state, result) {
  46. state.collectCode.fetching = false
  47. state.collectCode.data = result
  48. },
  49. REQUEST_COLLECTCODE_FAILURE (state) {
  50. state.collectCode = false
  51. },
  52. REQUEST_NOWPRODUCTINFO (state) {
  53. state.nowProductInfo.fetching = true
  54. },
  55. REQUEST_NOWPRODUCTINFO_SUCCESS (state, result) {
  56. state.nowProductInfo.fetching = false
  57. state.nowProductInfo.data = result
  58. },
  59. REQUEST_NOWPRODUCTINFO_FAILURE (state) {
  60. state.nowProductInfo = false
  61. },
  62. UpdateOne_PRODUCTINFO(state, resulut) {
  63. state.collectCode.data.content[resulut.key].status = resulut.status
  64. }
  65. }