<template>
  <scroll-view class="scrollBox" scroll-y="true" @scroll="handlePageScroll">
    <view class="earlyWarningDetail">
      <view class="earlyTop" :style="{height: `calc(${menu.bottom}px + 680rpx)`}">
        <!--      menu.bottom + 314 + 'px'-->
        <view class="earlyTopBg"></view>
        <view class="headerBox" :style="{paddingTop: menu.top + 'px',height:menu.bottom + 12 +'px'}">
          <view :style="{height:menu.height +'px',display: 'flex',alignItems: 'center',paddingLeft:'32rpx'}">
            <view class="backIconBox" @click="handleBack">
              <image class="backIcon" src="https://eshangtech.com/ShopICO/ahyd-BID/commercial/navigation-left.svg"/>
            </view>
            <div class="picker">
              <div class="selectService" >
                <image class="img" src="https://eshangtech.com/ShopICO/ahyd-BID/commercial/fixed.svg"></image>
                <view class="select" style="margin-left: 16rpx">
                  <view class="content">
                    <view class="uni-input">{{res.ServerpartName?res.ServerpartName:''}}</view>
                    <p class="area">{{res.SPRegionTypeName?res.SPRegionTypeName:''}}</p>
                    <image class="rightArrow" src="https://eshangtech.com/ShopICO/ahyd-BID/commercial/rightArrow.svg"></image>
                  </view>
                </view>
              </div>
            </div>
          </view>
        </view>

        <view class="detailFixed" :style="{top: menu.bottom + 12 +'px'}" v-if="showDetailFixed">
          <view class="itemDetail">
            <text :class="res.RevenueINC.increaseRate>0?'value red':res.RevenueINC.increaseRate<0?'value green':''">{{ res.RevenueINC.increaseRate?res.RevenueINC.increaseRate>0?`+${res.RevenueINC.increaseRate}%`:res.RevenueINC.increaseRate<0?`${res.RevenueINC.increaseRate}%`:'0':'-' }}</text>
            <text class="label">对客营收</text>
          </view>
          <view class="itemDetail">
            <text :class="res.BayonetINC.increaseRate>0?'value red':res.BayonetINC.increaseRate<0?'value green':''">{{ res.BayonetINC.increaseRate?res.BayonetINC.increaseRate>0?`+${res.BayonetINC.increaseRate}%`:res.BayonetINC.increaseRate<0?`${res.BayonetINC.increaseRate}%`:'0':'-' }}</text>
            <text class="label">入区车流</text>
          </view>
        </view>

        <view class="revenueBox" :style="{top: menu.bottom + 19 +'px' }">
          <view class="box">
            <view class="typeBox">
              <image class="bg" src="https://eshangtech.com/ShopICO/ahyd-BID/warning/detailTopBg1.png"/>
              <view class="typeBoxTop" style="display: flex;justify-content: space-between;align-items: center">
                <view>
                  <text class="title">对客营收</text>
                  <text class="unit">/万元</text>
                </view>
                <text class="monthText">{{date || ''}}</text>
              </view>
              <view class="typeBoxContent">
                <view style="width: 40%;display: inline-block">
                  <view class="valueItem">
                    <text :class="res.RevenueINC.increaseRate>0?'valueAdd':res.RevenueINC.increaseRate<0?'valueGreen':''">{{ res.RevenueINC.increaseRate?res.RevenueINC.increaseRate>0?`+${res.RevenueINC.increaseRate}%`:res.RevenueINC.increaseRate<0?`${res.RevenueINC.increaseRate}%`:'0':'-' }}</text>
                    <text class="label">同比去年</text>
                  </view>
                </view>
                <view style="width: 30%;display: inline-block">
                  <view class="valueItem">
                    <text class="value">{{res.RevenueINC && res.RevenueINC.curYearData?$util.getMoney(res.RevenueINC.curYearData/10000):'-'}}</text>
                    <text class="label">2024年</text>
                  </view>
                </view>
                <view style="width: 30%;display: inline-block">
                  <view class="valueItem">
                    <text class="value">{{res.RevenueINC && res.RevenueINC.lYearData?$util.getMoney(res.RevenueINC.lYearData/10000):'-'}}</text>
                    <text class="label">2023年</text>
                  </view>
                </view>
              </view>
              <!--            <view class="addBox">-->
              <!--              <text class="label">增长</text>-->
              <!--              <text :class="res.RevenueINC.increaseData<0?'addGreenValue':res.RevenueINC.increaseData>0?'addValue':''">{{res.RevenueINC.increaseData>0?`+${$util.getMoney(res.RevenueINC.increaseData/10000)}`:res.RevenueINC.increaseData<0?`${$util.getMoney(res.RevenueINC.increaseData/10000)}`:''}}</text>-->
              <!--            </view>-->
            </view>

            <view class="line"></view>

            <view class="typeBox">
              <image class="bg" src="https://eshangtech.com/ShopICO/ahyd-BID/warning/detailTopBg2.png"/>
              <view class="typeBoxTop">
                <!--              <text class="monthText">{{date || ''}}</text>-->
                <text class="title">入区车流</text>
                <text class="unit">/万辆</text>
              </view>
              <view class="typeBoxContent">
                <view style="width: 40%;display: inline-block">
                  <view class="valueItem">
                    <text :class="res.BayonetINC.increaseRate>0?'valueAdd':res.BayonetINC.increaseRate<0?'valueGreen':''">{{ res.BayonetINC.increaseRate?res.BayonetINC.increaseRate>0?`+${res.BayonetINC.increaseRate}%`:res.BayonetINC.increaseRate<0?`${res.BayonetINC.increaseRate}%`:'0':'-' }}</text>
                    <text class="label">同比去年</text>
                  </view>
                </view>
                <view style="width: 30%;display: inline-block">
                  <view class="valueItem">
                    <text class="value">{{res.BayonetINC && res.BayonetINC.curYearData?$util.getMoney(res.BayonetINC.curYearData/10000):'-'}}</text>
                    <text class="label">2024年</text>
                  </view>
                </view>
                <view style="width: 30%;display: inline-block">
                  <view class="valueItem">
                    <text class="value">{{res.BayonetINC && res.BayonetINC.lYearData?$util.getMoney(res.BayonetINC.lYearData/10000):'-'}}</text>
                    <text class="label">2023年</text>
                  </view>
                </view>
              </view>
              <img v-if="false" class="handleGo" @click="handleGoCarCharts" src="/static/images/warning/handleGo.svg"/>
              <!--            <view class="addBox">-->
              <!--              <text class="label">增长</text>-->
              <!--              <text :class="res.BayonetINC.increaseData<0?'addGreenValue':res.BayonetINC.increaseData>0?'addValue':''">{{res.BayonetINC.increaseData>0?`+${$util.getMoney(res.BayonetINC.increaseData/10000)}`:res.BayonetINC.increaseData<0?`${$util.getMoney(res.BayonetINC.increaseData/10000)}`:''}}</text>-->
              <!--            </view>-->
            </view>

            <view class="descBox">
              <text class="monthText">
                {{selectType===1?`${res.ServerpartName}${date || ''}度车流`:selectType===2?`${res.ServerpartName}${date || ''}车流`:selectType===3?`${res.ServerpartName}${date || ''}车流`:selectType===4?`${res.ServerpartName}${date || ''}车流`:''}}
                <text>{{res.BayonetINC.increaseRate>0?'增加':res.BayonetINC.increaseRate<0?'减少':''}}<text :style="{color:res.BayonetINC.increaseRate>0?'#E83944':res.BayonetINC.increaseRate<0?'#127E5B':''}">{{res.BayonetINC.increaseRate?`${Math.abs(res.BayonetINC.increaseRate)}%`:'-'}}</text></text>
                {{selectType===1?'，对客营收':selectType===2?'，门店的营收减少':selectType===3?'，对客营收':selectType===4?'，对客营收':''}}
                <text v-if="selectType!==2">{{res.RevenueINC.increaseRate>0?'增加':res.RevenueINC.increaseRate<0?'减少':''}}<text :style="{color:res.RevenueINC.increaseRate>0?'#E83944':res.RevenueINC.increaseRate<0?'#127E5B':''}">{{res.RevenueINC.increaseRate?`${Math.abs(res.RevenueINC.increaseRate)}%`:'-'}}</text></text>
              </text>




              <!--            <text class="monthText">{{selectType===1?`${res.ServerpartName}${date || ''}度车流增加${res.BayonetINC.increaseRate?`${Math.abs(res.BayonetINC.increaseRate)}%`:'-'}，营收减少${res.RevenueINC.increaseRate?`${Math.abs(res.RevenueINC.increaseRate)}%`:'-'}，请关注服务区整体营收呈现下降的情况！`:-->
              <!--                selectType===2?`${res.ServerpartName}${date || ''}车流增加${res.BayonetINC.increaseRate?`${Math.abs(res.BayonetINC.increaseRate)}%`:'-'}，门店的营收减少，请关注服务区部分门店营收呈现下降的情况！`:-->
              <!--                    selectType===3?`${res.ServerpartName}${date || ''}车流增加${res.BayonetINC.increaseRate?`${Math.abs(res.BayonetINC.increaseRate)}%`:'-'}，营收增长${res.RevenueINC.increaseRate?`${Math.abs(res.RevenueINC.increaseRate)}%`:'-'}不匹配，请关注营收与车流增幅产生较大差异的服务区！`:-->
              <!--                        selectType===4?`${res.ServerpartName}${date || ''}车流减少${res.BayonetINC.increaseRate?`${Math.abs(res.BayonetINC.increaseRate)}%`:'-'}，营收降低${res.RevenueINC.increaseRate?`${Math.abs(res.RevenueINC.increaseRate)}%`:'-'}不匹配，请关注营收与车流降幅产生较大差异的服务区！`:''}}</text>-->
              <!--            <view class="descTitle">预警说明：<text class="desc">-->
              <!--              {{selectType===1?'请重点关注入区车流增加自营商超营收同步增长，服务区整体营收呈现下降的情况！':selectType===2?'请重点关注入区车流增加自营商超营收同步增长，服务区部分门店营收呈现下降的情况！':selectType===3?'请重点关注营收与车流增幅产生较大差异的服务区！增幅差额=车流增幅-营收增幅':selectType===4?'请重点关注营收与车流降幅产生较大差异的服务区！增幅差额=销售增幅-车流降幅':''}}-->
              <!--            </text></view>-->
              <view class="other" v-if="ownerShop.ServerpartShopName">
                <image class="notice" src="https://eshangtech.com/ShopICO/ahyd-BID/warning/warningIcon.png"/>
                同期商超营收增长
                <text :style="{color: ownerShop.RevenueINC.increaseRate>0?'#E83944':ownerShop.RevenueINC.increaseRate<0?'#127E5B':''}">{{`${ownerShop.RevenueINC.increaseRate?ownerShop.RevenueINC.increaseRate+'%':''}`}}</text>
              </view>
              <view class="monthText">{{selectType===1?'请关注服务区整体营收呈现下降的情况！':selectType===2?'请关注服务区部分门店营收呈现下降的情况！':selectType===3?'不匹配，请关注营收与车流增幅产生较大差异的服务区！':selectType===4?'不匹配，请关注营收与车流降幅产生较大差异的服务区！':''}}</view>
            </view>
          </view>
        </view>
      </view>
      <view class="detailContentBox" >
        <!--      :style="{height: `calc(100vh - ${menu.bottom}px - 800rpx)`}"-->
        <view class="contentTop">
          <image class="topIcon" src="https://eshangtech.com/ShopICO/ahyd-BID/warning/shopIcon.png"/>
          <text class="topTitle">商家数据</text>
        </view>
        <view class="contentSort">
          <view class="sortItem" style="width: 56rpx">
            <view class="sort" >
              <view class="topName">商家</view>
            </view>
          </view>
          <view class="sortItem" style="width: 124rpx" @click="handleChangeSortName(1)">
            <view class="sort" >
              <view class="topName">2024年</view>
              <view class="sortIconBox">
                <image class="upIcon" :style="{transform: sortName===1?sortType===1?``:`rotate(180deg)`:``}" :src="sortType===1?'https://eshangtech.com/ShopICO/ahyd-BID/car/upDesc.svg':sortName===1?'https://eshangtech.com/ShopICO/ahyd-BID/car/downDesc.svg':'https://eshangtech.com/ShopICO/ahyd-BID/car/upDesc.svg'"/>
                <image class="bottomIcon" :style="{transform: sortName===1?sortType===1?``:`rotate(180deg)`:'rotate(-180deg)'}":src="sortType===1 && sortName===1?'https://eshangtech.com/ShopICO/ahyd-BID/car/downDesc.svg':'https://eshangtech.com/ShopICO/ahyd-BID/car/upDesc.svg'"/>
              </view>
            </view>
          </view>
          <view class="sortItem" style="width: 124rpx" @click="handleChangeSortName(2)">
            <view class="sort">
              <view class="topName">2023年</view>
              <view class="sortIconBox">
                <image class="upIcon" :style="{transform: sortName===2?sortType===1?``:`rotate(180deg)`:``}" :src="sortType===1?'https://eshangtech.com/ShopICO/ahyd-BID/car/upDesc.svg':sortName===2?'https://eshangtech.com/ShopICO/ahyd-BID/car/downDesc.svg':'https://eshangtech.com/ShopICO/ahyd-BID/car/upDesc.svg'"/>
                <image class="bottomIcon" :style="{transform: sortName===2?sortType===1?``:`rotate(180deg)`:'rotate(-180deg)'}":src="sortType===1 && sortName===2?'https://eshangtech.com/ShopICO/ahyd-BID/car/downDesc.svg':'https://eshangtech.com/ShopICO/ahyd-BID/car/upDesc.svg'"/>
              </view>
            </view>
          </view>
          <view class="sortItem" style="width: 84rpx" @click="handleChangeSortName(3)">
            <view class="sort">
              <view class="topName">增长</view>
              <view class="sortIconBox">
                <image class="upIcon" :style="{transform: sortName===3?sortType===1?``:`rotate(180deg)`:``}" :src="sortType===1?'https://eshangtech.com/ShopICO/ahyd-BID/car/upDesc.svg':sortName===3?'https://eshangtech.com/ShopICO/ahyd-BID/car/downDesc.svg':'https://eshangtech.com/ShopICO/ahyd-BID/car/upDesc.svg'"/>
                <image class="bottomIcon" :style="{transform: sortName===3?sortType===1?``:`rotate(180deg)`:'rotate(-180deg)'}":src="sortType===1 && sortName===3?'https://eshangtech.com/ShopICO/ahyd-BID/car/downDesc.svg':'https://eshangtech.com/ShopICO/ahyd-BID/car/upDesc.svg'"/>
              </view>
            </view>
          </view>
          <view class="sortItem" style="width: 84rpx" @click="handleChangeSortName(4)">
            <view class="sort" >
              <view class="topName">增幅</view>
              <view class="sortIconBox">
                <image class="upIcon" :style="{transform: sortName===4?sortType===1?``:`rotate(180deg)`:``}" :src="sortType===1?'https://eshangtech.com/ShopICO/ahyd-BID/car/upDesc.svg':sortName===4?'https://eshangtech.com/ShopICO/ahyd-BID/car/downDesc.svg':'https://eshangtech.com/ShopICO/ahyd-BID/car/upDesc.svg'"/>
                <image class="bottomIcon" :style="{transform: sortName===4?sortType===1?``:`rotate(180deg)`:'rotate(-180deg)'}":src="sortType===1 && sortName===4?'https://eshangtech.com/ShopICO/ahyd-BID/car/downDesc.svg':'https://eshangtech.com/ShopICO/ahyd-BID/car/upDesc.svg'"/>
              </view>
            </view>
          </view>
        </view>

        <view class="listBox">
          <view class="listItem" v-for="(item,index) in dataList" :key="index" :style="{background: item.ServerpartShopName==='自营超市'?'#ececec':'#F8F8F8'}">
            <view class="listItemTop">
              <view class="listItemLeft">
                <view class="logoBox">
                  <image class="logo" :src="item.Brand_ICO"/>
                </view>
                <view class="titleBox">
                  <view style="display: flex;align-items: center;">
                    <text class="itemTitle">{{item.ServerpartShopName}}</text>
                    <text class="MERCHANTS_NAME" v-if="item.MERCHANTS_NAME">{{item.MERCHANTS_NAME}}</text>
                  </view>
                  <view class="itemTypeBox">
                    <text v-if="item.SettlementModes" class="mode" style="margin-right: 8rpx">{{ SETTLEMENT_MODESOBJ[item.SettlementModes] || '' }}</text>
                    <text  v-if="item.BusinessType" class="type">{{ businessTypeObj[item.BusinessType ] || '' }}</text>
                  </view>
                </view>
              </view>
              <!--            <view class="listItemRight">-->
              <!--              <image class="warningIcon" src="https://eshangtech.com/ShopICO/ahyd-BID/warning/warningIcon.png"/>-->
              <!--            </view>-->
            </view>

            <view class="listItemBottom" style="margin-bottom: 16rpx;margin-top: 24rpx">
              <view class="bottomValue name" style="width: 56rpx">营收</view>
              <view class="bottomValue value" style="width: 124rpx">{{item.RevenueINC && item.RevenueINC.curYearData?$util.getMoney(item.RevenueINC.curYearData/10000):'-'}}</view>
              <view class="bottomValue value" style="width: 124rpx">{{item.RevenueINC && item.RevenueINC.lYearData?$util.getMoney(item.RevenueINC.lYearData/10000):'-'}}</view>
              <view class="bottomValue value" style="width: 84rpx">{{item.RevenueINC && item.RevenueINC.increaseData?$util.getMoney(item.RevenueINC.increaseData/10000):'-'}}</view>
              <view :class="item.RevenueINC.increaseRate<0?'bottomValue greenAdd':item.RevenueINC.increaseRate>0?'bottomValue add':''" style="width: 124rpx">{{item.RevenueINC.increaseRate?
                  item.RevenueINC.increaseRate>0?`+${item.RevenueINC.increaseRate}%`:
                      item.RevenueINC.increaseRate<0?`${item.RevenueINC.increaseRate}%`
                          :'':''}}</view>
            </view>
            <!--          <view class="listItemBottom">-->
            <!--            <view class="bottomValue name" style="width: 56rpx">车流</view>-->
            <!--            <view class="bottomValue value" style="width: 124rpx">{{res.BayonetINC.lYearData?$util.getMoney(res.BayonetINC.lYearData/10000):'-'}}</view>-->
            <!--            <view class="bottomValue value" style="width: 124rpx">{{res.BayonetINC.curYearData?$util.getMoney(res.BayonetINC.curYearData/10000):'-'}}</view>-->
            <!--            <view class="bottomValue value" style="width: 84rpx">{{res.BayonetINC.increaseData?$util.getMoney(res.BayonetINC.increaseData/10000):'-'}}</view>-->
            <!--            <view :class="res.BayonetINC.increaseRate<0?'bottomValue greenAdd':res.BayonetINC.increaseRate>0?'bottomValue add':''" style="width: 124rpx">{{res.BayonetINC.increaseRate?res.BayonetINC.increaseRate>0?`+${res.BayonetINC.increaseRate}%`:res.BayonetINC.increaseRate<0?`${res.BayonetINC.increaseRate}%`:'':''}}</view>-->
            <!--          </view>-->
          </view>
        </view>
      </view>
    </view>
  </scroll-view>
