import { $post } from '@/utils'

export const PAY_LISTS = () => new Promise(async (resolve, reject) => {
  try {
    const res = await $post('/pay/lists');
    const { ret } = res.data
    if (ret == 1) {
      resolve(res.data)
    }
    reject(res.data)
  } catch (error) { }
})

export const PAY_SUBMIT = (params) => new Promise(async (resolve, reject) => {
  try {
    const res = await $post('/pay/submit', params);
    const { ret } = res
    if (ret == 1) {
      resolve(res)
    }
    reject(res.data)
  } catch (error) { }
})

export const USER_BANK_ADD = (params) => new Promise(async (resolve, reject) => {
  try {
    const res = await $post('/users/bank/add', params);
    const { ret } = res.data
    if (ret == 1) {
      resolve(res.data)
    }
    reject(res.data)
  } catch (error) { }
})

export const USER_BANK = () => new Promise(async (resolve, reject) => {
  try {
    const res = await $post('/users/bank');
    const { ret } = res.data
    if (ret == 1) {
      resolve(res.data)
    }
    reject(res.data)
  } catch (error) { }
})

export const USER_EXTRACT = (params) => new Promise(async (resolve, reject) => {
  try {
    const res = await $post('/users/extract', params);
    const { ret } = res.data
    if (ret == 1) {
      resolve(res.data)
    }
    reject(res.data)
  } catch (error) { }
})