312 lines
17 KiB
Plaintext
312 lines
17 KiB
Plaintext
<view class="page detail-page">
|
|
<view class="custom-header" style="padding-top: {{statusBarHeight}}px;">
|
|
<view class="back-btn" bindtap="handleBack"><view class="back-arrow"></view></view>
|
|
<view class="header-title">订单详情</view>
|
|
</view>
|
|
|
|
<view wx:if="{{message}}" class="message card">{{message}}</view>
|
|
|
|
<view hidden="{{!loading}}" class="card empty-card">
|
|
<view class="page-subtitle">正在加载...</view>
|
|
</view>
|
|
|
|
<view hidden="{{loading || !orderInfo}}" class="detail-body">
|
|
<!-- 头部概要 -->
|
|
<view class="card overview-card">
|
|
<view class="overview-head">
|
|
<view class="overview-left">
|
|
<view class="order-no">{{orderInfo.order_no}}</view>
|
|
<view class="order-customer">{{orderInfo.customer_name}} · {{orderInfo.customer_mobile}}</view>
|
|
</view>
|
|
<view style="display:flex;flex-direction:column;align-items:flex-end;gap:8rpx;">
|
|
<view class="badge {{orderInfo.badgeClass}}">{{orderInfo.statusText}}</view>
|
|
<view wx:if="{{orderInfo.tracking_number}}" class="badge badge-orange">自发</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 客户收货信息 -->
|
|
<view class="card info-card">
|
|
<view class="section-title">客户收货信息</view>
|
|
<view class="info-row">
|
|
<text class="info-label">客户姓名</text>
|
|
<text class="info-value">{{orderInfo.customer_name || '-'}}</text>
|
|
</view>
|
|
<view class="info-row">
|
|
<text class="info-label">联系电话</text>
|
|
<text class="info-value">{{orderInfo.customer_mobile || '-'}}</text>
|
|
</view>
|
|
<view class="info-row">
|
|
<text class="info-label">收货地址</text>
|
|
<text class="info-value">{{orderInfo.customer_address || '-'}}</text>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 订单基础信息 -->
|
|
<view class="card info-card">
|
|
<view class="section-title">订单信息</view>
|
|
<view class="info-row" wx:if="{{orderInfo.salesman_name}}">
|
|
<text class="info-label">业务员</text>
|
|
<text class="info-value">{{orderInfo.salesman_name}}</text>
|
|
</view>
|
|
<view class="info-row" wx:if="{{orderInfo.delivery_type}}">
|
|
<text class="info-label">交付方式</text>
|
|
<text class="info-value">{{orderInfo.delivery_type}}</text>
|
|
</view>
|
|
<view class="info-row" wx:if="{{orderInfo.factory_name}}">
|
|
<text class="info-label">工厂</text>
|
|
<text class="info-value">{{orderInfo.factory_name}}</text>
|
|
</view>
|
|
<view class="info-row" wx:if="{{orderInfo.tracking_number}}">
|
|
<text class="info-label">快递单号</text>
|
|
<text class="info-value">{{orderInfo.tracking_number}}</text>
|
|
</view>
|
|
<view class="info-row" wx:if="{{orderInfo.created_at}}">
|
|
<text class="info-label">创建时间</text>
|
|
<text class="info-value">{{orderInfo.created_at}}</text>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 客户需求 + 备注 -->
|
|
<view wx:if="{{orderInfo.customer_demand || orderInfo.remark}}" class="card info-card">
|
|
<view wx:if="{{orderInfo.customer_demand}}" class="info-row">
|
|
<text class="info-label">客户需求</text>
|
|
<text class="info-value">{{orderInfo.customer_demand}}</text>
|
|
</view>
|
|
<view wx:if="{{orderInfo.remark}}" class="info-row">
|
|
<text class="info-label">备注</text>
|
|
<text class="info-value">{{orderInfo.remark}}</text>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 成本核算 -->
|
|
<view wx:if="{{products.length}}" class="card product-card">
|
|
<view class="section-title">成本核算({{products.length}} 项)</view>
|
|
<view wx:for="{{products}}" wx:key="index" class="product-row">
|
|
<view class="product-main">
|
|
<text class="product-name">{{item.name}}</text>
|
|
<text class="product-spec" wx:if="{{item.spec}}">{{item.spec}}</text>
|
|
<text class="product-spec" wx:if="{{item.demandSpec}}">需求: {{item.demandSpec}}</text>
|
|
<text class="product-spec" wx:if="{{item.qty}}">{{item.qty}} {{item.unit}}</text>
|
|
<text class="product-spec" wx:if="{{item.pricingType}}">计价: {{item.pricingType}}</text>
|
|
<text class="product-spec" wx:if="{{item.areaSqm}}">面积: {{item.areaSqm}}</text>
|
|
<text class="product-spec" wx:if="{{item.supplierModel}}">型号: {{item.supplierModel}}</text>
|
|
</view>
|
|
<view class="product-prices">
|
|
<text class="product-price">单价: ¥{{item.costPrice}}</text>
|
|
<text class="product-cost">成本: ¥{{item.costAmount}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 费用汇总 -->
|
|
<view wx:if="{{orderInfo.feeItems.length}}" class="card fee-card">
|
|
<view class="section-title">费用汇总</view>
|
|
<view class="fee-body">
|
|
<view wx:for="{{orderInfo.feeItems}}" wx:key="label" class="fee-row {{item.isIncome ? 'income' : ''}} {{item.isProfit ? 'profit ' + orderInfo.profitClass : ''}}">
|
|
<text class="fee-label">{{item.label}}</text>
|
|
<text class="fee-value">¥{{item.value}}</text>
|
|
</view>
|
|
<view class="fee-divider"></view>
|
|
<view class="fee-row profit {{orderInfo.profitClass}}">
|
|
<text class="fee-label">利润率</text>
|
|
<text class="fee-value">{{orderInfo.profitRate}}</text>
|
|
</view>
|
|
</view>
|
|
<view wx:if="{{orderInfo.payment_method}}" class="info-row" style="margin-top: 16rpx;">
|
|
<text class="info-label">支付方式</text>
|
|
<text class="info-value">{{orderInfo.payment_method}}</text>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 审批记录 -->
|
|
<view wx:if="{{approveLogs.length}}" class="card log-card">
|
|
<view class="section-title">审批记录</view>
|
|
<view wx:for="{{approveLogs}}" wx:key="log_id" class="log-row">
|
|
<view class="log-dot {{item.approve_result === 'pass' || item.approve_result === 'revised' ? 'dot-pass' : 'dot-reject'}}"></view>
|
|
<view class="log-content">
|
|
<view class="log-header">
|
|
<text class="log-time">{{item.approve_time}}</text>
|
|
<text class="log-type">{{item.approve_type === 'order' ? '订单审批' : (item.approve_type === 'revise' ? '订单修订' : '取消审批')}}</text>
|
|
<text class="log-result {{item.approve_result === 'pass' || item.approve_result === 'revised' ? 'result-pass' : 'result-reject'}}">{{item.approve_result === 'pass' ? '通过' : (item.approve_result === 'revised' ? '已修订' : '驳回')}}</text>
|
|
</view>
|
|
<text wx:if="{{item.approve_opinion}}" class="log-opinion">{{item.approve_opinion}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 物流信息 -->
|
|
<view wx:if="{{logistics}}" class="card info-card">
|
|
<view class="section-title">物流信息</view>
|
|
<view class="info-row" wx:if="{{logistics.express_company}}">
|
|
<text class="info-label">快递公司</text>
|
|
<text class="info-value">{{logistics.express_company}}</text>
|
|
</view>
|
|
<view class="info-row" wx:if="{{logistics.tracking_number}}">
|
|
<text class="info-label">快递单号</text>
|
|
<text class="info-value">{{logistics.tracking_number}}</text>
|
|
</view>
|
|
<view class="info-row" wx:if="{{logistics.task_status}}">
|
|
<text class="info-label">任务状态</text>
|
|
<text class="info-value">{{logistics.task_status}}</text>
|
|
</view>
|
|
<view wx:if="{{traceList.length}}" class="trace-timeline">
|
|
<view wx:for="{{traceList}}" wx:key="index" class="trace-item">
|
|
<view class="trace-dot {{index === 0 ? 'trace-dot-active' : ''}}"></view>
|
|
<view wx:if="{{index < traceList.length - 1}}" class="trace-line"></view>
|
|
<view class="trace-card">
|
|
<text class="trace-time">{{item.node_time}}</text>
|
|
<text class="trace-desc">{{item.node_desc}}</text>
|
|
<text wx:if="{{item.source_platform}}" class="trace-source">{{item.source_platform}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view wx:elif="{{logistics.tracking_number}}" class="empty-hint">暂无物流轨迹</view>
|
|
</view>
|
|
|
|
<!-- 自发订单提示(待审批+有快递单号) -->
|
|
<view wx:if="{{orderInfo.order_status === 'pending_approve' && orderInfo.tracking_number}}" class="card action-card">
|
|
<view class="approval-hint">马甸工厂自发 — 已填写快递单号({{orderInfo.tracking_number}}),审批通过后跳过工厂下发</view>
|
|
</view>
|
|
|
|
<!-- 工厂+司机选择(待审批/已审批,非自发) -->
|
|
<view wx:if="{{(orderInfo.order_status === 'pending_approve' || orderInfo.order_status === 'approved') && !orderInfo.tracking_number}}" class="card action-card">
|
|
<view class="section-title">下发工厂</view>
|
|
<view wx:if="{{!factoryList.length}}" class="empty-hint">暂无可用工厂</view>
|
|
<picker wx:else mode="selector" range="{{factoryList}}" range-key="supplier_name" value="{{selectedFactoryIndex}}" bindchange="onFactoryChange">
|
|
<view class="picker-value">
|
|
{{selectedFactoryIndex >= 0 ? factoryList[selectedFactoryIndex].supplier_name : '请选择工厂'}}
|
|
<text class="picker-arrow">▶</text>
|
|
</view>
|
|
</picker>
|
|
<view class="section-title" style="margin-top: 20rpx;">分配司机</view>
|
|
<view wx:if="{{!driverList.length}}" class="empty-hint">暂无可用司机</view>
|
|
<picker wx:else mode="selector" range="{{driverList}}" range-key="real_name" value="{{selectedDriverIndex}}" bindchange="onDriverChange">
|
|
<view class="picker-value">
|
|
{{selectedDriverIndex >= 0 ? driverList[selectedDriverIndex].real_name : '请选择司机'}}
|
|
<text class="picker-arrow">▶</text>
|
|
</view>
|
|
</picker>
|
|
</view>
|
|
|
|
<!-- 待工厂处理:司机+任务信息 -->
|
|
<view wx:if="{{orderInfo.order_status === 'pending_factory'}}" class="card action-card">
|
|
<view class="section-title">分配任务</view>
|
|
<view class="field-group">
|
|
<view class="field-label">选择司机</view>
|
|
<picker mode="selector" range="{{driverList}}" range-key="real_name" value="{{selectedDriverIndex}}" bindchange="onDriverChange">
|
|
<view class="picker-value">
|
|
{{selectedDriverIndex >= 0 ? driverList[selectedDriverIndex].real_name : '请选择司机'}}
|
|
<text class="picker-arrow">▶</text>
|
|
</view>
|
|
</picker>
|
|
</view>
|
|
<view class="field-group">
|
|
<view class="field-label">取货地址</view>
|
|
<input class="field-input" value="{{taskForm.pickup_address}}" bindinput="onTaskFormInput" data-field="pickup_address" placeholder="请输入取货地址" />
|
|
</view>
|
|
<view class="field-group">
|
|
<view class="field-label">送货地址</view>
|
|
<input class="field-input" value="{{taskForm.delivery_address}}" bindinput="onTaskFormInput" data-field="delivery_address" placeholder="请输入送货地址" />
|
|
</view>
|
|
<view class="field-group">
|
|
<view class="field-label">取货内容</view>
|
|
<input class="field-input" value="{{taskForm.pickup_content}}" bindinput="onTaskFormInput" data-field="pickup_content" placeholder="请输入取货内容" />
|
|
</view>
|
|
<view class="field-group">
|
|
<view class="field-label">数量</view>
|
|
<input class="field-input" type="number" value="{{taskForm.quantity}}" bindinput="onTaskFormInput" data-field="quantity" placeholder="请输入数量" />
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 待司机接单:司机选择 -->
|
|
<view wx:if="{{orderInfo.order_status === 'pending_driver'}}" class="card action-card">
|
|
<view class="section-title">分配司机</view>
|
|
<picker mode="selector" range="{{driverList}}" range-key="real_name" value="{{selectedDriverIndex}}" bindchange="onDriverChange">
|
|
<view class="picker-value">
|
|
{{selectedDriverIndex >= 0 ? driverList[selectedDriverIndex].real_name : '请选择司机'}}
|
|
<text class="picker-arrow">▶</text>
|
|
</view>
|
|
</picker>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 未绑定服务号时显示绑定引导 -->
|
|
<view wx:if="{{serviceBound === false}}" class="bind-hint-bar" bindtap="goBindService">
|
|
<text>绑定微信通知,实时接收审批提醒</text>
|
|
<text class="bind-arrow">></text>
|
|
</view>
|
|
|
|
<!-- 固定底部操作栏 -->
|
|
<view wx:if="{{orderInfo}}" class="action-bar">
|
|
<!-- 草稿/已驳回:提交审核 -->
|
|
<block wx:if="{{orderInfo.order_status === 'draft' || orderInfo.order_status === 'rejected'}}">
|
|
<button class="action-btn pass-btn" type="primary" loading="{{actionLoading}}" bindtap="handleSubmitReview">提交审核</button>
|
|
</block>
|
|
|
|
<!-- 待审批:通过+退回 -->
|
|
<block wx:elif="{{orderInfo.order_status === 'pending_approve'}}">
|
|
<button class="action-btn reject-btn" loading="{{actionLoading}}" bindtap="handleApprove" data-result="reject">退回</button>
|
|
<button class="action-btn pass-btn" type="primary" loading="{{actionLoading}}" bindtap="handleApprove" data-result="pass">通过</button>
|
|
</block>
|
|
|
|
<!-- 取消审批:同意+驳回 -->
|
|
<block wx:elif="{{orderInfo.order_status === 'cancel_pending' || orderInfo.order_status === 'cancel_fulfillment_pending'}}">
|
|
<button class="action-btn reject-btn" loading="{{actionLoading}}" bindtap="handleApprove" data-result="reject">驳回取消</button>
|
|
<button class="action-btn pass-btn" type="primary" loading="{{actionLoading}}" bindtap="handleApprove" data-result="pass">同意取消</button>
|
|
</block>
|
|
|
|
<!-- 已审批:推进待工厂 -->
|
|
<block wx:elif="{{orderInfo.order_status === 'approved'}}">
|
|
<button class="action-btn cancel-btn" loading="{{actionLoading}}" bindtap="handleApplyCancel">申请取消</button>
|
|
<button class="action-btn pass-btn" type="primary" loading="{{actionLoading}}" bindtap="handlePushToFactory">推进待工厂</button>
|
|
</block>
|
|
|
|
<!-- 待工厂处理:分配任务 -->
|
|
<block wx:elif="{{orderInfo.order_status === 'pending_factory'}}">
|
|
<button class="action-btn cancel-btn" loading="{{actionLoading}}" bindtap="handleApplyCancel">申请取消</button>
|
|
<button class="action-btn pass-btn" type="primary" loading="{{actionLoading}}" bindtap="handleAssignTask">分配任务</button>
|
|
</block>
|
|
|
|
<!-- 待司机接单 -->
|
|
<block wx:elif="{{orderInfo.order_status === 'pending_driver'}}">
|
|
<button class="action-btn cancel-btn" loading="{{actionLoading}}" bindtap="handleApplyCancel">申请取消</button>
|
|
<button class="action-btn pass-btn" type="primary" loading="{{actionLoading}}" bindtap="handleAssignDriver">{{logistics ? '重新分配司机' : '分配司机'}}</button>
|
|
</block>
|
|
|
|
<!-- 已接单:确认揽货 -->
|
|
<block wx:elif="{{orderInfo.order_status === 'accepted'}}">
|
|
<button class="action-btn cancel-btn" loading="{{actionLoading}}" bindtap="handleApplyCancel">申请取消</button>
|
|
<button class="action-btn pass-btn" type="primary" loading="{{actionLoading}}" bindtap="handleSimpleTransition" data-target="picked_up">确认揽货</button>
|
|
</block>
|
|
|
|
<!-- 已揽货:绑定物流单号 -->
|
|
<block wx:elif="{{orderInfo.order_status === 'picked_up'}}">
|
|
<button class="action-btn cancel-btn" loading="{{actionLoading}}" bindtap="handleApplyCancel">申请取消</button>
|
|
<button class="action-btn pass-btn" type="primary" loading="{{actionLoading}}" bindtap="handleSimpleTransition" data-target="in_transit">绑定物流单号</button>
|
|
</block>
|
|
|
|
<!-- 运输中:确认收货 -->
|
|
<block wx:elif="{{orderInfo.order_status === 'in_transit'}}">
|
|
<button class="action-btn cancel-btn" loading="{{actionLoading}}" bindtap="handleApplyCancel">申请取消</button>
|
|
<button class="action-btn pass-btn" type="primary" loading="{{actionLoading}}" bindtap="handleSimpleTransition" data-target="shipped">确认收货</button>
|
|
</block>
|
|
|
|
<!-- 已发货:标记完成 -->
|
|
<block wx:elif="{{orderInfo.order_status === 'shipped'}}">
|
|
<button class="action-btn cancel-btn" loading="{{actionLoading}}" bindtap="handleApplyCancel">申请取消</button>
|
|
<button class="action-btn pass-btn" type="primary" loading="{{actionLoading}}" bindtap="handleSimpleTransition" data-target="completed">标记完成</button>
|
|
</block>
|
|
|
|
<!-- 已完成(有佣金):待结算 -->
|
|
<block wx:elif="{{orderInfo.order_status === 'completed' && orderInfo.commission_amount > 0}}">
|
|
<button class="action-btn pass-btn" type="primary" loading="{{actionLoading}}" bindtap="handleSimpleTransition" data-target="pending_settle">待结算</button>
|
|
</block>
|
|
|
|
<!-- 已完成(无佣金)/ 待结算:结算 -->
|
|
<block wx:elif="{{orderInfo.order_status === 'completed' || orderInfo.order_status === 'pending_settle'}}">
|
|
<button class="action-btn pass-btn" type="primary" loading="{{actionLoading}}" bindtap="handleSettle">结算提成</button>
|
|
</block>
|
|
</view>
|
|
</view>
|