<view class="container">
  <!-- 顶部标签页 -->
  <l-tabs bind:linchange="changeTab" active-color="#73a2ff">
    <l-tabpanel tab="待处理" key="1" slot="1">
      <view class="ticket-list">
        <view class="ticket-item" wx:for="{{pendingList}}" >
          <!-- 工单信息 -->
          <view class="ticket-header">
            <view class="ticket-no">
              <text class="ticket-text">服务单号：{{item.orderNo}}</text>
            </view>
            <text class="ticket-time">{{item.orderTime}}</text>
          </view>
          
          <view class="ticket-content" bindtap="handleDetail" data-id="{{item.id}}">
            <view class="info-row">
              <text>客户：{{item.customerName}}</text>
              <text style="width:100rpx" class="status {{item.statusName == '未接单' ? 'status-pending' : 'status-processing'}}">{{item.statusName}}</text>
            </view>
            <view class="info-row">
              <text>服务人员：{{item.serviceStaffNames}}</text>
            </view>
            <view class="info-row">
              <text>预计服务完成时间：{{item.estimatedCompleteTime || '--'}}</text>
            </view>
            <view class="info-row">
              <text>货品：{{item.goodsName}}</text>
            </view>
          </view>

          <!-- 底部按钮 -->
           <!--  -->
          <view class="ticket-actions" wx:if="{{item.statusName == '未接单'}}" >
            <l-button size="mini" type="default"   plain="{{true}}" bindtap="handleAccept" data-id="{{item}}">接单</l-button>
            <l-button size="mini" type="error" plain="{{true}}" bindtap="handleReject" data-id="{{item}}">驳回</l-button>
          </view>
          <view class="ticket-actions" wx:if="{{item.statusName == '处理中' || item.statusName == '已接单'}}">
            <l-button size="mini" type="default" plain="{{true}}" bindtap="handleReport1" data-id="{{item.id}}">每日填报</l-button>
            <l-button size="mini" type="error" plain="{{true}}" bindtap="handleSuccess" data-id="{{item}}">完成</l-button>
          </view>
          <!-- wx:if="{{item.statusName == '已完成未验收'}}" -->
          <view class="ticket-actions"  wx:if="{{item.statusName == '已完成未验收'}}">
            <l-button size="mini" type="default" plain="{{true}}" bindtap="handleReport2" data-id="{{item.id}}" data-type="2">验收</l-button>
          </view>
        </view>
      </view>
     <block wx:if="{{!pendingList || pendingList.length === 0}}">
      <view class="table">
         <image style="width: 400rpx; height: 400rpx;margin:0 auto" mode="aspectFit" src="{{noData}}"></image>
         <text style="margin:0 auto">{{dataListTips}}</text> 
      </view>
    </block>
    </l-tabpanel>

    <l-tabpanel tab="已完成" key="2" slot="2">
      <view class="process-box">
      <view class="search-container" >
        <view class="date-range-picker">
          <!-- 开始日期 -->
          <picker 
            mode="date" 
            start="2015-09-01"
            name="completeStartTime"
            bindchange="bindDateChange1"
            place
          >
            <view class="date-item">
              <!-- <text class="date-label">开始日期</text> -->
              <text class="date-value">{{table2.parammaps.completeStartTime}}</text>
            </view>
          </picker>
          <!-- 分隔符 -->
          <text class="separator">~</text>
          <!-- 结束日期 -->
          <picker 
            mode="date" 
            start="2015-09-01"
            name="endDate"
            bindchange="bindDateChange2"
          >
            <view class="date-item">
              <text class="date-value">{{table2.parammaps.completeEndTime}}</text>
            </view>
          </picker>
        </view>
       <!-- 搜索栏 -->
        <view class="search-bar" style="display: flex; align-items: center;">
          <picker 
            mode="selector"
            range="{{installerList}}" 
            range-key="name"
            value="{{statusIndex}}"
            bindchange="onInstallerChange"
            bindcancel="onInputChangeClear"
            style="flex: 1; margin-right: 10px;"
            class="search-input"
          >
            <view class="picker-view">
              <text style="color: {{serviceStaffname ? '#333333' : '#999999'}}">{{ serviceStaffname || '请选择服务人员'}}</text>
            </view>
          </picker>
          <input 
            class="search-input" 
            placeholder="客户名称" 
            placeholder-class="placeholder"
            style="flex: 1; margin-right: 10px;"
            value="{{table2.parammaps.customerName}}"
            bindchange="onInputChange"
          />
          <button class="search-btn" bindtap="getList2"   style="flex-shrink: 0;width:110rpx; font-size: 12px;margin:0; background-color: #3963bc; color: white; border: none;" >搜索</button>
             

        </view>
      </view>
       <view  class="processed-list">
        <view class="processed-item" wx:for="{{processedList}}">
          <view class="ticket-header">
            <view class="ticket-no">
            <text class="ticket-text">安装单号：{{item.orderNo}}</text>
            </view>
            <text  class="ticket-time">{{item.completionTime}}</text>
          </view>
          <view class="processed-content" bindtap="handleDetail" data-id="{{item.id}}">
             <view class="info-row">
              <text>客户：{{item.customerName}}</text>
              <text class="status status-processing" style="width:100rpx">{{item.statusName}}</text>
            </view>
            <text>安装人：{{item.serviceStaffNames}}</text>
            <text>预计完成时间：{{item.actualCompleteTime}}</text>
            <text>安装产品：{{item.goodsName}}</text>
            <text>备注: {{item.remark}}</text>
          </view>
        </view>
       </view>
       <block wx:if="{{!processedList || processedList.length === 0}}">
        <view class="table">
          <image style="width: 400rpx; height: 400rpx;margin:0 auto" mode="aspectFit" src="{{noData}}"></image>
          <text style="margin:0 auto">{{dataListTips}}</text> 
        </view>
    </block>
      </view>
    </l-tabpanel>

   

  </l-tabs>

<!-- 弹窗 -->
  <view class="modal" wx:if="{{showModal}}" >
    <view class="title" >
                确认接单
    </view>
    <view class="modal-content">
        <view class="product-item">
          <text class="product-label">接单人：</text>
          <input class="quantity-input" type="number" value="{{form.acceptName}}" disabled="{{true}}"  />
        </view>
        <view class="product-item">
          <text class="product-label">接单时间：</text>
           <input class="quantity-input" type="number" value="{{form.acceptTime}}" disabled="{{true}}"  />
        </view>
       <view class="product-item">
          <text class="product-label">预计完成时间：</text>
          <picker class="quantity-input"  mode="date" bindchange="handleDateChange">
            <view class="date-input">
              <text>{{form.estimatedCompleteTime || '请选择日期'}}</text>
            </view>
          </picker>
        </view>
      <!-- 弹窗标题 -->
       <view style="text-align:right;margin-top:20rpx">
            <l-button size="mini" type="primary" plain="{{true}}" style="margin-right:20rpx;"  bindtap="hideDatePicker" > 取消</l-button>
            <l-button size="mini"  bindtap="handleAcceptConfirm">确认接单</l-button>
       </view>
      
    </view>
  </view>

  <!-- 遮罩层 -->
  <view class="mask" wx:if="{{showModal}}" bindtap="hideDatePicker"></view>
</view>