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

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

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

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

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