<wxs src='/utils/wxmlUtil.wxs' module="wxmlUtil"></wxs>

<view wx:for="{{list}}" data-item="{{item}}" wx:key="index" class="{{simpleFlag?'main-simple-class':'main-class' }}">
  <!-- 默认无法停用 -->
  <van-swipe-cell right-width="{{ 65 }}" disabled="{{swipeDisabled || (defaultFlag &&  item[defaultFlagKey])}}" data-index="{{index}}" data-item="{{item}}" bind:click="onCloseSwipe">
    <view class="main-foot" style="position: relative;">
      <view class="table-content" catchtap="toDetail" data-item="{{item}}" data-index="{{index}}">
        <!-- 标题行 -->
        <view class="{{simpleFlag?'table-title-simple-row':'table-title-row'}}">
          <view class="table-content-row-title-two" style="display: flex;width: 100%;justify-content: space-between;">
            <view style="display: flex;">
              <!-- 标题图标 -->
              <view catchtap="toTitle" wx:if="{{titleImageFlag}}" data-item="{{item}}" style="width: 39rpx;height: 39rpx;background-color: #95A8CB;border-radius:50%;">
                <view style="width: 39rpx;height: 39rpx;text-align: center;">
                  <van-image round width="100%" height="100%" fit="fill" src="{{imageUrl + titleImage}}" />
                </view>
              </view>
              <!-- 选择框-->
              <van-checkbox wx:if="{{chooseFlag}}" checked-color="#E4002B" value="{{ item.checked }}" data-index="{{index}}" catchtap="chooseData"></van-checkbox>
              <!-- 标题 -->
              <view class="title-class" style="width: {{(statusFlag &&  item[status] || switchFlag || flgPoint)?'100%':'100%'}}">
                <dk-text catchtap="toTitle" data-item="{{item}}" textDecoration="underline" fontSize="15px" value="{{item[title]}}"></dk-text>
              </view>
            </view>
            <view style="display: flex;">
              <!-- 原来的弯角 -->
              <view class="corner-view" wx:if="{{item[titleCorner]}}">
                <view class="corner-view-text">{{item[titleCorner]}}</view>
              </view>
              <!-- subMainTitle -->
              <view style="width: auto;" wx:if="{{subMainTitle}}">
                <dk-text data-item="{{item}}" textDecoration="underline" fontSize="15px" value="{{subMainTitlelabel + item[subMainTitle]}}"></dk-text>
              </view>

              <view style="width: auto;" wx:if="{{subTitle}}">
                <dk-text data-item="{{item}}" fontSize="13px" fontWeight="400" color="#95A8CB" value="{{item[subTitle]}}"></dk-text>
              </view>

              <!-- defaultFlagKey -->
              <view wx:if="{{defaultFlag &&  item[defaultFlagKey]}}" class="corner-view" style="width: 100rpx; border-radius: 10rpx;">
                <view class="corner-view-text">{{'默认'}}
                </view>
              </view>

              <!-- 状态 -->
              <view wx:if="{{statusFlag &&  item[status]}}" class="status-class" data-item="{{item}}" catchtap="toStatus">
                <view class="status-detail-class" style="{{item.color?'color:' + item.color:null }}">{{item[status]}}
                </view>
              </view>
              <!-- 启用/停用标识-->
              <view wx:if="{{switchFlag}}" style="text-align: right;">
                <view wx:if="{{flgValidOnFlag && !item['flgValid']}}" class="status-detail-class" style="color:red;width: 66rpx;border: 1px solid #EA4444 ;border-radius: 11rpx;">{{item['flgValid'] ? '' : $t['disable']}}
                </view>
              </view>
              <!--按钮-->
              <view wx:if="{{titleBtnText}}" class="status-class" data-item="{{item}}" catchtap="handleTitleBtn">
                <view class="btn-detail-class">{{titleBtnText}}
                </view>
              </view>
              <!-- 三个小点 -->
              <view wx:if="{{ flgPoint && (item.flgPoint == null || item.flgPoint)}}" class="oas-title-value" data-item="{{item}}" catchtap="toPoint">
                <van-icon size="25" name="ellipsis" color="#1B365D" />
              </view>
            </view>
          </view>
        </view>

        <!-- 图标-作废 收款 -->
        <view wx:if="{{!switchFlag && item['flgValid'] !=null && !item['flgValid']}}" class="status-view">
          <van-image round width="150rpx" height="150rpx" src="{{imageUrl + statusImage}}" />
        </view>
      <!-- 图标自定义 -->
        <view wx:if="{{statusImageFlag && item[statusImageFlagValue]}}" class="status-view">
          <van-image round width="150rpx" height="150rpx" src="{{imageUrl + statusImage}}" />
        </view>

        <view wx:if="{{ !detailReportFlag}}" style="margin-top: 20rpx; margin-bottom: 20rpx;">
          <!-- 内容 -->
          <view wx:if="{{!contentCol && !simpleFlag}}" class="table-content-row" wx:for="{{content}}" wx:for-item="col" data-item="{{col}}">
            <view style="display: flex;">
              <view class="table-content-row-font">
                <dk-text fontSize="14px" color="#95A8CB" fontWeight="nomal" value="{{col.title}}" copyValue="{{wxmlUtil.setItemValue(item,col.name)}}"></dk-text>
              </view>
              <view class="table-content-class" catchtap="openTelPhone" data-item="{{item}}" data-col="{{col}}" data-index="{{index}}" data-phone="{{col.phone}}" data-value="{{item[col.name]}}">
                {{wxmlUtil.setItemValue(item,col.name)}}
              </view>
            </view>
          </view>
          <!-- 内容变动 -->
          <view wx:if="{{contentCol  && !simpleFlag}}" class="table-content-row" wx:for="{{contentObj[item[contentCol]]}}" wx:for-item="col" data-item="{{col}}">
            <view style="display: flex;">
              <view class="table-content-row-font">
                <dk-text fontSize="14px" color="#95A8CB" fontWeight="nomal" value="{{col.title}}" copyValue="{{wxmlUtil.setItemValue(item,col.name)}}"></dk-text>
              </view>
              <view class="table-content-class" catchtap="openTelPhone" data-item="{{item}}" data-col="{{col}}" data-index="{{index}}" data-phone="{{col.phone}}" data-value="{{item[col.name]}}">
                {{wxmlUtil.setItemValue(item,col.name)}}
              </view>
            </view>
          </view>

          <!--内容标签-->
          <view style="display: flex;margin: 12rpx 32rpx;" wx:if="{{item.tags && item.tags.length > 0}}">
            <view style="font-size: 13px;" wx:for="{{item.tags}}" wx:key="indext" wx:for-index="indext" wx:for-item="itemt">
              <dk-tag border="1rpx solid #606EB2" height="32rpx" color="transparent" textColor="#606EB2" radius="5rpx" roundFlag="{{true}}" marginRight="12rpx" value="{{item.tags[indext]}}"></dk-tag>
            </view>
          </view>
        </view>
        <!--明细报表-->
        <view wx:if="{{ detailReportFlag}}" style="margin-top: 10rpx;">
          <view wx:if="{{!contentCol}}" class="table-content-row-detail" wx:for="{{content}}"  wx:for-item="col"  wx:for-index="index_" data-item="{{col}}">
       
            <view style="display: flex;justify-content: space-between;align-items: center;">
              <!--左侧-->
              <view class="table-content-class">
                <dk-title wx:if="{{col.left.type == 'title'}}" titleTag="{{item[col.left.tag]}}" title="{{item[col.left.title]}}"></dk-title>
                <dk-cell wx:if="{{col.left.type == 'price'}}" left="0rpx" height="50rpx" contentRight="{{false}}" contentFontSize="17" contentColor="#FF7B1A" contentFontWeight="bold" content="{{item[col.left.name]?item[col.left.name]:0}}"></dk-cell>
                <view wx:if="{{col.left.type != 'title' && col.left.type != 'price'}}" style="display: flex; color:{{col.left.type == 'qty'?'#95A8CB':'002340'}}">
                  <view wx:if="{{col.left.type == 'qty'}}">x</view>{{item[col.left.name]?(col.left.title?col.left.title:'') + item[col.left.name]:''}}
                </view>
              </view>
              <!--右侧-->
              <view class="table-content-class" style="display: flex;color:{{col.right.type == 'qty'?'#95A8CB':'#002340'}}">
                <view style="display: flex;" wx:if="{{col.right.type == 'price'}}">
                  <view style="display: flex;align-items: center;">
                    {{col.right.title}}
                  </view>
                  <dk-number-input inputWidthFlag="{{true}}" fontSize="19" center="right" data-key="{{col.right.name}}" inputColor="#FF7B1A" fontWeight="600" inputValue="{{item[col.right.name]?item[col.right.name]:0}}" data-index="{{index}}" bind:triggerBindValue="changeAmount">
                  </dk-number-input>
                </view>
                <view wx:if="{{col.right.type !== 'price'}}" style="display: flex;">
                  <view wx:if="{{col.right.type == 'qty'}}">x</view>{{item[col.right.name]?item[col.right.name]:''}}
                </view>

              </view>

            </view>
          </view>
          <!--根据contentCol切换-->
          <view wx:if="{{contentCol}}" class="table-content-row-detail" wx:for="{{contentObj[item[contentCol]]}}" wx:for-item="col" data-item="{{col}}">
            <view style="display: flex;justify-content: space-between;align-items: center;">
              <!--左侧-->
              <view class="table-content-class">
                <dk-title wx:if="{{col.left.type == 'title'}}" titleTag="{{item[col.left.tag]}}" title="{{item[col.left.title]}}"></dk-title>
                <dk-cell wx:if="{{col.left.type == 'price'}}" left="0rpx" height="50rpx" contentRight="{{false}}" contentFontSize="17" contentColor="#FF7B1A" contentFontWeight="bold" content="{{item[col.left.name]?item[col.left.name]:0}}"></dk-cell>
                <view wx:if="{{col.left.type != 'title' && col.left.type != 'price'}}" style="display: flex; color:{{col.left.type == 'qty'?'#95A8CB':'002340'}}">
                  <view wx:if="{{col.left.type == 'qty'}}">x</view>{{item[col.left.name]?(col.left.title?col.left.title:'') + item[col.left.name]:''}}
                </view>
              </view>
              <!--右侧-->
              <view class="table-content-class" style="display: flex;color:{{col.right.type == 'qty'?'#95A8CB':'002340'}}">
                <view wx:if="{{col.right.type == 'qty'}}">x</view>{{item[col.right.name]?item[col.right.name]:''}}
              </view>
            </view>
          </view>
        </view>

        <!-- 分割线 -->
        <view style="padding-left:25rpx;padding-right:25rpx;" wx:if="{{footerInfo && footerInfo.length > 0}}">
          <view style="border: 1rpx solid #E9F0FE;height: 0px;"></view>
        </view>

        <!-- 底部 -->
        <view class="table-content-row" style="padding-top: 0rpx;" wx:if="{{footerInfo && footerInfo.length > 0}}">
          <view style="display: flex; justify-content: space-between;">
            <view class="category-class">
              {{(wxmlUtil.setFooterItemValue(item,footerInfo) == 'undefined')?'':wxmlUtil.setFooterItemValue(item,footerInfo) }}
            </view>
            <view class="footer-tag-class" wx:if="{{footerTag && item[footerTag]}}">
              <dk-tag border="1rpx solid #437FF8" height="44rpx" color="transparent" textColor="#437FF8" radius="10rpx" roundFlag="{{true}}" value="{{item[footerTag]}}"></dk-tag>
            </view>
            <view wx:if="{{footerAmount}}" class="totalamount-class">
              <dk-cell center="{{(footerInfo && footerInfo.length > 0)?'space-around':'space-between'}}" contentRight="{{false}}" fontSize="15" contentFontSize="17" contentColor="#FF7B1A" titleColor="#002340" contentFontWeight="bold" title="{{footerAmount.title}}" content="{{item[footerAmount.name]?item[footerAmount.name]:0}}"></dk-cell>
            </view>
          </view>
        </view>
      </view>
    </view>
    <!-- 侧拉 -->
    <view style="font-size: 14px;" data-index="{{index}}" data-item="{{item}}" slot="right">{{swipeDeleteFlag?$t['delete']:(item['flgValid'] ? $t['disable'] : $t['enable']) }}</view>
  </van-swipe-cell>
</view>

<van-popup show="{{show}}" position="bottom" bind:close="closePop" custom-class="function-pop-class">
  <van-cell-group border="{{false}}" custom-class="function-cell-group">
    <van-grid square border="{{false}}" icon-size="42px">
      <!--按钮-->
      <van-grid-item use-slot catchtap="clickButton" wx:for="{{buttonList}}" data-item="{{item}}" wx:key="index">
        <view>
          <van-image custom-class="function-pop-image" fit="fill" src="{{imageUrl + routeUrl[routeObjName][item.name].image}}"></van-image>
        </view>
        <view style="margin-top: -18rpx;">
          <dk-text fontSize="12px" fontWeight="400" value="{{item.title?item.title:$t[item.name]}}"></dk-text>
        </view>
      </van-grid-item>
    </van-grid>
  </van-cell-group>
  <view class="popup-button" catchtap="closePop">
    <dk-text fontSize="14px" fontWeight="400" value="{{$t['cancel']}}"></dk-text>
  </view>
</van-popup>