1812 行
45 KiB
Vue
1812 行
45 KiB
Vue
<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">
|
||
<scroll-view class="sort-tabs-scroll" scroll-x="true" :show-scrollbar="false">
|
||
<view class="sort-tabs-inner">
|
||
<view
|
||
v-for="s in sortTabs"
|
||
: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>
|
||
</scroll-view>
|
||
<view class="refresh-pill clickable-hover" @tap="manualRefresh">
|
||
<image
|
||
class="refresh-ico"
|
||
:class="{ spinning: loading }"
|
||
src="/static/icons/master/hall-refresh.svg"
|
||
mode="aspectFit"
|
||
/>
|
||
<text class="refresh-txt">刷新</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 定位状态与接单区域快捷 bar(不遮挡,仅按需触发原生授权或区域校准) -->
|
||
<view
|
||
class="loc-status-bar clickable-hover"
|
||
:class="{ warn: !hasCoords && serverLocationSource === 'none' }"
|
||
@tap="handleLocationBarTap"
|
||
>
|
||
<view class="loc-bar-left">
|
||
<image class="loc-bar-ico" src="/static/icons/master/hall-location-pin.svg" mode="aspectFit" />
|
||
<text class="loc-bar-txt">{{ locBarText }}</text>
|
||
</view>
|
||
<view class="loc-bar-action">
|
||
<text class="loc-bar-action-txt">{{ locBarActionText }}</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:首屏骨架屏加载态 -->
|
||
<view class="skeleton-list" v-if="loading && !list.length">
|
||
<view class="sk-card" v-for="n in 3" :key="'sk-' + n">
|
||
<view class="sk-hd">
|
||
<view class="sk-line yjyf-shimmer w55"></view>
|
||
<view class="sk-line yjyf-shimmer w24"></view>
|
||
</view>
|
||
<view class="sk-bd">
|
||
<view class="sk-thumb yjyf-shimmer"></view>
|
||
<view class="sk-col">
|
||
<view class="sk-line yjyf-shimmer w80"></view>
|
||
<view class="sk-line yjyf-shimmer w95"></view>
|
||
<view class="sk-line yjyf-shimmer w60"></view>
|
||
</view>
|
||
</view>
|
||
<view class="sk-ft">
|
||
<view class="sk-line yjyf-shimmer w40"></view>
|
||
<view class="sk-btn yjyf-shimmer"></view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 状态 2:异常错误重试态 -->
|
||
<view class="state-empty-wrap" v-else-if="loadError && !list.length">
|
||
<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 in list"
|
||
:key="o.id"
|
||
@tap="goDetail(o)"
|
||
>
|
||
<!-- 卡片头部:服务标签 + 标题 + 预计到手报酬 -->
|
||
<view class="card-hd">
|
||
<view class="hd-left">
|
||
<text class="tag-urgent" v-if="Number(o.urgent)">急单</text>
|
||
<text 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="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
|
||
class="quote-btn clickable-hover"
|
||
v-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">可尝试切换订单类型、刷新列表或扩展接单技能范围</text>
|
||
<view class="state-actions">
|
||
<view
|
||
class="cta-primary clickable-hover"
|
||
v-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>
|
||
|
||
<!-- 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 {
|
||
checkLocationPermissionStatus,
|
||
getCurrentCoordinates,
|
||
getSavedManualLocation,
|
||
saveManualLocation,
|
||
openMiniProgramLocationSettingSync
|
||
} from '@/utils/location.js';
|
||
import YjyfNavBar from '@/components/YjyfNavBar.vue';
|
||
import YjyfRefreshScroll from '@/components/YjyfRefreshScroll.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 page = ref(1);
|
||
const hasMore = ref(false);
|
||
const coords = ref({ lat: '', lng: '' });
|
||
const locationStatus = ref('prompt');
|
||
const locationCity = ref('');
|
||
const locationLabel = ref('');
|
||
const serveRadius = ref(15);
|
||
const serverLocationSource = ref('none');
|
||
const requestingLocation = ref(false);
|
||
const initializingLocation = ref(false);
|
||
const hasCoords = computed(() => Boolean(coords.value.lat && coords.value.lng));
|
||
const locBarText = computed(() => {
|
||
if (hasCoords.value) {
|
||
const name = locationLabel.value || locationCity.value || '已开启实时定位';
|
||
return `当前位置:${name}(${serveRadius.value}km内)`;
|
||
}
|
||
if (serverLocationSource.value === 'saved') {
|
||
return `已按历史位置(${locationCity.value || '常驻城市'} · ${serveRadius.value}km内)为您推荐`;
|
||
}
|
||
return '未获取当前位置,开启或设置位置后可精准推荐附近订单';
|
||
});
|
||
const locBarActionText = computed(() => {
|
||
if (hasCoords.value) return '切换位置';
|
||
if (serverLocationSource.value === 'saved') return '设置位置';
|
||
return '选择位置';
|
||
});
|
||
const type = ref('all');
|
||
const sort = ref('recommend');
|
||
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 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;
|
||
}
|
||
return params;
|
||
}
|
||
|
||
function switchType(k) {
|
||
if (type.value === k) return;
|
||
type.value = k;
|
||
fetchHallList();
|
||
}
|
||
|
||
function switchSort(k) {
|
||
if (k === 'distance' && !hasCoords.value && serverLocationSource.value === 'none') {
|
||
handleRequestLocation();
|
||
}
|
||
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 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 openLocationPage() {
|
||
const query = [];
|
||
if (coords.value.lat && coords.value.lng) {
|
||
query.push(`lat=${encodeURIComponent(coords.value.lat)}`);
|
||
query.push(`lng=${encodeURIComponent(coords.value.lng)}`);
|
||
}
|
||
if (locationCity.value) {
|
||
query.push(`city=${encodeURIComponent(locationCity.value)}`);
|
||
}
|
||
if (locationLabel.value) {
|
||
query.push(`label=${encodeURIComponent(locationLabel.value)}`);
|
||
}
|
||
if (serveRadius.value) {
|
||
query.push(`radius=${encodeURIComponent(serveRadius.value)}`);
|
||
}
|
||
const qs = query.length ? `?${query.join('&')}` : '';
|
||
uni.navigateTo({ url: `/pages/master/location${qs}` });
|
||
}
|
||
|
||
function handleLocationBarTap() {
|
||
if (hasCoords.value) {
|
||
openLocationPage();
|
||
return;
|
||
}
|
||
handleRequestLocation();
|
||
}
|
||
|
||
function handleRequestLocation() {
|
||
// #ifdef MP-WEIXIN
|
||
// 已被微信拒绝过权限时,必须在点击同步手势周期内直接唤起微信原生设置页
|
||
if (locationStatus.value === 'denied') {
|
||
requestingLocation.value = true;
|
||
openMiniProgramLocationSettingSync().then(async (res) => {
|
||
requestingLocation.value = false;
|
||
if (res && res.ok && res.lat && res.lng) {
|
||
locationStatus.value = 'granted';
|
||
await applyVerifiedLocation(res.lat, res.lng);
|
||
uni.showToast({ title: '定位已开启,已更新附近推荐', icon: 'none' });
|
||
} else {
|
||
openLocationPage();
|
||
}
|
||
});
|
||
return;
|
||
}
|
||
requestDeviceLocationInteractive();
|
||
return;
|
||
// #endif
|
||
|
||
// #ifndef MP-WEIXIN
|
||
openLocationPage();
|
||
// #endif
|
||
}
|
||
|
||
async function applyVerifiedLocation(lat, lng, customLabel = '', customCity = '') {
|
||
coords.value = { lat, lng };
|
||
if (customCity) locationCity.value = customCity;
|
||
if (customLabel) locationLabel.value = customLabel;
|
||
const res = await syncMasterLocation(lat, lng, customCity, customLabel);
|
||
const finalCity = customCity || (res && res.location_city) || locationCity.value || '';
|
||
const finalLabel = customLabel || (res && res.location_label) || finalCity || '已定位';
|
||
const finalRadius = (res && res.serve_radius) || serveRadius.value;
|
||
locationCity.value = finalCity;
|
||
locationLabel.value = finalLabel;
|
||
serveRadius.value = finalRadius;
|
||
saveManualLocation({ lat, lng, label: finalLabel, city: finalCity, serveRadius: finalRadius });
|
||
await fetchHallList();
|
||
}
|
||
|
||
async function requestDeviceLocationInteractive() {
|
||
if (requestingLocation.value) return;
|
||
requestingLocation.value = true;
|
||
try {
|
||
const res = await getCurrentCoordinates({ timeout: 4500 });
|
||
if (res && res.ok && res.lat && res.lng) {
|
||
locationStatus.value = 'granted';
|
||
await applyVerifiedLocation(res.lat, res.lng);
|
||
uni.showToast({ title: '定位成功,已为您推荐附近工单', icon: 'none' });
|
||
} else {
|
||
if (res && res.reason === 'denied') {
|
||
locationStatus.value = 'denied';
|
||
}
|
||
openLocationPage();
|
||
}
|
||
} finally {
|
||
requestingLocation.value = false;
|
||
}
|
||
}
|
||
|
||
function onLocationPageUpdated(payload) {
|
||
if (!payload) return;
|
||
if (payload.lat && payload.lng) {
|
||
coords.value = { lat: payload.lat, lng: payload.lng };
|
||
}
|
||
if (payload.city) locationCity.value = payload.city;
|
||
if (payload.label) locationLabel.value = payload.label;
|
||
if (payload.serveRadius) serveRadius.value = Number(payload.serveRadius) || serveRadius.value;
|
||
fetchHallList();
|
||
}
|
||
|
||
async function resolveLocationSilent(timeoutMs = 3500) {
|
||
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';
|
||
}
|
||
}
|
||
|
||
// 若实时设备定位未获取,回读近期手动校准过的真实地点缓存
|
||
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;
|
||
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) {
|
||
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;
|
||
if (saved.serveRadius) serveRadius.value = saved.serveRadius;
|
||
} else if (!hasCoords.value) {
|
||
await resolveLocationSilent(3000);
|
||
}
|
||
await fetchHallList();
|
||
}
|
||
|
||
async function fetchHallList() {
|
||
const seq = ++loadSeq;
|
||
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 (meResult.status === 'fulfilled' && meResult.value) {
|
||
const meRes = meResult.value;
|
||
if (!meRes.applied || meRes.master?.verify_status !== 'pass') {
|
||
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.location_city) {
|
||
locationCity.value = hallRes.location_city;
|
||
}
|
||
if (hallRes.serve_radius) {
|
||
serveRadius.value = Number(hallRes.serve_radius) || serveRadius.value;
|
||
}
|
||
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) {
|
||
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(() => {
|
||
uni.$on('masterLocationUpdated', onLocationPageUpdated);
|
||
initLocationAndLoad();
|
||
});
|
||
|
||
onBeforeUnmount(() => {
|
||
uni.$off('masterLocationUpdated', onLocationPageUpdated);
|
||
while (timers.length) {
|
||
clearTimeout(timers.pop());
|
||
}
|
||
});
|
||
|
||
defineExpose({
|
||
load
|
||
});
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
@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. 骨架屏 */
|
||
.skeleton-list {
|
||
padding: 20rpx $yjyf-space-md $yjyf-space-lg;
|
||
}
|
||
.sk-card {
|
||
background: $yjyf-bg-card;
|
||
border-radius: $yjyf-radius-card;
|
||
padding: $yjyf-space-md;
|
||
margin-bottom: $yjyf-space-md;
|
||
box-shadow: $yjyf-shadow-card;
|
||
}
|
||
.sk-hd {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
padding-bottom: 18rpx;
|
||
border-bottom: 1rpx solid $yjyf-border-color;
|
||
margin-bottom: 20rpx;
|
||
}
|
||
.sk-bd {
|
||
display: flex;
|
||
gap: 20rpx;
|
||
margin-bottom: 20rpx;
|
||
}
|
||
.sk-thumb {
|
||
width: 156rpx;
|
||
height: 156rpx;
|
||
border-radius: 16rpx;
|
||
flex-shrink: 0;
|
||
}
|
||
.sk-col {
|
||
flex: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: center;
|
||
gap: $yjyf-space-sm;
|
||
}
|
||
.sk-ft {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
padding-top: 18rpx;
|
||
border-top: 1rpx solid $yjyf-border-color;
|
||
}
|
||
.sk-line {
|
||
height: 28rpx;
|
||
border-radius: 8rpx;
|
||
}
|
||
.sk-btn {
|
||
width: 180rpx;
|
||
height: 64rpx;
|
||
border-radius: $yjyf-radius-pill;
|
||
}
|
||
.w24 { width: 24%; }
|
||
.w40 { width: 40%; }
|
||
.w55 { width: 55%; }
|
||
.w60 { width: 60%; }
|
||
.w80 { width: 80%; }
|
||
.w95 { width: 95%; }
|
||
|
||
/* 5. 抢单卡片列表 */
|
||
.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;
|
||
}
|
||
.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: inline-flex;
|
||
align-items: center;
|
||
gap: 10rpx;
|
||
padding-right: $yjyf-space-xs;
|
||
}
|
||
|
||
/* 位置状态与引导条(紧贴控制台下方,不阻挡主列表) */
|
||
.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;
|
||
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-action {
|
||
flex-shrink: 0;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
padding: 4rpx 0;
|
||
}
|
||
.loc-bar-action-txt {
|
||
font-size: $yjyf-font-sub;
|
||
font-weight: 600;
|
||
color: $yjyf-primary;
|
||
line-height: 1;
|
||
}
|
||
.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>
|