- 新增账号安全页面及支付密码验证组件 - 新增用户类型选择流程及商家资质管理 - 新增订单资质校验逻辑,师傅需满足订单证书要求 - 新增企业资质认证相关数据库表及接口 - 优化用户列表展示,区分个人与商家用户类型
1286 行
32 KiB
Vue
1286 行
32 KiB
Vue
<template>
|
||
<view class="workbench-view">
|
||
<!-- 1. 顶部统一固定吸顶导航栏 -->
|
||
<YjyfNavBar theme="orange" title="师傅工作台" :fixed="true" :placeholder="true" />
|
||
|
||
<YjyfRefreshScroll
|
||
class="workbench-scroll"
|
||
theme="orange"
|
||
:nav-offset="navHeight"
|
||
:refresh-task="load"
|
||
>
|
||
<!-- 首屏加载骨架屏(杜绝空白闪烁或假数据兜底闪现) -->
|
||
<view v-if="initialLoading" class="skeleton-wrap">
|
||
<view class="skeleton-hero">
|
||
<view class="sk-user-row">
|
||
<view class="sk-avatar sk-shimmer"></view>
|
||
<view class="sk-user-lines">
|
||
<view class="sk-line sk-line-lg sk-shimmer"></view>
|
||
<view class="sk-line sk-line-sm sk-shimmer"></view>
|
||
</view>
|
||
<view class="sk-pill sk-shimmer"></view>
|
||
</view>
|
||
<view class="sk-asset-card sk-shimmer"></view>
|
||
</view>
|
||
<view class="skeleton-body">
|
||
<view class="sk-card">
|
||
<view class="sk-row sk-shimmer" v-for="n in 4" :key="n"></view>
|
||
</view>
|
||
<view class="sk-card">
|
||
<view class="sk-row sk-shimmer" v-for="n in 3" :key="'b' + n"></view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 首次加载失败异常态 -->
|
||
<view v-else-if="loadError && !info" class="error-state-wrap">
|
||
<view class="error-card">
|
||
<image class="error-ico" src="/static/icons/master/workbench-error.svg" mode="aspectFit" />
|
||
<text class="error-title">工作台信息加载失败</text>
|
||
<text class="error-desc">{{ loadError }}</text>
|
||
<view class="retry-btn clickable-hover" @tap="load(true)">
|
||
<text class="retry-btn-txt">重新加载</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 正常业务视图 -->
|
||
<template v-else>
|
||
<!-- 师傅顶部名片区(与导航栏共享连续渐变) -->
|
||
<view class="profile-hero" :style="{ backgroundPosition: '0 -' + navHeight + 'px' }">
|
||
<view class="hero-body">
|
||
<view class="user-block">
|
||
<view class="avatar-wrap clickable-hover" @tap="go('/pages/master/apply')">
|
||
<view class="avatar-clip">
|
||
<image class="avatar-img" :src="(info && info.avatar) || '/static/icons/avatar-master.svg'" mode="aspectFill" />
|
||
</view>
|
||
<view class="v-auth-badge">
|
||
<image class="v-badge-ico" src="/static/icons/v-auth.svg" mode="aspectFit" />
|
||
<text class="v-badge-txt">{{ verifyStatusMeta.text }}</text>
|
||
</view>
|
||
</view>
|
||
<view class="user-meta">
|
||
<view class="name-row">
|
||
<text class="user-name">{{ masterTitleName }}</text>
|
||
<text class="user-phone-tag" v-if="maskedMobile">{{ maskedMobile }}</text>
|
||
</view>
|
||
<text class="user-level" v-if="info">
|
||
评分 {{ scoreText }} · 完单 {{ info.order_count || 0 }}
|
||
</text>
|
||
</view>
|
||
<view
|
||
class="status-pill clickable-hover"
|
||
:class="{ off: info && info.work_status === 'off' }"
|
||
@tap="toggleWork"
|
||
>
|
||
<view class="status-dot"></view>
|
||
<text class="status-txt">{{ info && info.work_status === 'off' ? '暂停接单' : '听单中' }}</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 2. 资产工钱大卡 -->
|
||
<view class="assets-box">
|
||
<view class="asset-top">
|
||
<text class="asset-title">可提现工钱(元)</text>
|
||
<view class="bill-link clickable-hover" @tap="go('/pages/master/wallet')">
|
||
<text class="bill-txt">账单明细</text>
|
||
<image class="arrow-ico" src="/static/icons/arrow-right-white.svg" mode="aspectFit" />
|
||
</view>
|
||
</view>
|
||
<view class="asset-main">
|
||
<text class="asset-val">{{ availableMoneyText }}</text>
|
||
<view class="withdraw-btn clickable-hover" @tap="go('/pages/master/wallet')">
|
||
<text class="withdraw-btn-txt">去提现</text>
|
||
</view>
|
||
</view>
|
||
<view class="asset-sub">
|
||
<text class="sub-item">今日 ¥{{ todayIncome }}</text>
|
||
<text class="sub-divider">|</text>
|
||
<text class="sub-item">累计 ¥{{ totalIncome }}</text>
|
||
<template v-if="hasFrozenMoney">
|
||
<text class="sub-divider">|</text>
|
||
<text class="sub-item">待结算 ¥{{ frozenMoneyText }}</text>
|
||
</template>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="page-body">
|
||
<!-- 3. 接单与评价核心菜单组 -->
|
||
<view class="menu-card">
|
||
<view class="menu-item clickable-hover" @tap="goOrdersTab">
|
||
<view class="mi-left">
|
||
<image class="mi-ico" src="/static/icons/master/menu-orders.svg" mode="aspectFit" />
|
||
<text class="mi-title">接单管理</text>
|
||
</view>
|
||
<view class="mi-right">
|
||
<text class="mi-badge" v-if="info && info.todo_count > 0">{{ info.todo_count }} 待办</text>
|
||
<image class="mi-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
|
||
</view>
|
||
</view>
|
||
|
||
<view class="menu-item clickable-hover" @tap="go('/pages/master/quote')">
|
||
<view class="mi-left">
|
||
<image class="mi-ico" src="/static/icons/master/menu-quote.svg" mode="aspectFit" />
|
||
<text class="mi-title">报价管理</text>
|
||
</view>
|
||
<view class="mi-right">
|
||
<image class="mi-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
|
||
</view>
|
||
</view>
|
||
|
||
<view class="menu-item clickable-hover" @tap="go('/pages/master/reviews')">
|
||
<view class="mi-left">
|
||
<image class="mi-ico" src="/static/icons/master/menu-review.svg" mode="aspectFit" />
|
||
<text class="mi-title">客户评价</text>
|
||
</view>
|
||
<view class="mi-right">
|
||
<text class="mi-tip" v-if="credit">{{ credit.review_total || 0 }} 条</text>
|
||
<image class="mi-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
|
||
</view>
|
||
</view>
|
||
|
||
<view class="menu-item clickable-hover" @tap="go('/pages/master/credit')">
|
||
<view class="mi-left">
|
||
<image class="mi-ico" src="/static/icons/master/menu-credit.svg" mode="aspectFit" />
|
||
<text class="mi-title">信用与申诉</text>
|
||
</view>
|
||
<view class="mi-right">
|
||
<text class="mi-tip" v-if="credit">好评 {{ credit.good_rate }}%</text>
|
||
<image class="mi-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 4. 服务技能区(支持逗号串自动拆分、限宽省略及多标签折叠收起) -->
|
||
<view class="card">
|
||
<view class="card-head clickable-hover" @tap="goSkills">
|
||
<text class="card-title">服务技能</text>
|
||
<view class="card-edit-action">
|
||
<text class="card-tip" v-if="normalizedSkills.length > 0">{{ normalizedSkills.length }} 项</text>
|
||
<text class="card-edit-txt">管理</text>
|
||
<image class="card-edit-arrow" src="/static/icons/arrow-right-orange.svg" mode="aspectFit" />
|
||
</view>
|
||
</view>
|
||
<view class="skills-box" @tap="goSkills">
|
||
<view
|
||
class="skill-tag"
|
||
v-for="tag in visibleSkills"
|
||
:key="tag"
|
||
>
|
||
<text class="skill-tag-txt">{{ tag }}</text>
|
||
</view>
|
||
<view
|
||
v-if="hasOverflowSkills"
|
||
class="skill-toggle-btn clickable-hover"
|
||
@tap.stop="toggleSkillsExpand"
|
||
>
|
||
<text class="skill-toggle-txt">
|
||
{{ skillsExpanded ? '收起' : `+${hiddenSkillCount}` }}
|
||
</text>
|
||
<image
|
||
class="skill-toggle-ico"
|
||
:class="{ expanded: skillsExpanded }"
|
||
src="/static/icons/master/skill-toggle.svg"
|
||
mode="aspectFit"
|
||
/>
|
||
</view>
|
||
<view class="skill-tag empty" v-if="!normalizedSkills.length">
|
||
<text class="skill-tag-txt empty-txt">去设置服务技能</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 5. 资质与平台支持菜单组 -->
|
||
<view class="menu-card">
|
||
<view class="menu-item clickable-hover" @tap="go('/pages/master/apply')">
|
||
<view class="mi-left">
|
||
<image class="mi-ico" src="/static/icons/master/menu-auth.svg" mode="aspectFit" />
|
||
<text class="mi-title">实名认证</text>
|
||
</view>
|
||
<view class="mi-right">
|
||
<text class="mi-tip" :class="verifyStatusMeta.cls">{{ verifyStatusMeta.text }}</text>
|
||
<image class="mi-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
|
||
</view>
|
||
</view>
|
||
|
||
<view class="menu-item clickable-hover" @tap="go('/pages/master/certs')">
|
||
<view class="mi-left">
|
||
<image class="mi-ico" src="/static/icons/master/menu-cert.svg" mode="aspectFit" />
|
||
<text class="mi-title">技能证书</text>
|
||
</view>
|
||
<view class="mi-right">
|
||
<text class="mi-tip" :class="certStatusMeta.cls">{{ certStatusMeta.text }}</text>
|
||
<image class="mi-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
|
||
</view>
|
||
</view>
|
||
|
||
<view class="menu-item clickable-hover" @tap="callService">
|
||
<view class="mi-left">
|
||
<image class="mi-ico" src="/static/icons/master/menu-service.svg" mode="aspectFit" />
|
||
<text class="mi-title">联系客服</text>
|
||
</view>
|
||
<view class="mi-right">
|
||
<text class="mi-tip" v-if="servicePhone">{{ servicePhone }}</text>
|
||
<image class="mi-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
|
||
</view>
|
||
</view>
|
||
|
||
<view class="menu-item clickable-hover" @tap="go('/pages/mine/security')">
|
||
<view class="mi-left"><image class="mi-ico" src="/static/icons/master/menu-account-security.svg" mode="aspectFit" /><text class="mi-title">账号安全</text></view>
|
||
<view class="mi-right"><image class="mi-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" /></view>
|
||
</view>
|
||
<view class="menu-item clickable-hover" @tap="openAgreementPicker">
|
||
<view class="mi-left">
|
||
<image class="mi-ico" src="/static/icons/master/menu-agreement.svg" mode="aspectFit" />
|
||
<text class="mi-title">协议与规则</text>
|
||
</view>
|
||
<view class="mi-right">
|
||
<image class="mi-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 6. 身份切换通道 -->
|
||
<view class="switch-role-card clickable-hover" @tap="backToUser">
|
||
<view class="src-left">
|
||
<image class="src-ico" src="/static/icons/master/role-switch-orange.svg" mode="aspectFit" />
|
||
<view class="src-text">
|
||
<text class="src-title">切换业主端</text>
|
||
<text class="src-desc">发布安装维修需求</text>
|
||
</view>
|
||
</view>
|
||
<image class="src-arrow" src="/static/icons/arrow-right-orange.svg" mode="aspectFit" />
|
||
</view>
|
||
|
||
<!-- 7. 账号退出操作 -->
|
||
<view class="logout-action clickable-hover" @tap="logout">
|
||
<text class="logout-txt">退出登录</text>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
</YjyfRefreshScroll>
|
||
<YjyfServicePopup :visible="servicePopupVisible" @update:visible="servicePopupVisible = $event" />
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { ref, computed, onMounted } from 'vue';
|
||
import api from '@/utils/api.js';
|
||
import { isLogin, toLogin, clearAuth } from '@/utils/request.js';
|
||
import { setRole } from '@/utils/role.js';
|
||
import { getNavBarMetrics } from '@/utils/system.js';
|
||
import YjyfNavBar from '@/components/YjyfNavBar.vue';
|
||
import YjyfRefreshScroll from '@/components/YjyfRefreshScroll.vue';
|
||
import YjyfServicePopup from '@/components/YjyfServicePopup.vue';
|
||
|
||
const emit = defineEmits(['switch-tab']);
|
||
const MAX_VISIBLE_SKILLS = 8;
|
||
|
||
const navHeight = ref(getNavBarMetrics().totalNavHeight);
|
||
const loading = ref(false);
|
||
const loadError = ref('');
|
||
const info = ref(null);
|
||
const credit = ref(null);
|
||
const skills = ref([]);
|
||
const certSummary = ref(null);
|
||
const skillsExpanded = ref(false);
|
||
const todayIncome = ref('0.00');
|
||
const totalIncome = ref('0.00');
|
||
const servicePhone = ref(uni.getStorageSync('yjyf_service_phone') || '');
|
||
|
||
let loadSeq = 0;
|
||
|
||
const initialLoading = computed(() => loading.value && !info.value);
|
||
|
||
const masterTitleName = computed(() => {
|
||
if (!info.value) return '';
|
||
const rn = String(info.value.realname || '').trim();
|
||
if (!rn) return '认证师傅';
|
||
if (rn.indexOf('师傅') > -1) return rn;
|
||
return rn.slice(0, 1) + '师傅';
|
||
});
|
||
|
||
const maskedMobile = computed(() => {
|
||
if (!info.value || !info.value.mobile) return '';
|
||
const m = String(info.value.mobile).trim();
|
||
if (m.length >= 11) {
|
||
return m.slice(0, 3) + '****' + m.slice(7);
|
||
}
|
||
return m;
|
||
});
|
||
|
||
const scoreText = computed(() => {
|
||
const raw = info.value ? Number(info.value.score) : 0;
|
||
return Number.isFinite(raw) ? raw.toFixed(1) : '0.0';
|
||
});
|
||
|
||
const availableMoneyText = computed(() => {
|
||
const raw = info.value ? Number(info.value.money) : 0;
|
||
return Number.isFinite(raw) ? raw.toFixed(2) : '0.00';
|
||
});
|
||
|
||
const hasFrozenMoney = computed(() => {
|
||
return !!(info.value && Number(info.value.frozen_money) > 0);
|
||
});
|
||
|
||
const frozenMoneyText = computed(() => {
|
||
const raw = info.value ? Number(info.value.frozen_money) : 0;
|
||
return Number.isFinite(raw) ? raw.toFixed(2) : '0.00';
|
||
});
|
||
|
||
const verifyStatusMeta = computed(() => {
|
||
const status = info.value ? info.value.verify_status : '';
|
||
if (status === 'pass') return { text: '已认证', cls: 'is-success' };
|
||
if (status === 'pending') return { text: '审核中', cls: 'is-warning' };
|
||
if (status === 'reject') return { text: '未通过', cls: 'is-danger' };
|
||
return { text: '', cls: '' };
|
||
});
|
||
|
||
const certStatusMeta = computed(() => {
|
||
const s = certSummary.value;
|
||
if (!s) return { text: '', cls: '' };
|
||
const passed = Number(s.passed || 0);
|
||
const pending = Number(s.pending || 0);
|
||
const rejected = Number(s.rejected || 0);
|
||
if (passed > 0 && pending > 0) {
|
||
return { text: `已认证 ${passed} 项 · 审核中 ${pending}`, cls: 'is-success' };
|
||
}
|
||
if (passed > 0) {
|
||
return { text: `已认证 ${passed} 项`, cls: 'is-success' };
|
||
}
|
||
if (pending > 0) {
|
||
return { text: `审核中 (${pending})`, cls: 'is-warning' };
|
||
}
|
||
if (rejected > 0) {
|
||
return { text: `未通过 (${rejected})`, cls: 'is-danger' };
|
||
}
|
||
return { text: '上传证书展示专业资质', cls: 'is-warning' };
|
||
});
|
||
|
||
/**
|
||
* 规范化技能展示:兼容拆解历史逗号拼串(如 "家具,卫浴,水电工")并去重
|
||
*/
|
||
const normalizedSkills = computed(() => {
|
||
const list = Array.isArray(skills.value) ? skills.value : [];
|
||
const seen = new Set();
|
||
const out = [];
|
||
for (let i = 0; i < list.length; i++) {
|
||
const rawName = String((list[i] && list[i].name) || '').trim();
|
||
if (!rawName) continue;
|
||
const parts = rawName.split(/[,,]+/);
|
||
for (let j = 0; j < parts.length; j++) {
|
||
const tag = parts[j].trim();
|
||
if (tag && !seen.has(tag)) {
|
||
seen.add(tag);
|
||
out.push(tag);
|
||
}
|
||
}
|
||
}
|
||
return out;
|
||
});
|
||
|
||
const hasOverflowSkills = computed(() => normalizedSkills.value.length > MAX_VISIBLE_SKILLS);
|
||
|
||
const hiddenSkillCount = computed(() => {
|
||
return Math.max(0, normalizedSkills.value.length - MAX_VISIBLE_SKILLS);
|
||
});
|
||
|
||
const visibleSkills = computed(() => {
|
||
if (skillsExpanded.value || !hasOverflowSkills.value) {
|
||
return normalizedSkills.value;
|
||
}
|
||
return normalizedSkills.value.slice(0, MAX_VISIBLE_SKILLS);
|
||
});
|
||
|
||
function toggleSkillsExpand() {
|
||
skillsExpanded.value = !skillsExpanded.value;
|
||
}
|
||
|
||
function go(url) {
|
||
uni.navigateTo({ url });
|
||
}
|
||
|
||
function goOrdersTab() {
|
||
uni.redirectTo({
|
||
url: '/pages/master/orders',
|
||
fail: () => uni.navigateTo({ url: '/pages/master/orders' })
|
||
});
|
||
}
|
||
|
||
function goSkills() {
|
||
uni.navigateTo({ url: '/pages/master/skills' });
|
||
}
|
||
|
||
const servicePopupVisible = ref(false);
|
||
|
||
function callService() {
|
||
servicePopupVisible.value = true;
|
||
}
|
||
|
||
function openAgreementPicker() {
|
||
const items = [
|
||
{ label: '师傅服务协议', type: 'master' },
|
||
{ label: '用户服务协议', type: 'user_service' },
|
||
{ label: '隐私保护指引', type: 'privacy' }
|
||
];
|
||
uni.showActionSheet({
|
||
itemList: items.map((i) => i.label),
|
||
success: (res) => {
|
||
const picked = items[res.tapIndex];
|
||
if (!picked) return;
|
||
uni.navigateTo({
|
||
url: `/pages/agreement/detail?type=${encodeURIComponent(picked.type)}&title=${encodeURIComponent(picked.label)}`
|
||
});
|
||
}
|
||
});
|
||
}
|
||
|
||
async function load(forceSpinner = false) {
|
||
if (!isLogin()) {
|
||
toLogin();
|
||
return;
|
||
}
|
||
const seq = ++loadSeq;
|
||
if (!info.value || forceSpinner) {
|
||
loading.value = true;
|
||
}
|
||
loadError.value = '';
|
||
|
||
try {
|
||
const [infoRes, incomeRes, creditRes] = await Promise.allSettled([
|
||
api.masterInfo(),
|
||
api.masterIncome(),
|
||
api.masterCredit()
|
||
]);
|
||
if (seq !== loadSeq) return;
|
||
|
||
if (infoRes.status === 'fulfilled' && infoRes.value) {
|
||
const res = infoRes.value;
|
||
if (!res.applied || !res.master) {
|
||
uni.redirectTo({ url: '/pages/master/apply' });
|
||
return;
|
||
}
|
||
info.value = res.master;
|
||
skills.value = res.skills || [];
|
||
certSummary.value = res.cert_summary || null;
|
||
} else if (!info.value) {
|
||
const reason = infoRes.status === 'rejected' ? infoRes.reason : null;
|
||
loadError.value = (reason && (reason.msg || reason.message)) || '网络异常,请稍后重试';
|
||
return;
|
||
}
|
||
|
||
if (incomeRes.status === 'fulfilled' && incomeRes.value) {
|
||
const inc = incomeRes.value;
|
||
todayIncome.value = Number(inc.today_income || 0).toFixed(2);
|
||
totalIncome.value = Number(inc.total_income || 0).toFixed(2);
|
||
} else if (incomeRes.status === 'rejected') {
|
||
console.warn('获取收入统计失败', incomeRes.reason);
|
||
}
|
||
|
||
if (creditRes.status === 'fulfilled' && creditRes.value) {
|
||
credit.value = creditRes.value;
|
||
} else if (creditRes.status === 'rejected') {
|
||
console.warn('获取信用信息失败', creditRes.reason);
|
||
}
|
||
|
||
if (!servicePhone.value) {
|
||
api.home({ silent: true })
|
||
.then((h) => {
|
||
if (seq !== loadSeq) return;
|
||
if (h && h.service_phone) {
|
||
servicePhone.value = String(h.service_phone).trim();
|
||
uni.setStorageSync('yjyf_service_phone', servicePhone.value);
|
||
}
|
||
})
|
||
.catch((err) => {
|
||
console.warn('获取平台客服电话失败', err);
|
||
});
|
||
}
|
||
} catch (e) {
|
||
if (seq === loadSeq && !info.value) {
|
||
loadError.value = (e && (e.msg || e.message)) || '网络异常,请稍后重试';
|
||
}
|
||
} finally {
|
||
if (seq === loadSeq) {
|
||
loading.value = false;
|
||
}
|
||
}
|
||
}
|
||
|
||
const togglingWork = ref(false);
|
||
const switchingRole = ref(false);
|
||
|
||
async function toggleWork() {
|
||
if (!info.value || togglingWork.value) return;
|
||
togglingWork.value = true;
|
||
const next = info.value.work_status === 'off' ? 'on' : 'off';
|
||
try {
|
||
await api.masterToggle({ work_status: next });
|
||
info.value.work_status = next;
|
||
uni.showToast({ title: next === 'on' ? '已开启听单' : '已暂停接单', icon: 'none' });
|
||
} catch (e) {
|
||
uni.showToast({ title: (e && e.msg) || '切换状态失败', icon: 'none' });
|
||
} finally {
|
||
togglingWork.value = false;
|
||
}
|
||
}
|
||
|
||
function backToUser() {
|
||
if (switchingRole.value) return;
|
||
switchingRole.value = true;
|
||
api.switchRole({ role: 'user' })
|
||
.then((res) => {
|
||
setRole('user');
|
||
uni.reLaunch({ url: (res && res.redirect) || '/pages/index/index' });
|
||
setTimeout(() => {
|
||
switchingRole.value = false;
|
||
}, 500);
|
||
})
|
||
.catch((e) => {
|
||
switchingRole.value = false;
|
||
uni.showToast({ title: (e && e.msg) || '切换失败,请重试', icon: 'none' });
|
||
});
|
||
}
|
||
|
||
function logout() {
|
||
uni.showModal({
|
||
title: '提示',
|
||
content: '确认退出当前账号?',
|
||
confirmColor: '#F0710D',
|
||
success: (r) => {
|
||
if (!r.confirm) return;
|
||
clearAuth();
|
||
setRole('user');
|
||
uni.reLaunch({ url: '/pages/login/login' });
|
||
}
|
||
});
|
||
}
|
||
|
||
onMounted(() => {
|
||
navHeight.value = getNavBarMetrics().totalNavHeight;
|
||
load();
|
||
});
|
||
|
||
defineExpose({
|
||
load
|
||
});
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.workbench-view {
|
||
height: calc(100vh - 104rpx - constant(safe-area-inset-bottom));
|
||
height: calc(100vh - 104rpx - env(safe-area-inset-bottom));
|
||
display: flex;
|
||
flex-direction: column;
|
||
overflow: hidden;
|
||
width: 100%;
|
||
box-sizing: border-box;
|
||
background: $yjyf-bg-page;
|
||
}
|
||
|
||
.workbench-scroll {
|
||
flex: 1;
|
||
height: 0;
|
||
width: 100%;
|
||
}
|
||
|
||
/* ---------- 骨架屏态 ---------- */
|
||
.skeleton-hero {
|
||
padding: $yjyf-space-md $yjyf-space-md $yjyf-space-lg;
|
||
background: $yjyf-gradient-primary;
|
||
border-bottom-left-radius: $yjyf-space-lg;
|
||
border-bottom-right-radius: $yjyf-space-lg;
|
||
}
|
||
|
||
.sk-user-row {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.sk-avatar {
|
||
width: 112rpx;
|
||
height: 112rpx;
|
||
border-radius: 56rpx;
|
||
background: rgba(255, 255, 255, 0.28);
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.sk-user-lines {
|
||
flex: 1;
|
||
margin-left: $yjyf-space-md;
|
||
}
|
||
|
||
.sk-line {
|
||
height: 28rpx;
|
||
border-radius: $yjyf-radius-sm;
|
||
background: rgba(255, 255, 255, 0.28);
|
||
}
|
||
|
||
.sk-line-lg {
|
||
width: 240rpx;
|
||
height: 36rpx;
|
||
}
|
||
|
||
.sk-line-sm {
|
||
width: 180rpx;
|
||
margin-top: $yjyf-space-sm;
|
||
}
|
||
|
||
.sk-pill {
|
||
width: 128rpx;
|
||
height: 56rpx;
|
||
border-radius: 28rpx;
|
||
background: rgba(255, 255, 255, 0.28);
|
||
}
|
||
|
||
.sk-asset-card {
|
||
margin-top: $yjyf-space-lg;
|
||
height: 200rpx;
|
||
border-radius: $yjyf-radius-lg;
|
||
background: rgba(255, 255, 255, 0.22);
|
||
}
|
||
|
||
.skeleton-body {
|
||
padding: $yjyf-space-md;
|
||
}
|
||
|
||
.sk-card {
|
||
background: $yjyf-bg-card;
|
||
border-radius: $yjyf-radius-lg;
|
||
padding: $yjyf-space-sm $yjyf-space-md;
|
||
margin-bottom: $yjyf-space-md;
|
||
}
|
||
|
||
.sk-row {
|
||
height: 40rpx;
|
||
margin: $yjyf-space-md 0;
|
||
border-radius: $yjyf-radius-sm;
|
||
background: #F0F1F4;
|
||
}
|
||
|
||
.sk-shimmer {
|
||
animation: skPulse 1.4s ease-in-out infinite;
|
||
}
|
||
|
||
@keyframes skPulse {
|
||
0%, 100% { opacity: 1; }
|
||
50% { opacity: 0.55; }
|
||
}
|
||
|
||
/* ---------- 错误异常态 ---------- */
|
||
.error-state-wrap {
|
||
padding: $yjyf-space-xl $yjyf-space-md;
|
||
}
|
||
|
||
.error-card {
|
||
background: $yjyf-bg-card;
|
||
border-radius: $yjyf-radius-card;
|
||
padding: $yjyf-space-xl $yjyf-space-lg;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
box-shadow: $yjyf-shadow-card;
|
||
}
|
||
|
||
.error-ico {
|
||
width: 160rpx;
|
||
height: 160rpx;
|
||
}
|
||
|
||
.error-title {
|
||
margin-top: $yjyf-space-md;
|
||
font-size: $yjyf-font-title;
|
||
font-weight: 700;
|
||
color: $yjyf-text-main;
|
||
}
|
||
|
||
.error-desc {
|
||
margin-top: $yjyf-space-xs;
|
||
font-size: $yjyf-font-sub;
|
||
color: $yjyf-text-secondary;
|
||
text-align: center;
|
||
}
|
||
|
||
.retry-btn {
|
||
margin-top: $yjyf-space-lg;
|
||
height: 76rpx;
|
||
padding: 0 $yjyf-space-xl;
|
||
border-radius: $yjyf-radius-pill;
|
||
background: $yjyf-gradient-primary;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
box-shadow: $yjyf-shadow-button;
|
||
}
|
||
|
||
.retry-btn-txt {
|
||
font-size: $yjyf-font-body;
|
||
font-weight: 600;
|
||
color: #FFFFFF;
|
||
}
|
||
|
||
/* ---------- 顶部名片区 ---------- */
|
||
.profile-hero {
|
||
position: relative;
|
||
overflow: hidden;
|
||
padding-bottom: $yjyf-space-lg;
|
||
background-color: $yjyf-primary;
|
||
background-image: $yjyf-gradient-primary;
|
||
background-size: 100% 600rpx;
|
||
background-position: 0 0;
|
||
background-repeat: no-repeat;
|
||
border-bottom-left-radius: $yjyf-space-lg;
|
||
border-bottom-right-radius: $yjyf-space-lg;
|
||
}
|
||
|
||
.hero-body {
|
||
position: relative;
|
||
z-index: 2;
|
||
padding: $yjyf-space-sm $yjyf-space-md 0;
|
||
}
|
||
|
||
.user-block {
|
||
position: relative;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
.avatar-wrap {
|
||
width: 112rpx;
|
||
height: 112rpx;
|
||
border-radius: 56rpx;
|
||
background: $yjyf-bg-card;
|
||
border: 4rpx solid $yjyf-primary-light;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
flex-shrink: 0;
|
||
box-shadow: 0 4rpx 14rpx rgba(0, 0, 0, 0.12);
|
||
position: relative;
|
||
}
|
||
|
||
.avatar-clip {
|
||
width: 100%;
|
||
height: 100%;
|
||
border-radius: 50%;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.avatar-img {
|
||
display: block;
|
||
width: 100%;
|
||
height: 100%;
|
||
border-radius: 50%;
|
||
}
|
||
|
||
.v-auth-badge {
|
||
position: absolute;
|
||
bottom: -14rpx;
|
||
left: 50%;
|
||
transform: translateX(-50%);
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: max-content;
|
||
min-width: 112rpx;
|
||
height: 36rpx;
|
||
padding: 0 12rpx 0 8rpx;
|
||
background: #FFF5E5;
|
||
border: 1rpx solid #FFD39B;
|
||
border-radius: 18rpx;
|
||
box-shadow: 0 2rpx 6rpx rgba(240, 113, 13, 0.2);
|
||
box-sizing: border-box;
|
||
white-space: nowrap;
|
||
z-index: 5;
|
||
}
|
||
|
||
.v-badge-ico {
|
||
width: 24rpx;
|
||
height: 24rpx;
|
||
margin-right: 4rpx;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.v-badge-txt {
|
||
font-size: $yjyf-font-micro;
|
||
font-weight: 700;
|
||
color: #D86209;
|
||
line-height: 1;
|
||
white-space: nowrap;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.user-meta {
|
||
flex: 1;
|
||
min-width: 0;
|
||
margin-left: $yjyf-space-md;
|
||
}
|
||
|
||
.name-row {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: $yjyf-space-sm;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.user-name {
|
||
font-size: 36rpx;
|
||
font-weight: 700;
|
||
color: #FFFFFF;
|
||
letter-spacing: 1rpx;
|
||
}
|
||
|
||
.user-phone-tag {
|
||
font-size: $yjyf-font-micro;
|
||
color: rgba(255, 255, 255, 0.95);
|
||
background: rgba(255, 255, 255, 0.22);
|
||
padding: 4rpx 12rpx;
|
||
border-radius: $yjyf-radius-sm;
|
||
font-variant-numeric: tabular-nums;
|
||
}
|
||
|
||
.user-level {
|
||
display: block;
|
||
margin-top: $yjyf-space-xs;
|
||
font-size: $yjyf-font-micro;
|
||
color: rgba(255, 255, 255, 0.92);
|
||
}
|
||
|
||
.status-pill {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 0 $yjyf-space-md;
|
||
height: 60rpx;
|
||
border-radius: 30rpx;
|
||
background: $yjyf-bg-card;
|
||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
|
||
flex-shrink: 0;
|
||
margin-left: $yjyf-space-sm;
|
||
}
|
||
|
||
.status-pill.off {
|
||
background: rgba(255, 255, 255, 0.28);
|
||
}
|
||
|
||
.status-dot {
|
||
width: 12rpx;
|
||
height: 12rpx;
|
||
border-radius: 50%;
|
||
background: $yjyf-success;
|
||
margin-right: $yjyf-space-xs;
|
||
}
|
||
|
||
.status-pill.off .status-dot {
|
||
background: $yjyf-danger;
|
||
}
|
||
|
||
.status-txt {
|
||
font-size: $yjyf-font-sub;
|
||
font-weight: 600;
|
||
color: $yjyf-primary;
|
||
line-height: 1;
|
||
}
|
||
|
||
.status-pill.off .status-txt {
|
||
color: #FFFFFF;
|
||
}
|
||
|
||
/* ---------- 工钱资产卡 ---------- */
|
||
.assets-box {
|
||
position: relative;
|
||
margin-top: $yjyf-space-lg;
|
||
padding: $yjyf-space-md;
|
||
border-radius: $yjyf-radius-lg;
|
||
background: rgba(255, 255, 255, 0.18);
|
||
backdrop-filter: blur(10px);
|
||
}
|
||
|
||
.asset-top {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
.asset-title {
|
||
font-size: $yjyf-font-sub;
|
||
color: rgba(255, 255, 255, 0.92);
|
||
}
|
||
|
||
.bill-link {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
padding: 4rpx 0;
|
||
}
|
||
|
||
.bill-txt {
|
||
font-size: $yjyf-font-micro;
|
||
color: #FFFFFF;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.arrow-ico {
|
||
width: 24rpx;
|
||
height: 24rpx;
|
||
margin-left: 4rpx;
|
||
}
|
||
|
||
.asset-main {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
margin-top: $yjyf-space-xs;
|
||
}
|
||
|
||
.asset-val {
|
||
font-size: 56rpx;
|
||
font-weight: 700;
|
||
color: #FFFFFF;
|
||
line-height: 1.1;
|
||
font-variant-numeric: tabular-nums;
|
||
}
|
||
|
||
.withdraw-btn {
|
||
padding: 0 $yjyf-space-lg;
|
||
height: 60rpx;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border-radius: 30rpx;
|
||
background: $yjyf-bg-card;
|
||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
|
||
}
|
||
|
||
.withdraw-btn-txt {
|
||
color: $yjyf-primary;
|
||
font-size: $yjyf-font-sub;
|
||
font-weight: 700;
|
||
line-height: 1;
|
||
}
|
||
|
||
.asset-sub {
|
||
display: flex;
|
||
align-items: center;
|
||
flex-wrap: wrap;
|
||
gap: $yjyf-space-sm;
|
||
margin-top: $yjyf-space-sm;
|
||
padding-top: $yjyf-space-sm;
|
||
border-top: 1rpx solid rgba(255, 255, 255, 0.22);
|
||
}
|
||
|
||
.sub-item {
|
||
font-size: $yjyf-font-micro;
|
||
color: rgba(255, 255, 255, 0.92);
|
||
font-variant-numeric: tabular-nums;
|
||
}
|
||
|
||
.sub-divider {
|
||
font-size: $yjyf-font-micro;
|
||
color: rgba(255, 255, 255, 0.45);
|
||
}
|
||
|
||
/* ---------- 主体内容容器 ---------- */
|
||
.page-body {
|
||
padding: $yjyf-space-md $yjyf-space-md $yjyf-space-xl;
|
||
}
|
||
|
||
/* ---------- 功能菜单分组卡 ---------- */
|
||
.menu-card {
|
||
background: $yjyf-bg-card;
|
||
border-radius: $yjyf-radius-lg;
|
||
box-shadow: $yjyf-shadow-card;
|
||
overflow: hidden;
|
||
margin-bottom: $yjyf-space-md;
|
||
}
|
||
|
||
.menu-item {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
min-height: 96rpx;
|
||
padding: 0 $yjyf-space-md;
|
||
border-bottom: 1rpx solid $yjyf-border-color;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.menu-item:last-child {
|
||
border-bottom: none;
|
||
}
|
||
|
||
.menu-btn {
|
||
width: 100%;
|
||
padding: 0 $yjyf-space-md;
|
||
background: transparent;
|
||
line-height: normal;
|
||
border: none;
|
||
border-radius: 0;
|
||
text-align: left;
|
||
font-size: inherit;
|
||
color: inherit;
|
||
}
|
||
|
||
.menu-btn::after {
|
||
border: none;
|
||
}
|
||
|
||
.mi-left {
|
||
display: flex;
|
||
align-items: center;
|
||
min-width: 0;
|
||
}
|
||
|
||
.mi-ico {
|
||
width: 40rpx;
|
||
height: 40rpx;
|
||
margin-right: $yjyf-space-sm;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.mi-title {
|
||
font-size: $yjyf-font-body;
|
||
font-weight: 600;
|
||
color: $yjyf-text-main;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.mi-right {
|
||
display: flex;
|
||
align-items: center;
|
||
flex-shrink: 0;
|
||
margin-left: $yjyf-space-sm;
|
||
}
|
||
|
||
.mi-badge {
|
||
height: 40rpx;
|
||
padding: 0 14rpx;
|
||
border-radius: 20rpx;
|
||
background: #FDEEEB;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
color: $yjyf-danger;
|
||
font-size: $yjyf-font-micro;
|
||
font-weight: 600;
|
||
margin-right: $yjyf-space-xs;
|
||
}
|
||
|
||
.mi-tip {
|
||
font-size: $yjyf-font-sub;
|
||
color: $yjyf-text-secondary;
|
||
margin-right: $yjyf-space-xs;
|
||
}
|
||
|
||
.mi-tip.is-success {
|
||
color: $yjyf-success;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.mi-tip.is-warning {
|
||
color: $yjyf-warning;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.mi-tip.is-danger {
|
||
color: $yjyf-danger;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.mi-arrow {
|
||
width: 24rpx;
|
||
height: 24rpx;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
/* ---------- 服务技能卡 ---------- */
|
||
.card {
|
||
margin-bottom: $yjyf-space-md;
|
||
padding: $yjyf-space-md;
|
||
background: $yjyf-bg-card;
|
||
border-radius: $yjyf-radius-lg;
|
||
box-shadow: $yjyf-shadow-card;
|
||
}
|
||
|
||
.card-head {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
margin-bottom: $yjyf-space-sm;
|
||
}
|
||
|
||
.card-title {
|
||
font-size: $yjyf-font-body;
|
||
font-weight: 700;
|
||
color: $yjyf-text-main;
|
||
}
|
||
|
||
.card-edit-action {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: $yjyf-space-xs;
|
||
}
|
||
|
||
.card-tip {
|
||
font-size: $yjyf-font-sub;
|
||
color: $yjyf-text-secondary;
|
||
}
|
||
|
||
.card-edit-txt {
|
||
font-size: $yjyf-font-sub;
|
||
color: $yjyf-primary;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.card-edit-arrow {
|
||
width: 22rpx;
|
||
height: 22rpx;
|
||
}
|
||
|
||
.skills-box {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 12rpx;
|
||
}
|
||
|
||
.skill-tag {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
max-width: 224rpx;
|
||
padding: 0 20rpx;
|
||
height: 52rpx;
|
||
border-radius: 26rpx;
|
||
background: $yjyf-primary-bg;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.skill-tag-txt {
|
||
display: block;
|
||
max-width: 184rpx;
|
||
color: $yjyf-primary;
|
||
font-size: $yjyf-font-sub;
|
||
font-weight: 500;
|
||
line-height: 1.2;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.skill-tag.empty {
|
||
max-width: none;
|
||
background: $yjyf-bg-page;
|
||
}
|
||
|
||
.skill-tag-txt.empty-txt {
|
||
max-width: none;
|
||
color: $yjyf-text-secondary;
|
||
}
|
||
|
||
.skill-toggle-btn {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
height: 52rpx;
|
||
padding: 0 18rpx;
|
||
border-radius: 26rpx;
|
||
background: $yjyf-bg-page;
|
||
border: 1rpx solid $yjyf-border-color;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.skill-toggle-txt {
|
||
font-size: $yjyf-font-sub;
|
||
color: $yjyf-primary;
|
||
font-weight: 600;
|
||
line-height: 1;
|
||
}
|
||
|
||
.skill-toggle-ico {
|
||
width: 22rpx;
|
||
height: 22rpx;
|
||
margin-left: 4rpx;
|
||
transition: transform 0.2s ease;
|
||
}
|
||
|
||
.skill-toggle-ico.expanded {
|
||
transform: rotate(180deg);
|
||
}
|
||
|
||
/* ---------- 切换业主端卡片 ---------- */
|
||
.switch-role-card {
|
||
margin-bottom: $yjyf-space-lg;
|
||
padding: $yjyf-space-md;
|
||
background: $yjyf-bg-card;
|
||
border-radius: $yjyf-radius-lg;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
box-shadow: $yjyf-shadow-card;
|
||
}
|
||
|
||
.src-left {
|
||
display: flex;
|
||
align-items: center;
|
||
min-width: 0;
|
||
}
|
||
|
||
.src-ico {
|
||
width: 48rpx;
|
||
height: 48rpx;
|
||
margin-right: $yjyf-space-sm;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.src-text {
|
||
display: flex;
|
||
flex-direction: column;
|
||
min-width: 0;
|
||
}
|
||
|
||
.src-title {
|
||
font-size: $yjyf-font-body;
|
||
font-weight: 700;
|
||
color: $yjyf-text-main;
|
||
}
|
||
|
||
.src-desc {
|
||
margin-top: 4rpx;
|
||
font-size: $yjyf-font-micro;
|
||
color: $yjyf-text-secondary;
|
||
}
|
||
|
||
.src-arrow {
|
||
width: 28rpx;
|
||
height: 28rpx;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
/* ---------- 退出登录 ---------- */
|
||
.logout-action {
|
||
height: 88rpx;
|
||
background: $yjyf-bg-card;
|
||
border-radius: 44rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border: 1rpx solid $yjyf-border-color;
|
||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.02);
|
||
}
|
||
|
||
.logout-txt {
|
||
font-size: $yjyf-font-body;
|
||
color: $yjyf-text-secondary;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.clickable-hover {
|
||
transition: opacity 0.15s ease, transform 0.15s ease;
|
||
}
|
||
|
||
.clickable-hover:active {
|
||
opacity: 0.82;
|
||
transform: scale(0.98);
|
||
}
|
||
</style>
|