文件
yjyf/yjyf-app/pages/order/quick.vue
MiAn 14533eadb7 feat: 用户端与师傅端双小程序架构解耦,新增师傅独立认证及超时自动关单机制
1. 账号体系与数据库解耦:
   - 师傅表 fa_master 解除对 fa_user.id 的外键依赖,升级为独立认证账号主表;
   - 新增师傅端独立支撑表:fa_master_security、fa_master_token、fa_master_wechat、fa_master_agreement_read;
   - 新增工单超时未接单自动关闭与原路退款配置(order_unaccepted_close_days)。

2. 服务端(Server):
   - 新增师傅端独立 API 控制器与认证库(MasterAuth, MasterBase, MasterMessage, MasterSecurity, MasterToken);
   - WxLogin 支持双小程序端(user/master)独立换取 session_key、openid 与 access_token;
   - 新增控制台调度命令 php think order:autoclose,支持订单超时自动关闭与售后退款闭环;
   - 修复 PHP 8.5 兼容性问题(Request.php 的 (bool) 强制转换);
   - 系统业务配置全面收敛至数据库 fa_config 及 site.php。

3. 小程序端:
   - yjyf-app(用户端):彻底剥离师傅端路由、组件及静态资源,增加隐私授权弹窗与评价模块;
   - yjyf-master-app(师傅端):全新独立微信小程序工程(wx140d90ceda786107),实现工作台、接单大厅、资质认证、工单协同与钱包提现完整闭环。
2026-11-23 15:10:30 +08:00

4989 行
131 KiB
Vue

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

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

