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

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

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

  /**
   * 查询商户列表
   * @param paramObject 参数
   * @param callBack
   */
  getMerList(paramObject: object, callBack) {
    this.http.get(environment.baseUrl + 'mer/getMerList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 查询商户列表
   * @param paramObject 参数
   * @param callBack
   */
  getMerDetail(merId: number, callBack) {
    this.http.get(environment.baseUrl + 'mer/getMerDetail?merId=' + merId).subscribe(data => {
      callBack(data);
    });
  }

  merMigrateSalesman(paramObject: object, callBack) {
    this.http.post(environment.baseUrl + 'mer/merMigrateSalesman', paramObject).subscribe(data => {
      callBack(data);
    });
  }


}
