import { Injectable } from '@angular/core';
import {HttpClient} from "@angular/common/http";
import {CommonsService} from "./commons.service";
import {environment} from "../../environments/environment";

@Injectable({
  providedIn: 'root'
})
export class TradeProfitSharingService {

  constructor(
    private http: HttpClient,
    private commonsService: CommonsService
  ) { }

  /**
   * 查询分账结果
   * @param paramObject
   * @param callBack
   */
  queryResultList(paramObject: object, callBack) {
    this.http.get(environment.baseUrl + 'tradeOrderProfitSharing/queryResultList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 查询分账结果
   * @param paramObject
   * @param callBack
   */
  getReceiverList(paramObject: object, callBack) {
    this.http.get(environment.baseUrl + 'tradeOrderProfitSharing/getReceiverList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => {
      callBack(data);
    });
  }


  /**
   * 导出分账结果
   * @param paramObject
   * @param callBack
   */
  exportResult(paramObject: object, callBack) {
    this.http.get(environment.baseUrl + 'tradeOrderProfitSharing/exportResult?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => {
      callBack(data);
    });
  }


  /**
   * 查询分账明细
   * @param paramObject
   * @param callBack
   */
  exportReceiver(paramObject: object, callBack) {
    this.http.get(environment.baseUrl + 'tradeOrderProfitSharing/exportReceiver?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 查询分账详情
   * @param paramObject
   * @param callBack
   */
  queryProfitSharingDetail(paramObject: object, callBack) {
    this.http.get(environment.baseUrl + 'tradeOrderProfitSharing/queryProfitSharingDetail?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => {
      callBack(data);
    });
  }
}
