<page-plugin isAuth="{{authInfo['SF_ERP_PRODUCT_TASK_VIEW']}}" loading="{{loading}}"
  is-login="{{isLogin}}" bind:handleLogin="handleLogin">
  <search-popup placeholder="输入销售单号" bind:change="searchChange" bind:ok="searchOk"
    bind:reset="searchReset" value="{{params.order_no}}" data-key="order_no">
    <view slot="content">
      <search-input label="自定义单号" value="{{params.custom_order_no}}" data-key="custom_order_no"
        bind:change="searchChange" />
      <search-input label="经销商名称" value="{{params.custom_name}}" data-key="custom_name"
        bind:change="searchChange" />
      <!-- <search-input label="经销商手机" value="{{params.custom_phone}}" data-key="custom_phone"
        bind:change="searchChange" /> -->
      <search-input label="客户名称" value="{{params.end_user_name}}" data-key="end_user_name"
        bind:change="searchChange" />
      <search-input label="客户手机" value="{{params.end_user_phone}}" data-key="end_user_phone"
        bind:change="searchChange" />
      <search-input label="客户地址" value="{{params.end_user_address}}" data-key="end_user_address"
        bind:change="searchChange" />

      <option-cell-plugin title="生产状态" value="{{params.process_state}}" bind:change="searchChange"
        mode="checkbox" data-key="process_state" options="{{saleOrderProcessStateOption}}" />

      <!-- <option-cell-plugin title="收款状态" value="{{params.payed_state || ''}}"
        bind:change="searchChange" mode="radio" options="{{payedStateOption}}"
        data-key="payed_state" /> -->

      <!-- <date-picker-plugin title="创建开始日期" value="{{params.create_dateL}}" data-key="create_dateL"
        bind:confirm="searchChange" />
      <date-picker-plugin title="创建结束日期" value="{{params.create_dateU}}" data-key="create_dateU"
        bind:confirm="searchChange" /> -->
    </view>
  </search-popup>

  <count-plugin count="{{count}}">
    <!-- <sort-plugin options="{{sort}}" bind:ok="onSort" value="{{params.order}}" slot="right" /> -->
  </count-plugin>

  <empty-plugin wx:if="{{list.length == 0}}" />
  <card-plugin wx:for="{{ list }}" wx:key="order_no" wx:for-index="i">
    <view slot="header">{{ item.order_no }}</view>
    <view slot="content">
      <card-item-plugin wx:if="{{item.custom_order_no}}" label="自定义单号"
        value="{{item.custom_order_no}}" />
      <card-item-plugin wx:if="{{item.custom_name}}" label="经销商名称" value="{{item.custom_name}}" />
      <card-item-plugin wx:if="{{item.custom_phone}}" label="经销商手机" value="{{item.custom_phone}}" />
      <card-item-plugin wx:if="{{item.end_user_name}}" label="客户名称"
        value="{{item.end_user_name}}" />
      <card-item-plugin wx:if="{{item.end_user_phone}}" label="客户手机"
        value="{{item.end_user_phone}}" />
      <card-item-plugin wx:if="{{item.end_user_address}}" label="客户地址"
        value="{{item.end_user_address}}" />
    </view>
    <view wx:if="{{item.produce_info.length}}" slot="footer" class="card-plugin-footer"
      style="flex-direction: column;">
      <t-cell-group title="产品名称">
        <block wx:for="{{item.produce_info}}" wx:key="index" wx:for-item="produce">
          <t-cell title="{{produce.goods_name}}" bind:tap="onDetail" data-index="{{i}}"
            data-index2="{{index}}" hover="{{!!produce.produce_info_process.length}}"
            arrow="{{!!produce.produce_info_process.length }}" style="padding-right: 0;" />
        </block>
      </t-cell-group>
    </view>
  </card-plugin>
  <pagination-plugin curr_page="{{params.curr_page}}" page_count="{{params.page_count}}"
    total="{{count}}" bind:change="paginationChange" />
</page-plugin>
<popup-plugin visible="{{ detail.show }}" bind:close="onClose" title="{{detail.title}}">
  <view style="padding: 24rpx;">
    <card-plugin wx:for="{{ detail.data }}" wx:key="p_process_id" showAll="1">
      <view slot="header">{{ item.p_process_name }}</view>
      <view slot="content">
        <card-item-plugin wx:for="{{ item.children }}" wx:key="process_id"
          label="{{item.c_process_name}}" value="{{item.bonus_nums}}"
          customStyle="color: {{item.state == 2 ? '#2ba471': ''}};" />
      </view>
    </card-plugin>
  </view>
</popup-plugin>