<!--pages/agent/serviceBillDetail/index.wxml-->
<view class="panel mt-5">
  <view class="flex-align-start">
    <view style="flex:1">
      <view class="mt-5">
        <text class="colorInfo small">服务单号:</text>
        <text class="billno">{{orderMainData.billno}}</text>
      </view>
      <view class="mt-5">
        <t-tag class="mr-5" wx:if="{{orderMainData.servicetype}}" variant="light" shape="round" theme="primary" size="small">{{orderMainData.servicetype}}</t-tag>
        <t-tag class="mr-5" wx:if="{{orderMainData.class1}}" variant="light" shape="round" theme="primary" size="small">{{orderMainData.class1}}</t-tag>
        <t-tag class="mr-5" wx:if="{{orderMainData.class2}}" variant="light" shape="round" theme="primary" size="small">{{orderMainData.class2}}</t-tag>
      </view>
    </view>
  </view>
  <view class="small"><text class="label">服务单类型:</text>{{orderMainData.servicetype}}</view>
  <view class="small"><text class="label">服务单状态:</text>{{orderMainData.status}}</view>
  <view class="small"><text class="label">开始日期:</text>{{orderMainData.begdate}}</view>
  <view class="small"><text class="label">结束日期:</text>{{orderMainData.enddate}}</view>
  <view wx:if="{{orderMainData.backreason}}" class="small colorError"><text class="label">退回原因:</text>{{orderMainData.backreason}}</view>
</view>
<!-- <view style="padding:5px" class="small"><text class="label">现场联系人</text></view> -->

<view class="panel mt-5">
  <view>
    <view class="small"><text class="label">姓名:</text>{{orderMainData.scenecontact}}</view>
    <view class="small flex-align-center">
      <text class="label">电话:</text>
      <t-call phone="{{orderMainData.scenecontactphonenumber}}"></t-call>
    </view>
    <view class="small"><text class="label">岗位:</text>{{orderMainData.scenecontactrole}}</view>
    <view class="small"><text class="label">省市县:</text>{{orderMainData.province + orderMainData.city+orderMainData.county}}</view>
    <view class="small"><text class="label">地址:</text>{{orderMainData.address}}</view>
  </view>
</view>
<!-- <view style="padding:5px" class="small"><text class="label">关联订单</text></view> -->
<view class="panel mt-5" wx:if="{{orderMainData.sonum}}">
  <text class="label">关联订单:</text>{{orderMainData.sonum}}
</view>
<view class="panel mt-5">
  <view class="small">
    <text class="label">业务员:</text>{{orderMainData.saler_name||" --"}}
  </view>
  <view class="small" style="display: flex;">
    <text class="label">联系电话:</text>
    <t-call wx:if="{{orderMainData.saler_phonenumber}}" phone="{{orderMainData.saler_phonenumber}}" />
    <text wx:else> --</text>
  </view>
</view>

<view class="panel mt-5">
  <view class="small">
    <text class="label">问题描述:</text>{{orderMainData.reason}}
  </view>
</view>
<view class="panel mt-5">
  <view class="small"><text class="label">附件信息:</text></view>
  <imageview wx:if="{{filelist.length > 0}}" list="{{filelist}}"></imageview>
</view>
<view>
  <t-tabs defaultValue="{{0}}" bind:change="onTabsChange" bind:click="onTabsClick" t-class="custom-tabs">
    <t-tab-panel label="关联工单" value="0">
      <t-cell wx:for="{{linkWorkOrders}}" wx:key="sa_serviceorderid" title="工单编号" note="{{item.billno}}" data-item="{{item}}" bind:click="tolinkWorkOrder" hover arrow />
      <t-empty wx:if="{{linkWorkOrders.length === 0}}" icon="root-list" t-class="empty-cls" t-class-image="t-empty__image" description="暂无工单" />
    </t-tab-panel>
    <t-tab-panel wx:if="{{orderMainData.servicetype !== '售前' && orderMainData.servicetype !== '历史售后'}}" label="售后商品" value="1">
      <view style="padding:10px" wx:if="{{list.length === 0}}">
        <t-empty icon="cart" description="暂未添加商品">
          <t-button slot="action" theme="primary" size="extra-small" bindtap="addProduct">前往添加</t-button>
        </t-empty>
      </view>
      <view wx:else>
        <view style="text-align: right;border:1px solid #f1f2f3">
          <t-button theme="primary" size="small" icon="add" variant="text" bindtap="addProduct">
            继续添加
          </t-button>
        </view>
        <view wx:for="{{list}}" wx:key="{{itemid}}">
          <product-card data="{{item}}" isdelete="{{true}}" bind:delete="onMXDelete"></product-card>
        </view>

      </view>
    </t-tab-panel>
  </t-tabs>
</view>

<t-dialog id="t-dialog" />
<t-dialog visible="{{showWithInput}}" title="退回原因" confirm-btn="确定" cancel-btn="取消" bind:confirm="onBack" bind:cancel="showBackReason">
  <t-textarea style="margin-top:20px" slot="content" placeholder="请输入退回原因" value="" disableDefaultPadding="{{true}}" bind:change="inputReason" autosize bordered />
</t-dialog>

<t-dialog visible="{{showToWoker}}" title="转工单" confirm-btn="确定" cancel-btn="取消" bind:confirm="toWorker" bind:cancel="showBackReason">
  <view slot="content">
    <view class="d-title">
      选择工单模板:
    </view>
    <view style="margin-bottom:10px">
      <block wx:for="{{templist}}" wx:key="rowindex">
        <t-tag class="mr-5 mt-5" variant="{{actTemp.sa_workorder_templateid === item.sa_workorder_templateid?'dark':'outline'}}" theme="primary" data-item="{{item}}" bindtap="selectTemp">{{ item.name }}</t-tag>
      </block>
    </view>
    <view class="d-title">
      选择负责人:
    </view>
    <view class="mt-5">
      <block wx:for="{{workers}}" wx:key="rowindex">
        <t-tag class="mr-5 mt-5" variant="{{actLeader.userid === item.userid?'dark':'outline'}}" theme="primary" data-item="{{item}}" bindtap="selectLeader">{{ item.position?item.position + '-':'' }}{{ item.name }}</t-tag>
      </block>
    </view>
    <t-button bind:tap="showProgressDialog" variant="primary" size="extra-small">查看人员进度</t-button>
  </view>
</t-dialog>

<t-dialog visible="{{showProgress}}" title="进度" confirm-btn="确定" bind:confirm="showProgressDialog" external-classes="['t-class']" show-overlay="{{false}}">
  <view slot="content">
    <scroll-view style="display: inline-block;width: 100%;height: 300px;" scroll-y>
      <view wx:for="{{progress}}" wx:key="rowindex">
        <view class="small"><text class="label">姓名:</text>{{item.projectleader}}</view>
        <view class="small"><text class="label">地址:</text>{{item.province}}{{item.city}}{{item.county}}{{item.address}}</view>
        <view class="small"><text class="label">创建时间:</text>{{item.createdate}}</view>
        <t-divider align="left" />
      </view>
      <t-empty wx:if="{{progress.length === 0}}" icon="root-list" t-class="empty-cls" t-class-image="t-empty__image" description="暂无进行中的人员" />
    </scroll-view>
  </view>
</t-dialog>
<!-- 底部 -->
<block wx:if="{{tabbarsList.length!=0}}">
  <view style="height: 160rpx;" />
  <Yl_Tabbar list='{{tabbarsList}}' bind:callback="tabbarOnClick" />
</block>