<template>
  <view class="earlyWarningDetail">
    <view class="earlyTop" :style="{height: `calc(${menu.bottom}px + 628rpx)`}">
<!--      menu.bottom + 314 + 'px'-->
      <view class="earlyTopBg"></view>
      <view class="headerBox" :style="{top:menu.top  + 'px',height:menu.height+'px'}">
        <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 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">
              <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.RevenueINC.increaseRate>0?'valueAdd':res.RevenueINC.increaseRate<0?'valueGreen':''">{{ res.RevenueINC.increaseRate?`${res.RevenueINC.increaseRate}%`:'-' }}</text>
                  <text class="label">同比去年</text>
                </view>
              </view>
              <view style="width: 30%;display: inline-block">
                <view class="valueItem">
                  <text class="value">{{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.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.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.lYearData?$util.getMoney(res.BayonetINC.lYearData/10000):'-'}}</text>
                  <text class="label">2023年</text>
                </view>
              </view>
            </view>
            <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>
      </view>
    </view>
    <view class="detailContentBox" :style="{height: `calc(100vh - ${menu.bottom}px - 628rpx)`}">
      <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">
          <view class="sort">
            <view class="topName">2023年</view>
            <view class="sortIconBox">
              <image class="upIcon" src="https://eshangtech.com/ShopICO/ahyd-BID/car/upDesc.svg"/>
              <image class="bottomIcon" src="https://eshangtech.com/ShopICO/ahyd-BID/car/downDesc.svg"/>
            </view>
          </view>
        </view>
        <view class="sortItem" style="width: 124rpx">
          <view class="sort" >
            <view class="topName">2024年</view>
            <view class="sortIconBox">
              <image class="upIcon" src="https://eshangtech.com/ShopICO/ahyd-BID/car/upDesc.svg"/>
              <image class="bottomIcon" src="https://eshangtech.com/ShopICO/ahyd-BID/car/downDesc.svg"/>
            </view>
          </view>
        </view>
        <view class="sortItem" style="width: 84rpx">
          <view class="sort">
            <view class="topName">增长</view>
            <view class="sortIconBox">
              <image class="upIcon" src="https://eshangtech.com/ShopICO/ahyd-BID/car/upDesc.svg"/>
              <image class="bottomIcon" src="https://eshangtech.com/ShopICO/ahyd-BID/car/downDesc.svg"/>
            </view>
          </view>
        </view>
        <view class="sortItem" style="width: 84rpx">
          <view class="sort" >
            <view class="topName">增幅</view>
            <view class="sortIconBox">
              <image class="upIcon" src="https://eshangtech.com/ShopICO/ahyd-BID/car/upDesc.svg"/>
              <image class="bottomIcon" src="https://eshangtech.com/ShopICO/ahyd-BID/car/downDesc.svg"/>
            </view>
          </view>
        </view>
      </view>

      <view class="listBox">
        <view class="listItem" v-for="(item,index) in res.ShopINCList" :key="index">
          <view class="listItemTop">
            <view class="listItemLeft">
              <view class="logoBox">
                <image class="logo" :src="item.Brand_ICO"/>
              </view>
              <view class="titleBox">
                <text class="itemTitle">{{item.ServerpartShopName}}</text>
                <view class="itemTypeBox">
                  <text class="mode" style="margin-right: 8rpx">{{ item.SettlementModes }}</text>
                  <text 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.lYearData?$util.getMoney(item.RevenueINC.lYearData/10000):'-'}}</view>
            <view class="bottomValue value" style="width: 124rpx">{{item.RevenueINC.curYearData?$util.getMoney(item.RevenueINC.curYearData/10000):'-'}}</view>
            <view class="bottomValue value" style="width: 84rpx">{{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>
</template>
<script>
  export default {
    name: "detail",
    data(){
      return {
        menu:{},
        serviceInfo:{},// 当前选中服务区
        res:{},// 详情数据内容
        businessTypeObj:{
          1000: "合作经营",
          2000: "固定租金",
          3000: "保底采购",
          4000: "业主自营",
        },
        date: '',// 显示的月份或者时间段
      }
    },
    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
      }
      console.log('this.res',this.res)
    },
    methods:{
      // 返回上一级
      handleBack(){
        uni.navigateBack({
          delta: 1
        })
      },
    }
  }
</script>

<style scoped lang="scss">
.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: absolute;
      left: 0;
      box-sizing: border-box;
      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;
              }
            }

          }
        }
      }
    }
    .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: 46rpx;
                color: #E83944;
                line-height: 64rpx;
                text-align: left;
                font-style: normal;
              }
              .valueGreen{
                font-family: DINAlternate, DINAlternate;
                font-weight: bold;
                font-size: 46rpx;
                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;
            }
          }
        }

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

  .detailContentBox{
    width: 100%;
    background: #fff;
    border-radius: 32rpx 32rpx 0rpx 0rpx;
    box-sizing: border-box;
    padding: 24rpx 32rpx;
    .contentTop{
      display: flex;
      align-items: center;
      .topIcon{
        width: 48rpx;
        height: 48rpx;
        margin-right: 12rpx;
      }
      .topTitle{
        font-family: PingFangSC, PingFang SC;
        font-weight: 600;
        font-size: 28rpx;
        color: #212226;
        line-height: 40rpx;
        text-align: left;
        font-style: normal;
        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-family: PingFangSC, PingFang SC;
            font-weight: 400;
            font-size: 28rpx;
            color: #786B6C;
            line-height: 40rpx;
            text-align: left;
            font-style: normal;
          }
          .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: 80%;
            display: flex;
            align-items: center;
            .logoBox{
              width: 80rpx;
              height: 80rpx;
              border-radius: 16rpx;
              overflow: hidden;
              .logo{
                width: 100%;
                height: 100%;
              }
            }

            .titleBox{
              width: calc(100% - 96rpx);
              .itemTitle{
                font-family: PingFangSC, PingFang SC;
                font-weight: 600;
                font-size: 28rpx;
                color: #160002;
                line-height: 40rpx;
                text-align: left;
                font-style: normal;
                display: inline-block;
                width: 60%;
                white-space: nowrap;
                text-overflow: ellipsis;
                overflow: hidden;
              }
              .itemTypeBox{
                .mode{
                  display: inline-block;
                  background: #FFEFEA;
                  border-radius: 4rpx;
                  font-family: PingFangSC, PingFang SC;
                  font-weight: 400;
                  font-size: 20rpx;
                  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: 20rpx;
                  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-family: PingFangSC, PingFang SC;
            font-weight: 400;
            font-size: 28rpx;
            color: #A69E9F;
            line-height: 40rpx;
            text-align: left;
            font-style: normal;
          }
          .value{
            font-family: DINAlternate, DINAlternate;
            font-weight: bold;
            font-size: 28rpx;
            color: #160002;
            line-height: 40rpx;
            text-align: left;
            font-style: normal;
          }
          .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>
