You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
2.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import request from '@/components/hzjc/utils/request.js'
let money = {}
/**
* 获取充值设置
* @date 2022-11-01
*/
money.getRechargeConfig = function() {
return new Promise((resolve, reject) => {
request.getData('money/api/Config/getRechargeConfig').then(res => {
resolve(res)
}).catch(res => {
reject(res)
})
})
}
/**
* 获取充值卡列表
* @date 2022-11-01
*/
money.listCard = function() {
return new Promise((resolve, reject) => {
request.getData('money/api/Card/listCard').then(res => {
resolve(res)
}).catch(res => {
reject(res)
})
})
}
/**
* 提交订单并支付
* @param {int} buyType 购买方式 1--直接充值 2--购买充值卡
* @param {float} money buyType = 1时充值金额
* @param {int} cardId buyType = 2时充值卡ID
* @param {int} payType 支付方式 1--微信支付 2--支付宝支付
* @date 2022-11-01
*/
money.insertOrder = function(buyType, money, cardId, payType) {
return new Promise((resolve, reject) => {
// 获取下单数据
request.getData('money/api/Order/insertOrder', {
buy_type: buyType,
money: money,
card_id: cardId,
pay_type: payType
}, {
loading: true
}).then(res => {
resolve(res)
}).catch(res => {
reject(res)
})
})
}
/**
* 获取我的充值订单
* @param {object} that
* @param {int} isFirstPage 是否第一页 0--不是 1--是
* @date 2022-12-16
*/
money.listMyOrder = function(that, isFirstPage) {
return new Promise((resolve, reject) => {
request.getList('money/api/Order/listMyOrder', {
}, {
that: that,
first_page: isFirstPage
}).then(res => {
resolve(res)
}).catch(res => {
reject(res)
})
})
}
/**
* 获取我的余额
* @date 2022-11-01
*/
money.getMyMoney = function() {
return new Promise((resolve, reject) => {
request.getData('money/api/Money/getMyMoney').then(res => {
resolve(res)
}).catch(res => {
reject(res)
})
})
}
/**
* 获取余额明细列表
* @param {object} that
* @param {int} isFirstPage 是否第一页 0--不是 1--是
* @param {int} index 类型 0--全部 1--收入 2--支出
* @date 2022-11-01
*/
money.listLog = function(that, isFirstPage, index) {
return new Promise((resolve, reject) => {
request.getList('money/api/Money/listLog', {
index: index
}, {
that: that,
first_page: isFirstPage
}).then(res => {
resolve(res)
}).catch(res => {
reject(res)
})
})
}
export default money