zhengyiming
2025-02-24 58c6417603cc9e4c1012ba4fc4c6306dcb0e2324
packages/components/src/utils/lifeRechargeServices.ts
@@ -1,12 +1,6 @@
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
import { IRequest, BlLifeRechargeServicesOptions } from './types';
export interface PhoneMesssageCodeLoginInput {
  /** 手机号 */
  phoneNumber: string;
  /** 验证码 */
  code: string;
}
import { LifeRechargeConstants } from './lifeRechargeConstants';
export interface RequestConfig {}
@@ -26,4 +20,263 @@
      ...(options || {}),
    });
  }
  /** 获取折扣 GET /api/LifePay/GetRate */
  async getRate(options?: RequestConfig) {
    return this.request<LifePayRateListOutput[]>('/api/LifePay/GetRate', {
      method: 'GET',
      ...(options || {}),
    });
  }
  /** 获取电费面值 GET /api/LifePay/GetElectricParValue */
  async getElectricParValue(options?: RequestConfig) {
    return this.request<ElectricParValueResponse>('/api/LifePay/GetElectricParValue', {
      method: 'GET',
      ...(options || {}),
    });
  }
  /** 获取话费面值 GET /api/LifePay/GetPhoneParValue */
  async getPhoneParValue(options?: RequestConfig) {
    return this.request<PhoneParValueResponse>('/api/LifePay/GetPhoneParValue', {
      method: 'GET',
      ...(options || {}),
    });
  }
  /** 创建生活缴费话费订单 POST /api/LifePay/CreateLifePayPhoneOrder */
  async createLifePayPhoneOrder(
    body: LifePhoneDataCreateLifePayOrderInput,
    options?: RequestConfig
  ) {
    return this.request<CreateLifePayOrderOutput>('/api/LifePay/CreateLifePayPhoneOrder', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    });
  }
  /** 创建生活缴费电费订单 POST /api/LifePay/CreateLifePayElectricOrder */
  async createLifePayElectricOrder(
    body: LifeElectricDataCreateLifePayOrderInput,
    options?: RequestConfig
  ) {
    return this.request<CreateLifePayOrderOutput>('/api/LifePay/CreateLifePayElectricOrder', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    });
  }
  /** 根据订单号获取支付状态 GET /api/LifePay/GetPayStatusByOrderNo */
  async getPayStatusByOrderNo(params: APIgetPayStatusByOrderNoParams, options?: RequestConfig) {
    return this.request<LifeRechargeConstants.LifePayStatusEnum>(
      '/api/LifePay/GetPayStatusByOrderNo',
      {
        method: 'GET',
        params: {
          ...params,
        },
        ...(options || {}),
      }
    );
  }
  async setLifePayOrderPayType(body: SetLifePayOrderPayTypeInput, options?: RequestConfig) {
    return this.request<string>('/api/LifePay/SetLifePayOrderPayType', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    });
  }
  /** 获取我的订单分页数据 POST /api/LifePay/GetUserLifePayOrderPage */
  async getUserLifePayOrderPage(body: QueryLifePayOrderListInput, options?: RequestConfig) {
    return this.request<UserLifePayOrderOutputPageOutput>('/api/LifePay/GetUserLifePayOrderPage', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    });
  }
}
export interface PhoneMesssageCodeLoginInput {
  /** 手机号 */
  phoneNumber: string;
  /** 验证码 */
  code: string;
}
export interface LifePayRateListOutput {
  rateType?: LifeRechargeConstants.LifePayRateTypeEnum;
  rate?: number;
}
export interface ElectricParValueResponse {
  success?: string;
  requestNo?: string;
  partnerId?: string;
  service?: string;
  version?: string;
  protocol?: string;
  context?: string;
  ext?: string;
  code?: string;
  message?: string;
  detail?: string;
  electricParValue?: ElectricParValueOutput[];
}
export interface ElectricParValueOutput {
  electricType?: string;
  areaName?: string;
  parValue?: string;
  rate?: number;
  comments?: string;
}
export interface PhoneParValueResponse {
  success?: string;
  requestNo?: string;
  partnerId?: string;
  service?: string;
  version?: string;
  protocol?: string;
  context?: string;
  ext?: string;
  code?: string;
  message?: string;
  detail?: string;
  phoneParValue?: PhoneParValueOutput[];
}
export interface PhoneParValueOutput {
  ispCode?: string;
  ispName?: string;
  parValue?: string;
  rate?: number;
  phoneSection?: string;
  comments?: string;
}
export interface LifePhoneDataCreateLifePayOrderInput {
  userId?: string;
  productData?: LifePhoneData;
}
export interface LifePhoneData {
  /** 运营商编码,例如:"yidong", "dianxin", "liantong"。 */
  ispCode: string;
  /** 充值面额,单位为元。测试账户:parValue=100:缴费成功,parValue>100:缴费失败。 */
  parValue: number;
  /** 手机号。 */
  phone: string;
  /** 机主名称(电信手机号必填) */
  name?: string;
}
export interface CreateLifePayOrderOutput {
  orderNo?: string;
}
export interface LifeElectricDataCreateLifePayOrderInput {
  userId?: string;
  productData?: LifeElectricData;
}
export interface LifeElectricData {
  /** 充值面额,单位为元。 */
  parValue: number;
  /** 电网类型,例如:"guowang"代表国家电网,"nanwang"代表南方电网。 */
  electricType: string;
  /** 电费类型,国网必传:住宅、企事业、店铺三个选项。 */
  electricAccountType: string;
  /** 电费户号。 */
  electricAccount: string;
  /** 省份。 */
  province: string;
  /** 城市。 */
  city: string;
  /** 客户身份证后6位,南网必传。 */
  sixID?: string;
}
export interface APIgetPayStatusByOrderNoParams {
  orderNo?: string;
}
export interface SetLifePayOrderPayTypeInput {
  orderNo: string;
  lifePayType?: LifeRechargeConstants.LifePayTypeEnum;
}
export interface QueryLifePayOrderListInput {
  pageModel?: Pagination;
  lifePayOrderType?: LifeRechargeConstants.LifePayOrderTypeEnum;
  /** 开始支付时间 */
  beginPayTime?: string;
  /** 结束支付时间 */
  endPayTime?: string;
  payStatus?: LifeRechargeConstants.LifePayStatusEnum;
  lifePayOrderStatus?: LifeRechargeConstants.LifePayOrderStatusEnum;
  /** 开始完成时间 */
  beginFinishTime?: string;
  /** 结束完成时间 */
  endFinishTime?: string;
  /** 用户Id */
  userId?: string;
}
export interface Pagination {
  rows?: number;
  page?: number;
  orderInput?: OrderInput[];
  totalCount?: number;
  totalPage?: number;
}
export interface OrderInput {
  property?: string;
  order?: any;
}
export interface UserLifePayOrderOutputPageOutput {
  pageModel?: Pagination;
  objectData?: any;
  data?: UserLifePayOrderOutput[];
}
export interface UserLifePayOrderOutput {
  id?: string;
  lifePayType?: LifeRechargeConstants.LifePayTypeEnum;
  lifePayOrderType?: LifeRechargeConstants.LifePayOrderTypeEnum;
  /** 订单号 */
  orderNo?: string;
  /** 充值金额 */
  rechargeAmount?: number;
  /** 优惠金额 */
  discountAmount?: number;
  /** 实付金额 */
  payAmount?: number;
  /** 支付时间 */
  payTime?: string;
  payStatus?: LifeRechargeConstants.LifePayStatusEnum;
  lifePayOrderStatus?: LifeRechargeConstants.LifePayOrderStatusEnum;
  /** 完成时间 */
  finishTime?: string;
  /** 订单详细数据 */
  orderParamDetailJsonStr?: string;
}