Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

android / dayu

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Switch branch/tag
  • dayu
  • ..
  • homesale
  • HomeSalePresenter.java
Find file
BlameHistoryPermalink
  • mReturn's avatar
    销售&搜索&评论 · f5d1dccc
    mReturn committed 5 years ago
    f5d1dccc
HomeSalePresenter.java 1.12 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
package com.bigfish.salecenter.presenter.homesale;

import com.bigfish.salecenter.api.SaleService;
import com.bigfish.salecenter.model.SaleTab;
import com.dayu.base.api.Api;
import com.dayu.event.UserInfo;
import com.dayu.utils.ToastUtils;
import com.dayu.utils.UserManager;

/**
 * Created by mReturn
 * on 2020/2/12
 **/
public class HomeSalePresenter extends HomeSaleContract.Presenter{

    private int mUserId;
    private int mIndex;

    public void chooseTab(int index) {
        mView.showDialog();
        mIndex = index;
        getTabNum(mUserId);
    }

    @Override
    public void getTabNum(int userId) {
        Api.getService(SaleService.class).getTabNums(mUserId).compose(Api.applySchedulers())
                .subscribe(baseObserver(data ->{
                    SaleTab tab = new SaleTab(data.getGoodsCount(),data.getEngineerCollecd(),data.getSelling(),data.getSelled());
                    mView.setTabNum(tab, mIndex);
                }));

    }

    @Override
    public void onAttached() {
        UserInfo userInfo = UserManager.getInstance().getUser();
        mUserId = Integer.parseInt(userInfo.getAccountId());
    }
}