</template>
<script>
  import {wrapTreeNode} from "../../util/dateTime";
  import request from '@/util/index.js'

  export default {
    name: "detail",
    data(){
      return {
        menu:{},
        serviceInfo:{},// 当前选中服务区
        res:{},// 详情数据内容
        businessTypeObj:{
          1000: "合作经营",
          2000: "固定租金",
          3000: "保底采购",
          4000: "业主自营",
        },
        date: '',// 显示的月份或者时间段
        SETTLEMENT_MODESOBJ:{},
        dataList:[],
        sortName: 4,// 1是2023年  2是2024年  3增长  4增幅
        sortType: 2,// 1是降序 2是升序
        selectType: 0,// 预警类型
        otherList:[],// 除了自营超市以外的门店数据
        ownerShop:{},// 自营超市的门店数据
        showDetailFixed: false,// 车流和营收的增长 在下拉之后悬浮在页面上
      }
    },
    onLoad(query){
      let systemInfo = uni.getSystemInfoSync()
      this.menu = uni.getMenuButtonBoundingClientRect()
      let seat = uni.getStorageSync('currentService')
      this.serviceInfo = seat
      console.log('query',query)
      if (query.obj){
        this.res = JSON.parse(query.obj)
      }
      if (query.date){
        this.date = query.date
      }
      if (query.type){
        this.selectType = Number(query.type)
      }
      console.log('this.res',this.res)
      this.handleGetSETTLEMENT_MODES()
      this.handleChangeList()
      // this.dataList = this.handleSortList(this.res.ShopINCList)
    },
    methods:{
      handlePageScroll(e){
        if (e.target.scrollTop>200){
          this.showDetailFixed = true
        }else{
          this.showDetailFixed = false
        }
      },
      handleGoCarCharts(){
        console.log('res',this.res)
        this.$util.toNextRoute('navigateTo', `/pages/earlyWarning/carCharts?id=${this.res.ServerpartId}&date=${this.date}`)
      },
      // 处理数据 自营超市第一 然后剩下的按照 要求的排序排序
      handleChangeList(){
        let obj = {}
        let otherList = []
        this.res.ShopINCList.forEach(item=>{
          if (item.ServerpartShopName === '自营超市'){
            obj = item
          }else{
            otherList.push(item)
          }
        })
        console.log('obj',obj)
        this.ownerShop = obj
        this.otherList = otherList

        let resList = this.handleSortList(otherList)
        let list = []
        if (obj.ServerpartShopName){
          list = [obj,...resList]
        }else{
          list = [...resList]
        }
        this.dataList = list
        console.log('this.dataList',this.dataList)
      },
      // 返回上一级
      handleBack(){
        uni.navigateBack({
          delta: 1
        })
      },
      // 拿到SETTLEMENT_MODES的枚举
      async handleGetSETTLEMENT_MODES(){
        const req = {
          FieldExplainField: 'SETTLEMENT_MODES'
        }
        const data = await request.$webGet('/EShangApiMain/FrameWork/GetFieldEnumByField',req)
        let list = data.Result_Data.List
        let obj = {}
        if (list && list.length>0){
          list.forEach(item=>{
            obj[item.value] = item.label
          })
        }
        console.log('data231231',obj)
        this.SETTLEMENT_MODESOBJ = obj
      },
      // 修改排序
      handleChangeSortName(value){
        if (value===this.sortName){
          if (this.sortType===1){
            this.sortType=0
          }else{
            this.sortType=1
          }
        }else{
          this.sortName = value
          this.sortType=1
        }
        let res = this.handleSortList(this.otherList)

        if (this.ownerShop.ServerpartShopName){
          this.dataList = [this.ownerShop,...res]
        }else{
          this.dataList = [...res]
        }
      },
      // 排序方法
      handleSortList(list){
        var len = list.length;
        for (var i = 0; i < len - 1; i++) {
          for (var j = 0; j < len - 1 - i; j++) {
            if (this.sortType === 1){
              if (this.sortName ===1){
                if (list[j].RevenueINC.lYearData < list[j + 1].RevenueINC.lYearData) { // 比较相邻元素大小并交换位置
                  var temp = list[j];
                  list[j] = list[j + 1];
                  list[j + 1] = temp;
                }
              }else if(this.sortName===2){
                if (list[j].RevenueINC.curYearData < list[j + 1].RevenueINC.curYearData) { // 比较相邻元素大小并交换位置
                  var temp = list[j];
                  list[j] = list[j + 1];
                  list[j + 1] = temp;
                }
              }else if(this.sortName===3){
                if (list[j].RevenueINC.increaseData < list[j + 1].RevenueINC.increaseData) { // 比较相邻元素大小并交换位置
                  var temp = list[j];
                  list[j] = list[j + 1];
                  list[j + 1] = temp;
                }
              }else if(this.sortName===4){
                if (list[j].RevenueINC.increaseRate < list[j + 1].RevenueINC.increaseRate) { // 比较相邻元素大小并交换位置
                  var temp = list[j];
                  list[j] = list[j + 1];
                  list[j + 1] = temp;
                }
              }
            }else{
              if (this.sortName ===1){
                if (list[j].RevenueINC.lYearData > list[j + 1].RevenueINC.lYearData) { // 比较相邻元素大小并交换位置
                  var temp = list[j];
                  list[j] = list[j + 1];
                  list[j + 1] = temp;
                }
              }else if(this.sortName===2){
                if (list[j].RevenueINC.curYearData > list[j + 1].RevenueINC.curYearData) { // 比较相邻元素大小并交换位置
                  var temp = list[j];
                  list[j] = list[j + 1];
                  list[j + 1] = temp;
                }
              }else if(this.sortName===3){
                if (list[j].RevenueINC.increaseData > list[j + 1].RevenueINC.increaseData) { // 比较相邻元素大小并交换位置
                  var temp = list[j];
                  list[j] = list[j + 1];
                  list[j + 1] = temp;
                }
              }else if(this.sortName===4){
                if (list[j].RevenueINC.increaseRate > list[j + 1].RevenueINC.increaseRate) { // 比较相邻元素大小并交换位置
                  var temp = list[j];
                  list[j] = list[j + 1];
                  list[j + 1] = temp;
                }
              }
            }
          }
        }
        return list
      }
    }
  }
