文件
yjyf/yjyf-app/components/master/MasterHallView.vue
MiAn b71980dd6b feat: 新增账号安全模块及资质校验功能
- 新增账号安全页面及支付密码验证组件
- 新增用户类型选择流程及商家资质管理
- 新增订单资质校验逻辑,师傅需满足订单证书要求
- 新增企业资质认证相关数据库表及接口
- 优化用户列表展示,区分个人与商家用户类型
2026-11-21 15:37:01 +08:00

1822 行
52 KiB
Vue

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

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

<template>
<view class="hall-view">
<!-- 1. 顶部统一导航栏(含左上角退出师傅端回到用户端快捷入口) -->
<YjyfNavBar theme="orange" title="抢单大厅" :fixed="true" :placeholder="true">
<template #left>
<view
class="exit-user-pill clickable-hover"
:class="{ disabled: switchingRole }"
@tap="exitToUser"
>
<image class="exit-user-ico" src="/static/icons/master/switch-order-white.svg" mode="aspectFit" />
<text class="exit-user-txt">我要下单</text>
</view>
</template>
</YjyfNavBar>
<!-- 2. 顶部吸顶业务控制台(纯订单类型切换 + 排序筛选 + 手动刷新,无冗余师傅名片) -->
<view class="hall-control-panel">
<view class="type-tabs">
<view
v-for="t in typeTabs"
:key="t.key"
class="t-tab clickable-hover"
:class="{ on: type === t.key }"
@tap="switchType(t.key)"
>
<view class="t-tab-inner">
<text class="t-txt">{{ t.name }}</text>
<view class="t-count" v-if="counts[t.key] > 0" :class="{ active: type === t.key }">
<text class="t-count-txt">{{ formatCount(counts[t.key]) }}</text>
</view>
</view>
<view class="t-indicator" v-if="type === t.key"></view>
</view>
</view>
<view class="sort-bar">
<view class="sort-tabs-inner">
<view
v-for="s in sortTabs.slice(0, 3)"
:key="s.key"
class="s-tab clickable-hover"
:class="{ on: sort === s.key }"
@tap="switchSort(s.key)"
>
<text class="s-tab-txt">{{ s.name }}</text>
</view>
</view>
<view class="filter-trigger clickable-hover" :class="{ active: activeFilterChips.length }" @tap="openFilters">
<image class="filter-icon" src="/static/icons/filter-orange.svg" mode="aspectFit" />
<text>筛选{{ activeFilterChips.length ? '(' + activeFilterChips.length + ')' : '' }}</text>
</view>
</view>
<view class="active-filters" v-if="activeFilterChips.length">
<view class="active-filter" v-for="chip in activeFilterChips" :key="chip.key" @tap="clearFilter(chip.key)">
<text>{{ chip.label }}</text>
<image class="active-filter-close" src="/static/icons/close.svg" mode="aspectFit" />
</view>
<view class="clear-filters" @tap="clearAllFilters">清除</view>
</view>
</view>
<!-- 定位状态与接单区域快捷 bar(不遮挡,仅按需触发原生授权或区域校准) -->
<view class="loc-status-bar" :class="{ warn: !hasCoords && serverLocationSource === 'none' }">
<view class="loc-bar-left clickable-hover" @tap="handleLocationBarTap">
<image class="loc-bar-ico" src="/static/icons/master/hall-location-pin.svg" mode="aspectFit" />
<text class="loc-bar-txt">{{ locBarText }}</text>
<image class="loc-bar-arrow" src="/static/icons/master/hall-arrow-right-orange.svg" mode="aspectFit" />
</view>
</view>
<!-- 3. 可下拉刷新与分页的订单主列表容器 -->
<YjyfRefreshScroll
class="hall-scroll"
theme="light"
:refresh-task="load"
@scrolltolower="loadMore"
>
<!-- 暂停接单安全拦截提示(仅当师傅暂停接单时显示,正常听单时不占用首屏空间) -->
<view class="pause-alert-card" v-if="info && info.work_status === 'off'">
<view class="pa-left">
<image class="pa-ico" src="/static/icons/master/hall-pause-warn.svg" mode="aspectFit" />
<text class="pa-txt">当前处于暂停接单状态,开启后即可抢单</text>
</view>
<view
class="pa-btn clickable-hover"
:class="{ disabled: togglingWork }"
@tap="toggleWork"
>
<text class="pa-btn-txt">{{ togglingWork ? '开启中...' : '开启接单' }}</text>
</view>
</view>
<!-- 实时工单广播条(支持点击直达对应工单详情) -->
<view class="broadcast-card" v-if="broadcastList.length">
<image class="broadcast-ico" src="/static/icons/master/hall-broadcast.svg" mode="aspectFit" />
<swiper
class="broadcast-swiper"
:vertical="true"
:autoplay="broadcastList.length > 1"
:interval="3500"
:circular="true"
>
<swiper-item
class="swiper-item"
v-for="b in broadcastList"
:key="b.id"
@tap="goDetail(b.order)"
>
<text class="broadcast-txt">{{ b.text }}</text>
<image class="broadcast-arrow" src="/static/icons/arrow-right-orange.svg" mode="aspectFit" />
</swiper-item>
</swiper>
</view>
<!-- 状态 1:首屏同城雷达搜单加载动画 -->
<MasterHallLoader
v-if="showInitialLoader"
:stage="loaderStage"
:city="locationCity"
/>
<!-- 状态 2:异常错误重试态 -->
<view class="state-empty-wrap" v-else-if="loadError">
<image class="state-img" src="/static/icons/master/hall-error.svg" mode="aspectFit" />
<text class="state-title">工单大厅加载失败</text>
<text class="state-sub">{{ loadError }}</text>
<view class="state-actions">
<view class="cta-primary clickable-hover" @tap="load">重新加载</view>
</view>
</view>
<!-- 状态 3:真实抢单卡片列表 -->
<view class="list" v-else-if="list.length">
<view
class="order-card clickable-hover"
v-for="(o, idx) in list"
:key="o.id"
:style="idx < 6 ? { animationDelay: (idx * 45) + 'ms' } : null"
@tap="goDetail(o)"
>
<!-- 卡片头部:服务标签 + 标题 + 预计到手报酬 -->
<view class="card-hd">
<view class="hd-left">
<text class="tag-urgent" v-if="Number(o.urgent)">急单</text>
<text v-if="o.service_type_tag" class="tag-svc-type" :class="{ repair: o.service_type_tag === '维修' }">
{{ o.service_type_tag }}
</text>
<text class="svc-title">{{ o.service_name }}</text>
</view>
<view class="hd-right">
<template v-if="o.price_type === 'quote'">
<text class="price-mode-tag quote">开放竞价</text>
<text class="quote-label">师傅报价</text>
</template>
<template v-else>
<text class="price-mode-tag">
{{ o.price_type === 'custom' ? '用户定价' : '一口价' }}
</text>
<view class="amt-box">
<text class="amt-symbol">¥</text>
<text class="amt-val">{{ getOrderFee(o) }}</text>
</view>
</template>
</view>
</view>
<!-- 卡片主体:商品实拍图 + 核心履约信息 -->
<view class="card-bd">
<view class="thumb-wrap" v-if="o.service_image">
<image class="goods-thumb" :src="o.service_image" mode="aspectFill" />
<view class="thumb-badge">
<text class="thumb-badge-txt">共{{ o.goods_num || 1 }}套</text>
</view>
</view>
<view class="info-col">
<view class="goods-line">
<text class="goods-count">共{{ o.goods_num || 1 }}套商品</text>
<text class="goods-divider">·</text>
<text class="goods-name">{{ o.goods_model || o.goods_name || o.service_name }}</text>
</view>
<view class="info-row">
<image class="row-icon" src="/static/icons/master/order-loc.svg" mode="aspectFit" />
<text class="row-txt addr-txt">{{ o.address }}</text>
<view class="dist-pill" v-if="o.distance_text">
<image class="dist-ico" src="/static/icons/master/hall-distance.svg" mode="aspectFit" />
<text class="dist-txt">{{ o.distance_text }}</text>
</view>
</view>
<view class="info-row">
<image class="row-icon" src="/static/icons/master/order-time.svg" mode="aspectFit" />
<text class="row-txt">期望上门:{{ o.appoint_text }}</text>
</view>
<view class="badge-row">
<view class="cond-badge recommend" v-if="o.recommend_reason">
<image
class="rec-badge-ico"
src="/static/icons/master/hall-recommend-near.svg"
mode="aspectFit"
/>
<text class="rec-badge-txt">{{ o.recommend_reason }}</text>
</view>
<text class="cond-badge">楼层 {{ o.floor || 1 }} 层</text>
<text class="cond-badge">{{ Number(o.has_elevator) ? '有电梯' : '步梯无电梯' }}</text>
<text class="cond-badge addon" v-if="o.addon_services">{{ o.addon_services }}</text>
</view>
</view>
</view>
<!-- 客户工单特别要求 -->
<view class="qualification-row" v-if="o.qual_req">
<text>资质要求:{{ o.qual_req }}</text>
<text v-if="!o.qualification_allowed" class="qualification-warning">暂无有效认证证书</text>
<text v-if="!o.qualification_allowed" class="qualification-link" @tap.stop="goCerts">去上传证书</text>
</view>
<view class="remark-row" v-if="o.remark">
<text class="remark-tag">工单要求</text>
<text class="remark-txt">{{ o.remark }}</text>
</view>
<!-- 卡片底部:时效/竞价名额 + 唯一主操作按钮 -->
<view class="card-ft" @tap.stop>
<view class="ft-meta">
<template v-if="o.price_type === 'quote'">
<text class="quote-slot-txt">
{{ o.quote_count > 0 ? (o.quote_count + ' 位师傅已报价 · ') : '' }}仅剩
</text>
<text class="quote-slot-num">{{ o.remaining_quote_slots ?? 4 }}</text>
<text class="quote-slot-txt">个名额</text>
</template>
<template v-else>
<image class="cd-ico" src="/static/icons/master/hall-countdown.svg" mode="aspectFit" />
<text class="left-label">有效倒计时:</text>
<text class="left-val" :class="{ urgent: o.left_seconds <= 1800 }">
{{ countdown(o.left_seconds) }}
</text>
</template>
</view>
<view class="ft-btns">
<view v-if="!o.qualification_allowed" class="qualification-disabled"><text class="btn-txt">{{ o.price_type === 'quote' ? '暂不可报价' : '暂不可接单' }}</text></view>
<view
class="quote-btn clickable-hover"
v-else-if="o.price_type === 'quote'"
@tap="goDetail(o)"
>
<text class="btn-txt">立即报价</text>
</view>
<view
class="grab-btn clickable-hover"
v-else
@tap="openGrabConfirm(o)"
>
<text class="btn-txt">{{ o.price_type === 'custom' ? '按此价接单' : '立即抢单' }}</text>
</view>
</view>
</view>
</view>
<view class="list-foot-tip">
<text class="foot-tip-txt">
{{ loadingMore ? '正在加载更多工单...' : (hasMore ? '上滑加载更多工单' : '已展示全部待接工单') }}
</text>
</view>
</view>
<!-- 状态 4:友好空状态导流态 -->
<view class="state-empty-wrap" v-else>
<image class="state-img" src="/static/icons/master/empty-orders.svg" mode="aspectFit" />
<text class="state-title">当前筛选下暂无待接工单</text>
<text class="state-sub">{{ activeFilterChips.length ? '可清除筛选条件后查看其他订单' : '可尝试切换订单类型、刷新列表或扩展接单技能范围' }}</text>
<view class="state-actions">
<view class="cta-primary clickable-hover" v-if="activeFilterChips.length" @tap="clearAllFilters">清除筛选</view>
<view
class="cta-primary clickable-hover"
v-else-if="type !== 'all' && counts.all > 0"
@tap="switchType('all')"
>
查看全部订单 ({{ formatCount(counts.all) }})
</view>
<view class="cta-primary clickable-hover" v-else @tap="load">刷新抢单大厅</view>
<view class="cta-secondary clickable-hover" @tap="goSkills">扩展接单技能</view>
</view>
</view>
</YjyfRefreshScroll>
<view v-if="filtersOpen" class="filter-mask" @tap="filtersOpen = false">
<view class="filter-panel" @tap.stop>
<view class="filter-heading">
<text>订单筛选</text>
<view class="filter-close" @tap="filtersOpen = false"><image class="filter-close-icon" src="/static/icons/close.svg" mode="aspectFit" /></view>
</view>
<scroll-view class="filter-content" scroll-y>
<view class="filter-group">
<text class="filter-title">排序方式</text>
<view class="filter-options"><view v-for="item in sortTabs" :key="item.key" class="filter-option" :class="{ selected: draftSort === item.key }" @tap="draftSort = item.key">{{ item.name }}</view></view>
</view>
<view class="filter-group">
<text class="filter-title">订单距离</text>
<text class="filter-hint">只显示所选距离内的订单;与推荐范围分别设置</text>
<view class="filter-options"><view v-for="item in distanceOptions" :key="item.value" class="filter-option" :class="{ selected: draftDistance === item.value }" @tap="draftDistance = item.value">{{ item.label }}</view></view>
</view>
<view class="filter-group" v-if="filterOptions.service_types.length">
<text class="filter-title">服务类型</text>
<text class="filter-hint">根据订单中的服务明细筛选</text>
<view class="filter-options"><view class="filter-option" :class="{ selected: !draftServiceType }" @tap="draftServiceType = ''">全部</view><view v-for="item in visibleServiceTypes" :key="item.code" class="filter-option" :class="{ selected: draftServiceType === item.code }" @tap="draftServiceType = item.code">{{ item.name }}</view></view>
<view v-if="filterOptions.service_types.length > 5" class="filter-expand" @tap="showAllServiceTypes = !showAllServiceTypes">{{ showAllServiceTypes ? '收起服务类型' : '展开全部服务类型' }}</view>
</view>
<view class="filter-group" v-if="filterOptions.categories.length">
<text class="filter-title">服务品类</text>
<view class="filter-options"><view class="filter-option" :class="{ selected: !draftCategory }" @tap="draftCategory = 0">全部</view><view v-for="item in filterOptions.categories" :key="item.id" class="filter-option" :class="{ selected: draftCategory === Number(item.id) }" @tap="draftCategory = Number(item.id)">{{ item.name }}</view></view>
</view>
</scroll-view>
<view class="filter-footer"><view class="filter-reset" @tap="resetDraftFilters">重置</view><view class="filter-confirm" @tap="applyFilters">确定</view></view>
</view>
</view>
<!-- 4. 抢单防误点二次确认弹窗 -->
<view class="confirm-mask" v-if="selectedOrder" @tap="closeGrabConfirm">
<view class="confirm-dialog" @tap.stop>
<text class="cd-title">抢单确认提示</text>
<view class="cd-summary">
<text class="cd-svc">{{ selectedOrder.service_name }}</text>
<text class="cd-addr">{{ selectedOrder.address }}</text>
<text class="cd-price">预计到手报酬:¥{{ getOrderFee(selectedOrder) }}</text>
</view>
<text class="cd-content">
请确认已了解订单服务要求、商品数量及服务地址。抢单成功后需在 2 小时内联系客户约定上门时间,无故弃单将影响您的派单优先级。
</text>
<view class="cd-actions">
<view class="cd-btn cancel clickable-hover" @tap="closeGrabConfirm">
<text class="cd-btn-txt cancel">再看看</text>
</view>
<view
class="cd-btn ok clickable-hover"
:class="{ disabled: grabbing }"
@tap="confirmGrab"
>
<text class="cd-btn-txt ok">{{ grabbing ? '抢单中...' : '确认抢单' }}</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import { ref, computed, onMounted, onBeforeUnmount } from 'vue';
import api from '@/utils/api.js';
import { isLogin, toLogin } from '@/utils/request.js';
import { setRole } from '@/utils/role.js';
import { savePickedLocation } from '@/utils/masterHallLocation.mjs';
import {
checkLocationPermissionStatus,
getCurrentCoordinates,
getSavedManualLocation,
saveManualLocation
} from '@/utils/location.js';
import YjyfNavBar from '@/components/YjyfNavBar.vue';
import YjyfRefreshScroll from '@/components/YjyfRefreshScroll.vue';
import MasterHallLoader from '@/components/master/MasterHallLoader.vue';
const list = ref([]);
const info = ref(null);
const counts = ref({ all: 0, fixed: 0, quote: 0, custom: 0 });
const loading = ref(false);
const loadingMore = ref(false);
const loadError = ref('');
const hasCompletedFirstLoad = ref(false);
const page = ref(1);
const hasMore = ref(false);
const coords = ref({ lat: '', lng: '' });
const locationStatus = ref('prompt');
const locationCity = ref('');
const locationLabel = ref('');
const serverLocationSource = ref('none');
const requestingLocation = ref(false);
const initializingLocation = ref(false);
const showInitialLoader = computed(() => (loading.value || initializingLocation.value) && !list.value.length);
const loaderStage = computed(() => initializingLocation.value ? 'location' : 'fetching');
const hasCoords = computed(() => Boolean(coords.value.lat && coords.value.lng));
const locBarText = computed(() => {
if (hasCoords.value) {
const name = locationLabel.value || locationCity.value || '已开启实时定位';
return `接单位置:${name}`;
}
if (serverLocationSource.value === 'saved') {
return `接单位置:${locationCity.value || '已保存位置'}`;
}
return '选择接单位置';
});
const type = ref('all');
const sort = ref('recommend');
const filterOptions = ref({ categories: [], service_types: [] });
const distance = ref(0);
const category = ref(0);
const serviceType = ref('');
const filtersOpen = ref(false);
const draftSort = ref('recommend');
const draftDistance = ref(0);
const draftCategory = ref(0);
const draftServiceType = ref('');
const showAllServiceTypes = ref(false);
const visibleServiceTypes = computed(() => showAllServiceTypes.value ? filterOptions.value.service_types : filterOptions.value.service_types.slice(0, 5));
const selectedOrder = ref(null);
const grabbing = ref(false);
const togglingWork = ref(false);
const switchingRole = ref(false);
let loadSeq = 0;
const timers = [];
const typeTabs = [
{ key: 'all', name: '全部订单' },
{ key: 'fixed', name: '一口价' },
{ key: 'quote', name: '师傅竞价' },
{ key: 'custom', name: '用户定价' }
];
const sortTabs = [
{ key: 'recommend', name: '智能推荐' },
{ key: 'distance', name: '离我最近' },
{ key: 'new', name: '最新发布' },
{ key: 'amount', name: '实付最高' },
{ key: 'urgent', name: '急单优先' }
];
const distanceOptions = [
{ value: 0, label: '不限' }, { value: 5, label: '5km内' },
{ value: 15, label: '15km内' }, { value: 30, label: '30km内' }, { value: 50, label: '50km内' }
];
const activeFilterChips = computed(() => {
const chips = [];
if (sort.value === 'amount' || sort.value === 'urgent') chips.push({ key: 'sort', label: sortTabs.find(s => s.key === sort.value).name });
if (distance.value) chips.push({ key: 'distance', label: `${distance.value}km内` });
if (serviceType.value) {
const item = filterOptions.value.service_types.find(s => s.code === serviceType.value);
if (item) chips.push({ key: 'serviceType', label: item.name });
}
if (category.value) {
const item = filterOptions.value.categories.find(c => Number(c.id) === category.value);
if (item) chips.push({ key: 'category', label: item.name });
}
return chips;
});
// 基于真实待接工单生成可点击直达详情的实时广播条
const broadcastList = computed(() => {
if (!list.value.length) return [];
return list.value.slice(0, 6).map((o) => {
const region = o.district || o.city || '同城';
const priceDesc = o.price_type === 'quote'
? '开放竞价中'
: `预计到手 ¥${getOrderFee(o)}`;
const distPart = o.distance_text ? `,距离 ${o.distance_text}` : '';
return {
id: o.id,
order: o,
text: `${region}业主发布【${o.service_name}】工单,${priceDesc}${distPart}`
};
});
});
function formatCount(val) {
const n = Number(val) || 0;
return n > 99 ? '99+' : String(n);
}
function getOrderFee(o) {
if (!o) return '0.00';
const masterFee = Number(o.master_fee);
const payAmount = Number(o.pay_amount);
const amount = masterFee > 0 ? masterFee : (payAmount > 0 ? payAmount : 0);
return amount.toFixed(2);
}
function buildHallParams(targetPage) {
const params = {
page: targetPage,
limit: 20,
type: type.value,
sort: sort.value
};
if (coords.value.lat && coords.value.lng) {
params.lat = coords.value.lat;
params.lng = coords.value.lng;
}
if (locationCity.value) {
params.city = locationCity.value;
}
if (distance.value) params.distance_km = distance.value;
if (category.value) params.cat_id = category.value;
if (serviceType.value) params.service_type = serviceType.value;
return params;
}
function openFilters() {
draftSort.value = sort.value;
draftDistance.value = distance.value;
draftCategory.value = category.value;
draftServiceType.value = serviceType.value;
showAllServiceTypes.value = Boolean(serviceType.value && !filterOptions.value.service_types.slice(0, 5).some(item => item.code === serviceType.value));
filtersOpen.value = true;
}
function resetDraftFilters() {
draftSort.value = 'recommend';
draftDistance.value = 0;
draftCategory.value = 0;
draftServiceType.value = '';
}
function applyFilters() {
if ((draftDistance.value || draftSort.value === 'distance') && !hasCoords.value && serverLocationSource.value === 'none') {
uni.showToast({ title: '请先选择接单位置', icon: 'none' });
return;
}
sort.value = draftSort.value;
distance.value = draftDistance.value;
category.value = draftCategory.value;
serviceType.value = draftServiceType.value;
filtersOpen.value = false;
fetchHallList();
}
function clearFilter(key) {
if (key === 'sort') sort.value = 'recommend';
if (key === 'distance') distance.value = 0;
if (key === 'category') category.value = 0;
if (key === 'serviceType') serviceType.value = '';
fetchHallList();
}
function clearAllFilters() {
sort.value = 'recommend'; distance.value = 0; category.value = 0; serviceType.value = '';
fetchHallList();
}
function switchType(k) {
if (type.value === k) return;
type.value = k;
fetchHallList();
}
function switchSort(k) {
if (k === 'distance' && !hasCoords.value && serverLocationSource.value === 'none') {
handleLocationBarTap();
return;
}
if (sort.value === k) return;
sort.value = k;
fetchHallList();
}
function manualRefresh() {
if (loading.value) return;
load();
}
function countdown(sec) {
const s = Number(sec) || 0;
if (s <= 0) return '尽快接单';
const d = Math.floor(s / 86400);
const h = Math.floor((s % 86400) / 3600);
const m = Math.floor((s % 3600) / 60);
if (d > 0) return `${d}天${h}小时`;
if (h > 0) return `${h}小时${m}分`;
return `${Math.max(1, m)}分钟`;
}
function goDetail(o) {
if (!o || !o.id) return;
uni.navigateTo({ url: '/pages/master/detail?id=' + o.id });
}
function goSkills() {
uni.navigateTo({ url: '/pages/master/skills' });
}
function goCerts() {
uni.navigateTo({ url: '/pages/master/certs' });
}
function openGrabConfirm(o) {
if (info.value && info.value.work_status === 'off') {
uni.showModal({
title: '当前已暂停接单',
content: '您目前处于“暂停接单”状态,需开启接单听单后方可抢单,是否立即开启?',
confirmText: '开启接单',
confirmColor: '#F0710D',
success: (res) => {
if (res.confirm) {
toggleWork();
}
}
});
return;
}
selectedOrder.value = o;
}
function closeGrabConfirm() {
if (grabbing.value) return;
selectedOrder.value = null;
}
async function confirmGrab() {
if (grabbing.value || !selectedOrder.value) return;
grabbing.value = true;
const o = selectedOrder.value;
try {
const res = await api.masterGrab({ order_id: o.id });
selectedOrder.value = null;
uni.showToast({ title: '抢单成功!', icon: 'success' });
const t = setTimeout(() => {
grabbing.value = false;
uni.navigateTo({
url: `/pages/master/success?order_id=${o.id}&mobile=${res?.user_mobile || ''}`
});
}, 450);
timers.push(t);
} catch (e) {
grabbing.value = false;
uni.showToast({ title: e?.msg || e?.message || '手慢了,该订单已被接走', icon: 'none' });
}
}
async function syncMasterLocation(lat, lng, city = '', label = '') {
try {
const res = await api.masterUpdateLocation({ lat, lng, city, label });
if (res) {
if (res.location_city) locationCity.value = res.location_city;
if (res.location_label) locationLabel.value = res.location_label;
}
return res || null;
} catch (e) {
// 位置同步失败不阻断大厅主列表渲染
return null;
}
}
function handleLocationBarTap() {
if (requestingLocation.value || initializingLocation.value) return;
requestingLocation.value = true;
const options = {
success: async (selection) => {
try {
++loadSeq;
const saved = await savePickedLocation(selection, api.masterUpdateLocation);
coords.value = { lat: saved.lat, lng: saved.lng };
locationCity.value = saved.city;
locationLabel.value = saved.label;
saveManualLocation({ ...saved, manual: true });
await fetchHallList();
uni.showToast({ title: '接单位置已更新', icon: 'none' });
} catch (e) {
loading.value = false;
uni.showToast({ title: e?.msg || e?.message || '保存位置失败,请重试', icon: 'none' });
} finally {
requestingLocation.value = false;
}
},
fail: (err) => {
requestingLocation.value = false;
if (!String(err?.errMsg || '').toLowerCase().includes('cancel')) {
uni.showToast({ title: '无法打开位置选择,请检查定位权限', icon: 'none' });
}
}
};
if (hasCoords.value) {
options.latitude = Number(coords.value.lat);
options.longitude = Number(coords.value.lng);
}
uni.chooseLocation(options);
}
async function resolveLocationSilent(timeoutMs = 3500) {
const saved = getSavedManualLocation();
if (saved && saved.manual) {
coords.value = { lat: saved.lat, lng: saved.lng };
locationCity.value = saved.city;
locationLabel.value = saved.label;
return true;
}
const status = await checkLocationPermissionStatus();
locationStatus.value = status;
// 微信小程序未拒绝过(含首次 prompt),或已授权态,直接获取/请求官方定位
let shouldTryDevice = status === 'granted';
// #ifdef MP-WEIXIN
if (status === 'prompt') {
shouldTryDevice = true;
}
// #endif
if (shouldTryDevice) {
const res = await getCurrentCoordinates({ timeout: timeoutMs });
if (res && res.ok && res.lat && res.lng) {
locationStatus.value = 'granted';
const changed = coords.value.lat !== res.lat || coords.value.lng !== res.lng;
coords.value = { lat: res.lat, lng: res.lng };
if (changed || !locationLabel.value) {
const syncRes = await syncMasterLocation(res.lat, res.lng);
if (syncRes && syncRes.location_label) {
saveManualLocation({
lat: res.lat,
lng: res.lng,
label: syncRes.location_label,
city: syncRes.location_city || ''
});
}
}
return true;
}
if (res && res.reason === 'denied') {
locationStatus.value = 'denied';
}
}
// 若实时设备定位未获取,回读近期手动校准过的真实地点缓存
if (saved) {
coords.value = { lat: saved.lat, lng: saved.lng };
if (saved.city) locationCity.value = saved.city;
if (saved.label) locationLabel.value = saved.label;
return true;
}
return false;
}
async function initLocationAndLoad() {
if (!isLogin()) {
toLogin('/pages/master/hall');
return;
}
initializingLocation.value = true;
try {
await resolveLocationSilent(3500);
} finally {
initializingLocation.value = false;
}
await fetchHallList();
}
async function load() {
if (!isLogin()) {
toLogin('/pages/master/hall');
return;
}
if (initializingLocation.value || requestingLocation.value) {
return;
}
const saved = getSavedManualLocation();
if (saved) {
coords.value = { lat: saved.lat, lng: saved.lng };
if (saved.city) locationCity.value = saved.city;
if (saved.label) locationLabel.value = saved.label;
} else if (!hasCoords.value) {
await resolveLocationSilent(3000);
}
await fetchHallList();
}
async function fetchHallList() {
const seq = ++loadSeq;
const startAt = Date.now();
loading.value = true;
loadError.value = '';
page.value = 1;
try {
const [hallResult, meResult] = await Promise.allSettled([
api.masterHall(buildHallParams(1)),
api.masterInfo()
]);
if (seq !== loadSeq) return;
if (!hasCompletedFirstLoad.value) {
const elapsed = Date.now() - startAt;
const minDuration = 520;
if (elapsed < minDuration) {
await new Promise((resolve) => {
const t = setTimeout(resolve, minDuration - elapsed);
timers.push(t);
});
if (seq !== loadSeq) return;
}
}
if (meResult.status === 'fulfilled' && meResult.value) {
const meRes = meResult.value;
if (!meRes.applied || !meRes.master) {
uni.redirectTo({ url: '/pages/master/apply' });
return;
}
info.value = meRes.master;
}
if (hallResult.status === 'fulfilled' && hallResult.value) {
const hallRes = hallResult.value;
list.value = hallRes.list || [];
hasMore.value = !!hallRes.has_more;
if (hallRes.counts) {
counts.value = hallRes.counts;
}
if (hallRes.filter_options) filterOptions.value = hallRes.filter_options;
if (hallRes.location_city) {
locationCity.value = hallRes.location_city;
}
serverLocationSource.value = hallRes.location_source || 'none';
} else if (hallResult.status === 'rejected') {
const err = hallResult.reason;
loadError.value = err?.msg || err?.message || '网络波动,请稍后重试';
}
} catch (e) {
if (seq === loadSeq) {
loadError.value = e?.msg || e?.message || '网络波动,请稍后重试';
}
} finally {
if (seq === loadSeq) {
hasCompletedFirstLoad.value = true;
loading.value = false;
}
}
}
async function loadMore() {
if (loading.value || loadingMore.value || !hasMore.value) return;
const reqSeq = loadSeq;
loadingMore.value = true;
const nextPage = page.value + 1;
try {
const hallRes = await api.masterHall(buildHallParams(nextPage));
if (reqSeq !== loadSeq) return;
if (hallRes) {
const rows = hallRes.list || [];
list.value = list.value.concat(rows);
page.value = nextPage;
hasMore.value = !!hallRes.has_more;
}
} catch (e) {
uni.showToast({ title: '加载更多失败,请重试', icon: 'none' });
} finally {
loadingMore.value = 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?.msg || '操作失败,请重试', icon: 'none' });
} finally {
togglingWork.value = false;
}
}
async function exitToUser() {
if (switchingRole.value) return;
switchingRole.value = true;
try {
if (isLogin()) {
const res = await api.switchRole({ role: 'user' });
setRole('user');
uni.reLaunch({ url: (res && res.redirect) ? res.redirect : '/pages/index/index' });
} else {
setRole('user');
uni.reLaunch({ url: '/pages/index/index' });
}
} catch (e) {
uni.showToast({ title: e?.msg || '切换用户端失败,请重试', icon: 'none' });
} finally {
const t = setTimeout(() => {
switchingRole.value = false;
}, 500);
timers.push(t);
}
}
onMounted(() => {
initLocationAndLoad();
});
onBeforeUnmount(() => {
while (timers.length) {
clearTimeout(timers.pop());
}
});
defineExpose({
load
});
</script>
<style lang="scss" scoped>
.qualification-row { display: flex; flex-wrap: wrap; gap: 12rpx; margin-top: 16rpx; color: $yjyf-text-regular; font-size: $yjyf-font-sub; }
.qualification-warning { color: $yjyf-danger; }
.qualification-link { color: $yjyf-primary; }
.qualification-disabled { padding: 14rpx 24rpx; border-radius: $yjyf-radius-pill; background: $yjyf-text-disabled; }
@import '@/uni.scss';
.hall-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;
}
/* 1. TopBar 左上角退出师傅端按钮 */
.exit-user-pill {
display: inline-flex;
align-items: center;
justify-content: center;
gap: $yjyf-space-xs;
height: 56rpx;
margin-left: 12rpx;
padding: 0 18rpx 0 14rpx;
border-radius: $yjyf-radius-pill;
background: rgba(255, 255, 255, 0.2);
border: 1rpx solid rgba(255, 255, 255, 0.36);
box-sizing: border-box;
&.disabled {
opacity: 0.65;
}
}
.exit-user-ico {
width: 26rpx;
height: 26rpx;
flex-shrink: 0;
}
.exit-user-txt {
font-size: $yjyf-font-sub;
font-weight: 600;
color: $yjyf-text-inverse;
line-height: 1;
white-space: nowrap;
}
/* 2. 吸顶控制中枢(订单类型 Tab + 排序筛选栏) */
.hall-control-panel {
flex-shrink: 0;
background: $yjyf-bg-card;
border-bottom: 1rpx solid $yjyf-border-color;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
z-index: 10;
}
.type-tabs {
display: flex;
border-bottom: 1rpx solid $yjyf-border-color;
}
.t-tab {
flex: 1;
height: 88rpx;
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.t-tab-inner {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6rpx;
}
.t-txt {
font-size: $yjyf-font-body;
color: $yjyf-text-regular;
font-weight: 500;
white-space: nowrap;
}
.t-tab.on .t-txt {
color: $yjyf-text-main;
font-weight: 700;
font-size: 30rpx;
}
.t-indicator {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 48rpx;
height: 6rpx;
background: $yjyf-gradient-primary;
border-radius: 4rpx;
}
.t-count {
padding: 0 10rpx;
height: 32rpx;
border-radius: 16rpx;
background: $yjyf-bg-page;
display: inline-flex;
align-items: center;
justify-content: center;
line-height: 1;
&.active {
background: $yjyf-primary-bg;
}
}
.t-count-txt {
font-size: $yjyf-font-micro;
color: $yjyf-text-secondary;
font-weight: 600;
line-height: 1;
}
.t-count.active .t-count-txt {
color: $yjyf-primary;
}
.sort-bar {
display: flex;
align-items: center;
justify-content: space-between;
padding: $yjyf-space-sm $yjyf-space-md;
gap: $yjyf-space-xs;
}
.s-tab {
height: 52rpx;
padding: 0 $yjyf-space-sm;
background: $yjyf-bg-page;
border: 1rpx solid transparent;
border-radius: $yjyf-radius-pill;
display: inline-flex;
align-items: center;
justify-content: center;
line-height: 1;
white-space: nowrap;
flex-shrink: 0;
&.on {
background: $yjyf-primary-bg;
border-color: $yjyf-primary-border;
}
}
.s-tab-txt {
font-size: $yjyf-font-sub;
color: $yjyf-text-regular;
line-height: 1;
white-space: nowrap;
}
.s-tab.on .s-tab-txt {
color: $yjyf-primary;
font-weight: 600;
}
.refresh-pill {
display: inline-flex;
align-items: center;
justify-content: center;
height: 52rpx;
padding: 0 12rpx;
flex-shrink: 0;
white-space: nowrap;
line-height: 1;
}
.refresh-ico {
width: 26rpx;
height: 26rpx;
margin-right: 6rpx;
&.spinning {
animation: hallSpin 0.72s linear infinite;
}
}
.refresh-txt {
font-size: $yjyf-font-sub;
color: $yjyf-primary;
font-weight: 600;
}
/* 3. 滚动主容器 */
.hall-scroll {
flex: 1;
min-height: 0;
height: 0;
width: 100%;
}
/* 暂停接单安全警示条(仅暂停态可见) */
.pause-alert-card {
margin: 20rpx $yjyf-space-md 0;
padding: $yjyf-space-sm 20rpx;
border-radius: $yjyf-radius-md;
background: rgba(232, 51, 27, 0.08);
border: 1rpx solid rgba(232, 51, 27, 0.18);
display: flex;
align-items: center;
justify-content: space-between;
gap: $yjyf-space-sm;
}
.pa-left {
flex: 1;
min-width: 0;
display: flex;
align-items: center;
gap: 10rpx;
}
.pa-ico {
width: 32rpx;
height: 32rpx;
flex-shrink: 0;
}
.pa-txt {
font-size: $yjyf-font-sub;
color: $yjyf-danger;
font-weight: 600;
line-height: 1.4;
}
.pa-btn {
flex-shrink: 0;
height: 52rpx;
padding: 0 22rpx;
border-radius: $yjyf-radius-pill;
background: $yjyf-gradient-primary;
display: inline-flex;
align-items: center;
justify-content: center;
box-shadow: 0 4rpx 12rpx rgba(240, 113, 13, 0.24);
&.disabled {
opacity: 0.65;
}
}
.pa-btn-txt {
font-size: $yjyf-font-sub;
color: $yjyf-text-inverse;
font-weight: 600;
line-height: 1;
}
/* 实时工单广播条 */
.broadcast-card {
margin: 20rpx $yjyf-space-md 0;
padding: 0 20rpx;
height: 68rpx;
border-radius: 16rpx;
background: $yjyf-primary-bg;
border: 1rpx solid rgba(240, 113, 13, 0.14);
display: flex;
align-items: center;
}
.broadcast-ico {
width: 30rpx;
height: 30rpx;
margin-right: 12rpx;
flex-shrink: 0;
}
.broadcast-swiper {
flex: 1;
min-width: 0;
height: 68rpx;
}
.swiper-item {
display: flex;
align-items: center;
justify-content: space-between;
gap: $yjyf-space-xs;
}
.broadcast-txt {
flex: 1;
min-width: 0;
font-size: $yjyf-font-sub;
color: $yjyf-primary;
font-weight: 500;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.broadcast-arrow {
width: 22rpx;
height: 22rpx;
flex-shrink: 0;
}
/* 4. 抢单卡片列表 */
.list {
padding: 20rpx $yjyf-space-md $yjyf-space-lg;
}
.list-foot-tip {
padding: 12rpx 0 $yjyf-space-md;
text-align: center;
}
.foot-tip-txt {
font-size: $yjyf-font-micro;
color: $yjyf-text-muted;
}
.order-card {
background: $yjyf-bg-card;
border-radius: $yjyf-radius-card;
padding: $yjyf-space-md;
margin-bottom: $yjyf-space-md;
box-shadow: $yjyf-shadow-card;
animation: orderCardEnter 0.36s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes orderCardEnter {
from {
opacity: 0;
transform: translateY(16rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.card-hd {
display: flex;
align-items: flex-start;
justify-content: space-between;
padding-bottom: 20rpx;
border-bottom: 1rpx solid $yjyf-border-color;
}
.hd-left {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 10rpx;
flex: 1;
min-width: 0;
padding-right: $yjyf-space-sm;
}
.tag-urgent {
font-size: $yjyf-font-micro;
background: $yjyf-danger;
color: $yjyf-text-inverse;
height: 38rpx;
line-height: 38rpx;
padding: 0 12rpx;
border-radius: 8rpx;
font-weight: 600;
display: inline-flex;
align-items: center;
justify-content: center;
}
.tag-svc-type {
font-size: $yjyf-font-micro;
height: 38rpx;
line-height: 38rpx;
padding: 0 12rpx;
border-radius: 8rpx;
background: $yjyf-primary-bg;
color: $yjyf-primary;
font-weight: 600;
display: inline-flex;
align-items: center;
justify-content: center;
&.repair {
color: $yjyf-warning;
}
}
.svc-title {
font-size: $yjyf-font-title;
font-weight: 700;
color: $yjyf-text-main;
line-height: 1.35;
}
.hd-right {
display: flex;
flex-direction: column;
align-items: flex-end;
flex-shrink: 0;
}
.price-mode-tag {
font-size: $yjyf-font-micro;
height: 36rpx;
line-height: 36rpx;
padding: 0 12rpx;
border-radius: 6rpx;
font-weight: 600;
background: $yjyf-primary-bg;
color: $yjyf-primary;
display: inline-flex;
align-items: center;
justify-content: center;
&.quote {
background: rgba(74, 124, 255, 0.1);
color: $yjyf-info;
}
}
.quote-label {
margin-top: 6rpx;
font-size: $yjyf-font-sub;
color: $yjyf-text-secondary;
font-weight: 500;
}
.amt-box {
display: flex;
align-items: baseline;
margin-top: 6rpx;
font-variant-numeric: tabular-nums;
}
.amt-symbol {
font-size: $yjyf-font-sub;
font-weight: 700;
color: $yjyf-danger;
}
.amt-val {
font-size: 38rpx;
font-weight: 700;
color: $yjyf-danger;
line-height: 1.1;
}
/* 卡片主体:左图右文 */
.card-bd {
display: flex;
align-items: flex-start;
padding: 20rpx 0;
gap: 20rpx;
}
.thumb-wrap {
width: 156rpx;
height: 156rpx;
border-radius: 16rpx;
overflow: hidden;
position: relative;
flex-shrink: 0;
background: $yjyf-bg-page;
border: 1rpx solid $yjyf-border-color;
}
.goods-thumb {
width: 100%;
height: 100%;
}
.thumb-badge {
position: absolute;
left: 0;
right: 0;
bottom: 0;
background: rgba(31, 31, 31, 0.65);
padding: 4rpx 0;
text-align: center;
}
.thumb-badge-txt {
font-size: $yjyf-font-micro;
color: $yjyf-text-inverse;
font-weight: 500;
}
.info-col {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 12rpx;
}
.goods-line {
display: flex;
align-items: center;
}
.goods-count {
font-size: 26rpx;
font-weight: 600;
color: $yjyf-text-main;
flex-shrink: 0;
}
.goods-divider {
margin: 0 $yjyf-space-xs;
color: $yjyf-text-muted;
font-size: $yjyf-font-sub;
}
.goods-name {
flex: 1;
min-width: 0;
font-size: 26rpx;
color: $yjyf-text-regular;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.info-row {
display: flex;
align-items: center;
}
.row-icon {
width: 28rpx;
height: 28rpx;
margin-right: 10rpx;
flex-shrink: 0;
}
.row-txt {
font-size: $yjyf-font-sub;
color: $yjyf-text-regular;
line-height: 1.4;
}
.addr-txt {
flex: 1;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.dist-pill {
display: inline-flex;
align-items: center;
justify-content: center;
background: $yjyf-primary-bg;
height: 36rpx;
padding: 0 12rpx;
border-radius: 18rpx;
margin-left: 10rpx;
flex-shrink: 0;
line-height: 1;
}
.dist-ico {
width: 22rpx;
height: 22rpx;
margin-right: 4rpx;
}
.dist-txt {
font-size: $yjyf-font-micro;
color: $yjyf-primary;
font-weight: 600;
line-height: 1;
}
.badge-row {
display: flex;
flex-wrap: wrap;
gap: 10rpx;
margin-top: 4rpx;
}
.cond-badge {
font-size: $yjyf-font-micro;
color: $yjyf-text-secondary;
background: $yjyf-bg-page;
height: 40rpx;
line-height: 40rpx;
padding: 0 14rpx;
border-radius: 8rpx;
display: inline-flex;
align-items: center;
justify-content: center;
&.addon {
color: $yjyf-primary;
background: $yjyf-primary-bg;
max-width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
/* 客户要求备注条 */
.remark-row {
margin-bottom: $yjyf-space-sm;
background: $yjyf-bg-page;
padding: 12rpx $yjyf-space-sm;
border-radius: $yjyf-radius-sm;
display: flex;
align-items: flex-start;
}
.remark-tag {
font-size: $yjyf-font-micro;
color: $yjyf-primary;
font-weight: 600;
margin-right: 12rpx;
flex-shrink: 0;
line-height: 1.5;
}
.remark-txt {
flex: 1;
min-width: 0;
font-size: $yjyf-font-sub;
color: $yjyf-text-regular;
line-height: 1.5;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
/* 卡片底部 */
.card-ft {
display: flex;
align-items: center;
justify-content: space-between;
padding-top: 18rpx;
border-top: 1rpx solid $yjyf-border-color;
}
.ft-meta {
display: flex;
align-items: center;
}
.cd-ico {
width: 28rpx;
height: 28rpx;
margin-right: $yjyf-space-xs;
}
.left-label {
font-size: $yjyf-font-sub;
color: $yjyf-text-secondary;
}
.left-val {
font-size: $yjyf-font-sub;
color: $yjyf-primary;
font-weight: 600;
&.urgent {
color: $yjyf-danger;
}
}
.quote-slot-txt {
font-size: $yjyf-font-sub;
color: $yjyf-text-secondary;
}
.quote-slot-num {
font-size: 26rpx;
color: $yjyf-primary;
font-weight: 700;
margin: 0 6rpx;
}
.ft-btns {
display: flex;
align-items: center;
}
.grab-btn {
background: $yjyf-gradient-primary;
padding: 0 36rpx;
height: 68rpx;
border-radius: $yjyf-radius-pill;
display: flex;
align-items: center;
justify-content: center;
box-shadow: $yjyf-shadow-button;
}
.quote-btn {
background: $yjyf-info;
padding: 0 36rpx;
height: 68rpx;
border-radius: $yjyf-radius-pill;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 6rpx 16rpx rgba(74, 124, 255, 0.25);
}
.btn-txt {
color: $yjyf-text-inverse;
font-size: 26rpx;
font-weight: 600;
line-height: 1;
}
/* 6. 空状态 / 异常重试状态 */
.state-empty-wrap {
display: flex;
flex-direction: column;
align-items: center;
padding: 96rpx 40rpx;
}
.state-img {
width: 192rpx;
height: 192rpx;
margin-bottom: $yjyf-space-md;
}
.state-title {
font-size: 30rpx;
font-weight: 600;
color: $yjyf-text-main;
margin-bottom: 12rpx;
}
.state-sub {
font-size: $yjyf-font-sub;
color: $yjyf-text-secondary;
text-align: center;
margin-bottom: $yjyf-space-lg;
}
.state-actions {
display: flex;
gap: $yjyf-space-md;
}
.cta-primary {
background: $yjyf-gradient-primary;
color: $yjyf-text-inverse;
font-size: 26rpx;
font-weight: 600;
padding: 0 36rpx;
height: 72rpx;
display: inline-flex;
align-items: center;
justify-content: center;
line-height: 1;
border-radius: $yjyf-radius-pill;
box-shadow: $yjyf-shadow-button;
}
.cta-secondary {
background: $yjyf-primary-bg;
color: $yjyf-primary;
font-size: 26rpx;
font-weight: 600;
padding: 0 36rpx;
height: 72rpx;
display: inline-flex;
align-items: center;
justify-content: center;
line-height: 1;
border-radius: $yjyf-radius-pill;
border: 1rpx solid $yjyf-primary;
}
/* 7. 抢单二次确认弹窗 */
.confirm-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.6);
z-index: 999;
display: flex;
align-items: center;
justify-content: center;
padding: $yjyf-space-xl;
}
.confirm-dialog {
background: $yjyf-bg-card;
border-radius: 24rpx;
padding: 40rpx $yjyf-space-lg $yjyf-space-lg;
width: 100%;
max-width: 600rpx;
}
.cd-title {
font-size: 34rpx;
font-weight: 700;
color: $yjyf-text-main;
display: block;
text-align: center;
margin-bottom: $yjyf-space-md;
}
.cd-summary {
background: $yjyf-primary-bg;
border-radius: 16rpx;
padding: 20rpx;
margin-bottom: $yjyf-space-md;
display: flex;
flex-direction: column;
gap: $yjyf-space-xs;
}
.cd-svc {
font-size: $yjyf-font-body;
font-weight: 700;
color: $yjyf-text-main;
}
.cd-addr {
font-size: $yjyf-font-sub;
color: $yjyf-text-regular;
}
.cd-price {
font-size: 26rpx;
font-weight: 700;
color: $yjyf-danger;
}
.cd-content {
font-size: 26rpx;
color: $yjyf-text-regular;
line-height: 1.6;
display: block;
margin-bottom: $yjyf-space-lg;
}
.cd-actions {
display: flex;
gap: $yjyf-space-md;
}
.cd-btn {
flex: 1;
height: 80rpx;
border-radius: $yjyf-radius-pill;
display: flex;
align-items: center;
justify-content: center;
&.cancel {
background: $yjyf-bg-page;
}
&.ok {
background: $yjyf-gradient-primary;
}
&.ok.disabled {
opacity: 0.6;
}
}
.cd-btn-txt {
&.cancel {
color: $yjyf-text-secondary;
font-size: $yjyf-font-body;
font-weight: 500;
}
&.ok {
color: $yjyf-text-inverse;
font-size: $yjyf-font-body;
font-weight: 600;
}
}
/* 横向排序滚动栏扩展 */
.sort-tabs-scroll {
flex: 1;
min-width: 0;
width: 0;
white-space: nowrap;
&::-webkit-scrollbar {
display: none;
width: 0;
height: 0;
}
}
.sort-tabs-inner {
display: flex;
flex: 1;
min-width: 0;
align-items: center;
gap: 6rpx;
padding-right: $yjyf-space-xs;
}
.sort-tabs-inner .s-tab { flex: 1; min-width: 0; padding: 0 8rpx; }
.filter-trigger { flex-shrink: 0; min-height: 88rpx; display: flex; align-items: center; gap: 6rpx; color: $yjyf-primary; font-size: $yjyf-font-sub; font-weight: 600; }
.filter-icon { width: 26rpx; height: 26rpx; }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8rpx; padding: 0 $yjyf-space-md $yjyf-space-sm; }
.active-filter { display: inline-flex; align-items: center; gap: 6rpx; min-height: 52rpx; padding: 0 16rpx; border-radius: $yjyf-radius-pill; background: $yjyf-primary-bg; color: $yjyf-primary; font-size: $yjyf-font-micro; }
.active-filter-close { width: 18rpx; height: 18rpx; }
.clear-filters { display: flex; align-items: center; min-height: 52rpx; padding: 0 12rpx; color: $yjyf-text-secondary; font-size: $yjyf-font-sub; }
.filter-mask { position: fixed; inset: 0; z-index: 1005; background: rgba(0, 0, 0, 0.48); display: flex; align-items: flex-end; }
.filter-panel { width: 100%; height: 78vh; display: flex; flex-direction: column; background: $yjyf-bg-card; border-radius: $yjyf-radius-lg $yjyf-radius-lg 0 0; overflow: hidden; }
.filter-heading { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 $yjyf-space-md; height: 96rpx; font-size: 32rpx; font-weight: 700; color: $yjyf-text-main; border-bottom: 1rpx solid $yjyf-border-color; }
.filter-close { width: 88rpx; height: 88rpx; display: flex; align-items: center; justify-content: center; }
.filter-close-icon { width: 28rpx; height: 28rpx; }
.filter-content { flex: 1; min-height: 0; height: 0; box-sizing: border-box; padding: 0 $yjyf-space-md; }
.filter-group { padding: 24rpx 0; border-bottom: 1rpx solid $yjyf-border-color; }
.filter-title { display: block; color: $yjyf-text-main; font-size: $yjyf-font-body; font-weight: 700; }
.filter-hint { display: block; margin-top: 8rpx; color: $yjyf-text-secondary; font-size: $yjyf-font-micro; line-height: 1.4; }
.filter-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12rpx; margin-top: 16rpx; }
.filter-option { min-height: 76rpx; display: flex; align-items: center; justify-content: center; text-align: center; padding: 8rpx; box-sizing: border-box; border-radius: $yjyf-radius-sm; border: 1rpx solid transparent; background: $yjyf-bg-page; color: $yjyf-text-regular; font-size: $yjyf-font-sub; }
.filter-option.selected { color: $yjyf-primary; border-color: $yjyf-primary; background: $yjyf-primary-bg; font-weight: 600; }
.filter-expand { display: flex; align-items: center; min-height: 72rpx; color: $yjyf-primary; font-size: $yjyf-font-sub; }
.filter-footer { flex-shrink: 0; display: flex; gap: 16rpx; padding: 16rpx $yjyf-space-md calc(16rpx + env(safe-area-inset-bottom)); border-top: 1rpx solid $yjyf-border-color; background: $yjyf-bg-card; }
.filter-reset, .filter-confirm { flex: 1; height: 80rpx; display: flex; align-items: center; justify-content: center; border-radius: $yjyf-radius-pill; font-size: $yjyf-font-body; font-weight: 600; }
.filter-reset { background: $yjyf-bg-page; color: $yjyf-text-regular; }
.filter-confirm { background: $yjyf-gradient-primary; color: $yjyf-text-inverse; }
/* 位置状态与引导条(紧贴控制台下方,不阻挡主列表) */
.loc-status-bar {
display: flex;
align-items: center;
justify-content: space-between;
gap: $yjyf-space-sm;
padding: 14rpx $yjyf-space-md;
background: $yjyf-bg-card;
border-bottom: 1rpx solid $yjyf-border-color;
&.warn {
background: $yjyf-primary-bg;
}
}
.loc-bar-left {
flex: 1;
min-width: 0;
min-height: 88rpx;
display: flex;
align-items: center;
gap: 10rpx;
}
.loc-bar-ico {
width: 26rpx;
height: 26rpx;
flex-shrink: 0;
}
.loc-bar-txt {
flex: 1;
min-width: 0;
font-size: $yjyf-font-sub;
line-height: 1.4;
color: $yjyf-text-secondary;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.loc-status-bar.warn .loc-bar-txt {
color: $yjyf-text-regular;
}
.loc-bar-arrow {
width: 22rpx;
height: 22rpx;
margin-left: 4rpx;
}
/* 卡片真实定位推荐标签 */
.cond-badge.recommend {
display: inline-flex;
align-items: center;
gap: 4rpx;
background: $yjyf-primary-bg;
color: $yjyf-primary;
border: 1rpx solid $yjyf-primary-border;
font-weight: 600;
}
.rec-badge-ico {
width: 20rpx;
height: 20rpx;
flex-shrink: 0;
}
.rec-badge-txt {
font-size: $yjyf-font-micro;
color: $yjyf-primary;
font-weight: 600;
line-height: 1;
}
@keyframes hallSpin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>