文件
yjyf/yjyf-app/pages/master/wallet.vue
YuanWen f60b2df7b3 style: 统一替换橙色渐变主题色并重构导航栏组件
- 新增 back-white.svg 和 home.svg 图标文件
- 重构 YjyfNavBar 组件,默认主题改为橙色,使用 SVG 图标
- 统一各页面导航栏为自定义组件,替换原生导航栏
- 调整所有页面背景色为 #F5F6F8,统一视觉风格
- 优化渐变背景为 135deg 线性渐变,消除分层断层
- 更新 pages.json 配置,所有页面使用自定义导航样式
2026-11-05 14:11:24 +08:00

210 行
7.6 KiB
Vue

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<template>
<view class="page">
<!-- 资产大卡(一体化沉浸大背景) -->
<view class="wallet-hero">
<YjyfNavBar theme="transparent" title="我的钱包" :fixed="false" />
<view class="wallet-body">
<view class="hero-top">
<text class="hero-lab">可提现余额(元)</text>
<view class="channel-tag">
<image class="wechat-ico" src="/static/icons/wechat.svg" mode="aspectFit" />
<text class="channel-txt">微信钱包快速到账</text>
</view>
</view>
<text class="hero-num">{{ income ? income.money : '0.00' }}</text>
<view class="hero-row">
<view class="income-badge">
<text class="badge-lab">今日收入</text>
<text class="badge-val">¥{{ income ? income.today_income : '0.00' }}</text>
</view>
<view class="income-badge">
<text class="badge-lab">累计入账</text>
<text class="badge-val">¥{{ income ? income.total_income : '0.00' }}</text>
</view>
</view>
<view class="withdraw-cta clickable-hover" @tap="openWithdraw">
申请提现
</view>
</view>
</view>
<!-- 结算须知 -->
<view class="tips">
提现通常 T+1 到账,手续费 0.6%;结算周期:客户验收核销后款项即刻入账。
</view>
<!-- 账单明细卡片 -->
<view class="card">
<view class="card-head">
<text class="card-title">收支账单明细</text>
<view class="filter-tabs">
<text class="ft-item" :class="{ on: filterType === 'all' }" @tap="filterType = 'all'">全部</text>
<text class="ft-item" :class="{ on: filterType === 'settle' }" @tap="filterType = 'settle'">结算</text>
<text class="ft-item" :class="{ on: filterType === 'withdraw' }" @tap="filterType = 'withdraw'">提现</text>
</view>
</view>
<view class="log-list" v-if="filteredLogs.length">
<view class="log" v-for="(l, i) in filteredLogs" :key="i">
<view class="log-l">
<text class="log-t">{{ logTypeText(l.type) }}</text>
<text class="log-r">{{ l.remark }}</text>
<text class="log-time">{{ timeText(l.createtime) }}</text>
</view>
<view class="log-r2">
<text class="log-amt" :class="{ minus: Number(l.amount) < 0 }">
{{ Number(l.amount) > 0 ? '+' : '' }}{{ l.amount }}
</text>
<text class="log-bal">余额 {{ l.balance }}</text>
</view>
</view>
</view>
<!-- 空状态 -->
<view class="empty-box" v-else>
<image class="empty-img" src="/static/icons/master/empty-orders.svg" mode="aspectFit" />
<text class="empty-txt">暂无明细记录</text>
</view>
</view>
<!-- 师傅端专属底部导航 -->
<YjyfMasterTabBar :current="3" />
</view>
</template>
<script setup>
import { ref, computed } from 'vue';
import { onShow, onPullDownRefresh } from '@dcloudio/uni-app';
import api from '@/utils/api.js';
import YjyfMasterTabBar from '@/components/YjyfMasterTabBar.vue';
const income = ref(null);
const logs = ref([]);
const filterType = ref('all');
const filteredLogs = computed(() => {
if (filterType.value === 'all') return logs.value;
return logs.value.filter(l => l.type === filterType.value);
});
function logTypeText(t) {
return { settle: '工单结算', withdraw: '提现出账', income: '其他收入', refund: '退款扣减' }[t] || '账单明细';
}
function timeText(ts) {
if (!ts) return '';
const d = new Date(Number(ts) * 1000);
const p = (n) => (n < 10 ? '0' + n : n);
return `${d.getMonth() + 1}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`;
}
async function load() {
try {
const res = await api.masterIncome();
income.value = res;
logs.value = res.logs || [];
} catch (e) {}
}
function openWithdraw() {
uni.showModal({
title: '申请提现到微信钱包',
editable: true,
placeholderText: '请输入提现金额(≥10 元)',
confirmText: '立即提现',
confirmColor: '#F0710D',
success: async (r) => {
if (!r.confirm) return;
const amount = Number(r.content);
if (!amount || amount < 10) {
uni.showToast({ title: '单次提现不少于 10 元', icon: 'none' });
return;
}
try {
const res = await api.masterWithdraw({ amount: amount, channel: 'wechat' });
uni.showToast({ title: '已提交,预计到账 ¥' + res.arrive_amount, icon: 'none' });
load();
} catch (e) {}
}
});
}
onShow(() => load());
onPullDownRefresh(async () => {
await load();
uni.stopPullDownRefresh();
});
</script>
<style scoped>
.page { min-height: 100vh; background: #F5F6F8; padding-bottom: 30rpx; }
/* 资产卡片 */
.wallet-hero {
padding-bottom: 32rpx; position: relative;
background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%);
display: flex; flex-direction: column;
}
.wallet-body { padding: 10rpx 30rpx 0; }
.hero-top { display: flex; align-items: center; justify-content: space-between; }
.hero-lab { font-size: 24rpx; color: rgba(255,255,255,.92); }
.channel-tag {
display: flex; align-items: center; padding: 4rpx 16rpx; border-radius: 20rpx;
background: rgba(255,255,255,0.22);
}
.wechat-ico { width: 24rpx; height: 24rpx; margin-right: 8rpx; }
.channel-txt { font-size: 20rpx; color: #fff; font-weight: 500; }
.hero-num { margin-top: 14rpx; font-size: 68rpx; font-weight: 700; color: #fff; letter-spacing: 1.5rpx; line-height: 1.1; }
.hero-row { display: flex; align-items: center; margin-top: 18rpx; }
.income-badge {
padding: 6rpx 18rpx; border-radius: 12rpx; background: rgba(255,255,255,0.18);
display: flex; align-items: center; margin-right: 16rpx;
}
.badge-lab { font-size: 20rpx; color: rgba(255,255,255,0.85); margin-right: 8rpx; }
.badge-val { font-size: 22rpx; font-weight: 700; color: #fff; }
.withdraw-cta {
margin-top: 24rpx; align-self: flex-start; height: 68rpx; padding: 0 44rpx;
display: flex; align-items: center; border-radius: 34rpx; background: #fff;
color: #E36B0C; font-size: 26rpx; font-weight: 700;
box-shadow: 0 6rpx 16rpx rgba(0,0,0,0.1);
}
.tips {
margin: 20rpx 24rpx 0; padding: 16rpx 20rpx; background: #FFF7F0;
border-radius: 14rpx; font-size: 22rpx; color: #C4580A; line-height: 32rpx;
}
/* 账单卡片 */
.card {
margin: 20rpx 24rpx 0; padding: 24rpx; background: #fff; border-radius: 20rpx;
box-shadow: 0 6rpx 20rpx rgba(240,129,31,.06);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8rpx; }
.card-title { font-size: 28rpx; font-weight: 700; color: #1F1F1F; }
.filter-tabs { display: flex; align-items: center; }
.ft-item {
padding: 4rpx 16rpx; margin-left: 8rpx; border-radius: 16rpx;
font-size: 22rpx; color: #9A9A9A;
}
.ft-item.on { background: #FFF3E6; color: #E36B0C; font-weight: 600; }
.log-list { display: flex; flex-direction: column; }
.log {
display: flex; align-items: center; justify-content: space-between;
padding: 20rpx 0; border-bottom: 1rpx solid #F4F4F4;
}
.log:last-of-type { border-bottom: none; }
.log-l { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.log-t { font-size: 26rpx; font-weight: 600; color: #2C2C2E; }
.log-r { margin-top: 4rpx; font-size: 22rpx; color: #8A8A8E; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.log-time { margin-top: 6rpx; font-size: 20rpx; color: #B0B0B0; }
.log-r2 { display: flex; flex-direction: column; align-items: flex-end; }
.log-amt { font-size: 32rpx; font-weight: 700; color: #2FA84F; }
.log-amt.minus { color: #E8331B; }
.log-bal { margin-top: 4rpx; font-size: 20rpx; color: #B0B0B0; }
.empty-box { display: flex; flex-direction: column; align-items: center; padding: 70rpx 0; }
.empty-img { width: 140rpx; height: 140rpx; margin-bottom: 16rpx; }
.empty-txt { font-size: 24rpx; color: #9A9A9A; }
</style>