<view class="container">

  <view class="service-order">
    <view class="section-title1">服务工单</view>
      <view class="order-info">
      <view class="info-item">
        <text class="label">服务单号：</text>
        <text class="value">{{orderDetail.orderNo}}</text>
      </view>
      <!-- <view class="info-item">
        <text class="label">服务项目：</text>
        <text class="value">{{orderDetail.projectName}}</text>
      </view> -->
      <view class="info-item">
        <text class="label">客户：</text>
        <text class="value">{{orderDetail.customerName}}</text>
      </view>
      <view class="info-item">
        <text class="label">服务人员：</text>
        <text class="value">{{orderDetail.serviceStaffNames}}</text>
      </view>
      <view class="info-item">
        <text class="label">预计服务完成时间：</text>
        <text class="value">{{orderDetail.estimatedCompleteTime}}</text>
      </view>
      <view class="info-item delay-info">
        <text class="label">距服务完成时间还剩：</text>
        <text class="value highlight">{{orderDetail.remainingTime}}天</text>
      </view>
      <view class="info-item">
        <text class="label">备注：</text>
        <text class="value">{{orderDetail.remark}}</text>
      </view>
    </view>
  </view>

 
  <view class="service-record">
     <view class="record-header"> 
      <text class="section-title">每日填写</text>
      <l-button class="history-btn" bindtap="viewHistory" size="mini">服务记录</l-button>
    </view>
  </view>
  <!-- 添加日期选择器 -->
  <view class="date-picker">
    <view class="date-item {{selectedDates[date] ? 'selected' : ''}}" 
        wx:for="{{datas}}" 
        wx:for-item="date" 
        wx:key="index"
        bindtap="selectDate"
        data-date="{{date}}">
    <text class="date-text">{{date}}</text>
  </view>
  </view>


  <view class="record-content"  wx:for="{{records}}" wx:key="index">
      <view class="product-info">
        <view class="product-item">
         <text class="product-label">日期：</text>
         <text class="product-name">{{item.date}}</text>
        </view>
         <view class="product-item">
          <text class="product-label">服务项目：</text>
          <text class="product-name">{{item.projectName}}</text>
        </view>
         <!-- <view class="product-item">
          <text class="product-label">货品编号：</text>
          <text class="product-name">{{item.goodsCode}}</text>
        </view> -->
        <view class="product-item">
          <text class="product-label">货品：</text>
          <text class="product-name">{{item.goodsName}}</text>
        </view>
        <view class="product-item">
          <text class="product-label">数量：</text>
          <text class="product-value">{{item.orderQuantity}}</text>
        </view>
         <view class="product-item">
          <text class="product-label">剩余量：</text>
          <text class="product-value">{{item.unshippedQuantity}}</text>
        </view>
        <view class="product-item">
          <text class="product-label">已完成量：</text>
          <text class="product-value">{{item.shippedQuantity}}</text>
        </view>
      
        <view class="product-item">
          <text class="product-label">今日完成量：</text>
          <input class="quantity-input" type="number" value="{{item.todayQuantity ?item.todayQuantity:''}}" data-index="{{index}}" bindinput="onQuantityChange"  placeholder-style="font-size:28rpx;color:#aaa" placeholder="请填写今日完成量" />
        </view>
  
        <view class="product-item">
          <text class="product-label required">备注：</text>
          <textarea class="remarks-input" value="{{item.remark}}" bindinput="onRemarkChange"  data-index="{{index}}" placeholder-style="font-size:28rpx;color:#aaa"  placeholder="备注提示：是否使用临时工（公司支付工人工资），如有则填写工人数量，如没有填写无，请如实填写，否则将影响你的绩效" />
        </view>
      </view>
  </view>

   <!-- 底部按钮 -->
    <view class="ticket-actions" >
      <l-button size="mini" type="default" plain="{{true}}" bindtap="handleReject" data-id="{{item.id}}">取消</l-button>
      <l-button size="mini" type="default"  bindtap="posttDailyFill" data-id="{{item.id}}">保存</l-button>
    </view>
</view>