Authored by shuaiguo

feat(我的收入): 数据获取

@@ -33,6 +33,7 @@ export default function() { @@ -33,6 +33,7 @@ export default function() {
33 currentPage: 1, 33 currentPage: 1,
34 pageSize: 20, 34 pageSize: 20,
35 totalPage: 0, 35 totalPage: 0,
  36 + isFetching: false,
36 list: [] 37 list: []
37 }, 38 },
38 incomeInfo: { 39 incomeInfo: {
@@ -40,6 +41,7 @@ export default function() { @@ -40,6 +41,7 @@ export default function() {
40 currentPage: 1, 41 currentPage: 1,
41 pageSize: 20, 42 pageSize: 20,
42 totalPage: 0, 43 totalPage: 0,
  44 + isFetching: false,
43 list: [] 45 list: []
44 } 46 }
45 }, 47 },
@@ -425,7 +427,15 @@ export default function() { @@ -425,7 +427,15 @@ export default function() {
425 }, 427 },
426 428
427 async fetchInComeAssets({commit, state}, isRefresh) { 429 async fetchInComeAssets({commit, state}, isRefresh) {
428 - let {currentPage, list, pageSize} = state.assetData.incomeInfo; 430 + const {incomeInfo} = state.assetData;
  431 +
  432 + if (incomeInfo.isFetching) {
  433 + return;
  434 + }
  435 +
  436 + let {currentPage, list, pageSize} = incomeInfo;
  437 +
  438 + commit('setAssets', {incomeInfo: {...incomeInfo, isFetching: true}});
429 439
430 const page = isRefresh ? 1 : currentPage + 1; 440 const page = isRefresh ? 1 : currentPage + 1;
431 441
@@ -443,6 +453,7 @@ export default function() { @@ -443,6 +453,7 @@ export default function() {
443 let assetData = parseAssetList(result.data); 453 let assetData = parseAssetList(result.data);
444 454
445 assetData.list = [...list, ...assetData.list]; 455 assetData.list = [...list, ...assetData.list];
  456 + assetData.isFetching = false;
446 457
447 commit('setAssetStatisticalInfo', result.data.summary); 458 commit('setAssetStatisticalInfo', result.data.summary);
448 commit('setAssets', {incomeInfo: assetData}); 459 commit('setAssets', {incomeInfo: assetData});
@@ -452,7 +463,15 @@ export default function() { @@ -452,7 +463,15 @@ export default function() {
452 }, 463 },
453 464
454 async fetchWaitApplyAssets({commit, state, dispatch}, isRefresh) { 465 async fetchWaitApplyAssets({commit, state, dispatch}, isRefresh) {
455 - let {currentPage, list, pageSize} = state.assetData.waitApplyInfo; 466 + const {waitApplyInfo} = state.assetData;
  467 +
  468 + if (waitApplyInfo.isFetching) {
  469 + return;
  470 + }
  471 +
  472 + let {currentPage, list, pageSize} = waitApplyInfo;
  473 +
  474 + commit('setAssets', {waitApplyInfo: {...waitApplyInfo, isFetching: true}});
456 475
457 const page = isRefresh ? 1 : currentPage + 1; 476 const page = isRefresh ? 1 : currentPage + 1;
458 477
@@ -470,6 +489,7 @@ export default function() { @@ -470,6 +489,7 @@ export default function() {
470 let assetData = parseAssetList(result.data); 489 let assetData = parseAssetList(result.data);
471 490
472 assetData.list = [...list, ...assetData.list]; 491 assetData.list = [...list, ...assetData.list];
  492 + assetData.isFetching = false;
473 493
474 commit('setAssetStatisticalInfo', result.data.summary); 494 commit('setAssetStatisticalInfo', result.data.summary);
475 commit('setAssets', {waitApplyInfo: assetData}); 495 commit('setAssets', {waitApplyInfo: assetData});