import type { PageParams, PageResult } from '@/types/global'
import type { rechargeCenter, rechargeOrderListItem, rechargePlanParams } from '@/types/member'
import { request } from '@/utils/request'

export const getRechargeCenterApi = () => {
  return request<rechargeCenter>({
    method: 'GET',
    url: 'shop/recharge/center',
  })
}

/**
 * 余额充值
 * @param data
 * @returns
 */
export const postRechargeApi = (data: rechargePlanParams) => {
  return request<WechatMiniprogram.RequestPaymentOption>({
    method: 'POST',
    url: 'shop/recharge/recharge',
    data,
  })
}

/**
 * 获取充值订单列表
 * @param data
 * @returns
 */
export const getRechargeOrderListApi = (data: PageParams) => {
  return request<PageResult<rechargeOrderListItem[]>>({
    method: 'GET',
    url: 'shop/recharge/orderList',
    data,
  })
}
