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 OrderOilService {

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

  /**
   * 查询加油订单
   *
   * @param  paramsObject   对象
   * @param  callBack   回调
   */
  public getGasOrderList(param: object, callBack) {
    this.http.get(environment.orderUrl + 'oil/getOilOrderList?' + this.common.getWhereCondition(param)).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 查询油站订单详情
   *
   * @param  paramsObject   对象
   * @param  callBack   回调
   */
  public getGasOrderDetail(orderNo: string, callBack) {
    this.http.get(environment.orderUrl + 'oil/getOilOrderDetail?orderNo=' + orderNo).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 导出加油订单
   *
   * @param  paramsObject   对象
   * @param  callBack   回调
   */
  public exportGasOrderList(param: object, callBack) {
    this.http.get(environment.orderUrl + 'oil/exportOilOrder?' + this.common.getWhereCondition(param)).subscribe(data => {
      callBack(data);
    });
  }



}
