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
143 additions
and
13 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 |
---|---|---|
|
@@ -42,7 +42,7 @@ export function postTransform(data) { | |
} | ||
|
||
/** | ||
* 发起提现请求 | ||
* 发起充值请求 | ||
* @author mutoe <[email protected]> | ||
* @export | ||
* @param {Object} data | ||
|
@@ -52,9 +52,21 @@ export function postTransform(data) { | |
* @returns | ||
*/ | ||
export function postWalletRecharge(data) { | ||
return api.post( | ||
"/walletRecharge/orders", | ||
{ ...data, from: 2 }, | ||
{ validateStatus: s => s === 201 } | ||
); | ||
const url = "/walletRecharge/orders"; | ||
data = Object.assing(data, { from: 2 }); | ||
return api.post(url, data, { validateStatus: s => s === 201 }); | ||
} | ||
|
||
/** | ||
* 发起提现请求 | ||
* @author mutoe <[email protected]> | ||
* @export | ||
* @param {Object} data | ||
* @param {number} data.amount | ||
* @param {string} data.type | ||
* @param {string} data.account | ||
* @returns | ||
*/ | ||
export function postWalletWithdraw(data) { | ||
return api.post("/plus-pay/cash", 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<template lang="html"> | ||
<div class="wallet-detail p-wallet-detail"> | ||
|
||
<common-header class="header"> 提现明细 </common-header> | ||
|
||
<load-more | ||
ref="loadmore" | ||
:on-refresh="onRefresh" | ||
:on-load-more="onLoadMore" | ||
class="m-wallet-list"> | ||
<wallet-detail-item | ||
v-for="item in list" | ||
v-if="item.id" | ||
:key="item.id" | ||
:detail="item" | ||
@click="showDetail(item.id)" /> | ||
</load-more> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import _ from "lodash"; | ||
import walletDetailItem from "./WalletDetailItem.vue"; | ||
export default { | ||
name: "WalletWithdrawDetail", | ||
components: { walletDetailItem }, | ||
data() { | ||
return { | ||
currAction: "out", | ||
list: [] | ||
}; | ||
}, | ||
computed: { | ||
after() { | ||
const len = this.list.length; | ||
return len ? this.list[len - 1].id : 0; | ||
} | ||
}, | ||
watch: { | ||
currAction() { | ||
this.list = []; | ||
this.$refs.loadmore.beforeRefresh(); | ||
} | ||
}, | ||
methods: { | ||
showDetail(id) { | ||
this.$router.push({ path: "/wallet/detail", params: { id } }); | ||
}, | ||
async onRefresh() { | ||
const data = await this.$store.dispatch("wallet/getWalletOrders", { | ||
action: this.currAction | ||
}); | ||
if (data.length > 0) this.list = _.unionBy([...data, ...this.list], "id"); | ||
this.$refs.loadmore.topEnd(!(data.length < 15)); | ||
}, | ||
async onLoadMore() { | ||
const data = await this.$store.dispatch("wallet/getWalletOrders", { | ||
action: this.currAction, | ||
after: this.after | ||
}); | ||
if (data.length > 0) { | ||
this.list = [...this.list, ...data]; | ||
} | ||
this.$refs.loadmore.bottomEnd(data.length < 15); | ||
} | ||
} | ||
}; | ||
</script> | ||
|
||
<style lang="less" scoped> | ||
.p-wallet-detail { | ||
.header { | ||
overflow: initial; | ||
} | ||
} | ||
</style> |
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 |
---|---|---|
|
@@ -28,16 +28,25 @@ const mutations = { | |
}; | ||
|
||
const actions = { | ||
/** | ||
* 获取钱包流水 | ||
* @author mutoe <[email protected]> | ||
* @returns {Promise<Object[]>} | ||
*/ | ||
async getWalletOrders({ commit, state }, params) { | ||
let { data } = await api.getWalletOrders(params); | ||
if (params && params.after) data = [...state.list, ...data]; | ||
commit(TYPES.UPDATE_WALLET, { list: data }); | ||
return data || []; | ||
}, | ||
|
||
/** | ||
* 获取钱包配置信息 | ||
* @author mutoe <[email protected]> | ||
*/ | ||
async getWalletInfo({ commit }) { | ||
let { | ||
data: { labels: items, ratio, rule, recharge_type: type } | ||
} = await api.getWalletInfo(); | ||
let { data } = await api.getWalletInfo(); | ||
const { labels: items, ratio, rule, recharge_type: type } = data; | ||
commit(TYPES.UPDATE_WALLET, { items, type, ratio, rule }); | ||
}, | ||
|
||
|
@@ -49,6 +58,16 @@ const actions = { | |
async requestRecharge(state, payload) { | ||
const { data = "" } = await api.postWalletRecharge(payload); | ||
return data; | ||
}, | ||
|
||
/** | ||
* 发起提现请求 | ||
* @author mutoe <[email protected]> | ||
* @returns | ||
*/ | ||
async requestWithdraw(state, payload) { | ||
const { data } = await api.postWalletWithdraw(payload); | ||
return data; | ||
} | ||
}; | ||
|
||
|