/*
 * @Author: your name
 * @Date: 2021-12-03 15:31:52
 * @LastEditTime: 2022-01-06 09:27:56
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \tms-obc-web\src\app\routes\order-management\services\order-management.service.ts
 */
import { Injectable, Injector } from '@angular/core';
import { map } from 'rxjs/operators';
import { EACacheService, ShipperBaseService } from '@shared';

@Injectable({
  providedIn: 'root'
})
export class OrderManagementService extends ShipperBaseService {

  $api_get_getEnterpriseNetTransHis = `/api/mdc/enterpriseNetTransHis/getEnterpriseNetTransHis`;
  $api_get_catalogue_member = `/user?_allow_anonymous=true`;
  $api_get_bulkPage_list = `/api/sdc/goodsResourceOperate/listBulkPage`;
  // 据 手机号/姓名 查询 车队长/司机
  $api_get_getDriverInfo = `/api/mdc/cuc/user/getDriverInfo`;
  $api_del_driver = ``;
      // 获取货主企业列表
  public $api_getList = '/api/mdc/cuc/enterpriseInfo/cargoOwner/getList?_allow_anonymous=true';
   // 风险单：
  //  风险单列表查询
  $api_get_listRiskPage = `/api/sdc/billRiskOperate/listRiskPage`;
  //  风险单列表查询
  $api_get_listStatisticalStatus = `/api/sdc/billRiskOperate/listStatisticalStatus`;
  //  风险单详情查询
  $api_get_getRiskDetail = `/api/sdc/billRiskOperate/getRiskDetail`;
  //  风险单审核
  $api_get_listRisk_audit = `/api/sdc/billRiskOperate/audit`;
  //  查询整车订单列表
  $api_get_listWholePage = `/api/sdc/billOperate/listWholePage`;
  //  整车详情
  $api_get_getWholeBillDetail = `/api/sdc/billOperate/getWholeBillDetail`;
      // 根据车牌号查询车辆信息
  $api_get_getCarLicenseListByCarNo= `/api/mdc/cuc/carLicenseAudit/operate/getCarLicenseListByCarNo`;

