149 lines
6.0 KiB
Vue
149 lines
6.0 KiB
Vue
<template>
|
||
<view>
|
||
<view class="header">
|
||
<view class="searchBox" :style="{ height: localHeight + 'px', paddingTop: top + 'px' }">
|
||
<view class="searchBox_left" @click="back">
|
||
<u-icon name="arrow-left" size="20px" color="#000"></u-icon>
|
||
</view>
|
||
<view class="searchBox_mid">{{ topVal }}</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 余额显示部分 -->
|
||
<view class="balance-container">
|
||
<view class="balance-content">
|
||
<view>
|
||
<view class="balance-title">{{ topVal }}(元)</view>
|
||
<view class="balance-amount">{{ balance }}</view>
|
||
<!-- <view v-if="topVal == '保证金'" class="balance-text">
|
||
去充值
|
||
</view> -->
|
||
<view class="balance-icon">
|
||
<image src="https://static.hshuishang.com//user_wallet2.png" mode="widthFix" />
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 变动记录 -->
|
||
<view class="records-container">
|
||
<!-- <view class="tabs" v-if="topVal == '保证金' && records.length > 0">
|
||
<view v-for="(item, index) in tabList" :key="index"
|
||
:class="['tabItem', selectedTab === item.id ? 'active2' : '']" @click="selectTab(index, item)">
|
||
{{ item.tabName }}
|
||
</view>
|
||
</view> -->
|
||
<view v-if="records.length == 0">
|
||
<view class="records-list">暂无变动记录</view>
|
||
</view>
|
||
<view class="records-list" v-else>
|
||
<view class="record-item" v-for="(record, index) in records" :key="index">
|
||
<view class="record-info">
|
||
<view class="record-name">{{ record.change_reason == 1 ? '下单' : '退单' }} - {{
|
||
record.related_order }}</view>
|
||
<view class="record-time">{{ record.change_time }}</view>
|
||
</view>
|
||
<view class="record-amount" v-if="topVal == '保证金'">
|
||
<view>
|
||
<text :class="['amount-sign', record.change_reason == 1 ? 'positive' : 'negative']">{{
|
||
record.change_reason == 1 ? '+' : '-' }}</text>
|
||
<text :class="['amount-value', record.change_reason == 1 ? 'positive' : 'negative']">¥{{
|
||
record.amount_change }}</text>
|
||
</view>
|
||
<view class="record-balance">余:¥{{ record.balance_after }}</view>
|
||
</view>
|
||
|
||
<view class="record-amount" v-else-if="topVal == '应收'">
|
||
<view :class="['amount-sign', record.change_reason == 1 ? 'positive' : 'negative']">{{
|
||
record.change_reason == 1 ? '收款' : '退款' }}</view>
|
||
<view>
|
||
<text :class="['amount-sign', record.change_reason == 1 ? 'positive' : 'negative']">{{
|
||
record.change_reason == 1 ? '+' : '-' }}</text>
|
||
<text :class="['amount-value', record.change_reason == 1 ? 'positive' : 'negative']">¥{{
|
||
record.amount_change }}</text>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="record-amount" v-else>
|
||
<view class="record-balance">手续费</view>
|
||
<view>
|
||
<text class="amount-sign">{{ record.change_reason == 1 ? '+' : '-' }}</text>
|
||
<text class="amount-sign">¥{{ record.amount_change }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
<script>
|
||
import { menuButtonInfo, NavgateTo, picUrl, request } from '../../../utils/index';
|
||
import { apiArr as walletApi } from '../../../api/wallet';
|
||
|
||
export default {
|
||
data() {
|
||
return {
|
||
top: "",
|
||
localHeight: "",
|
||
topVal: "",
|
||
balance: "",
|
||
records: [],
|
||
tabList: [
|
||
{
|
||
id: 0,
|
||
tabName: '全部'
|
||
},
|
||
{
|
||
id: 1,
|
||
tabName: '充值记录'
|
||
},
|
||
{
|
||
id: 2,
|
||
tabName: '消费记录'
|
||
}
|
||
],
|
||
selectedTab: 0,
|
||
merchant_id: "",
|
||
}
|
||
},
|
||
onLoad(options) {
|
||
const meun = menuButtonInfo();
|
||
this.top = meun.top;
|
||
this.localHeight = meun.height;
|
||
this.topVal = options.type == 1 ? '保证金' : (options.type == 2 ? '应收' : '手续费');
|
||
this.balance = options.amount;
|
||
this.merchant_id = options.merchant_id;
|
||
this.getWalletInfo();
|
||
},
|
||
methods: {
|
||
back() {
|
||
uni.navigateBack({
|
||
delta: 1
|
||
});
|
||
},
|
||
selectTab(index, item) {
|
||
this.selectedTab = item.id;
|
||
},
|
||
// 获取钱包信息
|
||
getWalletInfo() {
|
||
const params = {
|
||
merchant_id: this.merchant_id,
|
||
}
|
||
request(walletApi.walletChangeList, 'POST', params, { silent: false }).then(res => {
|
||
let filteredRows = res.rows;
|
||
if (this.topVal == '保证金') {
|
||
filteredRows = res.rows.filter(item => item.change_category == 5);
|
||
} else if (this.topVal == '应收') {
|
||
filteredRows = res.rows.filter(item => item.change_category == 2);
|
||
} else {
|
||
filteredRows = res.rows.filter(item => item.change_category == 3);
|
||
}
|
||
this.records = filteredRows;
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
<style>
|
||
@import url("./index.css");
|
||
</style> |