<!--module/order/pages/other-detail/other-detail.wxml-->
<t-navbar title="{{title}}" left-arrow />
<scroll-view class="page-scroll__container" type="list" scroll-y style="{{containerStyle}}">
  <view class="info-box">
  </view>
  <!-- 实体商品 -->
  <view>
    <view class="goods-list" wx:if="{{sellTypeFirstItems.length > 0}}">
      <view class="category-title">实体商品</view>
      <view wx:for="{{sellTypeFirstItems}}" wx:for-item="goods" wx:for-index="goodsIndex" wx:key="id">
        <!-- 线下取货小标题：当遇到第一个线下取货商品时显示 -->
        <view class="offline-title" wx:if="{{goods.receiptType === '1' && (goodsIndex === 0 || sellTypeFirstItems[goodsIndex - 1].receiptType === '0')}}">线下取货</view>
        <!-- 快递信息 -->
        <view bindtap="{{goods.receiptStatus !== '0' ? 'goLogistics' : ''}}" data-goods="{{goods}}">
        <view class="express-info" wx:if="{{goods.receiptType === '0'  && goods.receiptStatus === '1'}}">
          <view class="express-text">
            <view style="font-weight:600;margin-right: 10rpx;display: flex;align-items: center;">
              <text style="font-size: 25rpx;"> 快件{{goodsIndex + 1}}</text>
              <!-- <i class="iconfont {{goods.expressTypeIcon}}" style="font-size:15px" wx:if="{{goods.expressTypeIcon}}"></i> -->
            </view>
            <view style="color:#9b9797;font-size: 25rpx;">{{goods.expressTypeName}} {{goods.expressNo}}</view>
          </view>
          <t-icon name="chevron-right" color="#000" size="40rpx" slot="note" />
        </view>
          <view class="goods-status {{goods.statusClass}}" wx:if="{{goods.statusText && orderStatus !== 'closed'}}">{{goods.statusText}}</view>
          </view>
        <view>
          <view class="goods-item">
            <image class="goods-image" src="{{goods.image}}" mode="aspectFill" wx:if="{{goods.image}}" />
            <view class="service-package-placeholder" wx:else>
              <text class="placeholder-icon">📦</text>
            </view>
            <view class="goods-info">
              <view class="goods-name-row">
                <text class="goods-name">{{goods.name}}</text>
                <text class="goods-price">¥{{goods.price}}</text>
              </view>
              <view class="goods-desc-row">
                <view class="goods-desc" wx:if="{{goods.description}}">{{goods.description}}</view>
                <view class="quantity-text">x{{goods.quantity}}</view>
              </view>
              <!-- 确认收货按钮 -->
              <view class="confirm-receipt-btn" wx:if="{{goods.receiptStatus === '1'}}" bindtap="onConfirmReceipt" data-patientConditioningRecordId="{{goods.patientConditioningRecordId}}" data-index="{{goodsIndex}}">
                确认收货
              </view>
              <!-- 申请售后 + 评价 -->
              <view class="action-btns">
                <!-- <view class="btn-aftersale" catchtap="onApplyAfterSale">申请售后</view> -->
                <view class="btn-review" catchtap="onReview" data-goods="{{goods}}" wx:if="{{goods.isCanEvaluate}}">{{goods.evaluateTime?"已评价":"评价"}}</view>
              </view>
            </view>
          </view>
        </view>
      </view>
    </view>

    <!-- 线下服务商品 -->
    <view class="goods-list" wx:if="{{sellTypeSecondItems.length > 0}}">
      <view class="category-title">线下服务商品</view>
      <view wx:for="{{sellTypeSecondItems}}" wx:for-item="goods" wx:for-index="goodsIndex" wx:key="id" data-id="{{goods.id}}" bindtap="goAppointment">
        <view>
          <view class="goods-status {{goods.statusClass}}" wx:if="{{goods.statusText && orderStatus !== 'closed'}}">{{goods.statusText}}</view>
          <view class="goods-item">
            <image class="goods-image" src="{{goods.image}}" mode="aspectFill" wx:if="{{goods.image}}" />
            <view class="service-package-placeholder" wx:else>
              <text class="placeholder-icon">📦</text>
            </view>
            <view class="goods-info">
              <view class="goods-name-row">
                <text class="goods-name">{{goods.name}}</text>
                <text class="goods-price">¥{{goods.price}}</text>
              </view>
              <view class="goods-desc-row">
                <view class="goods-desc" wx:if="{{goods.description}}">{{goods.description}}</view>
                <view class="quantity-text">x{{goods.quantity}}</view>
              </view>
              <!-- 申请售后 + 评价 -->
              <view class="action-btns" catchtap="preventTap">
                <!-- <view class="btn-aftersale" catchtap="onApplyAfterSale">申请售后</view> -->
                <view class="btn-review" catchtap="onReview" data-goods="{{goods}}" wx:if="{{goods.isCanEvaluate}}">{{goods.evaluateTime?"已评价":"评价"}}</view>
              </view>
            </view>
          </view>
        </view>
      </view>
    </view>

    <!-- 线上权益商品 -->
    <view class="goods-list" wx:if="{{sellTypeThirdItems.length > 0}}">
      <view class="category-title">线上权益商品</view>
      <view wx:for="{{sellTypeThirdItems}}" wx:for-item="goods" wx:for-index="goodsIndex" wx:key="id">
        <view>
          <view class="goods-status {{goods.statusClass}}" wx:if="{{goods.statusText && orderStatus !== 'closed'}}">{{goods.statusText}}</view>
          <view class="goods-item">
            <image class="goods-image" src="{{goods.image}}" mode="aspectFill" wx:if="{{goods.image}}" />
            <view class="service-package-placeholder" wx:else>
              <text class="placeholder-icon">📦</text>
            </view>
            <view class="goods-info">
              <view class="goods-name-row">
                <text class="goods-name">{{goods.name}}</text>
                <text class="goods-price">¥{{goods.price}}</text>
              </view>
              <view class="goods-desc-row">
                <view class="goods-desc" wx:if="{{goods.description}}">{{goods.description}}</view>
                <view class="quantity-text">x{{goods.quantity}}</view>
              </view>
              <!-- 申请售后 + 评价 -->
              <view class="action-btns">
                <!-- <view class="btn-aftersale" catchtap="onApplyAfterSale">申请售后</view> -->
                <view class="btn-review" catchtap="onReview" data-goods="{{goods}}" wx:if="{{goods.isCanEvaluate}}">{{goods.evaluateTime?"已评价":"评价"}}</view>
              </view>
            </view>
          </view>
        </view>
      </view>
    </view>
    <!-- 商品总价 -->
    <view class="price-total-wrapper">
      <view class="price-total">
        <text class="price-label">商品总价:</text>
        <text class="price-value">¥{{orderDetail.cost}}</text>
      </view>
    </view>
  </view>
  <!-- 实际付款 -->
  <view class="price-summary-section">
    <view class="price-summary-card price-row">
      <text class="price-label">{{orderStatus==='closed'?'应付款':'实付款'}}:</text>
      <text class="price-value payable-value">¥{{orderStatus === 'received' ? orderDetail.realAmount : orderDetail.cost}}</text>
    </view>
  </view>

  <!--  最下方的信息 -->
  <view class="order-info-section">
    <!-- 备注 -->
    <view class="info-card">
      <view class="remark-item">
        <text class="info-label">备注</text>
        <view class="remark-input-wrapper">
          <textarea class="remark-textarea" placeholder="请输入备注信息" value="{{orderDetail.remark || '无'}}" maxlength="200" bindinput="onRemarkInput" auto-height show-confirm-bar="{{false}}" disabled="{{orderStatus!=='pending'}}" />
          <view class="remark-count">
            <text class="remark-count-text" wx:if="{{orderDetail.remark}}">{{remarkLength}}/200</text>
          </view>
        </view>
      </view>
    </view>

    <!-- 订单详情 -->
    <view class="info-card">
      <view class="info-item" wx:if="{{orderDetail.orderNo}}">
        <text class="info-label" style="font-weight:600">订单编号</text>
        <view class="info-value-row">
          <text class="info-value">{{orderDetail.orderNo || ''}}</text>
          <text class="copy-btn" bindtap="copyOrderNo" data-orderno="{{orderDetail.orderNo}}">复制</text>
        </view>
      </view>
      <view class="info-divider"></view>
      <view class="info-item">
        <text class="info-label">创建时间</text>
        <text class="info-value">{{orderDetail.operateTime || ''}}</text>
      </view>
      <view class="info-divider"></view>
      <view class="info-item" wx:if="{{orderStatus!=='closed'}}">
        <text class="info-label">付款时间</text>
        <text class="info-value">{{orderDetail.payTime || ''}}</text>
      </view>
      <view class="info-divider" wx:if="{{orderStatus!=='closed'}}"></view>
      <view class="info-item" wx:if="{{orderStatus==='completed'}}">
        <text class="info-label">成交时间</text>
        <text class="info-value">{{orderDetail.finishTime || ''}}</text>
      </view>
      <view class="info-divider" wx:if="{{orderStatus==='completed'}}"></view>
      <view class="info-item" wx:if="{{orderStatus==='closed'}}">
        <text class="info-label">关闭时间</text>
        <text class="info-value">{{orderDetail.cancelTime || ''}}</text>
      </view>
      <view class="info-divider" wx:if="{{orderStatus==='closed'}}"></view>
      <view class="info-item" wx:if="{{orderStatus!=='closed'}}">
        <text class="info-label">微信交易号</text>
        <text class="info-value">{{orderDetail.payTransactionNo || ''}}</text>
      </view>
    </view>

    <!-- 服务包详情 -->
    <view class="info-card">
      <view class="info-item" wx:if="{{orderDetail.conditioningWrapName}}">
        <text class="info-label" style="font-weight:600">服务包</text>
        <text class="info-value">{{orderDetail.conditioningWrapName || ''}}</text>
      </view>
      <view class="info-divider" wx:if="{{orderDetail.operateBy}}"></view>
      <view class="info-item" wx:if="{{orderDetail.operateBy}}">
        <text class="info-label">开具医生</text>
        <text class="info-value">{{orderDetail.operateBy || ''}}</text>
      </view>
      <view class="info-divider" wx:if="{{orderDetail.operateTime}}"></view>
      <view class="info-item" wx:if="{{orderDetail.operateTime}}">
        <text class="info-label">开具时间</text>
        <text class="info-value">{{orderDetail.operateTime || ''}}</text>
      </view>
      <view class="info-divider" wx:if="{{orderDetail.estimatedStartDate}}"></view>
      <view class="info-item" wx:if="{{orderDetail.estimatedStartDate}}">
        <text class="info-label">开始调养日期</text>
        <text class="info-value">{{orderDetail.estimatedStartDate || ''}}</text>
      </view>
    </view>
  </view>


</scroll-view>