    //  查询大宗订单列表
    $api_get_listBulkPage = `/api/sdc/billOperate/listBulkPage`;
    //  查看运费变更记录详情-整车
    $api_get_getChangeRecordWholeDetail = `/api/sdc/billFreightChangeRecord/getChangeRecordWholeDetail`;
    //  根据订单ID查看运费变更申请记录
    $api_get_listChangeApply = `/api/sdc/billFreightChangeApplication/listChangeApply`;
    //  变更运费页面-整车-整车
    $api_get_getFreightChangeWholeDetail = `/api/sdc/billFreightChangeApplication/getFreightChangeWholeDetail`;
    //  订单申请撤销
    $api_get_revokeChangeRecord = `/api/sdc/billFreightChangeApplication/revokeChangeRecord`;
    //  运费变更申请-整车
    $api_get_insertFreightChangeWhole = `/api/sdc/billFreightChangeApplication/insertFreightChangeWhole`;
    //  取消订单
    $api_get_cancelAnOrder = `/api/sdc/billOperate/cancelAnOrder`;
    //  批量签收整车订单
    $api_get_batchSignWholeOrder = `/api/sdc/billOperate/batchSignWholeOrder`;
    //  批量签收大宗订单
    $api_get_batchSignBulkOrder = `/api/sdc/billOperate/batchSignBulkOrder`;
    //  大宗签收详情
    $api_get_getBulkSignForDetail = `/api/sdc/billOperate/getBulkSignForDetail`;
    //  整车签收详情
    $api_get_getWholeSignForDetail = `/api/sdc/billOperate/getWholeSignForDetail`;
    //  确认签收大宗订单
    $api_get_signBulkOrder = `/api/sdc/billOperate/signBulkOrder`;
    //  确认签收整车订单
    $api_get_signWholeOrder = `/api/sdc/billOperate/signWholeOrder`;
  // 上传图片
  public $api_upload_url = `/api/mdc/pbc/upload/multipartFile/file`;
  // 根据用户id查用户信息（注意：nickName才是用户名称）
  public $api_getUserDetailByAppUserId = `/api/mdc/cuc/userBasicInfo/get`;
  // 根据车辆id查车辆信息
  public $api_getCarLicenseByIds = `/api/mdc/cuc/carLicense/getCarLicenseByIds`;
  // 统计【整车】订单状态数量
  public $api_statisticalStatus = `/api/sdc/billOperate/getWholeStatistical`;
  // 统计【大宗】订单状态数量
  public $api_getBulkStatistical = `/api/sdc/billOperate/getBulkStatistical`;
  // 变更运费页面-大宗
  public $api_getFreightChangeBulkDetail = `/api/sdc/billFreightChangeApplication/getFreightChangeBulkDetail`;
  // 变更运费页面-大宗
  public $api_insertFreightChangeBulk = `/api/sdc/billFreightChangeApplication/insertFreightChangeBulk`;
  // 大宗详情
  public $api_getBulkBillDetail = `/api/sdc/billOperate/getBulkBillDetail`;
  // 查看运费变更记录详情-大宗
  public $api_getChangeRecordBulkDetail = `/api/sdc/billFreightChangeRecord/getChangeRecordBulkDetail`;
  // 查看运费变更记录详情-整车
  public $api_getChangeRecordWholeDetail = `/api/sdc/billFreightChangeRecord/getChangeRecordWholeDetail`;
  //运费变更申请计算费用-大宗
  $api_calculate_cost = `/api/sdc/billFreightChangeApplication/getBulkSurchargeDetail`;
  //运费变更申请计算费用-大宗
  $api_getWholeSurchargeDetail = `/api/sdc/billFreightChangeApplication/getWholeSurchargeDetail`;
   //运费变更申请-大宗
   $api_change_bulk = `/api/sdc/billFreightChangeApplication/insertFreightChangeBulk`;
     // 删除装卸货信息
  $api_delete_Wholedeletebatch = `/api/sdc/unLoadingPlace/deletebatch`;
     // 修改-大宗订单
  $api_set_modifyBulkOrder = `/api/sdc/billOperate/modifyBulkOrder`;
     // 修改-整车订单
  $api_set_modifyWholeOrder = `/api/sdc/billOperate/modifyWholeOrder`;
     // 修改-整车订单详情
  $api_set_getWholeOrderDetail = `/api/sdc/billOperate/getWholeOrderDetail`;
     // 修改--大宗订单详情
  $api_set_getBulkOrderDetail = `/api/sdc/billOperate/getBulkOrderDetail`;
     // 批量修改网络货运人
  $api_set_updateEnterpriseInfoBatch = `/api/sdc/billOperate/updateEnterpriseInfoBatch`;
     // 批量修改附加费率
  $api_set_updateAdditionalRateBatch = `/api/sdc/billOperate/updateAdditionalRateBatch`;


     // 查询投诉列表
  $api_get_operate_listPage = `/api/sdc/complaint/operate/listPage`;
     // 获取投诉表详情
  $api_get_getComplaintDriverDetails = `/api/sdc/complaint/operate/getComplaintDriverDetails`;
     // 处理投诉
  $api_get_dealWithComplaint = `/api/sdc/complaint/operate/dealWithComplaint`;
     // 撤销投诉
  $api_get_canelComplaint = `/api/sdc/complaint/operate/canelComplaint`;


     // 批量修改车队长
  $api_get_updateCarCaptainBatch = `/api/sdc/billOperate/updateCarCaptainBatch`;
     // 根据手机号查询车队长/司机
  $api_get_getCarCaptainByMobile = `/api/mdc/userDriverExpand/getCarCaptainByMobile`;




    // 获取货主企业列表
    public $api_enterpriceList = '/api/mdc/cuc/enterpriseInfo/operate/enterpriceList';
    /**
   * 根据企业ID，获取企业历史网络货运人
   * @returns
   */
     getNetworkFreightForwarderHistory(params: any) {
       const param = {
        enterpriseIds: params.enterpriseInfoIds
       }
      return this.request(this.$api_get_getEnterpriseNetTransHis, param).pipe(
        map((res: any) => {
          if (!res) {
            return [];
          }
          const list = res.map((item: any) => ({
            label: item.networkTransporterName,
            value: item.networkTransporterId
          }));
          return [{ value: '', label: '全部' }, ...list];
        })
      );
    }
  constructor(public injector: Injector,public eaCacheSrv: EACacheService) {
    super(injector,eaCacheSrv)
  }
}
