This repository has been archived by the owner on Nov 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
156 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,19 @@ export function getCurrencyOrders(params) { | |
validateStatus: s => s === 200 | ||
}); | ||
} | ||
|
||
/** | ||
* 发起充值 | ||
* @author mutoe <[email protected]> | ||
* @export | ||
* @param {Object} data | ||
* @param {string} data.type 充值方式 | ||
* @param {number} data.amount 充值金额(单位:RMB分) | ||
* @param {Object|Array} [data.extra] 拓展信息字段 | ||
* @returns | ||
*/ | ||
export function postCurrencyRecharge(data) { | ||
return api.post("/currency/recharge", data, { | ||
validateStatus: s => s === 201 | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,17 @@ export function getWalletOrders(params) { | |
validateStatus: s => s === 200 | ||
}); | ||
} | ||
|
||
/** | ||
* 转换为积分 | ||
* @author mutoe <[email protected]> | ||
* @export | ||
* @param {Object} data | ||
* @param {number} data.amount | ||
* @returns | ||
*/ | ||
export function postTransform(data) { | ||
return api.post("/plus-pay/transform", data, { | ||
validateStatus: s => s === 201 | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import * as api from "@/api/currency"; | ||
import * as walletApi from "@/api/wallet"; | ||
|
||
const state = { | ||
rule: "", // 充值提现规则 | ||
|
@@ -60,10 +61,41 @@ const actions = { | |
/** | ||
* 获取积分流水 | ||
* @author mutoe <[email protected]> | ||
* @returns {Promise<Object[]>} | ||
*/ | ||
async getCurrencyOrders(state, payload) { | ||
const { data = [] } = await api.getCurrencyOrders(payload); | ||
return data; | ||
}, | ||
|
||
/** | ||
* 发起充值请求 | ||
* @author mutoe <[email protected]> | ||
* @returns {Promise<Object>} | ||
*/ | ||
async requestRecharge(state, payload) { | ||
const { data = {} } = await api.postCurrencyRecharge(payload); | ||
return data; | ||
}, | ||
|
||
/** | ||
* 发起提现请求 | ||
* @author mutoe <[email protected]> | ||
* @param {number} amount | ||
* @returns {Promise<{message: string[]}>} | ||
*/ | ||
async requestWithdraw(state, amount) { | ||
return api.postCurrencyWithdraw({ amount }); | ||
}, | ||
|
||
/** | ||
* 积分转换为余额 | ||
* @author mutoe <[email protected]> | ||
* @param {number} amount | ||
* @returns {Promise<{message: string[]}>} | ||
*/ | ||
async currency2wallet(state, amount) { | ||
return walletApi.postTransform({ amount }).catch(err => err.response.data); | ||
} | ||
}; | ||
|
||
|