Commit 1d2513ed authored by wykolor's avatar wykolor

feat: 提现记录接口对接

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