<template>
<view class="page">
<!-- 统一规范顶部固定橙色导航栏 -->
<YjyfNavBar
theme="orange"
:title="currentStepTitle"
:fixed="true"
:placeholder="true"
:custom-back="true"
@back="handleNavBack"
/>
<!-- ==================== 步骤 1:添加商品 ==================== -->
<view class="main-body" v-if="currentStep === 1">
<!-- 顶部常驻双行卡片:品类与下单模式 -->
<view class="top-service-card">
<!-- 第 1 行:当前服务品类 -->
<view class="tsc-row">
<view class="tsc-left">
<view class="tsc-icon-wrap">
<image class="tsc-img" :src="currentCatIconUrl || '/static/icons/service-default.svg'" mode="aspectFit" />
</view>
<text class="tsc-title">{{ drawerCatName || '选择服务类目' }}</text>
</view>
<view class="tsc-btn clickable-hover" @tap="goToSelectCategory">
<text class="tsc-btn-txt">重新选择类目</text>
</view>
</view>
<!-- 第 2 行:当前下单模式 -->
<view class="tsc-row no-border tsc-mode-row">
<view class="tsc-left">
<view class="tsc-icon-wrap">
<image
class="tsc-img"
:src="priceType === 'quote' ? '/static/icons/mode-hammer.svg' : (priceType === 'custom' ? '/static/icons/mode-custom.svg' : '/static/icons/mode-coin.svg')"
mode="aspectFit"
/>
</view>
<text class="tsc-title">{{ currentModeName }}</text>
</view>
<view class="tsc-btn clickable-hover" @tap="showModeDrawer = true">
<text class="tsc-btn-txt">切换下单模式</text>
</view>
</view>
<!-- 自主定价快捷出价 -->
<view class="custom-price-bar" v-if="priceType === 'custom'">
<text class="cpb-label">我的意向出价:</text>
<view class="cpb-input-wrap">
<text class="cpb-currency">¥</text>
<input class="cpb-input" type="digit" v-model="userPrice" placeholder="请输入出价金额" @input="scheduleCalc" />
</view>
</view>
</view>
<!-- 商品信息列表(支持多组) -->
<view class="group-list">
<view class="group-card" v-for="(g, idx) in goodsList" :key="idx">
<!-- 组头部:左侧“商品信息 + 商品模板”,右侧“第 X 组 + 垃圾桶” -->
<view class="gc-head">
<view class="gc-head-left">
<text class="gc-title">商品信息</text>
<view class="gc-tpl-wrap clickable-hover" @tap="openGoodsTemplate(idx)">
<view class="gc-tpl-btn">
<text class="gc-tpl-txt">商品模板</text>
</view>
</view>
</view>
<view class="gc-meta">
<text class="gc-group-num">第 {{ idx + 1 }} 组</text>
<view class="gc-del-btn clickable-hover" @tap="removeOrResetGroup(idx)">
<image class="gc-trash-img" src="/static/icons/trash.svg" mode="aspectFit" />
</view>
</view>
</view>
<!-- 流式媒体上传网格(自动换行平铺:已选图片 -> *添加图片 -> 安装视频 -> 安装环境图 -> ?) -->
<view class="media-grid-wrap">
<!-- 1. 已选商品图片列表(最多 9 张,点击预览大图,右上角红标移除) -->
<view
class="media-tile filled-tile clickable-hover"
v-for="(imgUrl, imgIdx) in (g.images || [])"
:key="'gimg_' + imgIdx + '_' + imgUrl"
@tap="previewImg(g.images, imgIdx)"
>
<image class="mt-img" :src="imgUrl" mode="aspectFill" />
<view class="mt-del" @tap.stop="removeGroupImg(idx, imgIdx)">
<image class="mt-del-ico" src="/static/icons/media-remove-red.svg" mode="aspectFit" />
</view>
</view>
<!-- 2. 添加图片入口(未满 9 张时自动紧跟图片后排布) -->
<view
class="media-tile pic-dash clickable-hover"
v-if="!(g.images && g.images.length >= 9)"
@tap="openMediaDrawer(idx, 'image')"
>
<image class="dc-icon" src="/static/icons/add-img.svg" mode="aspectFit" />
<view class="dc-req-line">
<text class="dc-star">*</text>
<text class="dc-txt orange">添加图片</text>
</view>
</view>
<!-- 3. 安装视频 & 安装环境图(一口价模式下展示,同网格流式平铺) -->
<template v-if="priceType === 'fixed'">
<view
class="media-tile filled-tile video-tile clickable-hover"
v-for="(vid, vIdx) in (g.videos || [])"
:key="'gvid_' + vIdx + '_' + (vid.tempFilePath || vIdx)"
@tap="playVideo(vid.tempFilePath)"
>
<image class="mt-img" v-if="vid.thumbTempFilePath" :src="vid.thumbTempFilePath" mode="aspectFill" />
<view class="video-poster-bg" v-else></view>
<view class="video-play-center">
<view class="mp-play-badge">
<image class="mp-play-icon" src="/static/icons/play-white.svg" mode="aspectFit" />
</view>
<text class="video-poster-tip" v-if="!vid.thumbTempFilePath">安装视频</text>
</view>
<view class="mt-del" @tap.stop="removeGroupVideo(idx, vIdx)">
<image class="mt-del-ico" src="/static/icons/media-remove-red.svg" mode="aspectFit" />
</view>
</view>
<view
class="media-tile video-dash clickable-hover"
v-if="!(g.videos && g.videos.length)"
@tap="pickVideo(idx)"
>
<image class="dc-icon" src="/static/icons/add-video.svg" mode="aspectFit" />
<text class="dc-txt gray">安装视频</text>
<text class="dc-sub gray">(非必填)</text>
</view>
<view
class="media-tile filled-tile clickable-hover"
v-for="(envUrl, envIdx) in (g.envImages || [])"
:key="'eimg_' + envIdx + '_' + envUrl"
@tap="previewImg(g.envImages, envIdx)"
>
<image class="mt-img" :src="envUrl" mode="aspectFill" />
<view class="mt-del" @tap.stop="removeGroupEnvImg(idx, envIdx)">
<image class="mt-del-ico" src="/static/icons/media-remove-red.svg" mode="aspectFit" />
</view>
</view>
<view
class="media-tile env-dash clickable-hover"
v-if="!(g.envImages && g.envImages.length >= 6)"
@tap="onEnvImageBoxTap(idx)"
>
<image class="dc-icon" src="/static/icons/add-env.svg" mode="aspectFit" />
<text class="dc-txt gray">安装环境图</text>
<text class="dc-sub gray">(非必填)</text>
</view>
</template>
<!-- 4. 紧跟末尾的橙色帮助问号图标 -->
<view class="env-help-box clickable-hover" @tap="showEnvHelp">
<image class="eh-icon" src="/static/icons/info-orange.svg" mode="aspectFit" />
</view>
</view>
<!-- 表单项列表:全部采用抽屉选择 -->
<view class="form-item-list">
<!-- ① 商品行:自填模式(其它类目或未检索到商品)下直接输入,常规品类下弹窗选择 -->
<view class="form-row" v-if="g.is_custom || isOtherCategory">
<view class="fr-label">
<text class="req-star">*</text>
<text class="label-txt">输入商品</text>
</view>
<view class="fr-input-box">
<input
class="fr-custom-input"
v-model="g.custom_name"
placeholder="请输入商品名称"
maxlength="20"
@input="scheduleCalc"
/>
<text class="fr-char-count">{{ (g.custom_name || '').length }}/20</text>
</view>
</view>
<view class="form-row clickable-hover" v-else @tap="openGoodsDrawer(idx)">
<view class="fr-label">
<text class="req-star">*</text>
<text class="label-txt">选择商品</text>
</view>
<view class="fr-value-box">
<text class="val-txt" :class="{ placeholder: !g.item_name }">{{ g.item_name ? (g.item_name + (g.spec_name && g.spec_name !== g.item_name ? '(' + g.spec_name + ')' : '')) : '选择商品类型' }}</text>
<image class="fr-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
</view>
</view>
<!-- ② 商品数量:步进器 + 右侧动态单位(对标视频 00:00 桌子显示“张”) -->
<view class="form-row">
<view class="fr-label">
<text class="req-star">*</text>
<text class="label-txt">商品数量</text>
</view>
<view class="fr-stepper-group">
<view class="fr-stepper">
<view class="step-btn step-minus clickable-hover" :class="{ disabled: g.num <= 1 }" @tap="stepGroupNum(idx, -1)">
<image class="step-ico" src="/static/icons/step-minus.svg" mode="aspectFit" />
</view>
<view class="step-num-box">{{ g.num }}</view>
<view class="step-btn step-plus clickable-hover" @tap="stepGroupNum(idx, 1)">
<image class="step-ico" src="/static/icons/step-plus.svg" mode="aspectFit" />
</view>
</view>
<text class="step-unit-txt">{{ g.unit || '个' }}</text>
</view>
</view>
<!-- ③ 服务项目:抽屉展示(对标视频 00:02 & 01:20) -->
<view class="form-row clickable-hover" @tap="openServiceTypeDrawer(idx)">
<view class="fr-label">
<text class="req-star">*</text>
<text class="label-txt">服务项目</text>
</view>
<view class="fr-value-box">
<text class="val-txt" :class="{ placeholder: !g.service_type_name, 'highlight-dark': !!g.service_type_name }">{{ g.service_type_name || '选择服务项目' }}</text>
<image class="fr-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
</view>
</view>
<!-- ④ 增项服务:仅在服务项目为“安装”或“维修”时显示(1:1 复刻视频 00:04 vs 00:52 选“拆旧”自动隐藏) -->
<view class="form-row clickable-hover" v-if="canShowAddonRow(g)" @tap="openAddonDrawer(idx)">
<view class="fr-label">
<text class="label-txt no-star">增项服务</text>
</view>
<view class="fr-value-box">
<text class="val-txt" :class="{ placeholder: !hasAddons(g), 'highlight-dark': hasAddons(g) }">{{ addonSummary(g) }}</text>
<image class="fr-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
</view>
</view>
<!-- ⑤ 商品备注:上下结构 + 全宽浅灰输入框(对标 frame_004, frame_009) -->
<view class="form-row no-border flex-col-remark">
<view class="fr-label">
<text class="label-txt no-star">商品备注</text>
</view>
<view class="gc-remark-box">
<input
class="gc-remark-input"
v-model="g.remark"
placeholder="点击,输入商品备注..."
placeholder-style="color: #999999;"
/>
</view>
</view>
</view>
<!-- 组底部红色小计金额(一口价模式且已选商品时显示,对标 frame_009) -->
<view class="gc-subtotal-row" v-if="priceType === 'fixed' && g.item_name && Number(getGroupEstimatedPrice(g)) > 0">
<text class="gc-subtotal-price">¥{{ getGroupEstimatedPrice(g) }}</text>
</view>
</view>
</view>
</view>
<!-- ==================== 步骤 2:客户信息 (1:1 对标 frame_015, frame_018, frame_021) ==================== -->
<view class="main-body" v-else-if="currentStep === 2">
<!-- 智能地址粘贴识别卡片 (对标 frame_015) -->
<view class="paste-parse-card">
<view class="ppc-box">
<textarea
class="ppc-textarea"
v-model="rawAddressText"
placeholder="粘贴整段:姓名,手机号,省市区及详细地址,点击立即识别即可自动拆分填入"
placeholder-style="color: #999999;"
/>
<view class="ppc-btn-row">
<!-- 首次引导提示气泡(对标 frame_015) -->
<view class="ppc-guide-bubble" v-if="showStep2Tip" @tap.stop="showStep2Tip = false">
<text class="pgb-txt">请填写客户的姓名、手机号和地址,然后点击下一步</text>
<image class="pgb-close-ico" src="/static/icons/close-orange.svg" mode="aspectFit" />
</view>
<view class="ppc-right-btns">
<view class="ppc-history-btn clickable-hover" @tap="openAddressBook">
<text class="phb-txt">历史客户</text>
</view>
<view class="ppc-action-btn clickable-hover" @tap="executeParseAddress">
<text class="pab-txt">立即识别</text>
</view>
</view>
</view>
</view>
</view>
<!-- 客户信息表单卡片 -->
<view class="customer-card">
<!-- 客户姓名 -->
<view class="form-row">
<view class="fr-label">
<text class="req-star">*</text>
<text class="label-txt">客户姓名</text>
</view>
<view class="fr-value-box">
<input class="fr-input right-align" v-model="form.contact" placeholder="请输入客户姓名" placeholder-style="color: #999999;" />
</view>
</view>
<!-- 客户手机 -->
<view class="form-row">
<view class="fr-label">
<text class="req-star">*</text>
<text class="label-txt">客户手机</text>
</view>
<view class="fr-value-box">
<input class="fr-input right-align" type="number" maxlength="11" v-model="form.mobile" placeholder="请输入客户手机号" placeholder-style="color: #999999;" />
</view>
</view>
<!-- 客户地址(省市区选择 + 地图定位选点 + 师傅运力提示) -->
<view class="form-row addr-col-row">
<view class="addr-top-line">
<view class="fr-label">
<text class="req-star">*</text>
<text class="label-txt">客户地址</text>
</view>
<view class="addr-ops-wrap">
<!-- #ifdef MP-WEIXIN -->
<picker mode="region" :value="[form.province, form.city, form.district]" @change="onRegionChange">
<view class="region-picker-btn clickable-hover">
<text class="val-txt region-txt" :class="{ placeholder: !form.province }">
{{ form.province ? `${form.province}-${form.city}-${form.district}` : '请选择省市区' }}
</text>
<image class="fr-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
</view>
</picker>
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<view class="region-picker-btn clickable-hover" @tap="showRegionDrawer = true">
<text class="val-txt region-txt" :class="{ placeholder: !form.province }">
{{ form.province ? `${form.province}-${form.city}-${form.district}` : '请选择省市区' }}
</text>
<image class="fr-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
</view>
<!-- #endif -->
<!-- 垂直微细分割线 -->
<view class="addr-loc-divider"></view>
<!-- 地图定位跳转选择入口 -->
<view class="map-loc-btn clickable-hover" @tap="chooseMapLocation">
<image class="mlb-ico" src="/static/icons/location-pin.svg" mode="aspectFit" />
<text class="mlb-txt">地图定位</text>
</view>
</view>
</view>
<!-- 师傅运力提示(真实接口驱动,选定地区后展示) -->
<view class="master-capacity-hint" v-if="form.province && form.city">
<image class="mch-icon" src="/static/icons/loc-pin-orange.svg" mode="aspectFit" />
<template v-if="masterCountInfo.is_local">
<text class="mch-txt">该地区可提供{{ drawerCatName || '服务' }}师傅共 </text>
<text class="mch-num">{{ currentDistrictMasterCount }}位</text>
<text class="mch-tag">同城待命</text>
</template>
<template v-else>
<text class="mch-txt">本地正在快速入驻,已调度全网师傅共 </text>
<text class="mch-num">{{ currentDistrictMasterCount }}位</text>
<text class="mch-tag cross-region">跨区直达</text>
</template>
</view>
</view>
<!-- 详细地址(支持直接输入 & 右侧定位选点) -->
<view class="form-row">
<view class="fr-label">
<text class="req-star">*</text>
<text class="label-txt">详细地址</text>
</view>
<view class="fr-value-box detail-input-wrap">
<input
class="fr-input right-align detail-input-field"
v-model="form.address"
placeholder="详细门牌号、楼栋房号"
placeholder-style="color: #999999;"
/>
<view class="detail-loc-trigger clickable-hover" @tap="chooseMapLocation" title="地图选点">
<image class="dlt-icon" src="/static/icons/location-pin.svg" mode="aspectFit" />
</view>
</view>
</view>
<!-- 楼层与电梯 -->
<view class="form-row">
<view class="fr-label">
<text class="label-txt no-star">楼层电梯</text>
</view>
<view class="elevator-radios">
<view class="el-radio clickable-hover" :class="{ on: form.has_elevator === 1 }" @tap="setElevator(1)">
<view class="rd-dot"></view>
<text class="rd-txt">有电梯</text>
</view>
<view class="el-radio clickable-hover" :class="{ on: form.has_elevator === 0 }" @tap="setElevator(0)">
<view class="rd-dot"></view>
<text class="rd-txt">无电梯(步梯)</text>
</view>
</view>
</view>
<!-- 无电梯步梯层数步进器(实时联动计算步梯搬运费) -->
<view class="form-row" v-if="form.has_elevator === 0">
<view class="fr-label">
<text class="req-star">*</text>
<text class="label-txt">步梯楼层</text>
</view>
<view class="fr-stepper-group">
<view class="fr-stepper">
<view class="step-btn step-minus clickable-hover" :class="{ disabled: form.floor <= 2 }" @tap="stepFloor(-1)">
<image class="step-ico" src="/static/icons/step-minus.svg" mode="aspectFit" />
</view>
<view class="step-num-box">{{ form.floor }}</view>
<view class="step-btn step-plus clickable-hover" :class="{ disabled: form.floor >= 30 }" @tap="stepFloor(1)">
<image class="step-ico" src="/static/icons/step-plus.svg" mode="aspectFit" />
</view>
</view>
<text class="step-unit-txt">层</text>
</view>
</view>
<!-- 服务备注与常用模板抽屉入口 (对标 frame_018) -->
<view class="form-row no-border flex-col-start">
<view class="remark-head-row">
<text class="label-txt no-star">服务备注</text>
<view class="tpl-btn clickable-hover" @tap="showRemarkDrawer = true">
<text class="tpl-txt">请选择常用备注模板</text>
<image class="tpl-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
</view>
</view>
<view class="remark-input-box">
<input class="remark-input" v-model="form.remark" placeholder="点击输入..." placeholder-style="color: #999999;" />
</view>
</view>
</view>
<!-- 订单联系人与交付协同卡片(支持“显示全部 / 收起”,1:1 对标奇兵到家图1 & 图2) -->
<view class="customer-card">
<!-- 订单联系人(发单账号/商家联系人,与上方终端客户信息独立) -->
<view class="form-row clickable-hover" @tap="editOrderContact">
<view class="fr-label">
<text class="req-star">*</text>
<text class="label-txt">订单联系人</text>
</view>
<view class="fr-value-box">
<text class="val-txt highlight-dark">{{ contactDisplay }}</text>
<image class="fr-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
</view>
</view>
<!-- 期望上门时间:常驻显示(对标图1) -->
<view class="form-row clickable-hover" :class="{ 'no-border': !showAllStep2Fields }" @tap="showAppointDrawer = true">
<view class="fr-label">
<text class="label-txt no-star">期望上门时间</text>
</view>
<view class="fr-value-box">
<text class="val-txt" :class="{ placeholder: !appointDate, 'highlight-dark': appointDate }">{{ appointDisplay || '选择上门时间' }}</text>
<image class="fr-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
</view>
</view>
<template v-if="showAllStep2Fields">
<!-- 物流单号(右侧带“查询”按钮,点击或失焦自动识别物流名称并联动下方物流公司,对标图2) -->
<view class="form-row">
<view class="fr-label">
<text class="label-txt no-star">物流单号</text>
</view>
<view class="fr-value-box express-no-box">
<input
class="fr-input right-align"
v-model="form.logistics_no"
placeholder="请输入物流单号"
placeholder-style="color: #999999;"
@blur="onExpressNoBlur"
/>
<view class="express-query-btn clickable-hover" @tap.stop="queryExpressCompany">
<text class="eqb-txt">{{ queryingExpress ? '查询中' : '查询' }}</text>
</view>
</view>
</view>
<!-- 物流公司:抽屉展示(对标图2 & 图5按首字母分组) -->
<view class="form-row clickable-hover" @tap="showLogisticsDrawer = true">
<view class="fr-label">
<text class="label-txt no-star">物流公司</text>
</view>
<view class="fr-value-box">
<text class="val-txt" :class="{ placeholder: !form.logistics_company, 'highlight-dark': form.logistics_company }">{{ form.logistics_company || '选择物流公司' }}</text>
<image class="fr-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
</view>
</view>
<!-- 货物是否到达客户家 (对标图2) -->
<view class="form-row">
<view class="fr-label">
<text class="label-txt no-star">货物是否到达客户家</text>
</view>
<view class="goods-arrived-pills">
<view
class="arrived-pill clickable-hover"
:class="{ active: form.goods_arrived === 0 }"
@tap="form.goods_arrived = 0"
>未到货</view>
<view
class="arrived-pill clickable-hover"
:class="{ active: form.goods_arrived === 1 }"
@tap="form.goods_arrived = 1"
>已到货</view>
</view>
</view>
<!-- 订单来源 (对标图2) -->
<view class="form-row clickable-hover" @tap="pickOrderSource">
<view class="fr-label">
<text class="label-txt no-star">订单来源</text>
</view>
<view class="fr-value-box">
<input
class="fr-input right-align"
v-model="form.order_source"
placeholder="输入此订单的来源店铺"
placeholder-style="color: #999999;"
@tap.stop
/>
<image class="fr-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
</view>
</view>
<!-- 来源订单号 (对标图2) -->
<view class="form-row">
<view class="fr-label">
<text class="label-txt no-star">来源订单号</text>
</view>
<view class="fr-value-box">
<input class="fr-input right-align" v-model="form.source_order_no" placeholder="输入来源订单号" placeholder-style="color: #999999;" />
</view>
</view>
<!-- 资质要求 (对标图2) -->
<view class="form-row clickable-hover" @tap="pickQualReq">
<view class="fr-label">
<text class="label-txt no-star">资质要求</text>
</view>
<view class="fr-value-box">
<text class="val-txt" :class="{ placeholder: !form.qual_req, 'highlight-dark': form.qual_req }">{{ form.qual_req || '选择师傅接单所需要的资质证件' }}</text>
<image class="fr-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
</view>
</view>
<!-- 师傅要求:抽屉展示 (对标图2) -->
<view class="form-row no-border clickable-hover" @tap="showDemandDrawer = true">
<view class="fr-label">
<text class="label-txt no-star">师傅要求</text>
</view>
<view class="fr-value-box">
<text class="val-txt" :class="{ placeholder: !hasDemandReq, 'highlight-dark': hasDemandReq }">{{ demandSummaryText }}</text>
<image class="fr-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
</view>
</view>
</template>
<!-- 底部折叠/展开栏(对标图1“显示全部 v” 与 图2“收起 ^”) -->
<view class="step2-expand-bar clickable-hover" @tap="showAllStep2Fields = !showAllStep2Fields">
<text class="seb-txt">{{ showAllStep2Fields ? '收起' : '显示全部' }}</text>
<image class="seb-arrow" :class="{ up: showAllStep2Fields }" src="/static/icons/arrow-down.svg" mode="aspectFit" />
</view>
</view>
</view>
<!-- ==================== 步骤 3:确认订单 (1:1 对标 frame_025, frame_027, frame_028) ==================== -->
<view class="main-body" v-else-if="currentStep === 3">
<!-- 顶部地址卡片 (对标 frame_025) -->
<view class="confirm-addr-card">
<view class="cac-icon-wrap">
<image class="cac-pin-icon" src="/static/icons/loc-pin-orange.svg" mode="aspectFit" />
</view>
<view class="cac-info">
<view class="cac-user-line">
<text class="cac-name">{{ form.contact }}</text>
<text class="cac-mobile">{{ form.mobile }}</text>
</view>
<text class="cac-full-addr">{{ form.province }} {{ form.city }} {{ form.district }} {{ form.address }}</text>
</view>
<view class="cac-edit-link clickable-hover" @tap="currentStep = 2">
<text class="cel-txt">编辑</text>
</view>
</view>
<!-- 商品列表清单卡片 -->
<view class="confirm-goods-card">
<view class="cgc-item" v-for="(g, idx) in goodsList" :key="idx">
<view class="cgc-thumb-wrap" @tap="g.images && g.images.length ? previewImg(g.images, 0) : null">
<image
class="cgc-thumb"
:src="(g.images && g.images.length) ? g.images[0] : (currentCatIconUrl || '/static/icons/service-default.svg')"
:mode="(g.images && g.images.length) ? 'aspectFill' : 'aspectFit'"
/>
<view class="cgc-view-big" v-if="g.images && g.images.length">
<text class="cvb-txt">查看大图</text>
</view>
</view>
<view class="cgc-detail">
<view class="cgc-top-row">
<text class="cgc-name">{{ g.item_name }}{{ g.spec_name && g.spec_name !== g.item_name ? '(' + g.spec_name + ')' : '' }} x{{ g.num }}</text>
<text class="cgc-price-sub" v-if="priceType !== 'quote' && goodsList.length > 1">¥{{ getGroupEstimatedPrice(g) }}</text>
</view>
<view class="cgc-services-row">
<text class="cgc-service-summary">{{ getConfirmServiceSummary(g) }}</text>
</view>
</view>
</view>
</view>
<!-- 附加服务卡片 (对标 frame_025, 027) -->
<view class="confirm-extra-card">
<view class="cec-head">
<text class="cec-title">附加服务</text>
<image class="cec-info-icon" src="/static/icons/info-orange.svg" mode="aspectFit" @tap="showUrgentHelp" />
</view>
<view class="cec-row clickable-hover" @tap="toggleUrgent">
<view class="cec-label-wrap">
<view class="cec-title-line">
<text class="cec-label">加急订单</text>
<text class="cec-urgent-tag" v-if="isUrgent">+¥{{ currentUrgentAmount }}</text>
</view>
<text class="cec-urgent-sub">优先指派附近优质师傅,最快30分钟响应</text>
</view>
<view class="cec-radio-circle" :class="{ on: isUrgent }">
<image class="crc-check" v-if="isUrgent" src="/static/icons/check-white.svg" mode="aspectFit" />
</view>
</view>
</view>
<!-- 费用与优惠明细卡片 (对标 frame_025, 028) -->
<view class="confirm-fee-card">
<!-- 报价模式说明 -->
<view class="cfc-quote-box" v-if="priceType === 'quote'">
<view class="cqb-badge">师傅竞价</view>
<text class="cqb-title">由接单师傅在线竞价报价</text>
<text class="cqb-desc">发布订单后,师傅将在订单大厅查看需求并给出报价。您可在线对比师傅报价与评价,选定满意的师傅后再支付费用托管至平台。</text>
</view>
<!-- 用户自主定价模式 -->
<template v-else-if="priceType === 'custom'">
<view class="cfc-row">
<text class="cfc-label">我的意向出价总额</text>
<text class="cfc-val highlight">¥{{ Number(userPrice) || 0 }}</text>
</view>
</template>
<!-- 一口价模式 -->
<template v-else>
<view class="cfc-row">
<text class="cfc-label">商品总价</text>
<text class="cfc-val">¥{{ amount ? amount.base_amount : '0.00' }}</text>
</view>
<view class="cfc-row" v-if="amount && amount.floor_amount > 0">
<text class="cfc-label">步梯搬运费</text>
<text class="cfc-val">¥{{ amount.floor_amount }}</text>
</view>
<view class="cfc-row" v-if="isUrgent && amount && amount.urgent_amount > 0">
<text class="cfc-label">加急服务费</text>
<text class="cfc-val">¥{{ amount.urgent_amount }}</text>
</view>
<view class="cfc-row clickable-hover" @tap="openCouponDrawer">
<view class="cfc-coupon-left">
<view class="cfc-quan-badge">券</view>
<text class="cfc-label">优惠券</text>
</view>
<view class="cfc-coupon-right">
<text class="cfc-discount-val" v-if="amount && Number(amount.discount_amount) > 0">-¥{{ amount.discount_amount }}</text>
<text class="cfc-coupon-placeholder" v-else>{{ selectedCoupon ? selectedCoupon.name : '选择可用优惠券' }}</text>
<image class="cfc-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
</view>
</view>
</template>
<!-- 底部轻量提示 -->
<view class="cfc-hint-line">
<image class="chl-ico" src="/static/icons/info-orange.svg" mode="aspectFit" />
<text class="chl-txt">明码标价资金托管,非师傅原因空跑依约享补贴保障</text>
</view>
</view>
<!-- 支付方式选择卡片(仅在一口价与自主定价等需实时支付的模式展示) -->
<view class="confirm-pay-card" v-if="priceType !== 'quote'">
<view class="cpc-head">
<text class="cpc-title">支付方式</text>
</view>
<!-- 选项一:微信支付(默认优先推荐勾选) -->
<view class="cpc-item clickable-hover" @tap="selectedPayType = 'wechat'">
<view class="cpc-left">
<image class="cpc-icon" src="/static/icons/wxpay.svg" mode="aspectFit" />
<view class="cpc-meta">
<view class="cpc-name-line">
<text class="cpc-name">微信支付</text>
<text class="cpc-rec-badge">推荐</text>
</view>
<text class="cpc-desc">官方担保 极速退款</text>
</view>
</view>
<view class="cpc-radio-circle" :class="{ on: selectedPayType === 'wechat' }">
<image class="crc-check" v-if="selectedPayType === 'wechat'" src="/static/icons/check-white.svg" mode="aspectFit" />
</view>
</view>
<view class="cpc-divider"></view>
<!-- 选项二:余额支付 -->
<view class="cpc-item clickable-hover" :class="{ disabled: !isBalanceSufficient }" @tap="chooseBalancePay">
<view class="cpc-left">
<image class="cpc-icon" src="/static/icons/wallet-recharge.svg" mode="aspectFit" />
<view class="cpc-meta">
<view class="cpc-name-line">
<text class="cpc-name">余额支付</text>
<text class="cpc-bal-txt" :class="{ insufficient: !isBalanceSufficient }">
可用 ¥{{ userBalance.toFixed(2) }}
<text v-if="!isBalanceSufficient" class="cpc-warn-txt">(不足)</text>
</text>
</view>
<text class="cpc-desc" v-if="isBalanceSufficient">预存款秒级抵扣</text>
<text class="cpc-desc alert-desc" v-else>余额不足 请选微信</text>
</view>
</view>
<view class="cpc-radio-circle" :class="{ on: selectedPayType === 'balance', disabled: !isBalanceSufficient }">
<image class="crc-check" v-if="selectedPayType === 'balance'" src="/static/icons/check-white.svg" mode="aspectFit" />
</view>
</view>
</view>
<!-- 超时自动转报价订单保障 (对标 frame_028) -->
<view class="confirm-guarantee-card" v-if="priceType === 'fixed'">
<view class="cgc-check-row" @tap="autoQuote = !autoQuote">
<view class="guarantee-checkbox" :class="{ on: autoQuote }">
<image class="gc-icon" v-if="autoQuote" src="/static/icons/check-white.svg" mode="aspectFit" />
</view>
<view class="cgc-check-text-wrap">
<text class="cgc-check-label">如超过</text>
<text class="cgc-orange-txt" @tap.stop="pickAutoQuoteHours">{{ autoQuoteHours }}小时</text>
<text class="cgc-check-label">无法匹配合适师傅,自动换成报价订单</text>
<view class="cgc-set-link-wrap" @tap.stop="pickAutoQuoteHours">
<text class="cgc-set-link">设置时长</text>
<image class="inline-link-arrow" src="/static/icons/arrow-right-orange.svg" mode="aspectFit" />
</view>
</view>
</view>
<view class="cgc-sub-hint">
一口价订单转成报价订单后会生成一笔新的报价单,已支付的金额会退回您的支付账户。
</view>
</view>
<!-- 底部右侧“发布订单须知”(对标 frame_028) -->
<view class="publish-notice-row" @tap="showPublishNotice">
<text class="pnr-txt">发布订单须知</text>
<image class="pnr-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
</view>
</view>
<!-- ==================== 吸底操作栏(分步对应) ==================== -->
<!-- 步骤 1 吸底栏(1:1 复刻 frame_004 & frame_007) -->
<view class="step1-bottom-bar" v-if="currentStep === 1">
<!-- 顶部通栏橙色渐变优惠提示条(一口价且有优惠时展示,对标 frame_007) -->
<view
class="step1-promo-banner clickable-hover"
v-if="priceType === 'fixed' && amount && Number(amount.discount_amount) > 0"
@tap="showFeeDrawer = true"
>
<text class="spb-txt">已使用优惠券,共减 ¥{{ amount.discount_amount }}(原价¥{{ amount.total_amount }})</text>
<image class="spb-arrow-ico" src="/static/icons/chevron-up-white.svg" mode="aspectFit" />
</view>
<!-- 右对齐汇总区(1:1 复刻视频 00:00 报价模式显示“共1组商品”,一口价模式显示“共1组商品合计 ¥55.00”) -->
<view class="step1-summary-area">
<view class="s1-main-line" v-if="priceType === 'quote'">
<text class="s1-count">共{{ goodsList.length }}组商品</text>
</view>
<template v-else>
<view class="s1-main-line">
<text class="s1-count">共{{ goodsList.length }}组商品合计</text>
<view class="s1-quan-badge" v-if="priceType === 'fixed' && amount && Number(amount.discount_amount) > 0">券</view>
<text class="s1-price">¥{{ priceType === 'custom' ? (Number(userPrice) || '0.00') : (amount ? amount.pay_amount : '0.00') }}</text>
</view>
<view class="s1-sub-line" v-if="priceType === 'fixed' && amount && Number(amount.discount_amount) > 0">
<text class="s1-discount-txt">共减 ¥{{ amount.discount_amount }}</text>
</view>
</template>
</view>
<view class="step1-action-row">
<view class="btn-add-more clickable-hover" @tap="handleAddMoreGoods">
<image class="bam-plus-ico" src="/static/icons/plus-orange.svg" mode="aspectFit" />
<text class="bam-txt">继续添加商品</text>
</view>
<view class="btn-step-next clickable-hover" @tap="goStep2">
<text class="bsn-txt">下一步</text>
</view>
</view>
</view>
<!-- 步骤 2 吸底栏:合计总价与费用明细入口 + [上一步] + [下一步] -->
<view class="step2-bottom-bar" v-else-if="currentStep === 2">
<!-- 左侧金额汇总与明细入口 -->
<view class="step2-summary-wrap clickable-hover" @tap="showFeeDrawer = true">
<view class="s2-price-line">
<text class="s2-count-label">合计:</text>
<text class="s2-price-val">¥{{ currentDisplayPrice }}</text>
<view class="s2-detail-pill">
<text class="s2-detail-txt">明细</text>
<image class="s2-detail-arrow" src="/static/icons/chevron-up-orange.svg" mode="aspectFit" />
</view>
</view>
<view class="s2-sub-line" v-if="step2ExtraTip">
<text class="s2-sub-txt">{{ step2ExtraTip }}</text>
</view>
</view>
<!-- 右侧动作按钮组 -->
<view class="step2-btns-wrap">
<view class="btn-step-back-compact clickable-hover" @tap="currentStep = 1">
<text class="bsb-txt">上一步</text>
</view>
<view class="btn-step-next-compact clickable-hover" @tap="goStep3">
<text class="bsnc-txt">下一步</text>
</view>
</view>
</view>
<!-- 步骤 3 吸底栏:合计总价与优惠 + 明细入口 + [发布订单] (对标 frame_025, frame_028) -->
<view class="step3-bottom-bar" v-else-if="currentStep === 3">
<view class="step3-summary clickable-hover" @tap="showFeeDrawer = true">
<template v-if="priceType === 'quote'">
<view class="s3-top">
<text class="s3-count">共{{ goodsList.length }}组商品</text>
<text class="s3-quote-tip">价格待师傅报价</text>
</view>
<view class="s3-sub">
<text class="s3-quote-sub">选定师傅后再支付托管</text>
</view>
</template>
<template v-else-if="priceType === 'custom'">
<view class="s3-top">
<text class="s3-count">共{{ goodsList.length }}组 合计:</text>
<text class="s3-price">¥{{ Number(userPrice) || 0 }}</text>
<view class="s3-detail-pill">
<text class="s3-detail-txt">明细</text>
<image class="s3-detail-arrow" src="/static/icons/chevron-up-orange.svg" mode="aspectFit" />
</view>
</view>
<view class="s3-sub">
<text class="s3-quote-sub">自主定价全包服务</text>
</view>
</template>
<template v-else>
<view class="s3-top">
<text class="s3-count">共{{ goodsList.length }}组 合计:</text>
<text class="s3-price">¥{{ amount ? amount.pay_amount : '0.00' }}</text>
<view class="s3-detail-pill">
<text class="s3-detail-txt">明细</text>
<image class="s3-detail-arrow" src="/static/icons/chevron-up-orange.svg" mode="aspectFit" />
</view>
</view>
<view class="s3-sub" v-if="amount && Number(amount.discount_amount) > 0">
<text class="s3-origin">原价¥{{ amount.total_amount }}</text>
<text class="s3-discount">已省¥{{ amount.discount_amount }}</text>
</view>
</template>
</view>
<view class="btn-publish-order clickable-hover" :class="{ disabled: submitting }" @tap="confirmSubmitAndPay">
<text class="bpo-txt">{{ submitting ? '提交中...' : (priceType === 'quote' ? '发布订单' : (selectedPayType === 'balance' && isBalanceSufficient ? '余额支付' : '立即支付')) }}</text>
</view>
</view>
<!-- ==================== 所有下拉选项:全部使用 1:1 对标抽屉展示 ==================== -->
<!-- 1. 商品规格选择抽屉 (对标 frame_008) -->
<GoodsPickerDrawer
:visible="showGoodsDrawer"
:cat-id="drawerCatId"
:cat-name="drawerCatName"
@update:visible="showGoodsDrawer = $event"
@select="handleGoodsDrawerSelect"
@custom="handleGoodsDrawerCustom"
/>
<!-- 2. 服务项目选择抽屉 (对标 frame_004) -->
<ServiceTypeDrawer
:visible="showServiceTypeDrawer"
:list="currentEditingServiceTypes"
:current-code="currentEditingServiceTypeCode"
@update:visible="showServiceTypeDrawer = $event"
@confirm="handleServiceTypeConfirm"
/>
<!-- 3. 增项服务抽屉 (对标视频 00:06 报价模式不显示单价 / 00:17 一口价模式显示单价) -->
<AddonServiceDrawer
:visible="showAddonDrawerFlag"
:list="currentEditingAddons"
:show-price="priceType === 'fixed'"
@update:visible="showAddonDrawerFlag = $event"
@confirm="handleAddonConfirm"
/>
<!-- 4. 期望上门时间抽屉 (对标 frame_020) -->
<AppointTimeDrawer
:visible="showAppointDrawer"
:date="appointDate"
:slot="appointSlot"
@update:visible="showAppointDrawer = $event"
@confirm="handleAppointConfirm"
/>
<!-- 5. 师傅要求选择抽屉 (对标 frame_022, 023) -->
<MasterDemandDrawer
:visible="showDemandDrawer"
:same-goods="form.demand_same_goods"
:high-rating="form.demand_high_rating"
:timeout-hours="form.demand_timeout"
@update:visible="showDemandDrawer = $event"
@confirm="handleDemandConfirm"
/>
<!-- 6. 常用备注模板抽屉 (对标 frame_018) -->
<RemarkTemplateDrawer
:visible="showRemarkDrawer"
@update:visible="showRemarkDrawer = $event"
@select="handleRemarkTemplateSelect"
/>
<!-- 7. 物流公司选择抽屉 (对标 frame_021) -->
<LogisticsDrawer
:visible="showLogisticsDrawer"
:current-name="form.logistics_company"
@update:visible="showLogisticsDrawer = $event"
@select="handleLogisticsSelect"
/>
<!-- 8. 费用明细抽屉 (对标 frame_006) -->
<FeeDetailDrawer
:visible="showFeeDrawer"
:base-amount="amount ? amount.base_amount : '0.00'"
:addon-amount="calculatedAddonAmount"
:floor-amount="amount ? amount.floor_amount : '0.00'"
:urgent-amount="amount ? amount.urgent_amount : '0.00'"
:discount-amount="amount ? amount.discount_amount : '0.00'"
:pay-amount="amount ? amount.pay_amount : '0.00'"
@update:visible="showFeeDrawer = $event"
/>
<!-- 9. 下单模式选择抽屉 (1:1 对标图一) -->
<ModePickerDrawer
:visible="showModeDrawer"
:current-mode="priceType"
@update:visible="showModeDrawer = $event"
@select="handleModeSelect"
/>
<!-- 10. 图片/媒体操作选择抽屉 -->
<MediaActionDrawer
:visible="showMediaDrawer"
:media-type="mediaTargetType"
@update:visible="showMediaDrawer = $event"
@select="handleMediaActionSelect"
/>
<!-- 11. 优惠券选择抽屉 -->
<CouponPickerDrawer
:visible="showCouponDrawer"
:current-id="selectedCoupon ? selectedCoupon.id : 0"
:order-total="amount ? amount.total_amount : 0"
@update:visible="showCouponDrawer = $event"
@select="handleCouponSelect"
/>
<!-- 12. 服务地址选择抽屉 -->
<AddressPickerDrawer
:visible="showAddressDrawer"
@update:visible="showAddressDrawer = $event"
@select="applySelectedAddress"
/>
<!-- 13. 省市区级联选择抽屉(H5端通用支持) -->
<RegionPickerDrawer
:visible="showRegionDrawer"
:province="form.province"
:city="form.city"
:district="form.district"
@update:visible="showRegionDrawer = $event"
@confirm="handleRegionDrawerConfirm"
/>
<!-- 14. 切换一口价下单模式冲突确认弹窗(1:1 复刻视频 01:08 - 01:20) -->
<view class="mode-conflict-mask" v-if="showModeConflictModal" @tap="showModeConflictModal = false">
<view class="mode-conflict-dialog" @tap.stop>
<view class="mcd-body">
<text class="mcd-line">以下商品的服务:{{ conflictGoodsNames }},不支持一口价下单模式</text>
<text class="mcd-line">如切换下单模式将会自动删除这些商品,您确定切换下单模式吗?</text>
</view>
<view class="mcd-foot">
<view class="mcd-btn mcd-btn-confirm clickable-hover" @tap="confirmModeConflictSwitch">
<text class="mcd-btn-txt gray">确定切换</text>
</view>
<view class="mcd-btn mcd-btn-cancel clickable-hover" @tap="showModeConflictModal = false">
<text class="mcd-btn-txt dark">不切换</text>
</view>
</view>
</view>
</view>
<!-- 15. 安装视频全屏播放预览弹窗 -->
<view class="video-modal-mask" v-if="previewVideoUrl" @tap="previewVideoUrl = ''">
<view class="video-modal-box" @tap.stop>
<view class="vm-head">
<text class="vm-title">安装视频预览</text>
<view class="vm-close clickable-hover" @tap="previewVideoUrl = ''">
<image class="vm-close-ico" src="/static/icons/close.svg" mode="aspectFit" />
</view>
</view>
<video class="vm-player" :src="previewVideoUrl" controls autoplay />
</view>
</view>
<!-- 16. 通用字典单选抽屉(订单来源 / 资质要求 / 自动转报价时长,100% 后端真实字典驱动) -->
<view class="dict-drawer-mask" v-if="dictDrawer.visible" @tap="dictDrawer.visible = false">
<view class="dict-drawer-sheet" @tap.stop>
<view class="dd-head">
<text class="dd-title">{{ dictDrawer.title }}</text>
<view class="dd-close clickable-hover" @tap="dictDrawer.visible = false">
<image class="dd-close-ico" src="/static/icons/close.svg" mode="aspectFit" />
</view>
</view>
<view class="dd-search-wrap" v-if="dictDrawer.mode === 'qual_req'">
<view class="dd-search-box">
<image class="dd-search-ico" src="/static/icons/search-gray.svg" mode="aspectFit" />
<input
class="dd-search-input"
v-model="dictDrawer.keyword"
placeholder="搜索资质名称"
placeholder-style="color: #999999;"
/>
</view>
</view>
<scroll-view scroll-y class="dd-scroll">
<view class="dd-state" v-if="dictsLoading">
<text class="dd-state-txt">正在加载选项...</text>
</view>
<view class="dd-state" v-else-if="dictsError">
<text class="dd-state-txt">{{ dictsError }}</text>
<view class="dd-retry clickable-hover" @tap="loadCommonDicts(true)">
<text class="dd-retry-txt">重新加载</text>
</view>
</view>
<view class="dd-state" v-else-if="filteredDictDrawerItems.length === 0">
<text class="dd-state-txt">暂无可选选项</text>
</view>
<template v-else>
<view
v-for="item in filteredDictDrawerItems"
:key="item.key"
class="dd-item clickable-hover"
:class="{ active: item.active }"
@tap="onSelectDictDrawerItem(item)"
>
<text class="dd-item-txt">{{ item.label }}</text>
<image v-if="item.active" class="dd-item-check" src="/static/icons/check-orange.svg" mode="aspectFit" />
</view>
</template>
</scroll-view>
</view>
</view>
<YjyfPaymentPassword ref="paymentPasswordDialog" />
<YjyfPrivacyPopup />
</view>
</template>
<script setup>
import YjyfPaymentPassword from '@/components/YjyfPaymentPassword.vue';
import YjyfPrivacyPopup from '@/components/YjyfPrivacyPopup.vue';
import { serviceAddons } from '@/utils/productPricing.js';
import { ref, reactive, computed } from 'vue';
const paymentPasswordDialog = ref(null);
import { onLoad, onShow, onUnload } from '@dcloudio/uni-app';
import api from '@/utils/api.js';
import { executeOrderWxPay, openOrderPaymentResult } from '@/utils/pay.js';
import { isLogin, toLogin } from '@/utils/request.js';
// 支付方式状态管理(优先默认勾选微信支付)
const selectedPayType = ref('wechat');
const userBalance = ref(0.00);
const currentPayAmount = computed(() => {
if (priceType.value === 'custom') {
return Number(userPrice.value) || 0;
}
return amount.value ? (Number(amount.value.pay_amount) || 0) : 0;
});
const isBalanceSufficient = computed(() => {
return userBalance.value >= currentPayAmount.value && currentPayAmount.value > 0;
});
function chooseBalancePay() {
if (!isBalanceSufficient.value) {
uni.showToast({
title: `可用余额不足(当前 ¥${userBalance.value.toFixed(2)},需支付 ¥${currentPayAmount.value.toFixed(2)})`,
icon: 'none'
});
selectedPayType.value = 'wechat';
return;
}
selectedPayType.value = 'balance';
}
async function loadUserWallet() {
if (!isLogin()) return;
try {
const res = await api.userWallet();
if (res && res.balance !== undefined) {
userBalance.value = Number(res.balance) || 0;
}
} catch (e) {}
}
// 引入所有抽屉组件
import GoodsPickerDrawer from '@/components/GoodsPickerDrawer.vue';
import ServiceTypeDrawer from '@/components/ServiceTypeDrawer.vue';
import AddonServiceDrawer from '@/components/AddonServiceDrawer.vue';
import AppointTimeDrawer from '@/components/AppointTimeDrawer.vue';
import MasterDemandDrawer from '@/components/MasterDemandDrawer.vue';
import RemarkTemplateDrawer from '@/components/RemarkTemplateDrawer.vue';
import LogisticsDrawer from '@/components/LogisticsDrawer.vue';
import FeeDetailDrawer from '@/components/FeeDetailDrawer.vue';
import ModePickerDrawer from '@/components/ModePickerDrawer.vue';
import MediaActionDrawer from '@/components/MediaActionDrawer.vue';
import CouponPickerDrawer from '@/components/CouponPickerDrawer.vue';
import AddressPickerDrawer from '@/components/AddressPickerDrawer.vue';
import RegionPickerDrawer from '@/components/RegionPickerDrawer.vue';
// 流程步骤控制:1: 添加商品, 2: 客户信息, 3: 确认订单
const currentStep = ref(1);
const showStep2Tip = ref(true);
const showAllStep2Fields = ref(false);
const currentStepTitle = computed(() => {
if (currentStep.value === 1) return '添加商品';
if (currentStep.value === 2) return '客户信息';
return '确认订单';
});
function handleNavBack() {
if (currentStep.value === 3) {
currentStep.value = 2;
} else if (currentStep.value === 2) {
currentStep.value = 1;
} else {
let pages = [];
try {
pages = getCurrentPages() || [];
} catch (e) {}
if (pages.length > 1) {
uni.navigateBack();
} else {
uni.reLaunch({ url: '/pages/index/index' });
}
}
}
// 计价模式
const priceType = ref('fixed');
const userPrice = ref('');
const showModeDrawer = ref(false);
const currentModeName = computed(() => {
if (priceType.value === 'quote') return '报价下单';
if (priceType.value === 'custom') return '自己定价';
return '一口价下单';
});
const showModeConflictModal = ref(false);
const conflictGoodsNames = ref('');
// 判断某个服务项目是否支持“一口价”模式(只要后台配置了 >0 的一口价且非显式禁用,即支持一口价下单)
function isServiceTypeFixedSupported(code, price, supportFixedFlag) {
if (supportFixedFlag === 0) return false;
return Number(price) > 0;
}
function handleModeSelect(mode) {
if (mode === 'fixed' && priceType.value !== 'fixed') {
const unsupported = goodsList.value.filter(g => {
if (!g.item_name && !g.custom_name) return false;
if (g.is_custom || isOtherCategory.value || (g.pricing_revision == null && g.service_price_type === 'quote')) return true;
const curType = (g.service_types || []).find(st => st.code === g.service_type);
const price = curType ? curType.price : g.base_price;
const flag = curType ? curType.support_fixed : undefined;
return !isServiceTypeFixedSupported(g.service_type, price, flag);
});
if (unsupported.length > 0) {
conflictGoodsNames.value = unsupported.map(g => g.spec_name || g.item_name || g.custom_name || '当前商品').join('、');
showModeConflictModal.value = true;
return;
}
}
priceType.value = mode;
scheduleCalc();
}
function confirmModeConflictSwitch() {
showModeConflictModal.value = false;
priceType.value = 'fixed';
// 移除不支持一口价的商品,若全部不支持则保留1组空待选状态(1:1 复刻视频 01:19 - 01:20)
const supported = goodsList.value.filter(g => {
if (g.is_custom || isOtherCategory.value || (g.pricing_revision == null && g.service_price_type === 'quote')) return false;
const curType = (g.service_types || []).find(st => st.code === g.service_type);
const price = curType ? curType.price : g.base_price;
const flag = curType ? curType.support_fixed : undefined;
return isServiceTypeFixedSupported(g.service_type, price, flag);
});
if (supported.length > 0) {
goodsList.value = supported;
} else {
const first = goodsList.value[0] || {};
goodsList.value = [
{
service_id: 0,
item_name: '',
spec_name: '',
cat_id: drawerCatId.value,
cat_name: drawerCatName.value,
unit: first.unit || '个',
base_price: 0,
num: 1,
service_type: '',
service_type_name: '',
service_types: first.service_types || [],
remark: '',
images: [],
videos: [],
envImages: [],
extras: []
}
];
}
scheduleCalc();
}
// 当前类目
const drawerCatId = ref(0);
const drawerCatName = ref('');
const currentCatIconUrl = ref('');
const isOtherCategory = computed(() => {
return Number(drawerCatId.value) === 15 || drawerCatName.value === '其它' || drawerCatName.value === '更多';
});
function goToSelectCategory() {
uni.navigateTo({ url: '/pages/category/category' });
}
// 商品信息列表(支持多组,数据由真实接口返回填充)
const goodsList = ref([
{
service_id: 0,
item_name: '',
spec_id: 0,
spec_name: '',
cat_id: 0,
cat_name: '',
unit: '个',
base_price: 0,
num: 1,
service_type: '',
service_type_name: '',
service_types: [],
remark: '',
images: [],
videos: [],
envImages: [],
extras: []
}
]);
function stepGroupNum(idx, d) {
goodsList.value[idx].num = Math.max(1, goodsList.value[idx].num + d);
scheduleCalc();
}
function removeOrResetGroup(idx) {
if (goodsList.value.length > 1) {
goodsList.value.splice(idx, 1);
scheduleCalc();
} else {
// 只有 1 组时清空重置当前组内容
const g = goodsList.value[0];
g.item_name = '';
g.spec_name = '';
g.custom_name = '';
g.num = 1;
g.remark = '';
g.images = [];
g.videos = [];
g.envImages = [];
if (g.extras) g.extras.forEach(ex => { ex.num = 0; });
scheduleCalc();
uni.showToast({ title: '已重置当前商品信息', icon: 'none' });
}
}
function openGoodsTemplate(idx) {
if (!isLogin()) {
toLogin();
return;
}
editingGroupIndex.value = idx;
const curGroup = goodsList.value[idx] || null;
const cid = (curGroup && curGroup.cat_id) ? curGroup.cat_id : (drawerCatId.value || 0);
const cname = (curGroup && curGroup.cat_name) ? curGroup.cat_name : (drawerCatName.value || '');
uni.setStorageSync('yjyf_goods_template_ctx', {
groupIndex: idx,
catId: cid,
catName: cname,
currentGroup: curGroup ? JSON.parse(JSON.stringify(curGroup)) : null
});
uni.navigateTo({
url: `/pages/order/goods-template?cat_id=${cid}&group_index=${idx}`
});
}
function onReceiveGoodsTemplate(payload) {
uni.removeStorageSync('yjyf_picked_goods_template');
if (!payload) return;
const tpl = payload.template ? payload.template : payload;
if (typeof payload.groupIndex === 'number' && payload.groupIndex >= 0 && payload.groupIndex < goodsList.value.length) {
editingGroupIndex.value = payload.groupIndex;
}
handleApplyGoodsTemplate(tpl);
}
async function handleApplyGoodsTemplate(tpl) {
if (!tpl) return;
const targetIdx = (editingGroupIndex.value >= 0 && editingGroupIndex.value < goodsList.value.length)
? editingGroupIndex.value
: 0;
const prev = goodsList.value[targetIdx] || {};
const copiedExtras = Array.isArray(tpl.extras)
? tpl.extras.map(ex => ({ ...ex }))
: [];
const tplImages = Array.isArray(tpl.images) ? [...tpl.images] : [];
const mergedImages = tplImages.length > 0 ? tplImages.slice(0, 9) : (prev.images || []);
const nextGroup = {
service_id: tpl.service_id || 0,
item_name: tpl.item_name || '',
spec_id: tpl.spec_id || 0,
spec_name: tpl.spec_name || tpl.item_name || '',
cat_id: tpl.cat_id || drawerCatId.value,
cat_name: tpl.cat_name || drawerCatName.value,
unit: tpl.unit || '个',
service_price_type: tpl.price_type || 'fixed',
base_price: Number(tpl.base_price) || 0,
num: Math.max(1, Number(tpl.num) || 1),
service_type: tpl.service_type || 'install',
service_type_name: tpl.service_type_name || '安装',
service_types: Array.isArray(tpl.service_types) && tpl.service_types.length ? tpl.service_types : (prev.service_types || []),
is_custom: !!tpl.is_custom,
custom_name: tpl.custom_name || (tpl.is_custom ? tpl.item_name : ''),
remark: tpl.remark || '',
images: mergedImages,
videos: prev.videos || [],
envImages: prev.envImages || [],
extras: copiedExtras
};
if (nextGroup.service_id && !nextGroup.is_custom) {
try {
const { detail } = await api.serviceDetail(nextGroup.service_id);
const spec = nextGroup.spec_id ? detail.specs.find(item => Number(item.id) === Number(nextGroup.spec_id)) : null;
if (nextGroup.spec_id && !spec) throw new Error('规格已下架');
if (detail.pricing_revision != null) {
const types = spec ? spec.service_types : detail.service_types;
const current = types.find(item => item.code === nextGroup.service_type) || types.find(item => item.is_default);
if (!current) throw new Error('服务已停用');
Object.assign(nextGroup, {
pricing_revision: detail.pricing_revision,
service_type: current.code,
service_type_name: current.name,
service_types: types,
base_price: current.price,
service_price_type: current.mode,
extras: serviceAddons(current, [], copiedExtras)
});
}
} catch (error) {
uni.showToast({ title: '模板关联的商品或规格不可用,请重新选择', icon: 'none' });
return;
}
}
if (tpl.cat_id) drawerCatId.value = Number(tpl.cat_id);
if (tpl.cat_name) drawerCatName.value = tpl.cat_name;
if (tpl.cat_icon_url) currentCatIconUrl.value = tpl.cat_icon_url;
if ((nextGroup.is_custom || nextGroup.service_price_type === 'quote' || Number(nextGroup.base_price) <= 0) && priceType.value === 'fixed') {
priceType.value = 'quote';
}
goodsList.value[targetIdx] = nextGroup;
scheduleCalc();
fetchMasterCount();
uni.showToast({ title: '已套用商品模板', icon: 'success' });
}
function receiveFirstGoods(group) {
const service = (group.service_types || []).find(type => type.code === group.service_type);
const legacyAddons = group.extras || [];
goodsList.value = [{
...group,
service_price_type: service?.mode || group.service_price_type,
legacy_addons: legacyAddons,
extras: serviceAddons(service, legacyAddons, legacyAddons)
}];
if (group.pricing_revision != null && service?.mode === 'quote' && priceType.value === 'fixed') {
priceType.value = 'quote';
}
uni.removeStorageSync('yjyf_first_goods');
if (group.cat_id) drawerCatId.value = group.cat_id;
if (group.cat_name) drawerCatName.value = group.cat_name;
if (group.cat_icon_url) currentCatIconUrl.value = group.cat_icon_url;
calc();
fetchMasterCount();
}
function canShowAddonRow(g) {
return !!(g && g.extras && g.extras.length);
}
function hasAddons(g) {
return g.extras && g.extras.some(ex => ex.num > 0);
}
function addonSummary(g) {
if (!g.extras) return '选择增项服务';
const hits = g.extras.filter(ex => ex.num > 0).map(ex => `${ex.name}x${ex.num}`);
return hits.length ? hits.join(';') : '选择增项服务';
}
function getConfirmServiceSummary(g) {
const parts = [];
if (g.extras) {
g.extras.filter(ex => ex.num > 0).forEach(ex => {
parts.push(ex.name);
});
}
parts.push(g.service_type_name || '安装');
return parts.join(';');
}
function getGroupEstimatedPrice(g) {
const base = Number(g.base_price) || 0;
const addon = (g.extras || []).reduce((acc, cur) => acc + (Number(cur.price) || 0) * (Number(cur.num) || 0), 0);
return ((base * (g.num || 1)) + addon).toFixed(2);
}
// 1. 商品规格选择抽屉
const showGoodsDrawer = ref(false);
const editingGroupIndex = ref(0);
const isEditingGroup = ref(false);
function openGoodsDrawer(idx) {
if (typeof idx === 'number') {
editingGroupIndex.value = idx;
isEditingGroup.value = true;
drawerCatId.value = goodsList.value[idx]?.cat_id || drawerCatId.value;
drawerCatName.value = goodsList.value[idx]?.cat_name || drawerCatName.value;
} else {
isEditingGroup.value = false;
}
showGoodsDrawer.value = true;
}
function buildOtherCategoryGroup() {
return {
service_id: 32,
item_name: '',
custom_name: '',
is_custom: true,
spec_name: '',
cat_id: 15,
cat_name: '其它',
unit: '个',
base_price: 0,
num: 1,
service_type: 'install',
service_type_name: '安装',
service_types: [
{ code: 'install', name: '安装', price: 0, is_default: 1 },
{ code: 'repair', name: '维修', price: 0, is_default: 0 },
{ code: 'grout', name: '美缝', price: 0, is_default: 0 },
{ code: 'glue', name: '打胶', price: 0, is_default: 0 },
{ code: 'remove', name: '拆旧', price: 0, is_default: 0 },
{ code: 'deliver', name: '送货到家', price: 0, is_default: 0 },
{ code: 'deliver_install', name: '送货到家并安装', price: 0, is_default: 0 },
{ code: 'deliver_downstairs', name: '送货到楼下(不含上楼)', price: 0, is_default: 0 },
{ code: 'clean', name: '保洁', price: 0, is_default: 0 },
{ code: 'drill', name: '打孔', price: 0, is_default: 0 },
{ code: 'film', name: '贴膜', price: 0, is_default: 0 },
{ code: 'move', name: '移机', price: 0, is_default: 0 },
{ code: 'other', name: '其他', price: 0, is_default: 0 }
],
remark: '',
images: [],
videos: [],
envImages: [],
extras: [
{ id: 1, key: 'addon_1', name: '拆旧', unit: '份', price: 30, num: 0 }
]
};
}
function handleGoodsDrawerSelect(spec) {
const serviceTypes = spec.service_types || [];
const defType = serviceTypes.find(st => st.is_default) || (spec.pricing_revision == null ? serviceTypes[0] : null);
if (!defType) {
uni.showToast({ title: '该商品暂未配置可用的默认服务', icon: 'none' });
return;
}
const extras = serviceAddons(defType, spec.addons || []);
const newGroup = {
service_id: spec.service_id,
item_name: spec.item_name,
spec_id: spec.spec_id || 0,
spec_name: spec.spec_name,
cat_id: spec.cat_id || drawerCatId.value,
cat_name: spec.cat_name || drawerCatName.value,
unit: spec.unit || '个',
service_price_type: spec.price_type || 'fixed',
base_price: defType.price,
pricing_revision: spec.pricing_revision,
legacy_addons: spec.addons || [],
num: 1,
service_type: defType.code,
service_type_name: defType.name,
service_types: serviceTypes,
remark: '',
images: [],
videos: [],
envImages: [],
extras: extras
};
if (spec.price_type === 'quote' && priceType.value === 'fixed') {
priceType.value = 'quote';
uni.showToast({ title: '该商品为师傅报价项目,已切换为报价模式', icon: 'none' });
}
if (isEditingGroup.value) {
goodsList.value[editingGroupIndex.value] = { ...goodsList.value[editingGroupIndex.value], ...newGroup };
} else {
goodsList.value.push(newGroup);
}
if (spec.cat_id) drawerCatId.value = spec.cat_id;
if (spec.cat_name) drawerCatName.value = spec.cat_name;
scheduleCalc();
}
// 奇兵到家同款:找不到商品去下单兜底(自填商品)
function handleGoodsDrawerCustom() {
showGoodsDrawer.value = false;
drawerCatId.value = 15;
drawerCatName.value = '其它';
currentCatIconUrl.value = '/uploads/icons/cat-more.svg';
priceType.value = 'quote';
const customGroup = buildOtherCategoryGroup();
if (isEditingGroup.value) {
goodsList.value[editingGroupIndex.value] = { ...goodsList.value[editingGroupIndex.value], ...customGroup };
} else {
goodsList.value.push(customGroup);
}
scheduleCalc();
}
function handleAddMoreGoods() {
if (isOtherCategory.value) {
goodsList.value.push(buildOtherCategoryGroup());
scheduleCalc();
} else {
openGoodsDrawer(false);
}
}
// 2. 服务项目选择抽屉
const showServiceTypeDrawer = ref(false);
const currentEditingServiceTypes = ref([]);
const currentEditingServiceTypeCode = ref('');
function openServiceTypeDrawer(idx) {
editingGroupIndex.value = idx;
const g = goodsList.value[idx];
currentEditingServiceTypes.value = g.service_types || [];
currentEditingServiceTypeCode.value = g.service_type || 'install';
showServiceTypeDrawer.value = true;
}
function handleServiceTypeConfirm(typeItem) {
const g = goodsList.value[editingGroupIndex.value];
if (g && typeItem) {
g.service_type = typeItem.code;
g.service_type_name = typeItem.name;
const previous = g.extras || [];
g.extras = serviceAddons(typeItem, g.legacy_addons || previous, previous);
if (Array.isArray(typeItem.addons)) g.service_price_type = typeItem.mode;
if (previous.some(item => item.num > 0 && !g.extras.some(addon => addon.key === item.key))) {
uni.showToast({ title: '已移除不适用的增值服务', icon: 'none' });
}
const supportsFixed = isServiceTypeFixedSupported(typeItem.code, typeItem.price, typeItem.support_fixed);
if (supportsFixed) {
g.base_price = Number(typeItem.price);
} else {
g.base_price = 0;
if (priceType.value === 'fixed') {
priceType.value = 'quote';
uni.showToast({
title: '该服务不支持“一口价”,已转为“报价”模式',
icon: 'none',
duration: 2500
});
}
}
scheduleCalc();
}
}
// 3. 增项服务抽屉
const showAddonDrawerFlag = ref(false);
const currentEditingAddons = ref([]);
function openAddonDrawer(idx) {
editingGroupIndex.value = idx;
currentEditingAddons.value = goodsList.value[idx].extras || [];
showAddonDrawerFlag.value = true;
}
function handleAddonConfirm(updatedList) {
const g = goodsList.value[editingGroupIndex.value];
if (g) {
g.extras = updatedList;
scheduleCalc();
}
}
// 4. 期望上门时间抽屉
const showAppointDrawer = ref(false);
const _nowDate = new Date();
const _pad2 = (n) => (n < 10 ? '0' + n : '' + n);
const today = `${_nowDate.getFullYear()}-${_pad2(_nowDate.getMonth() + 1)}-${_pad2(_nowDate.getDate())}`;
const appointDate = ref(today);
const appointSlot = ref('晚上');
const appointDisplay = computed(() => {
if (!appointDate.value) return '';
return `${appointDate.value} ${appointSlot.value}`;
});
function handleAppointConfirm(data) {
appointDate.value = data.date;
appointSlot.value = data.slot;
}
// 5. 师傅要求抽屉
const showDemandDrawer = ref(false);
const hasDemandReq = computed(() => form.demand_same_goods || form.demand_high_rating);
const demandSummaryText = computed(() => {
const parts = [];
if (form.demand_same_goods) parts.push('完工过相同商品');
if (form.demand_high_rating) parts.push('评分≥4.5');
return parts.length ? parts.join('、') : '对师傅的要求';
});
function handleDemandConfirm(res) {
form.demand_same_goods = res.sameGoods;
form.demand_high_rating = res.highRating;
form.demand_timeout = res.timeoutHours;
}
// 6. 常用备注模板抽屉
const showRemarkDrawer = ref(false);
function handleRemarkTemplateSelect(tplText) {
if (form.remark) {
form.remark += ';' + tplText;
} else {
form.remark = tplText;
}
}
// 7. 物流公司抽屉
const showLogisticsDrawer = ref(false);
function handleLogisticsSelect(company) {
form.logistics_company = company;
}
// 8. 费用明细抽屉
const showFeeDrawer = ref(false);
const calculatedAddonAmount = computed(() => {
let total = 0;
goodsList.value.forEach(g => {
(g.extras || []).forEach(ex => {
total += (Number(ex.price) || 0) * (Number(ex.num) || 0);
});
});
return total.toFixed(2);
});
// 9. 媒体选择抽屉(支持相册、拍照、从商品图库中选择、从系统图库中选择真实商品图)
const showMediaDrawer = ref(false);
const mediaTargetType = ref('image'); // 'image' or 'env'
const previewVideoUrl = ref('');
function openMediaDrawer(idx, type) {
editingGroupIndex.value = idx;
mediaTargetType.value = type;
showMediaDrawer.value = true;
}
function onEnvImageBoxTap(idx) {
const g = goodsList.value[idx];
if (g && Array.isArray(g.envImages) && g.envImages.length >= 6) {
previewImg(g.envImages, 0);
return;
}
uploadGroupMedia(idx, 'env');
}
function playVideo(url) {
if (!url) return;
previewVideoUrl.value = url;
}
function applyPickedGalleryImages(urls) {
uni.removeStorageSync('yjyf_picked_gallery_images');
if (!Array.isArray(urls) || urls.length === 0) return;
const idx = editingGroupIndex.value;
const g = goodsList.value[idx];
if (!g) return;
if (!Array.isArray(g.images)) g.images = [];
let addedCount = 0;
urls.forEach((u) => {
const cleanUrl = typeof u === 'string' ? u.trim() : '';
if (cleanUrl && !g.images.includes(cleanUrl) && g.images.length < 9) {
g.images.push(cleanUrl);
addedCount += 1;
}
});
if (addedCount === 0) {
uni.showToast({ title: '所选图片已在当前商品中', icon: 'none' });
}
}
function handleMediaActionSelect(sourceType) {
const idx = editingGroupIndex.value;
const g = goodsList.value[idx];
if (!g) return;
const curLen = Array.isArray(g.images) ? g.images.length : 0;
const remain = 9 - curLen;
if (sourceType === 'system_default') {
if (remain <= 0) {
uni.showToast({ title: '最多可添加9张商品图片', icon: 'none' });
return;
}
const cid = g.cat_id || drawerCatId.value || 0;
const sid = g.service_id || 0;
uni.navigateTo({
url: `/pages/order/system-gallery?cat_id=${cid}&service_id=${sid}&max=${remain}`
});
return;
}
if (sourceType === 'goods_default') {
if (!isLogin()) {
toLogin();
return;
}
if (remain <= 0) {
uni.showToast({ title: '最多可添加9张商品图片', icon: 'none' });
return;
}
const cid = g.cat_id || drawerCatId.value || 0;
uni.navigateTo({
url: `/pages/order/goods-gallery?cat_id=${cid}&max=${remain}`
});
return;
}
if (mediaTargetType.value === 'image') {
uploadGroupMedia(idx, 'image');
} else {
uploadGroupMedia(idx, 'env');
}
}
const uploadingMediaCount = ref(0);
function uploadGroupMedia(idx, kind) {
if (uploadingMediaCount.value > 0) return;
const g = goodsList.value[idx];
const currentCount = kind === 'image' ? (g.images?.length || 0) : (g.envImages?.length || 0);
const maxCount = kind === 'image' ? 9 : 6;
if (currentCount >= maxCount) {
uni.showToast({ title: `最多上传${maxCount}张`, icon: 'none' });
return;
}
uni.chooseImage({
count: maxCount - currentCount,
sourceType: ['album', 'camera'],
success: async (res) => {
uploadingMediaCount.value++;
uni.showLoading({ title: '上传中...', mask: true });
const uploadedGoodsUrls = [];
try {
for (const tempPath of res.tempFilePaths) {
const up = await api.upload(tempPath, 'order');
const imgUrl = up.fullurl || up.url;
if (imgUrl) {
if (kind === 'image') {
if (!g.images) g.images = [];
if (g.images.length < maxCount && !g.images.includes(imgUrl)) {
g.images.push(imgUrl);
uploadedGoodsUrls.push(imgUrl);
}
} else {
if (!g.envImages) g.envImages = [];
if (g.envImages.length < maxCount && !g.envImages.includes(imgUrl)) {
g.envImages.push(imgUrl);
}
}
}
}
if (kind === 'image' && uploadedGoodsUrls.length > 0 && isLogin()) {
try {
await api.saveGoodsGallery({
cat_id: g.cat_id || drawerCatId.value || 0,
title: g.item_name || g.custom_name || drawerCatName.value || '商品实拍',
images: JSON.stringify(uploadedGoodsUrls)
});
} catch (syncErr) {
console.warn('sync goods gallery skipped:', syncErr);
}
}
} catch (e) {
uni.showToast({ title: (e && e.msg) ? e.msg : '图片上传失败', icon: 'none' });
} finally {
uploadingMediaCount.value = Math.max(0, uploadingMediaCount.value - 1);
uni.hideLoading();
}
}
});
}
function pickVideo(idx) {
if (uploadingMediaCount.value > 0) return;
uni.chooseVideo({
sourceType: ['album', 'camera'],
maxDuration: 60,
camera: 'back',
success: async (res) => {
uploadingMediaCount.value++;
uni.showLoading({ title: '视频上传中...', mask: true });
try {
const up = await api.upload(res.tempFilePath, 'order');
const videoUrl = up.fullurl || up.url;
if (videoUrl) {
if (!goodsList.value[idx].videos) goodsList.value[idx].videos = [];
goodsList.value[idx].videos.push({
tempFilePath: videoUrl,
thumbTempFilePath: res.thumbTempFilePath || ''
});
}
} catch (e) {
uni.showToast({ title: (e && e.msg) ? e.msg : '视频上传失败', icon: 'none' });
} finally {
uploadingMediaCount.value = Math.max(0, uploadingMediaCount.value - 1);
uni.hideLoading();
}
}
});
}
function removeGroupImg(gIdx, iIdx) { goodsList.value[gIdx].images.splice(iIdx, 1); }
function removeGroupVideo(gIdx, vIdx) { goodsList.value[gIdx].videos.splice(vIdx, 1); }
function removeGroupEnvImg(gIdx, eIdx) { goodsList.value[gIdx].envImages.splice(eIdx, 1); }
function previewImg(list, idx) { uni.previewImage({ urls: list, current: list[idx] }); }
function showEnvHelp() {
uni.showModal({
title: '上传图片/视频说明',
content: '1. 添加商品图片便于师傅准确了解产品规格型号;\n2. 上传安装环境图或视频便于师傅提前备齐工具与辅料配件。',
showCancel: false,
confirmText: '我知道了',
confirmColor: '#F0710D'
});
}
// 客户信息表单(严禁硬编码默认省市区,优先回填用户真实默认收货地址)
const form = reactive({
contact: '',
mobile: '',
province: '',
city: '',
district: '',
address: '',
lng: '',
lat: '',
has_elevator: 1,
floor: 1,
remark: '',
order_contact_name: '',
order_contact_mobile: '',
logistics_no: '',
logistics_company: '',
goods_arrived: 0,
order_source: '',
source_order_no: '',
qual_req: '',
demand_same_goods: false,
demand_high_rating: false,
demand_timeout: 1
});
const queryingExpress = ref(false);
// 物流单号查询并联动下方物流公司
async function queryExpressCompany(silent = false) {
const rawNo = (form.logistics_no || '').trim();
if (!rawNo) {
if (!silent) uni.showToast({ title: '请先输入物流单号', icon: 'none' });
return;
}
if (queryingExpress.value) return;
queryingExpress.value = true;
try {
const res = await api.detectExpress({ express_no: rawNo });
if (res && res.company_name) {
form.logistics_company = res.company_name;
if (!silent) {
uni.showToast({ title: `已匹配:${res.company_name}`, icon: 'none' });
}
} else if (!silent) {
uni.showToast({ title: '未能识别物流公司,请手动选择', icon: 'none' });
}
} catch (e) {
if (!silent) {
uni.showToast({ title: (e && (e.message || e.msg)) || '物流识别失败,请手动选择', icon: 'none' });
}
} finally {
queryingExpress.value = false;
}
}
function onExpressNoBlur() {
if (form.logistics_no && form.logistics_no.trim().length >= 5) {
queryExpressCompany(true);
}
}
// 平台通用字典(100% 后端 /api/common/dicts 真实表与系统配置驱动)
const dictOptions = reactive({
order_sources: [],
qual_reqs: [],
auto_quote_hours: []
});
const dictsLoaded = ref(false);
const dictsLoading = ref(false);
const dictsError = ref('');
const dictDrawer = reactive({
visible: false,
mode: '',
title: '',
keyword: ''
});
async function loadCommonDicts(force = false) {
if (dictsLoaded.value && !force) return;
if (dictsLoading.value) return;
dictsLoading.value = true;
dictsError.value = '';
try {
const res = await api.commonDicts();
dictOptions.order_sources = Array.isArray(res && res.order_sources) ? res.order_sources : [];
dictOptions.qual_reqs = Array.isArray(res && res.qual_reqs) ? res.qual_reqs : [];
dictOptions.auto_quote_hours = Array.isArray(res && res.auto_quote_hours) ? res.auto_quote_hours : [];
dictsLoaded.value = true;
} catch (e) {
dictsError.value = (e && (e.message || e.msg)) || '选项加载失败,请重试';
} finally {
dictsLoading.value = false;
}
}
const filteredDictDrawerItems = computed(() => {
const mode = dictDrawer.mode;
const kw = (dictDrawer.keyword || '').trim().toLowerCase();
if (mode === 'order_source') {
return dictOptions.order_sources.map(src => ({
key: 'src_' + src,
label: src,
value: src,
active: form.order_source === src
}));
}
if (mode === 'qual_req') {
const items = [
{
key: 'qual_none',
label: '无特殊资质要求',
value: '',
active: !form.qual_req
},
...dictOptions.qual_reqs.map(q => ({
key: 'qual_' + q,
label: q,
value: q,
active: form.qual_req === q
}))
];
if (!kw) return items;
return items.filter(it => it.label.toLowerCase().includes(kw));
}
if (mode === 'auto_quote_hours') {
return dictOptions.auto_quote_hours.map(h => {
const hv = Number(h);
return {
key: 'hrs_' + hv,
label: `${hv}小时`,
value: hv,
active: Number(autoQuoteHours.value) === hv
};
});
}
return [];
});
function openDictDrawer(mode, title) {
dictDrawer.mode = mode;
dictDrawer.title = title;
dictDrawer.keyword = '';
dictDrawer.visible = true;
if (!dictsLoaded.value && !dictsLoading.value) {
loadCommonDicts(true);
}
}
function onSelectDictDrawerItem(item) {
if (dictDrawer.mode === 'order_source') {
form.order_source = item.value;
} else if (dictDrawer.mode === 'qual_req') {
form.qual_req = item.value;
} else if (dictDrawer.mode === 'auto_quote_hours') {
autoQuoteHours.value = Number(item.value);
}
dictDrawer.visible = false;
}
function pickOrderSource() {
openDictDrawer('order_source', '选择订单来源');
}
function pickQualReq() {
openDictDrawer('qual_req', '选择资质要求');
}
const contactDisplay = computed(() => {
const name = form.order_contact_name || '发单联系人';
const mob = form.order_contact_mobile || '';
if (mob) {
const safeMob = mob.length >= 11 ? (mob.slice(0, 7) + '...') : mob;
return `${name} ${safeMob}`;
}
return name;
});
function editOrderContact() {
uni.showModal({
title: '修改订单联系人电话',
editable: true,
placeholderText: '请输入订单联系人电话(11位手机号)',
content: form.order_contact_mobile || '',
confirmColor: '#F0710D',
success: (res) => {
if (res.confirm && res.content) {
const val = res.content.trim();
if (!/^1\d{10}$/.test(val)) {
uni.showToast({ title: '请输入正确的11位手机号', icon: 'none' });
return;
}
form.order_contact_mobile = val;
}
}
});
}
async function initOrderContactFromProfile() {
if (!isLogin()) return;
try {
const p = await api.profile();
if (p) {
form.order_contact_name = p.nickname || ('用户' + String(p.mobile || '').slice(-4));
form.order_contact_mobile = p.mobile || '';
}
} catch (e) {}
}
const currentDistrictMasterCount = ref(0);
const masterCountInfo = reactive({
count: 0,
is_local: false,
tip: ''
});
const showRegionDrawer = ref(false);
const showAddressDrawer = ref(false);
const showCouponDrawer = ref(false);
const selectedCoupon = ref(null);
async function initDefaultCustomerAddress() {
if (!isLogin()) return;
try {
const res = await api.addressList();
const list = (res && res.list) ? res.list : [];
if (list.length > 0 && !form.contact && !form.address) {
const defAddr = list.find(a => Number(a.is_default) === 1) || list[0];
applySelectedAddress(defAddr);
}
} catch (e) {}
}
async function fetchMasterCount() {
if (!form.province || !form.city) {
currentDistrictMasterCount.value = 0;
masterCountInfo.count = 0;
masterCountInfo.is_local = false;
masterCountInfo.tip = '';
return;
}
try {
const res = await api.masterCount({
province: form.province,
city: form.city,
district: form.district,
cat_id: drawerCatId.value
});
if (res && res.count !== undefined) {
currentDistrictMasterCount.value = Number(res.count) || 0;
masterCountInfo.count = Number(res.count) || 0;
masterCountInfo.is_local = !!res.is_local;
masterCountInfo.tip = res.tip || '';
}
} catch (e) {}
}
function onRegionChange(e) {
const val = e.detail.value;
if (val && val.length >= 3) {
form.province = val[0];
form.city = val[1];
form.district = val[2];
fetchMasterCount();
scheduleCalc();
}
}
function handleRegionDrawerConfirm(reg) {
if (!reg) return;
form.province = reg.province;
form.city = reg.city;
form.district = reg.district;
fetchMasterCount();
scheduleCalc();
}
function setElevator(val) {
form.has_elevator = val;
if (val === 0 && Number(form.floor) < 2) {
form.floor = 3;
}
scheduleCalc();
}
function stepFloor(delta) {
const next = Math.min(30, Math.max(2, (Number(form.floor) || 2) + delta));
if (next === form.floor) return;
form.floor = next;
scheduleCalc();
}
// 智能粘贴识别
const rawAddressText = ref('');
function pasteFromClipboard() {
uni.getClipboardData({
success: (res) => { rawAddressText.value = res.data || ''; }
});
}
function executeParseAddress() {
const raw = rawAddressText.value.trim();
if (!raw) {
uni.showToast({ title: '请输入或粘贴地址文本', icon: 'none' });
return;
}
const mobileHit = raw.match(/(1[3-9]\d{9})/);
if (mobileHit) form.mobile = mobileHit[1];
let textLeft = raw.replace(form.mobile, ' ').trim();
const nameHit = textLeft.match(/^([^,,\s]{2,4})[,,\s]/);
if (nameHit) {
form.contact = nameHit[1];
textLeft = textLeft.replace(nameHit[0], ' ').trim();
}
const regHit = textLeft.match(/(.*?[省|市|自治区])\s*(.*?[市|州|地区])?\s*(.*?[区|县|市|旗])?\s*(.*)/);
if (regHit) {
if (regHit[1]) form.province = regHit[1].trim();
if (regHit[2]) form.city = regHit[2].trim();
if (regHit[3]) form.district = regHit[3].trim();
if (regHit[4]) form.address = regHit[4].trim();
} else {
form.address = textLeft;
}
showStep2Tip.value = false;
fetchMasterCount();
scheduleCalc();
uni.showToast({ title: '地址识别完成' });
}
function parseRegionFromAddress(str) {
if (!str) return '';
const m = String(str).match(/^([^省]+省|[^自治区]+自治区|北京市|上海市|天津市|重庆市)?([^市州盟]+(?:市|州|盟))?([^区县旗]+(?:区|县|旗|市))?(.*)$/);
if (m && (m[1] || m[2] || m[3])) {
if (m[1]) form.province = m[1].trim();
if (m[2]) {
form.city = m[2].trim();
} else if (m[1] && /北京市|上海市|天津市|重庆市/.test(m[1])) {
form.city = m[1].trim();
}
if (m[3]) form.district = m[3].trim();
return (m[4] || '').trim();
}
return str;
}
function handleLocationSuccess(res) {
if (!res) return;
const rawAddr = res.address || '';
const poiName = res.name || '';
const remain = parseRegionFromAddress(rawAddr);
let detail = '';
if (remain && poiName && !remain.includes(poiName)) {
detail = `${remain} ${poiName}`.trim();
} else {
detail = (remain || poiName || rawAddr).trim();
}
if (detail) {
form.address = detail;
}
if (res.longitude) form.lng = String(res.longitude);
if (res.latitude) form.lat = String(res.latitude);
showStep2Tip.value = false;
fetchMasterCount();
scheduleCalc();
uni.showToast({
title: '已定位:' + (poiName || form.district || '位置选择成功'),
icon: 'none'
});
}
function chooseMapLocation() {
const chooseOptions = {
success: (res) => {
handleLocationSuccess(res);
},
fail: (err) => {
if (err && (err.errMsg && (err.errMsg.indexOf('auth deny') > -1 || err.errMsg.indexOf('auth denied') > -1))) {
uni.showModal({
title: '定位权限未开启',
content: '需要位置信息权限以通过地图精确定位服务地址,是否前往开启?',
confirmText: '去设置',
confirmColor: '#F0710D',
success: (mRes) => {
if (mRes.confirm) {
uni.openSetting();
}
}
});
} else if (err && err.errMsg && err.errMsg.indexOf('cancel') === -1) {
console.warn('[chooseLocation] fail:', err);
}
}
};
if (form.lat && form.lng && Number(form.lat) > 0 && Number(form.lng) > 0) {
chooseOptions.latitude = Number(form.lat);
chooseOptions.longitude = Number(form.lng);
}
// #ifdef MP-WEIXIN
uni.chooseLocation(chooseOptions);
// #endif
// #ifndef MP-WEIXIN
try {
uni.chooseLocation(chooseOptions);
} catch (e) {
uni.showToast({ title: '当前环境请手动输入地址或选择省市区', icon: 'none' });
}
// #endif
}
function applySelectedAddress(hit) {
if (!hit) return;
form.contact = hit.contact || '';
form.mobile = hit.mobile || '';
if (hit.province) form.province = hit.province;
if (hit.city) form.city = hit.city;
if (hit.district) form.district = hit.district;
form.address = hit.address || '';
if (hit.lng) form.lng = String(hit.lng);
if (hit.lat) form.lat = String(hit.lat);
form.floor = Number(hit.floor) || 1;
form.has_elevator = (hit.has_elevator !== undefined && hit.has_elevator !== null && hit.has_elevator !== '') ? Number(hit.has_elevator) : 1;
showStep2Tip.value = false;
fetchMasterCount();
scheduleCalc();
}
function openAddressBook() {
if (!isLogin()) {
toLogin();
return;
}
showAddressDrawer.value = true;
}
function openCouponDrawer() {
if (!isLogin()) {
toLogin();
return;
}
showCouponDrawer.value = true;
}
function handleCouponSelect(coupon) {
selectedCoupon.value = coupon || null;
calc();
}
// 附加服务与加急
const isUrgent = ref(false);
const autoQuote = ref(true);
const autoQuoteHours = ref(24);
function toggleUrgent() {
isUrgent.value = !isUrgent.value;
scheduleCalc();
}
function pickAutoQuoteHours() {
openDictDrawer('auto_quote_hours', '选择超时自动转报价时长');
}
function showPublishNotice() {
uni.showModal({
title: '发布订单须知',
content: '1. 请确保商品及客户地址信息真实准确;\n2. 师傅接单后将第一时间与客户联系预约具体上门时间;\n3. 平台全程担保交易,验收合格后再确认完工。',
showCancel: false,
confirmText: '我知道了',
confirmColor: '#F0710D'
});
}
const currentDisplayPrice = computed(() => {
if (priceType.value === 'quote') return '待报价';
if (priceType.value === 'custom') return (Number(userPrice.value) || 0).toFixed(2);
return (amount.value && amount.value.pay_amount !== undefined) ? Number(amount.value.pay_amount).toFixed(2) : '0.00';
});
const estimatedUrgentFee = computed(() => {
if (amount.value && amount.value.estimated_urgent_amount) {
return Number(amount.value.estimated_urgent_amount).toFixed(2);
}
const base = (amount.value && amount.value.base_amount) ? Number(amount.value.base_amount) : 0;
return Math.max(20, Math.min(200, Math.round(base * 0.2 * 100) / 100)).toFixed(2);
});
const currentUrgentAmount = computed(() => {
if (amount.value && Number(amount.value.urgent_amount) > 0) {
return Number(amount.value.urgent_amount).toFixed(2);
}
return estimatedUrgentFee.value;
});
const step2ExtraTip = computed(() => {
if (priceType.value === 'quote') return '价格待师傅接单报价';
if (priceType.value === 'custom') return '自主定价全包服务';
const tips = [];
if (amount.value && Number(amount.value.floor_amount) > 0) {
tips.push(`含步梯搬运费¥${amount.value.floor_amount}`);
}
if (amount.value && Number(amount.value.discount_amount) > 0) {
tips.push(`已优惠¥${amount.value.discount_amount}`);
}
return tips.join(',');
});
function showUrgentHelp() {
const base = (amount.value && amount.value.base_amount) ? Number(amount.value.base_amount) : 0;
const fee = estimatedUrgentFee.value;
uni.showModal({
title: '加急服务费计算说明',
content: `1. 计费口径:加急服务费按商品基础服务费的 20% 计算,单笔订单最低 20 元,最高 200 元封顶。\n2. 本单基础费:¥${base.toFixed(2)},对应加急费:¥${fee}。\n3. 履约保障:勾选后系统将优先置顶推送给附近正在待命的高评分金牌师傅,承诺最快30分钟内极速响应接单。`,
showCancel: false,
confirmText: '我知道了',
confirmColor: '#F0710D'
});
}
// 费用试算
const amount = ref(null);
let calcTimer = null;
let calcSequence = 0;
async function calc() {
const sequence = ++calcSequence;
try {
const res = await api.calc({
price_type: priceType.value,
user_price: Number(userPrice.value) || 0,
floor: form.floor,
has_elevator: form.has_elevator,
urgent: isUrgent.value ? 1 : 0,
coupon_id: (priceType.value === 'fixed' && selectedCoupon.value) ? selectedCoupon.value.id : 0,
goods_list: JSON.stringify(goodsList.value)
});
if (sequence !== calcSequence) return;
amount.value = res;
if (selectedCoupon.value && priceType.value === 'fixed' && (!res || !res.coupon)) {
selectedCoupon.value = null;
}
} catch (e) {
if (sequence === calcSequence) amount.value = null;
console.warn('[QuickOrder] calc failed:', e);
}
}
function scheduleCalc() {
clearTimeout(calcTimer);
calcTimer = setTimeout(calc, 250);
}
// 分步导航验证
function goStep2() {
if (priceType.value === 'custom') {
const p = Number(userPrice.value);
if (!p || p < 1 || p > 100000) {
uni.showToast({ title: '请输入 1-100000 元的有效意向出价', icon: 'none' });
return;
}
}
for (let i = 0; i < goodsList.value.length; i++) {
const g = goodsList.value[i];
if (g.is_custom || isOtherCategory.value) {
if (!g.custom_name || !g.custom_name.trim()) {
uni.showToast({ title: `请输入第 ${i + 1} 组商品名称`, icon: 'none' });
return;
}
g.item_name = g.custom_name.trim();
} else if (!g.item_name) {
uni.showToast({ title: `第 ${i + 1} 组尚未选择商品`, icon: 'none' });
return;
}
if (!g.images || g.images.length === 0) {
uni.showToast({ title: `请为第 ${i + 1} 组添加商品图片`, icon: 'none' });
return;
}
}
currentStep.value = 2;
fetchMasterCount();
}
function goStep3() {
if (!form.contact) {
uni.showToast({ title: '请填写客户姓名', icon: 'none' });
return;
}
if (!form.mobile || !/^1\d{10}$/.test(form.mobile)) {
uni.showToast({ title: '请填写正确的11位客户手机号', icon: 'none' });
return;
}
if (!form.province || !form.city || !form.district) {
uni.showToast({ title: '请选择客户所在省市区', icon: 'none' });
return;
}
if (!form.address) {
uni.showToast({ title: '请填写详细地址', icon: 'none' });
return;
}
currentStep.value = 3;
calc();
loadUserWallet();
}
// 下单与支付
const submitting = ref(false);
async function confirmSubmitAndPay() {
if (!isLogin()) { toLogin(); return; }
if (submitting.value) return;
if (uploadingMediaCount.value > 0) {
uni.showToast({ title: '图片或视频正在上传中,请稍候', icon: 'none' });
return;
}
submitting.value = true;
let createdOrderId = 0;
try {
let appointTimeStr = '14:30:00';
if (appointSlot.value && appointSlot.value.indexOf('上午') > -1) appointTimeStr = '10:00:00';
else if (appointSlot.value && appointSlot.value.indexOf('下午') > -1) appointTimeStr = '14:30:00';
else if (appointSlot.value && appointSlot.value.indexOf('晚上') > -1) appointTimeStr = '19:00:00';
else appointTimeStr = '10:00:00';
const safeDateStr = String(appointDate.value || today).replace(/-/g, '/');
let targetTime = Math.floor(new Date(`${safeDateStr} ${appointTimeStr}`).getTime() / 1000);
const now = Math.floor(Date.now() / 1000);
if (isNaN(targetTime) || targetTime <= now) {
targetTime = now + 3600;
}
const createRes = await api.orderCreate({
service_id: goodsList.value[0]?.service_id || 1,
price_type: priceType.value,
user_price: priceType.value === 'custom' ? Number(userPrice.value) : 0,
coupon_id: (priceType.value === 'fixed' && selectedCoupon.value) ? selectedCoupon.value.id : 0,
contact: form.contact,
mobile: form.mobile,
province: form.province,
city: form.city,
district: form.district,
address: form.address,
lng: form.lng || '',
lat: form.lat || '',
floor: form.floor,
has_elevator: form.has_elevator,
urgent: isUrgent.value ? 1 : 0,
auto_quote_timeout: (priceType.value === 'fixed' && autoQuote.value) ? (Number(autoQuoteHours.value) || 24) * 3600 : 0,
appoint_time: targetTime,
remark: form.remark,
order_contact: `${form.order_contact_name} ${form.order_contact_mobile}`.trim(),
logistics_no: form.logistics_no,
logistics_company: form.logistics_company,
goods_arrived: form.goods_arrived,
order_source: form.order_source,
source_order_no: form.source_order_no,
qual_req: form.qual_req,
master_req: demandSummaryText.value === '对师傅的要求' ? '' : demandSummaryText.value,
goods_list: JSON.stringify(goodsList.value)
});
createdOrderId = createRes.order_id;
if (priceType.value === 'quote') {
uni.showToast({ title: '报价单发布成功,等待师傅报价' });
setTimeout(() => {
submitting.value = false;
uni.redirectTo({ url: `/pages/order/detail?id=${createdOrderId}` });
}, 600);
} else {
openOrderPaymentResult(createdOrderId, await executeOrderWxPay(api.orderPay, {
order_id: createdOrderId,
pay_type: (selectedPayType.value === 'balance' && isBalanceSufficient.value) ? 'balance' : 'wechat'
}, () => paymentPasswordDialog.value.open({ createdOrderId })), true);
}
} catch (e) {
if (e && e.paymentSetupNavigation) { submitting.value = false; return; }
if (createdOrderId) {
if (!e || !e.unsupportedEnv) {
const reason = (e && e.message) ? `订单已创建(${e.message})` : '订单已创建,请在详情页完成支付';
uni.showToast({ title: reason, icon: 'none' });
}
setTimeout(() => {
submitting.value = false;
uni.redirectTo({ url: `/pages/order/detail?id=${createdOrderId}` });
}, 1200);
} else {
submitting.value = false;
if (!e || (e.code === undefined && !e.handledToast)) {
uni.showToast({ title: (e && e.message) || '下单失败,请稍后重试', icon: 'none' });
}
}
}
}
async function loadRealCategoryAndServices(options) {
const firstGoods = uni.getStorageSync('yjyf_first_goods');
if (firstGoods) {
receiveFirstGoods(firstGoods);
return;
}
let targetCatId = options && options.cat_id ? Number(options.cat_id) : 0;
let targetCatName = options && options.cat_name ? decodeURIComponent(options.cat_name) : '';
const targetServiceId = options && options.service_id ? Number(options.service_id) : 0;
const targetGoodsNum = options && options.goods_num ? Math.max(1, Number(options.goods_num) || 1) : 1;
const hasExplicitMode = !!(options && (options.mode || options.custom == 1));
if (options && options.mode === 'custom') priceType.value = 'custom';
if (options && (options.mode === 'quote' || options.custom == 1)) priceType.value = 'quote';
try {
if (targetServiceId > 0 && !targetCatId) {
try {
const detailRes = await api.serviceDetail(targetServiceId);
if (detailRes && detailRes.detail && detailRes.detail.cat_id) {
targetCatId = Number(detailRes.detail.cat_id);
}
} catch (e) {}
}
const resCats = await api.cats();
const cats = resCats && resCats.list ? resCats.list : [];
if (cats.length > 0) {
let matchedCat = null;
if (targetCatId) {
matchedCat = cats.find(c => Number(c.id) === targetCatId);
}
if (!matchedCat && targetCatName) {
matchedCat = cats.find(c => c.name === targetCatName || targetCatName.includes(c.name));
}
if (!matchedCat) {
matchedCat = cats[0];
}
if (options?.custom == 1 || targetCatId === 15 || targetCatName === '其它' || targetCatName === '其他') {
matchedCat = cats.find(c => c.id === 15 || c.name === '其它' || c.name === '其他') || { id: 15, name: '其它', icon_url: '/uploads/icons/cat-more.svg' };
drawerCatId.value = matchedCat.id;
drawerCatName.value = '其它';
currentCatIconUrl.value = matchedCat.icon_url || '/uploads/icons/cat-more.svg';
priceType.value = 'quote';
const otherGroup = buildOtherCategoryGroup();
otherGroup.num = targetGoodsNum;
goodsList.value = [otherGroup];
scheduleCalc();
fetchMasterCount();
return;
}
drawerCatId.value = matchedCat.id;
drawerCatName.value = matchedCat.name;
currentCatIconUrl.value = matchedCat.icon_url || '';
const sRes = await api.services({ cat_id: matchedCat.id });
const services = sRes && sRes.list ? sRes.list : [];
if (services.length > 0) {
const firstS = (targetServiceId > 0 ? services.find(s => Number(s.id) === targetServiceId) : null) || services[0];
const firstSpec = firstS.specs && firstS.specs[0];
const legacy = firstS.addons || [];
const serviceTypes = firstS.service_types || [];
const configured = firstS.pricing_revision != null;
const resolvedServiceTypes = configured
? (firstSpec ? (firstSpec.service_types || []) : serviceTypes)
: serviceTypes.map(st => ({
...st,
price: firstSpec?.service_prices?.[st.code] ?? (st.is_default && Number(firstSpec?.base_price) > 0 ? firstSpec.base_price : st.price)
}));
const defType = resolvedServiceTypes.find(st => st.is_default) || (configured ? null : resolvedServiceTypes[0]);
if (!defType) return;
const effectivePrice = defType.price;
const selectedPriceType = configured ? defType.mode : firstS.price_type;
const extras = serviceAddons(defType, legacy);
if (priceType.value === 'fixed' && ((configured || !hasExplicitMode) && selectedPriceType === 'quote'
|| (!hasExplicitMode && effectivePrice <= 0))) {
priceType.value = 'quote';
}
goodsList.value = [
{
service_id: firstS.id,
item_name: firstS.name,
spec_id: firstSpec ? firstSpec.id : 0,
spec_name: firstSpec ? firstSpec.name : firstS.name,
cat_id: matchedCat.id,
cat_name: matchedCat.name,
unit: firstS.unit || '个',
service_price_type: selectedPriceType || 'fixed',
base_price: effectivePrice,
num: targetGoodsNum,
service_type: defType.code,
service_type_name: defType.name,
service_types: resolvedServiceTypes,
pricing_revision: firstS.pricing_revision,
legacy_addons: legacy,
remark: '',
images: [],
videos: [],
envImages: [],
extras: extras
}
];
}
}
} catch (e) {}
calc();
fetchMasterCount();
}
onLoad((options) => {
uni.$on('selectAddress', applySelectedAddress);
uni.$on('yjyf:selectGalleryImages', applyPickedGalleryImages);
uni.$on('yjyf:applyGoodsTemplate', onReceiveGoodsTemplate);
loadRealCategoryAndServices(options);
initOrderContactFromProfile();
loadUserWallet();
initDefaultCustomerAddress();
loadCommonDicts();
});
onUnload(() => {
uni.$off('selectAddress', applySelectedAddress);
uni.$off('yjyf:selectGalleryImages', applyPickedGalleryImages);
uni.$off('yjyf:applyGoodsTemplate', onReceiveGoodsTemplate);
});
onShow(() => {
loadUserWallet();
const pickedTpl = uni.getStorageSync('yjyf_picked_goods_template');
if (pickedTpl) {
onReceiveGoodsTemplate(pickedTpl);
}
const pickedImgs = uni.getStorageSync('yjyf_picked_gallery_images');
if (pickedImgs && Array.isArray(pickedImgs) && pickedImgs.length > 0) {
uni.removeStorageSync('yjyf_picked_gallery_images');
applyPickedGalleryImages(pickedImgs);
}
const firstGoods = uni.getStorageSync('yjyf_first_goods');
if (firstGoods) {
receiveFirstGoods(firstGoods);
}
const pickedAddr = uni.getStorageSync('yjyf_selected_address');
if (pickedAddr) {
uni.removeStorageSync('yjyf_selected_address');
applySelectedAddress(pickedAddr);
}
});
</script>
<style scoped>
.page {
min-height: 100vh;
background: #F5F6F8;
padding-bottom: calc(360rpx + env(safe-area-inset-bottom));
box-sizing: border-box;
}
/* ---------- 主体内容区 ---------- */
.main-body {
padding: 20rpx 20rpx;
}
/* ---------- 顶部品类与模式双行卡片 ---------- */
.top-service-card {
background: #FFFFFF;
border-radius: 20rpx;
padding: 0 24rpx;
margin-bottom: 20rpx;
box-shadow: 0 4rpx 20rpx rgba(31, 31, 31, 0.04);
}
.tsc-row {
display: flex;
align-items: center;
justify-content: space-between;
height: 120rpx;
border-bottom: 1rpx solid #F0F0F2;
}
.tsc-row.tsc-mode-row {
height: 120rpx;
}
.tsc-row.no-border {
border-bottom: none;
}
.tsc-left {
display: flex;
align-items: center;
gap: 24rpx;
}
.tsc-icon-wrap {
width: 84rpx;
height: 84rpx;
border-radius: 50%;
background: #FFF2E8;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.tsc-img {
width: 52rpx;
height: 52rpx;
}
.tsc-title {
font-size: 30rpx;
font-weight: 700;
color: #1F1F1F;
}
.tsc-btn {
display: inline-flex;
align-items: center;
justify-content: center;
height: 58rpx;
padding: 0 22rpx;
background: #FFFFFF;
border: 1rpx solid #DCDCDC;
border-radius: 29rpx;
line-height: 1;
}
.tsc-btn-txt {
font-size: 26rpx;
color: #333333;
line-height: 1;
}
.custom-price-bar {
display: flex;
align-items: center;
padding: 20rpx 0 24rpx;
border-top: 1rpx dashed #E5E7EB;
}
.cpb-label {
font-size: 28rpx;
font-weight: 600;
color: #1F1F1F;
}
.cpb-input-wrap {
display: flex;
align-items: center;
flex: 1;
background: #FFF7F0;
border-radius: 12rpx;
padding: 10rpx 20rpx;
}
.cpb-currency {
font-size: 32rpx;
font-weight: 700;
color: #F0710D;
margin-right: 8rpx;
}
.cpb-input {
font-size: 30rpx;
color: #1F1F1F;
flex: 1;
}
/* ---------- 商品卡片组(1:1 复刻图一 & frame_004, frame_009) ---------- */
.group-list {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.group-card {
background: #FFFFFF;
border-radius: 20rpx;
padding: 28rpx 24rpx 24rpx;
box-shadow: 0 4rpx 20rpx rgba(31, 31, 31, 0.04);
}
.gc-head {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 28rpx;
}
.gc-head-left {
display: flex;
align-items: center;
gap: 18rpx;
}
.gc-title {
font-size: 30rpx;
font-weight: 700;
color: #1F1F1F;
}
.gc-tpl-wrap {
position: relative;
display: inline-flex;
align-items: center;
}
.gc-tpl-btn {
height: 46rpx;
padding: 0 14rpx;
border: 1rpx solid #F0710D;
border-radius: 6rpx;
background: #FFFFFF;
display: inline-flex;
align-items: center;
justify-content: center;
}
.gc-tpl-txt {
font-size: 24rpx;
color: #F0710D;
line-height: 1;
}
.gc-meta {
display: flex;
align-items: center;
gap: 20rpx;
}
.gc-group-num {
font-size: 28rpx;
color: #333333;
}
.gc-del-btn {
display: flex;
align-items: center;
justify-content: center;
padding: 4rpx;
}
.gc-trash-img {
width: 34rpx;
height: 34rpx;
opacity: 0.75;
}
/* 媒体流式平铺网格(4列自动折行) */
.media-grid-wrap {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 16rpx;
margin-bottom: 24rpx;
}
.media-tile {
width: 152rpx;
height: 152rpx;
border: 2rpx dashed #D8DCE3;
border-radius: 12rpx;
background: #FFFFFF;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 6rpx;
position: relative;
overflow: hidden;
flex-shrink: 0;
box-sizing: border-box;
}
.media-tile.pic-dash {
border-color: #F0710D;
}
.media-tile.filled-tile {
border: 1rpx solid #EBEDF0;
background: #F5F6F8;
}
.mt-img {
width: 100%;
height: 100%;
display: block;
}
.mt-del {
position: absolute;
top: 6rpx;
right: 6rpx;
width: 36rpx;
height: 36rpx;
display: flex;
align-items: flex-start;
justify-content: flex-end;
z-index: 4;
}
.mt-del-ico {
width: 30rpx;
height: 30rpx;
display: block;
}
.video-poster-bg {
width: 100%;
height: 100%;
background: linear-gradient(135deg, #2D3648 0%, #1B2230 100%);
}
.video-play-center {
position: absolute;
inset: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 8rpx;
z-index: 2;
pointer-events: none;
}
.video-poster-tip {
font-size: 22rpx;
color: rgba(255, 255, 255, 0.92);
line-height: 1;
}
.dc-icon {
width: 48rpx;
height: 48rpx;
margin-bottom: 4rpx;
}
.dc-req-line {
display: flex;
align-items: center;
justify-content: center;
}
.dc-star {
color: #E8331B;
font-size: 26rpx;
font-weight: 700;
margin-right: 2rpx;
}
.dc-txt {
font-size: 24rpx;
font-weight: 500;
line-height: 1.2;
}
.dc-txt.orange {
color: #F0710D;
}
.dc-txt.gray {
color: #888888;
}
.dc-sub {
font-size: 22rpx;
color: #999999;
line-height: 1.1;
}
.env-help-box {
width: 52rpx;
height: 52rpx;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.eh-icon {
width: 38rpx;
height: 38rpx;
}
.mp-play-badge {
width: 52rpx;
height: 52rpx;
background: rgba(0, 0, 0, 0.45);
border: 2rpx solid rgba(255, 255, 255, 0.72);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.mp-play-icon {
width: 22rpx;
height: 22rpx;
margin-left: 3rpx;
}
/* ---------- 表单项行通用排版 ---------- */
.form-item-list {
display: flex;
flex-direction: column;
}
.form-row {
display: flex;
align-items: center;
justify-content: space-between;
min-height: 100rpx;
border-bottom: 1rpx solid #F0F0F2;
padding: 8rpx 0;
}
.form-row.no-border {
border-bottom: none;
}
.form-row.flex-col-remark {
flex-direction: column;
align-items: stretch;
justify-content: flex-start;
padding: 22rpx 0 8rpx;
gap: 18rpx;
}
.gc-remark-box {
width: 100%;
height: 76rpx;
background: #F5F5F5;
border-radius: 10rpx;
padding: 0 24rpx;
display: flex;
align-items: center;
box-sizing: border-box;
}
.gc-remark-input {
width: 100%;
font-size: 26rpx;
color: #1F1F1F;
}
.gc-subtotal-row {
border-top: 1rpx solid #F0F0F2;
margin-top: 20rpx;
padding-top: 22rpx;
display: flex;
align-items: center;
justify-content: flex-end;
}
.gc-subtotal-price {
font-size: 36rpx;
font-weight: 700;
color: #E8331B;
}
.fr-label {
display: flex;
align-items: center;
gap: 4rpx;
flex-shrink: 0;
}
.req-star {
color: #E8331B;
font-size: 28rpx;
font-weight: 700;
}
.label-txt {
font-size: 28rpx;
font-weight: 400;
color: #1F1F1F;
}
.label-txt.no-star {
padding-left: 0;
}
.fr-value-box {
display: flex;
align-items: center;
gap: 10rpx;
flex: 1;
justify-content: flex-end;
}
.val-txt {
font-size: 28rpx;
color: #1F1F1F;
text-align: right;
max-width: 450rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.val-txt.placeholder {
color: #999999;
}
.val-txt.highlight {
color: #F0710D;
font-weight: 500;
}
.val-txt.highlight-dark {
color: #1F1F1F;
font-weight: 400;
}
.fr-arrow {
width: 28rpx;
height: 28rpx;
opacity: 0.45;
}
.fr-stepper-group {
display: flex;
align-items: center;
gap: 14rpx;
}
.fr-stepper {
display: flex;
align-items: center;
border: 1rpx solid #DCDCDC;
border-radius: 6rpx;
overflow: hidden;
}
.step-btn {
width: 58rpx;
height: 54rpx;
display: flex;
align-items: center;
justify-content: center;
background: #FFFFFF;
}
.step-btn.disabled {
opacity: 0.4;
}
.step-ico {
width: 26rpx;
height: 26rpx;
}
.step-num-box {
width: 68rpx;
height: 54rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
color: #1F1F1F;
border-left: 1rpx solid #DCDCDC;
border-right: 1rpx solid #DCDCDC;
background: #FFFFFF;
}
.step-unit-txt {
font-size: 28rpx;
color: #333333;
}
.fr-input {
font-size: 28rpx;
color: #1F1F1F;
width: 100%;
text-align: right;
}
.fr-input-box {
flex: 1;
display: flex;
align-items: center;
justify-content: flex-end;
gap: 12rpx;
}
.fr-custom-input {
flex: 1;
font-size: 28rpx;
color: #1F1F1F;
text-align: right;
}
.fr-char-count {
font-size: 24rpx;
color: #999999;
flex-shrink: 0;
}
.fr-input.right-align {
text-align: right;
}
/* ---------- 步骤 2:客户信息卡片 ---------- */
.paste-parse-card {
background: #FFFFFF;
border-radius: 20rpx;
padding: 20rpx;
margin-bottom: 20rpx;
box-shadow: 0 4rpx 20rpx rgba(31, 31, 31, 0.04);
}
.ppc-box {
background: #F5F6F8;
border-radius: 12rpx;
padding: 20rpx;
position: relative;
}
.ppc-textarea {
width: 100%;
height: 120rpx;
font-size: 26rpx;
line-height: 1.5;
color: #1F1F1F;
}
.ppc-btn-row {
display: flex;
flex-direction: column;
align-items: stretch;
gap: 12rpx;
margin-top: 12rpx;
}
.ppc-guide-bubble {
display: inline-flex;
align-items: center;
gap: 10rpx;
background: #FFF7F0;
border: 1rpx solid #FFD1A8;
border-radius: 8rpx;
padding: 8rpx 14rpx;
min-width: 0;
}
.pgb-txt {
flex: 1;
min-width: 0;
font-size: 22rpx;
color: #F0710D;
line-height: 1.3;
}
.pgb-close-ico {
width: 22rpx;
height: 22rpx;
flex-shrink: 0;
}
.ppc-right-btns {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 16rpx;
}
.ppc-clipboard-btn {
display: inline-flex;
align-items: center;
justify-content: center;
height: 54rpx;
padding: 0 22rpx;
background: #FFFFFF;
border: 1rpx solid #D5D5D5;
border-radius: 8rpx;
}
.pcb-txt {
font-size: 24rpx;
color: #444444;
}
.ppc-history-btn {
display: inline-flex;
align-items: center;
justify-content: center;
height: 54rpx;
padding: 0 24rpx;
background: #FFF7F0;
border: 1rpx solid #FFD1A8;
border-radius: 10rpx;
}
.phb-txt {
white-space: nowrap;
font-size: 26rpx;
font-weight: 500;
color: #F0710D;
}
.express-no-box {
gap: 16rpx;
}
.express-query-btn {
flex-shrink: 0;
padding: 6rpx 12rpx;
display: inline-flex;
align-items: center;
justify-content: center;
}
.eqb-txt {
font-size: 26rpx;
color: #F0710D;
font-weight: 500;
}
.ppc-action-btn {
display: inline-flex;
align-items: center;
justify-content: center;
height: 54rpx;
padding: 0 26rpx;
background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%);
border-radius: 8rpx;
}
.pab-txt {
white-space: nowrap;
font-size: 26rpx;
font-weight: 500;
color: #FFFFFF;
}
.customer-card {
background: #FFFFFF;
border-radius: 20rpx;
padding: 0 24rpx;
margin-bottom: 20rpx;
box-shadow: 0 4rpx 20rpx rgba(31, 31, 31, 0.04);
}
.addr-col-row {
display: flex;
flex-direction: column;
align-items: stretch;
padding: 22rpx 0 18rpx;
}
.addr-top-line {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16rpx;
}
.addr-ops-wrap {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 14rpx;
flex: 1;
min-width: 0;
}
.region-picker-btn {
display: flex;
align-items: center;
gap: 8rpx;
min-width: 0;
flex-shrink: 1;
}
.region-txt {
max-width: 320rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
text-align: right;
font-size: 28rpx;
color: #1F1F1F;
}
.addr-loc-divider {
width: 1rpx;
height: 28rpx;
background: #E5E5E5;
flex-shrink: 0;
}
.map-loc-btn {
display: inline-flex;
align-items: center;
gap: 6rpx;
padding: 6rpx 14rpx;
background: #FFF7F0;
border: 1rpx solid #FFD1A8;
border-radius: 24rpx;
flex-shrink: 0;
transition: opacity 0.15s ease;
}
.mlb-ico {
width: 24rpx;
height: 24rpx;
flex-shrink: 0;
}
.mlb-txt {
font-size: 22rpx;
font-weight: 600;
color: #F0710D;
line-height: 1;
}
.master-capacity-hint {
margin-top: 14rpx;
background: #FFF7F0;
border: 1rpx solid #FFE4CC;
border-radius: 10rpx;
padding: 10rpx 16rpx;
display: flex;
align-items: center;
gap: 10rpx;
}
.mch-icon {
width: 26rpx;
height: 26rpx;
flex-shrink: 0;
}
.mch-txt {
font-size: 22rpx;
color: #666666;
line-height: 1.3;
}
.mch-num {
font-size: 24rpx;
font-weight: 600;
color: #F0710D;
}
.mch-tag {
margin-left: auto;
font-size: 20rpx;
color: #2FA84F;
background: #EDF9F0;
padding: 2rpx 10rpx;
border-radius: 6rpx;
font-weight: 500;
flex-shrink: 0;
}
.detail-input-wrap {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 12rpx;
flex: 1;
min-width: 0;
}
.detail-input-field {
flex: 1;
min-width: 0;
}
.detail-loc-trigger {
width: 56rpx;
height: 56rpx;
display: flex;
align-items: center;
justify-content: center;
background: #FFF7F0;
border: 1rpx solid #FFE4CC;
border-radius: 50%;
flex-shrink: 0;
margin-left: 8rpx;
transition: transform 0.15s ease;
}
.dlt-icon {
width: 30rpx;
height: 30rpx;
}
.elevator-radios {
display: flex;
align-items: center;
gap: 32rpx;
}
.el-radio {
display: flex;
align-items: center;
gap: 12rpx;
}
.rd-dot {
width: 32rpx;
height: 32rpx;
border-radius: 50%;
border: 2rpx solid #CCCCCC;
background: #FFFFFF;
box-sizing: border-box;
position: relative;
}
.el-radio.on .rd-dot {
border: 8rpx solid #F0710D;
}
.rd-txt {
font-size: 28rpx;
color: #1F1F1F;
}
.flex-col-start {
flex-direction: column;
align-items: stretch;
padding: 20rpx 0 24rpx;
}
.remark-head-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 16rpx;
}
.tpl-btn {
display: flex;
align-items: center;
gap: 6rpx;
}
.tpl-txt {
font-size: 26rpx;
color: #F0710D;
}
.tpl-arrow {
width: 24rpx;
height: 24rpx;
opacity: 0.6;
}
.remark-input-box {
background: #F5F5F5;
border-radius: 10rpx;
height: 76rpx;
padding: 0 24rpx;
display: flex;
align-items: center;
}
.remark-input {
font-size: 26rpx;
color: #1F1F1F;
width: 100%;
}
.goods-arrived-pills {
display: flex;
align-items: center;
gap: 16rpx;
}
.arrived-pill {
display: inline-flex;
align-items: center;
justify-content: center;
height: 54rpx;
padding: 0 24rpx;
font-size: 26rpx;
color: #333333;
background: #FFFFFF;
border: 1rpx solid #CCCCCC;
border-radius: 6rpx;
line-height: 1;
}
.arrived-pill.active {
background: #FFF2E8;
border-color: #F0710D;
color: #F0710D;
}
.step2-expand-bar {
border-top: 1rpx solid #F0F0F2;
height: 84rpx;
display: flex;
align-items: center;
justify-content: center;
gap: 8rpx;
}
.seb-txt {
font-size: 26rpx;
color: #666666;
}
.seb-arrow {
width: 26rpx;
height: 26rpx;
opacity: 0.6;
transition: transform 0.2s;
}
.seb-arrow.up {
transform: rotate(180deg);
}
/* ---------- 步骤 3:确认订单卡片 ---------- */
.confirm-addr-card {
background: #FFFFFF;
border-radius: 20rpx;
padding: 28rpx 24rpx;
margin-bottom: 20rpx;
display: flex;
align-items: center;
gap: 20rpx;
box-shadow: 0 4rpx 20rpx rgba(31, 31, 31, 0.04);
}
.cac-icon-wrap {
width: 56rpx;
height: 56rpx;
flex-shrink: 0;
}
.cac-pin-icon {
width: 56rpx;
height: 56rpx;
}
.cac-info {
flex: 1;
display: flex;
flex-direction: column;
gap: 8rpx;
}
.cac-user-line {
display: flex;
align-items: center;
gap: 16rpx;
}
.cac-name {
font-size: 30rpx;
font-weight: 700;
color: #1F1F1F;
}
.cac-mobile {
font-size: 28rpx;
color: #333333;
}
.cac-full-addr {
font-size: 26rpx;
color: #666666;
line-height: 1.4;
}
.cac-edit-link {
padding: 8rpx 4rpx 8rpx 16rpx;
flex-shrink: 0;
}
.cel-txt {
font-size: 28rpx;
color: #F0710D;
}
.confirm-goods-card {
background: #FFFFFF;
border-radius: 20rpx;
padding: 8rpx 24rpx;
margin-bottom: 20rpx;
box-shadow: 0 4rpx 20rpx rgba(31, 31, 31, 0.04);
}
.cgc-item {
display: flex;
align-items: center;
gap: 20rpx;
padding: 24rpx 0;
border-bottom: 1rpx solid #F0F0F2;
}
.cgc-item:last-child {
border-bottom: none;
}
.cgc-thumb-wrap {
width: 140rpx;
height: 140rpx;
border-radius: 12rpx;
background: #FFF7F0;
position: relative;
overflow: hidden;
flex-shrink: 0;
}
.cgc-thumb {
width: 100%;
height: 100%;
}
.cgc-view-big {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.55);
text-align: center;
padding: 4rpx 0;
}
.cvb-txt {
font-size: 22rpx;
color: #FFFFFF;
}
.cgc-detail {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
min-height: 120rpx;
}
.cgc-top-row {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16rpx;
}
.cgc-name {
font-size: 28rpx;
font-weight: 600;
color: #1F1F1F;
flex: 1;
}
.cgc-price {
font-size: 30rpx;
font-weight: 700;
color: #1F1F1F;
}
.cgc-price-sub {
font-size: 24rpx;
color: #888888;
font-weight: normal;
}
.cgc-services-row {
display: flex;
align-items: center;
margin-top: 16rpx;
}
.cgc-service-summary {
font-size: 26rpx;
color: #888888;
}
.confirm-extra-card {
background: #FFFFFF;
border-radius: 20rpx;
padding: 24rpx;
margin-bottom: 20rpx;
box-shadow: 0 4rpx 20rpx rgba(31, 31, 31, 0.04);
}
.cec-head {
display: flex;
align-items: center;
gap: 10rpx;
margin-bottom: 24rpx;
}
.cec-title {
font-size: 30rpx;
font-weight: 700;
color: #1F1F1F;
}
.cec-info-icon {
width: 32rpx;
height: 32rpx;
}
.cec-row {
display: flex;
align-items: center;
justify-content: space-between;
}
.cec-label {
font-size: 28rpx;
color: #1F1F1F;
}
.cec-radio-circle {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
border: 2rpx solid #CCCCCC;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
}
.cec-radio-circle.on {
background: #F0710D;
border-color: #F0710D;
}
.crc-check {
width: 24rpx;
height: 24rpx;
}
/* 确认下单 - 支付方式卡片 */
.confirm-pay-card {
background: #FFFFFF;
border-radius: 20rpx;
padding: 24rpx;
margin-bottom: 20rpx;
box-shadow: 0 4rpx 20rpx rgba(31, 31, 31, 0.04);
}
.cpc-head {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20rpx;
}
.cpc-title {
font-size: 30rpx;
font-weight: 600;
color: #1F1F1F;
}
.cpc-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16rpx 0;
}
.cpc-item.disabled {
opacity: 0.7;
}
.cpc-left {
display: flex;
align-items: center;
flex: 1;
min-width: 0;
}
.cpc-icon {
width: 44rpx;
height: 44rpx;
margin-right: 18rpx;
flex-shrink: 0;
}
.cpc-meta {
display: flex;
flex-direction: column;
flex: 1;
min-width: 0;
}
.cpc-name-line {
display: flex;
align-items: center;
line-height: 1.4;
}
.cpc-name {
font-size: 28rpx;
font-weight: 500;
color: #1F1F1F;
}
.cpc-rec-badge {
margin-left: 12rpx;
background: #FFF7F0;
color: #F0710D;
font-size: 20rpx;
font-weight: 500;
padding: 2rpx 10rpx;
border-radius: 6rpx;
border: 1rpx solid rgba(240, 113, 13, 0.25);
}
.cpc-bal-txt {
margin-left: 12rpx;
font-size: 24rpx;
color: #2FA84F;
font-weight: 500;
}
.cpc-bal-txt.insufficient {
color: #E8331B;
}
.cpc-warn-txt {
font-size: 20rpx;
color: #E8331B;
}
.cpc-desc {
font-size: 22rpx;
color: #888888;
margin-top: 4rpx;
}
.cpc-desc.alert-desc {
color: #E8331B;
}
.cpc-radio-circle {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
border: 2rpx solid #CCCCCC;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
margin-left: 16rpx;
flex-shrink: 0;
}
.cpc-radio-circle.on {
background: #F0710D;
border-color: #F0710D;
}
.cpc-radio-circle.disabled {
background: #F5F6F8;
border-color: #E0E0E0;
}
.cpc-divider {
height: 1rpx;
background: #F0F0F2;
margin: 10rpx 0;
}
.confirm-fee-card {
background: #FFFFFF;
border-radius: 20rpx;
padding: 24rpx;
margin-bottom: 20rpx;
box-shadow: 0 4rpx 20rpx rgba(31, 31, 31, 0.04);
}
.cfc-row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16rpx 0;
}
.cfc-label {
font-size: 28rpx;
color: #1F1F1F;
}
.cfc-val {
font-size: 28rpx;
color: #1F1F1F;
}
.cfc-coupon-left {
display: flex;
align-items: center;
gap: 12rpx;
}
.cfc-quan-badge {
width: 34rpx;
height: 34rpx;
border-radius: 6rpx;
background: #E8331B;
color: #FFFFFF;
font-size: 22rpx;
display: flex;
align-items: center;
justify-content: center;
}
.cfc-coupon-right {
display: flex;
align-items: center;
gap: 8rpx;
}
.cfc-discount-val {
font-size: 28rpx;
color: #E8331B;
}
.cfc-coupon-placeholder {
font-size: 26rpx;
color: #888888;
}
.cfc-arrow {
width: 26rpx;
height: 26rpx;
opacity: 0.45;
}
.cfc-total-line {
border-top: 1rpx solid #F0F0F2;
margin-top: 16rpx;
padding-top: 24rpx;
display: flex;
align-items: baseline;
justify-content: flex-end;
gap: 10rpx;
}
.total-tag {
font-size: 28rpx;
color: #1F1F1F;
}
.total-price {
font-size: 36rpx;
font-weight: 700;
color: #E8331B;
}
.cfc-notice-box {
background: #FFF9F2;
border-radius: 10rpx;
padding: 18rpx 20rpx;
margin-top: 20rpx;
}
.cnb-txt {
font-size: 24rpx;
color: #F0710D;
line-height: 1.5;
}
.confirm-guarantee-card {
background: #FFFFFF;
border-radius: 20rpx;
padding: 24rpx;
margin-bottom: 16rpx;
box-shadow: 0 4rpx 20rpx rgba(31, 31, 31, 0.04);
}
.cgc-check-row {
display: flex;
align-items: flex-start;
gap: 16rpx;
margin-bottom: 14rpx;
}
.guarantee-checkbox {
width: 36rpx;
height: 36rpx;
border-radius: 6rpx;
border: 2rpx solid #CCCCCC;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
margin-top: 4rpx;
}
.guarantee-checkbox.on {
background: #F0710D;
border-color: #F0710D;
}
.gc-icon {
width: 24rpx;
height: 24rpx;
}
.cgc-check-text-wrap {
flex: 1;
font-size: 28rpx;
line-height: 1.45;
}
.cgc-check-label {
color: #1F1F1F;
font-weight: 600;
}
.cgc-orange-txt {
color: #F0710D;
font-weight: 600;
margin: 0 4rpx;
}
.cgc-set-link-wrap {
display: inline-flex;
align-items: center;
gap: 4rpx;
margin-left: 16rpx;
vertical-align: middle;
}
.cgc-set-link {
color: #F0710D;
font-size: 26rpx;
}
.inline-link-arrow {
width: 22rpx;
height: 22rpx;
}
.cgc-sub-hint {
font-size: 24rpx;
color: #888888;
line-height: 1.5;
}
.publish-notice-row {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 4rpx;
padding: 8rpx 8rpx 20rpx;
}
.pnr-txt {
font-size: 26rpx;
color: #666666;
}
.pnr-arrow {
width: 22rpx;
height: 22rpx;
opacity: 0.55;
}
/* ---------- 吸底栏统一样式 ---------- */
/* 步骤 1 吸底栏(1:1 复刻 frame_004 & frame_007) */
.step1-bottom-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: #FFFFFF;
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.06);
z-index: 90;
padding-bottom: env(safe-area-inset-bottom);
}
.step1-promo-banner {
height: 58rpx;
background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%);
padding: 0 24rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.spb-txt {
font-size: 24rpx;
color: #FFFFFF;
}
.spb-arrow-ico {
width: 26rpx;
height: 26rpx;
}
.step1-summary-area {
display: flex;
flex-direction: column;
align-items: flex-end;
padding: 16rpx 24rpx 4rpx;
}
.s1-main-line {
display: flex;
align-items: center;
gap: 8rpx;
}
.s1-count {
font-size: 26rpx;
color: #1F1F1F;
}
.s1-quan-badge {
width: 36rpx;
height: 36rpx;
border-radius: 6rpx;
background: #E8331B;
color: #FFFFFF;
font-size: 22rpx;
display: flex;
align-items: center;
justify-content: center;
}
.s1-price {
font-size: 36rpx;
font-weight: 700;
color: #E8331B;
}
.s1-sub-line {
margin-top: 2rpx;
}
.s1-discount-txt {
font-size: 22rpx;
color: #E8331B;
}
.step1-action-row {
display: flex;
align-items: center;
gap: 20rpx;
padding: 14rpx 24rpx 18rpx;
}
.btn-add-more {
flex: 1;
height: 84rpx;
border: 2rpx solid #F0710D;
background: #FFFFFF;
border-radius: 42rpx;
display: flex;
align-items: center;
justify-content: center;
gap: 8rpx;
}
.bam-plus-ico {
width: 28rpx;
height: 28rpx;
}
.bam-txt {
font-size: 30rpx;
font-weight: 600;
color: #F0710D;
}
.btn-step-next {
flex: 1;
height: 84rpx;
background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%);
border-radius: 42rpx;
display: flex;
align-items: center;
justify-content: center;
}
.bsn-txt {
font-size: 30rpx;
font-weight: 600;
color: #FFFFFF;
}
/* 步骤 2 吸底栏 */
.step2-bottom-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: #FFFFFF;
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.06);
z-index: 90;
padding: 18rpx 24rpx calc(18rpx + env(safe-area-inset-bottom));
display: flex;
align-items: center;
justify-content: space-between;
gap: 16rpx;
}
.step2-summary-wrap {
display: flex;
flex-direction: column;
gap: 4rpx;
min-width: 0;
flex-shrink: 1;
}
.s2-price-line {
display: flex;
align-items: baseline;
gap: 6rpx;
}
.s2-count-label {
font-size: 26rpx;
color: #1F1F1F;
font-weight: 500;
}
.s2-price-val {
font-size: 38rpx;
font-weight: 700;
color: #E8331B;
line-height: 1;
}
.s2-detail-pill,
.s3-detail-pill {
display: inline-flex;
align-items: center;
gap: 2rpx;
padding: 2rpx 10rpx;
margin-left: 6rpx;
background: #FFF7F0;
border: 1rpx solid #FFE4CC;
border-radius: 16rpx;
vertical-align: middle;
}
.s2-detail-txt,
.s3-detail-txt {
font-size: 20rpx;
font-weight: 500;
color: #F0710D;
line-height: 1;
}
.s2-detail-arrow,
.s3-detail-arrow {
width: 18rpx;
height: 18rpx;
}
.s2-sub-line {
display: flex;
align-items: center;
}
.s2-sub-txt {
font-size: 22rpx;
color: #888888;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 320rpx;
}
.step2-btns-wrap {
display: flex;
align-items: center;
gap: 14rpx;
flex-shrink: 0;
}
.btn-step-back-compact {
height: 80rpx;
padding: 0 32rpx;
border: 2rpx solid #DCDCDC;
background: #FFFFFF;
border-radius: 40rpx;
display: flex;
align-items: center;
justify-content: center;
}
.btn-step-next-compact {
height: 80rpx;
padding: 0 44rpx;
background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%);
border-radius: 40rpx;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4rpx 14rpx rgba(240, 113, 13, 0.25);
}
.bsnc-txt {
font-size: 28rpx;
font-weight: 600;
color: #FFFFFF;
}
.cec-label-wrap {
display: flex;
flex-direction: column;
gap: 6rpx;
}
.cec-title-line {
display: flex;
align-items: center;
gap: 12rpx;
}
.cec-urgent-tag {
font-size: 24rpx;
font-weight: 600;
color: #F0710D;
}
.cec-urgent-sub {
font-size: 22rpx;
color: #888888;
}
.cfc-hint-line {
margin-top: 20rpx;
padding-top: 16rpx;
border-top: 1rpx solid #F0F0F2;
display: flex;
align-items: center;
gap: 8rpx;
}
.chl-ico {
width: 22rpx;
height: 22rpx;
flex-shrink: 0;
opacity: 0.8;
}
.chl-txt {
font-size: 20rpx;
color: #888888;
line-height: 1.3;
}
.mch-tag.cross-region {
background: #EBF3FF;
color: #4A7CFF;
}
.btn-step-back {
flex: 1;
height: 84rpx;
border: 2rpx solid #DCDCDC;
background: #FFFFFF;
border-radius: 42rpx;
display: flex;
align-items: center;
justify-content: center;
}
.bsb-txt {
font-size: 30rpx;
color: #444444;
font-weight: 500;
}
.btn-step-next-large {
flex: 1;
height: 84rpx;
background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%);
border-radius: 42rpx;
display: flex;
align-items: center;
justify-content: center;
}
.bsnl-txt {
font-size: 30rpx;
font-weight: 600;
color: #FFFFFF;
}
/* 步骤 3 吸底栏 */
.step3-bottom-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: #FFFFFF;
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.06);
z-index: 90;
padding: 18rpx 24rpx calc(18rpx + env(safe-area-inset-bottom));
display: flex;
align-items: center;
justify-content: space-between;
}
.step3-summary {
display: flex;
flex-direction: column;
gap: 4rpx;
}
.s3-top {
display: flex;
align-items: baseline;
}
.s3-count {
font-size: 28rpx;
color: #1F1F1F;
}
.s3-price {
font-size: 38rpx;
font-weight: 700;
color: #E8331B;
}
.s3-sub {
display: flex;
align-items: center;
gap: 12rpx;
}
.s3-origin {
font-size: 24rpx;
color: #999999;
text-decoration: line-through;
}
.s3-discount {
font-size: 24rpx;
color: #E8331B;
}
.btn-publish-order {
height: 84rpx;
padding: 0 64rpx;
background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%);
border-radius: 42rpx;
display: flex;
align-items: center;
justify-content: center;
}
.btn-publish-order.disabled {
opacity: 0.6;
}
.bpo-txt {
font-size: 30rpx;
font-weight: 600;
color: #FFFFFF;
}
.clickable-hover:active {
opacity: 0.85;
}
.cfc-quote-box {
padding: 10rpx 0;
}
.cqb-badge {
display: inline-flex;
align-items: center;
justify-content: center;
height: 40rpx;
font-size: 22rpx;
color: #F0710D;
background: #FFF7F0;
padding: 0 14rpx;
border-radius: 8rpx;
font-weight: 600;
margin-bottom: 12rpx;
line-height: 1;
}
.cqb-title {
display: block;
font-size: 30rpx;
font-weight: 700;
color: #1F1F1F;
margin-bottom: 8rpx;
}
.cqb-desc {
display: block;
font-size: 24rpx;
color: #666666;
line-height: 1.6;
}
.s3-quote-tip {
font-size: 32rpx;
font-weight: 700;
color: #F0710D;
margin-left: 8rpx;
}
.s3-quote-sub {
font-size: 22rpx;
color: #999999;
}
/* ---------- 模式冲突拦截确认弹窗(1:1 复刻视频 01:08) ---------- */
.mode-conflict-mask {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.55);
display: flex;
align-items: center;
justify-content: center;
z-index: 1200;
padding: 0 56rpx;
}
.mode-conflict-dialog {
width: 100%;
background: #FFFFFF;
border-radius: 20rpx;
padding: 52rpx 44rpx 44rpx;
box-sizing: border-box;
}
.mcd-body {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
gap: 16rpx;
margin-bottom: 44rpx;
}
.mcd-line {
font-size: 28rpx;
color: #444444;
line-height: 1.6;
}
.mcd-line:first-child {
font-size: 30rpx;
font-weight: 700;
color: #1F1F1F;
}
.mcd-foot {
display: flex;
align-items: center;
gap: 24rpx;
}
.mcd-btn {
flex: 1;
height: 84rpx;
border-radius: 42rpx;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
}
.mcd-btn-confirm {
background: #FFFFFF;
border: 2rpx solid #DCDCDC;
}
.mcd-btn-cancel {
background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%);
}
.mcd-btn-txt {
font-size: 30rpx;
font-weight: 600;
}
.mcd-btn-txt.gray {
color: #444444;
}
.mcd-btn-txt.dark {
color: #FFFFFF;
}
/* ---------- 安装视频预览弹窗 ---------- */
.video-modal-mask {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.75);
display: flex;
align-items: center;
justify-content: center;
z-index: 1250;
padding: 0 36rpx;
}
.video-modal-box {
width: 100%;
background: #FFFFFF;
border-radius: 20rpx;
overflow: hidden;
padding-bottom: 20rpx;
}
.vm-head {
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx 28rpx;
border-bottom: 1rpx solid #F0F0F2;
}
.vm-title {
font-size: 30rpx;
font-weight: 600;
color: #1F1F1F;
}
.vm-close {
width: 52rpx;
height: 52rpx;
display: flex;
align-items: center;
justify-content: flex-end;
}
.vm-close-ico {
width: 30rpx;
height: 30rpx;
}
.vm-player {
width: 100%;
height: 440rpx;
background: #000000;
}
/* ---------- 通用字典单选抽屉 ---------- */
.dict-drawer-mask {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.55);
z-index: 1200;
display: flex;
flex-direction: column;
justify-content: flex-end;
}
.dict-drawer-sheet {
background: #FFFFFF;
border-top-left-radius: 28rpx;
border-top-right-radius: 28rpx;
max-height: 76vh;
display: flex;
flex-direction: column;
overflow: hidden;
padding-bottom: env(safe-area-inset-bottom);
}
.dd-head {
height: 96rpx;
padding: 0 32rpx;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1rpx solid #F0F0F2;
flex-shrink: 0;
}
.dd-title {
font-size: 32rpx;
font-weight: 700;
color: #1F1F1F;
}
.dd-close {
width: 56rpx;
height: 56rpx;
display: flex;
align-items: center;
justify-content: flex-end;
}
.dd-close-ico {
width: 28rpx;
height: 28rpx;
}
.dd-search-wrap {
padding: 16rpx 24rpx;
background: #F5F6F8;
flex-shrink: 0;
}
.dd-search-box {
height: 72rpx;
background: #FFFFFF;
border-radius: 36rpx;
padding: 0 24rpx;
display: flex;
align-items: center;
gap: 12rpx;
}
.dd-search-ico {
width: 28rpx;
height: 28rpx;
flex-shrink: 0;
}
.dd-search-input {
flex: 1;
height: 68rpx;
font-size: 26rpx;
color: #1F1F1F;
}
.dd-scroll {
flex: 1;
min-height: 300rpx;
max-height: 60vh;
}
.dd-state {
padding: 80rpx 32rpx;
display: flex;
flex-direction: column;
align-items: center;
gap: 20rpx;
}
.dd-state-txt {
font-size: 26rpx;
color: #888888;
}
.dd-retry {
padding: 12rpx 36rpx;
border-radius: 32rpx;
border: 1rpx solid #F0710D;
background: #FFF7F0;
}
.dd-retry-txt {
font-size: 26rpx;
color: #F0710D;
font-weight: 500;
}
.dd-item {
min-height: 96rpx;
padding: 0 32rpx;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1rpx solid #F0F0F2;
}
.dd-item-txt {
font-size: 28rpx;
color: #444444;
}
.dd-item.active .dd-item-txt {
color: #F0710D;
font-weight: 600;
}
.dd-item-check {
width: 30rpx;
height: 30rpx;
flex-shrink: 0;
}
</style>