充值日志:接入完成

pull/29/head^2
YunaiV 2023-12-18 23:04:24 +08:00
parent 6584a70fa0
commit f8ea20060f
2 changed files with 54 additions and 48 deletions

View File

@ -1,47 +1,36 @@
<!-- 充值记录 -->
<template> <template>
<s-layout class="widthdraw-log-wrap" title="充值记录"> <s-layout class="widthdraw-log-wrap" title="充值记录">
<!-- 记录卡片 --> <!-- 记录卡片 -->
<view class="wallet-log-box ss-p-b-30"> <view class="wallet-log-box ss-p-b-30">
<view class="log-list" v-for="item in state.pagination.data" :key="item"> <view class="log-list" v-for="item in state.pagination.list" :key="item">
<view class="head ss-flex ss-col-center ss-row-between"> <view class="head ss-flex ss-col-center ss-row-between">
<view class="title">充值金额</view> <view class="title">充值金额</view>
<view <view class="num" :class="item.refundStatus === 10 ? 'danger-color' : 'success-color'">
class="num" {{ fen2yuan(item.payPrice) }}
:class=" <text v-if="item.bonusPrice > 0"> {{ fen2yuan(item.bonusPrice)}} </text>
item.status === -1 </view>
? 'danger-color'
: item.status === 2
? 'success-color'
: 'warning-color'
"
>{{ item.pay_fee }}</view
>
</view> </view>
<view class="status-box item ss-flex ss-col-center ss-row-between"> <view class="status-box item ss-flex ss-col-center ss-row-between">
<view class="item-title">支付状态</view> <view class="item-title">支付状态</view>
<view <view
class="status-text" class="status-text"
:class=" :class="item.refundStatus === 10 ? 'danger-color' : 'success-color'"
item.status === -1
? 'danger-color'
: item.status === 2
? 'success-color'
: 'warning-color'
"
>{{ item.status_text }}</view
> >
{{ item.refundStatus === 10 ? '已退款' : '已支付' }}
</view>
</view> </view>
<view class="time-box item ss-flex ss-col-center ss-row-between"> <view class="time-box item ss-flex ss-col-center ss-row-between">
<text class="item-title">充值渠道</text> <text class="item-title">充值渠道</text>
<view class="time ss-ellipsis-1">{{ item.platform_text }}</view> <view class="time ss-ellipsis-1">{{ item.payChannelName }}</view>
</view> </view>
<view class="time-box item ss-flex ss-col-center ss-row-between"> <view class="time-box item ss-flex ss-col-center ss-row-between">
<text class="item-title">充值单号</text> <text class="item-title">充值单号</text>
<view class="time"> {{ item.order_sn }} </view> <view class="time"> {{ item.payOrderChannelOrderNo }} </view>
</view> </view>
<view class="time-box item ss-flex ss-col-center ss-row-between"> <view class="time-box item ss-flex ss-col-center ss-row-between">
<text class="item-title">充值时间</text> <text class="item-title">充值时间</text>
<view class="time"> {{ item.paid_time }}</view> <view class="time"> {{ sheep.$helper.timeFormat(item.payTime, 'yyyy-mm-dd hh:MM:ss') }}</view>
</view> </view>
</view> </view>
</view> </view>
@ -49,59 +38,64 @@
v-if="state.pagination.total === 0" v-if="state.pagination.total === 0"
icon="/static/comment-empty.png" icon="/static/comment-empty.png"
text="暂无充值记录" text="暂无充值记录"
></s-empty> />
<uni-load-more <uni-load-more
v-if="state.pagination.total > 0" v-if="state.pagination.total > 0"
:status="state.loadStatus" :status="state.loadStatus"
:content-text="{ :content-text="{
contentdown: '上拉加载更多', contentdown: '上拉加载更多',
}" }"
@tap="loadmore" @tap="loadMore"
/> />
</s-layout> </s-layout>
</template> </template>
<script setup> <script setup>
import { reactive } from 'vue'; import { reactive } from 'vue';
import sheep from '@/sheep';
import { onLoad, onReachBottom } from '@dcloudio/uni-app'; import { onLoad, onReachBottom } from '@dcloudio/uni-app';
import _ from 'lodash'; import _ from 'lodash';
import PayWalletApi from '@/sheep/api/pay/wallet';
import sheep from '@/sheep';
import { fen2yuan } from '../../sheep/hooks/useGoods';
const state = reactive({ const state = reactive({
currentTab: 0,
pagination: { pagination: {
data: [], list: [],
current_page: 1, total: 0,
total: 1, pageNo: 1,
last_page: 1, pageSize: 5,
}, },
loadStatus: '', loadStatus: '',
}); });
async function getLogList(page = 1, list_rows = 5) { async function getLogList(page = 1, list_rows = 5) {
const res = await sheep.$api.trade.orderLog({ type: 'recharge', list_rows, page }); const { code, data } = await PayWalletApi.getWalletRechargePage({
if (res.error === 0) { pageNo: page,
let logList = _.concat(state.pagination.data, res.data.data); pageSize: list_rows,
state.pagination = { });
...res.data, if (code !== 0) {
data: logList, return;
};
if (state.pagination.current_page < state.pagination.last_page) {
state.loadStatus = 'more';
} else {
state.loadStatus = 'noMore';
}
} }
state.pagination.list = _.concat(state.pagination.list, data.list);
state.pagination.total = data.total;
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
} }
// //
function loadmore() { function loadMore() {
if (state.loadStatus !== 'noMore') { if (state.loadStatus === 'noMore') {
getLogList(state.pagination.current_page + 1); return;
} }
state.pagination.pageNo++;
getLogList();
} }
onLoad(() => { onLoad(() => {
getLogList(); getLogList();
}); });
onReachBottom(() => { onReachBottom(() => {
loadmore(); loadMore();
}); });
</script> </script>

View File

@ -39,7 +39,19 @@ const PayWalletApi = {
method: 'POST', method: 'POST',
data, data,
}); });
} },
// 获得钱包充值记录分页
getWalletRechargePage: (params) => {
return request({
url: '/app-api/pay/wallet-recharge/page',
method: 'GET',
params,
custom: {
showError: false,
showLoading: false,
},
});
},
}; };
export default PayWalletApi; export default PayWalletApi;