</script>

<style scoped lang="scss">
.scrollBox{
  width: 100vw;
  height: 100vh;
  .earlyWarningDetail{
    width: 100%;
    background: #F3F3F3;
    .earlyTop{
      width: 100%;
      //height: 616rpx;
      background: #F3F3F3;
      position: relative;
      .earlyTopBg{
        width: 100%;
        height: 430rpx;
        background: linear-gradient( 180deg, #D8E3FF 0%, #F3F3F3 100%);
      }
      .headerBox{
        width: 100%;
        position: fixed;
        left: 0;
        top: 0;
        z-index: 20;
        box-sizing: border-box;
        background: linear-gradient( 180deg, #D8E3FF 0%, #E5EBF9 100%);
        //padding: 32rpx;
        display: flex;
        align-items: center;
        .backIconBox{
          width: 48rpx;
          height: 48rpx;
          margin-right: 18rpx;
          .backIcon{
            width: 100%;
            height: 100%;
          }
        }
        .picker{
          .selectService{
            display: flex;
            align-items: center;
            .img{
              width: 40px;
              height: 40px;
              z-index: 2;
            }
            .select{
              height: 32px;
              background: #F8F8FA;
              border-radius: 0 16px 16px 0;
              transform: translateX(-40px);
              box-sizing: border-box;
              padding-left: 35px;
              padding-right: 8rpx;
              display: flex;
              align-items: center;
              .content{
                display: flex;
                align-items: center;
                .uni-input{
                  padding: 0;
                  background: transparent;
                  font-size: 14px;
                  font-family: PingFangSC-Semibold, PingFang SC;
                  font-weight: 600;
                  color: #160002;
                }
                .area{
                  font-size: 12px;
                  font-family: PingFangSC-Regular, PingFang SC;
                  font-weight: 400;
                  color: #786B6C;
                  line-height: 40px;
                  margin-left: 4px;
                }
                .rightArrow{
                  width: 12px;
                  height: 12px;
                }
                .noticeText{
                  font-size: 24rpx;
                  font-family: PingFangSC, PingFang SC;
                  font-weight: 400;
                  color: #B6BACB;
                  line-height: 40rpx;
                  white-space: nowrap;
                }
              }

            }
          }
        }
      }
      .detailFixed{
        width: 100%;
        position: fixed;
        left: 0;
        background: #E5EBF9;
        display: flex;
        align-items: center;
        box-sizing: border-box;
        padding: 32rpx;
        z-index: 20;
        .itemDetail{
          width: 50%;
          display: flex;
          flex-direction: column;
          //align-items: center;
          .value{
            font-family: DINAlternate, DINAlternate;
            font-weight: bold;
            font-size: 42rpx;
            line-height: 40rpx;
            text-align: left;
            font-style: normal;
          }
          .green{
            color: #127E5B;
          }
          .red{
            color: #E83944;
          }
          .label{
            font-family: PingFangSC, PingFang SC;
            font-weight: 400;
            font-size: 28rpx;
            color: #9A9A9A;
            line-height: 40rpx;
            text-align: left;
            font-style: normal;
          }
        }
      }
      .revenueBox{
        position: absolute;
        width: calc(100% - 48rpx);
        margin-left: 24rpx;
        background: #FFFFFF;
        border-radius: 16rpx;
        box-sizing: border-box;
        padding: 2rpx;
        .box{
          width: 100%;
          background: linear-gradient( 180deg, #CDE1FF 0%, #FFFFFF 30%);
          border-radius: 14rpx;
          box-sizing: border-box;
          padding: 24rpx 22rpx;
          .typeBox{
            width: 100%;
            position: relative;
            .bg{
              width: 208rpx;
              height: 208rpx;
              position: absolute;
              right: -22rpx;
              top: 0;
            }
            .typeBoxTop{
              display: flex;
              align-items: center;
              .monthText{
                font-family: PingFangSC, PingFang SC;
                font-weight: 400;
                font-size: 24rpx;
                color: #FFFFFF;
                line-height: 24rpx;
                text-align: left;
                font-style: normal;
                padding: 4rpx 8rpx;
                background: #F2792E;
                border-radius: 4rpx;
                margin-right: 6rpx;
              }
              .title{
                font-family: PingFangSC, PingFang SC;
                font-weight: 600;
                font-size: 32rpx;
                color: #160002;
                line-height: 44rpx;
                text-align: left;
                font-style: normal;
              }
              .unit{
                font-family: PingFangSC, PingFang SC;
                font-weight: 400;
                font-size: 24rpx;
                color: #9A9A9A;
                line-height: 36rpx;
                text-align: left;
                font-style: normal;
                margin-left: 4rpx;
              }
            }
            .typeBoxContent{
              display: flex;
              margin-top: 24rpx;
              .valueItem{
                height: 100%;
                display: flex;
                flex-direction: column;
                justify-content: flex-end;
                .valueAdd{
                  font-family: DINAlternate, DINAlternate;
                  font-weight: bold;
                  font-size: 42rpx;
                  color: #E83944;
                  line-height: 64rpx;
                  text-align: left;
                  font-style: normal;
                }
                .valueGreen{
                  font-family: DINAlternate, DINAlternate;
                  font-weight: bold;
                  font-size: 42rpx;
                  color: #127E5B;
                  line-height: 40rpx;
                  text-align: left;
                  font-style: normal;
                }
                .label{
                  font-family: PingFangSC, PingFang SC;
                  font-weight: 400;
                  font-size: 24rpx;
                  color: #9A9A9A;
                  line-height: 36rpx;
                  text-align: left;
                  font-style: normal;
                }
                .value{
                  font-family: DINAlternate, DINAlternate;
                  font-weight: bold;
                  font-size: 32rpx;
                  color: #160002;
                  line-height: 44rpx;
                  text-align: left;
                  font-style: normal;
                }
              }
            }
            .addBox{
              margin-top: 16rpx;
              .label{
                font-family: PingFangSC, PingFang SC;
                font-weight: 400;
                font-size: 24rpx;
                color: #9A9A9A;
                line-height: 36rpx;
                text-align: left;
                font-style: normal;
              }
              .addValue{
                font-family: DINAlternate, DINAlternate;
                font-weight: bold;
                font-size: 28rpx;
                color: #E83944;
                line-height: 32rpx;
                text-align: left;
                font-style: normal;
                margin-left: 8rpx;
              }
              .addGreenValue{
                font-family: DINAlternate, DINAlternate;
                font-weight: bold;
                font-size: 28rpx;
                color:  #127E5B;
                line-height: 32rpx;
                text-align: left;
                font-style: normal;
                margin-left: 8rpx;
              }
            }
            .handleGo{
              width: 30rpx;
              height: 30rpx;
              position: absolute;
              right: 16rpx;top: 70%;
            }
          }

          .line{
            width: 100%;
            height: 2rpx;
            background: #F5F4F4;
            margin: 24rpx 0 24rpx 0;
          }

          .descBox{
            width: 100%;
            background: #F8F8F8;
            border-radius: 16rpx;
            box-sizing: border-box;
            padding: 16rpx;
            margin-top: 24rpx;
            .monthText{
              font-family: PingFangSC, PingFang SC;
              font-weight: 400;
              font-size: 24rpx;
              display: inline-block;
              margin-bottom: 8rpx;
              color: gray;
            }
            .other{
              display: flex;
              align-items: center;
              font-family: PingFangSC, PingFang SC;
              font-weight: 400;
              font-size: 24rpx;
              color: gray;
              .notice{
                width: 30rpx;
                height: 30rpx;
                margin: 0 8rpx;
              }
            }
            .descTitle{
              font-family: PingFangSC, PingFang SC;
              font-weight: 400;
              font-size: 24rpx;
              color: gray;
              .desc{
                color: red;
              }
            }
          }
        }
      }
    }

    .detailContentBox{
      width: 100%;
      background: #fff;
      border-radius: 32rpx 32rpx 0rpx 0rpx;
      box-sizing: border-box;
      padding: 24rpx 32rpx;
      margin-top: 32rpx;
      .contentTop{
        display: flex;
        align-items: center;
        .topIcon{
          width: 48rpx;
          height: 48rpx;
          margin-right: 12rpx;
        }
        .topTitle{
          font-size: 32rpx;
          font-family: PingFangSC, PingFang SC;
          font-weight: 600;
          color: #160002;
          line-height: 44rpx;
          margin-left: 12rpx;
        }
      }

      .contentSort{
        display: flex;
        justify-content: space-between;
        margin-top: 28rpx;
        .sortItem{
          display: inline-block;
          .sort{
            display: flex;
            align-items: center;
            justify-content: flex-start;
            .topName{
              font-size: 24rpx;
              font-family: PingFangSC, PingFang SC;
              font-weight: 400;
              color: #9A9A9A;
              line-height: 36rpx;
            }
            .sortIconBox{
              display: flex;
              flex-direction: column;
              margin-left: 10rpx;
              .upIcon{
                width: 16rpx;
                height: 12rpx;
                margin-bottom: 4rpx;
              }
              .bottomIcon{
                width: 16rpx;
                height: 12rpx;
              }
            }
          }
        }
      }

      .listBox{
        width: 100%;
        height: calc(100% - 70px);
        margin-top: 16rpx;
        .listItem{
          width: 100%;
          background: #F8F8F8;
          border-radius: 16rpx;
          box-sizing: border-box;
          padding: 24rpx;
          margin-bottom: 24rpx;
          .listItemTop{
            display: flex;
            align-items: center;
            justify-content: space-between;
            .listItemLeft{
              width: 100%;
              display: flex;
              align-items: flex-start;
              .logoBox{
                width: 80rpx;
                height: 80rpx;
                border-radius: 16rpx;
                overflow: hidden;
                margin-right: 16rpx;
                .logo{
                  width: 100%;
                  height: 100%;
                }
              }

              .titleBox{
                width: calc(100% - 96rpx);
                flex: 1;
                .itemTitle{
                  font-size: 28rpx;
                  font-family: PingFangSC, PingFang SC;
                  font-weight: 400;
                  color: #160002;
                  line-height: 40rpx;
                  display: inline-block;
                  width: 50%;
                  white-space: nowrap;
                  text-overflow: ellipsis;
                  overflow: hidden;
                }
                .MERCHANTS_NAME{
                  font-family: PingFangSC, PingFang SC;
                  font-weight: 400;
                  font-size: 24rpx;
                  color: #571519;
                  line-height: 44rpx;
                  text-align: left;
                  font-style: normal;
                  padding: 4rpx 16rpx;
                  background: #FCF1D3;
                  border-radius: 4rpx;
                  display: inline-block;
                  width: 50%;
                  text-overflow: ellipsis;
                  overflow: hidden;
                  white-space: nowrap;
                }
                .itemTypeBox{
                  .mode{
                    display: inline-block;
                    background: #FFEFEA;
                    border-radius: 4rpx;
                    font-family: PingFangSC, PingFang SC;
                    font-weight: 400;
                    font-size: 24rpx;
                    color: #FF6531;
                    line-height: 28rpx;
                    text-align: left;
                    font-style: normal;
                    padding: 2rpx 8rpx;
                  }
                  .type{
                    background: #E3EFFF;
                    border-radius: 4rpx;
                    font-family: PingFangSC, PingFang SC;
                    font-weight: 400;
                    font-size: 24rpx;
                    color: #1979FE;
                    line-height: 28rpx;
                    text-align: left;
                    font-style: normal;
                    padding: 2rpx 8rpx;
                  }
                }
              }
            }
            .listItemRight{
              .warningIcon{
                width: 40rpx;
                height: 40rpx;
              }
            }
          }

          .listItemBottom{
            display: flex;
            align-items: center;
            justify-content: space-between;
            .bottomValue{
            }
            .name{
              font-size: 24rpx;
              font-family: PingFangSC, PingFang SC;
              font-weight: 400;
              color: #9A9A9A;
              line-height: 36rpx;
              margin-left: 4rpx;
              white-space: nowrap;
            }
            .value{
              font-size: 28rpx;
              font-family: DINAlternate, DINAlternate;
              font-weight: bold;
              color: #160002;
              line-height: 32rpx;
            }
            .add{
              font-family: DINAlternate, DINAlternate;
              font-weight: bold;
              font-size: 28rpx;
              color: #E83944;
              line-height: 40rpx;
              text-align: left;
              font-style: normal;
            }
            .greenAdd{
              font-family: DINAlternate, DINAlternate;
              font-weight: bold;
              font-size: 28rpx;
              color: #127E5B;
              line-height: 40rpx;
              text-align: left;
              font-style: normal;
            }
          }
        }
      }
    }
  }
}
</style>
