statistics.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. export default {
  2. namespaced: true,
  3. // 储存数据
  4. state: {
  5. // 订单统计
  6. order: {
  7. pay: 0, // 待支付
  8. delive: 0, // 待发货
  9. receiving: 0, // 待收货
  10. evaluate: 0, // 待评价
  11. customer: 0 ,//售后
  12. whole: 0 ,//普通订单总数
  13. groups: 0 //拼团订单总数
  14. },
  15. // 动态统计
  16. dynamic: {
  17. collection: 0, // 收藏
  18. concern: 0, // 关注店铺
  19. footprint: 0, // 足迹
  20. coupon: 0, // 卡券
  21. accountbank: 0 // 银行卡
  22. },
  23. // 消息统计
  24. notice: {
  25. order: 0,
  26. notice: 0,
  27. chat: 0
  28. },
  29. // 物流状态
  30. logistics: []
  31. },
  32. // 修改数据
  33. mutations: {
  34. // 修改所有
  35. edit(state, payload){
  36. for (let i in payload) {
  37. for (let j in state) {
  38. if (i === j) {
  39. state[j] = payload[i];
  40. }
  41. }
  42. }
  43. uni.setStorageSync("hl88app:statis", state);
  44. },
  45. // 设置统计订单数据 - 修改键
  46. order(state, payload) {
  47. for (let i in payload) {
  48. for (let j in state.order) {
  49. if (i === j) {
  50. state.order[j] = payload[i];
  51. }
  52. }
  53. }
  54. uni.setStorageSync("hl88app:statis", state);
  55. },
  56. // 设置统计动态数据 - 修改键
  57. dynamic(state, payload) {
  58. for (let i in payload) {
  59. for (let j in state.dynamic) {
  60. if (i === j) {
  61. state.dynamic[j] = payload[i];
  62. }
  63. }
  64. }
  65. uni.setStorageSync("hl88app:statis", state);
  66. },
  67. // 设置通知统计数据 - 修改键
  68. noticec(state, payload) {
  69. for (let i in payload) {
  70. for (let j in state.notice) {
  71. if (i === j) {
  72. state.notice[j] = payload[i];
  73. }
  74. }
  75. }
  76. uni.setStorageSync("hl88app:statis", state);
  77. }
  78. },
  79. actions: {
  80. async get({commit, rootState}) {
  81. commit('edit', uni.getStorageSync('hl88app:statis'));
  82. }
  83. }
  84. };