Commit 1d2513ed authored by wykolor's avatar wykolor

feat: 提现记录接口对接

parent 490e0ef6
......@@ -2,7 +2,7 @@
* @Author: wykolor
* @Date: 2021-03-23 10:36:45
* @Last Modified by: mikey.zhaopeng
* @Last Modified time: 2021-03-29 13:48:46
* @Last Modified time: 2021-04-07 11:51:44
*/
// 流水类型
......@@ -36,3 +36,11 @@ export enum ErrCode {
STUDENT_WITHDRAWING = "STUDENT_WITHDRAWING", // 学生提现中
BALANCE_NOT_ENOUGH = "BALANCE_NOT_ENOUGH", // 余额不足
}
// 提现记录状态
export enum WithdrawStatus {
WITHDRAWING = "WITHDRAWING",
RECEIVED = "RECEIVED",
FAILED = "FAILED"
}
\ No newline at end of file
......@@ -18,7 +18,7 @@
@load="onLoad"
>
<van-tab name="REDUCE" title="支出" class="bonus-detail-pay-list">
<template>
<template v-if="reduceList.length">
<div v-for="item in reduceList" :key="item.id" class="bonus-detail-pay-item">
<ul>
<li style="color: #000">{{ item.bizTypeName }}</li>
......@@ -31,17 +31,25 @@
</li>
</ul>
<ul class="bonus-detail-pay-item-desc">
<li v-if="item.bizType === BizType.WITHDRAW">
申请时间:{{ item.withdrawApplyTime }}
</li>
<li
v-if="item.bizType === BizType.WITHDRAW"
class="bonus-detail-pay-item-desc-money flex"
>
<span>申请时间:{{ item.withdrawApplyTime }}</span>
<label v-if="!item.withdrawPayTime">-¥{{ item.amountChange }}</label>
</li>
<li
v-if="item.bizType === BizType.WITHDRAW && item.withdrawPayTime"
class="bonus-detail-pay-item-desc-money flex"
>
<span>到账时间: {{ item.withdrawPayTime }}</span>
<label>-¥{{ item.amountChange }}</label>
</li>
<li v-if="item.bizType === BizType.ORDER">{{ item.className }}</li>
<li v-if="item.bizType === BizType.ORDER">
<span v-for="(className, index) in item.className" :key="className + index">{{
className
}}</span>
</li>
<li
v-if="item.bizType === BizType.ORDER"
class="bonus-detail-pay-item-desc-money flex"
......@@ -52,10 +60,10 @@
</ul>
</div>
</template>
<!-- <van-empty description="暂无数据~" v-else /> -->
<van-empty v-else />
</van-tab>
<van-tab name="ADD" title="收入" class="bonus-detail-income-list">
<template>
<template v-if="addList.length">
<div class="bonus-detail-income-item" v-for="item in addList" :key="item.id">
<ul>
<li class="flex ">
......@@ -65,13 +73,13 @@
>
</li>
<li class="flex bonus-detail-pay-item-desc-money">
<span class="gray">{{ item.withdrawPayTime }}</span>
<span class="gray">{{ item.creationTime }}</span>
<label>+¥{{ item.amountChange }}</label>
</li>
</ul>
</div>
</template>
<!-- <van-empty description="暂无数据~" v-else /> -->
<van-empty v-else />
</van-tab>
</van-list>
</van-pull-refresh>
......@@ -121,7 +129,7 @@ const BonusDetail = defineComponent({
reduceList: []
});
const [sendNativeMessage] = useNativeBridge("test", arg => console.log(arg));
const onLoad = () => {
const onLoad = async () => {
if (state.refreshing) {
if (state.active === FlowType.ADD) {
pageAdd.pageNum = 1;
......@@ -138,8 +146,12 @@ const BonusDetail = defineComponent({
pageSize: state.active === FlowType.ADD ? pageAdd.pageSize : pageReduce.pageSize,
pageNum: state.active === FlowType.ADD ? pageAdd.pageNum : pageReduce.pageNum
};
bonusModel.getBonusList(params).then(res => {
const { list, total } = res.data;
try {
const {
data: { total, list }
} = await bonusModel.getBonusList(params);
console.log(list);
if (total === 0) {
state.finished = true;
return;
......@@ -156,7 +168,29 @@ const BonusDetail = defineComponent({
state.finished = pageAdd.finished;
pageAdd.pageNum++;
}
});
console.log(bonusList.reduceList, bonusList.addList);
} catch {
state.finished = true;
}
// bonusModel.getBonusList(params).then(res => {
// const { list, total } = res.data;
// if (total === 0) {
// state.finished = true;
// return;
// }
// state.loading = false;
// if (state.active === FlowType.REDUCE) {
// bonusList.reduceList = bonusList.reduceList.concat(list);
// pageReduce.finished = bonusList.reduceList.length === total;
// state.finished = pageReduce.finished;
// pageReduce.pageNum++;
// } else {
// bonusList.addList = bonusList.addList.concat(list);
// pageAdd.finished = bonusList.addList.length === total;
// state.finished = pageAdd.finished;
// pageAdd.pageNum++;
// }
// });
};
const onRefresh = () => {
// 清空列表数据
......
......@@ -90,41 +90,56 @@
@load="onLoad"
:immediate-check="false"
>
<template v-if="withdrawList.length">
<div class="bonus-record-item" v-for="item in withdrawList" :key="item.id">
<div class="bonus-record-item-header">
<div class="bonus-record-item-header-status">
<i
class="iconfont"
:class="
item.status === '0'
item.status === WithdrawStatus.WITHDRAWING
? 'icon-shijian'
: item.status === '1'
: item.status === WithdrawStatus.RECEIVED
? 'icon-jindutiaoqiandai'
: 'icon-xiazaishibai'
"
:style="{
color:
item.status === '0' ? '#46BB36' : item.status === '1' ? '#027AFF' : '#F1551E'
item.status === WithdrawStatus.WITHDRAWING
? '#46BB36'
: item.status === WithdrawStatus.RECEIVED
? '#027AFF'
: '#F1551E'
}"
></i>
<span>{{
item.status === "0" ? "提现中" : item.status === "1" ? "提现成功" : "提现失败"
item.status === WithdrawStatus.WITHDRAWING
? "提现中"
: item.status === WithdrawStatus.RECEIVED
? "提现成功"
: "提现失败"
}}</span>
<label v-if="item.status === '0'">请耐心等候~</label>
<label v-if="item.status === WithdrawStatus.WITHDRAWING">请耐心等候~</label>
</div>
<p class="bonus-record-item-apply-money">
{{ item.status === "1" ? "-" : "" }}¥{{ item.withdrawAmount }}
{{ item.status === WithdrawStatus.RECEIVED ? "-" : "" }}¥{{ item.withdrawAmount }}
</p>
</div>
<ul class="bonus-record-item-detail">
<li>微信提现:{{ item.accountName }}</li>
<li>申请时间:{{ item.withdrawApplyTime }}</li>
<li v-if="item.status === '0'">预计时间:{{ item.expectedPayTime }}</li>
<li v-if="item.status === '1'">到账时间:{{ item.withdrawPayTime }}</li>
<li v-if="item.status === '2'">失败时间:{{ item.failTime }}</li>
<li v-if="item.status === '2'">失败原因:{{ item.reason }}</li>
<li v-if="item.status === WithdrawStatus.WITHDRAWING">
预计时间:{{ item.expectedPayTime }}
</li>
<li v-if="item.status === WithdrawStatus.RECEIVED">
到账时间:{{ item.withdrawPayTime }}
</li>
<li v-if="item.status === WithdrawStatus.FAILED">失败时间:{{ item.failTime }}</li>
<li v-if="item.status === WithdrawStatus.FAILED">失败原因:{{ item.reason }}</li>
</ul>
</div>
</template>
<van-empty v-else />
</van-list>
</div>
<!-- 规则弹窗 -->
......@@ -188,11 +203,11 @@ import { computed, defineComponent, onMounted, reactive, toRefs } from "vue";
import { useRoute, useRouter } from "vue-router";
import { useStore } from "vuex";
import { Dialog, Button, Col, Row, Cell, List, Loading, Toast } from "vant";
import { Dialog, Button, Col, Row, Cell, List, Loading, Toast, Empty } from "vant";
import { BonusAccountResponse, WithdrawListParams, WithdrawListResponse } from "@/model/bonus";
import { bonusModel } from "@/server/api";
import { BonusAccountStatus, ErrCode } from "@/model/bonus/constant";
import { BonusAccountStatus, ErrCode, WithdrawStatus } from "@/model/bonus/constant";
import { bindWeChat, useNativeBridge, makeCall } from "@/util/use-native-bridge";
import { formatBonusTipTxt } from "@/util/formatBonusTipTxt";
import { bindWeiChat } from "@/server/api/bonus";
......@@ -222,6 +237,7 @@ const Bonus = defineComponent({
bonusAccount: null,
binding: false,
BonusAccountStatus,
WithdrawStatus,
withdrawList: []
});
const [sendNativeMessage] = useNativeBridge("test", function() {
......@@ -242,10 +258,12 @@ const Bonus = defineComponent({
pageNum: 1,
studentId: bonusStoreState.value.studentId
});
const onLoad = () => {
const onLoad = async () => {
state.loading = true;
bonusModel.getWithdrawList(withdrawListParams).then(res => {
const { hasNextPage, list, total } = res.data;
try {
const {
data: { hasNextPage, list, total }
} = await bonusModel.getWithdrawList(withdrawListParams);
if (!list || total === 0) {
state.finished = true;
return;
......@@ -254,7 +272,9 @@ const Bonus = defineComponent({
state.finished = !hasNextPage;
state.withdrawList = state.withdrawList.concat(list);
withdrawListParams.pageNum++;
});
} catch {
state.finished = true;
}
};
onMounted(() => {
const message = {
......@@ -337,7 +357,8 @@ const Bonus = defineComponent({
[Cell.name]: Cell,
[List.name]: List,
[Dialog.Component.name]: Dialog.Component,
[Loading.name]: Loading
[Loading.name]: Loading,
[Empty.name]: Empty
}
});
export default Bonus;
......
......@@ -180,8 +180,8 @@ const Withdraw = defineComponent({
state.withdrawableTotal = Number(withdrawableTotal);
state.withdrawAccount = withdrawAccount as string;
const formatter = value => {
if (value > state.withdrawAccount) {
return state.withdrawAccount;
if (value > state.withdrawableTotal) {
return state.withdrawableTotal.toFixed(2);
}
return value && Number(value).toFixed(2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment