<template>
  <view class="main">
    <view class="header">
      <view class="headerTop" :style="{top: menu.top + 'px',height:menu.height + 'px'}">
        <image @click="handleBack" class="backIcon" src="https://eshangtech.com/ShopICO/ahyd-BID/commercial/navigation-left.svg"></image>
        <text class="pageTitle">支出详情</text>
      </view>

      <view class="incomeTab" :style="{top:(menu.bottom + 18) + 'px'}">
        <view :class="selectTab===item.value?'selectItem incomeItem':'incomeItem'" v-for="(item,index) in pageTab" :key="index"
              @click="handleChangePageTab(item.value)">{{item.label}}</view>
      </view>
    </view>

    <view class="contentDetail">
      <view class="detailItem">
        <view class="itemTop">
          <view class="itemTitle">服务区自营小计</view>
          <image class="monthSumBg" src="/static/images/revenueBox/expenditure.png"/>
          <view class="itemBox">
            <view class="leftChar">
              <OtherCharts :success="number" :colorList="['#1679FF', '#E7F1FF']"/>
              <text class="rateText">39.67%</text>
            </view>
            <view class="rightDetail">
              <view class="messageBox">
                <view class="success">
                  <text class="revenueValue">119.01</text>
                  <text class="revenueLabel">2022年完成<text class="revenueUnit">/万元</text></text>
                </view>
                <view class="rateBox">
                  <text class="rateValue">32.54%</text>
                  <text class="rateLabel">成本比</text>
                </view>
              </view>
              <view class="messageBox" style="margin-top: 32rpx">
                <view class="success">
                  <text class="revenueValue">119.01</text>
                  <text class="revenueLabel">2022年完成<text class="revenueUnit">/万元</text></text>
                </view>
                <view class="rateBox">
                  <text class="rateValue">32.54%</text>
                  <text class="rateLabel">成本比</text>
                </view>
              </view>
            </view>
          </view>
        </view>

        <view class="contentBox">
          <view class="contentItem" v-for="(item,index) in 3" :key="index">
            <view class="topItem">
              <view class="index" :style="{background:`url(${index===0?'/static/images/revenueBox/secondBg.svg':index===1?'/static/images/revenueBox/thirdBg.svg':'/static/images/revenueBox/otherBg.svg'})`}">{{index + 1}}</view>
              <view class="smallItemName">餐饮小吃</view>
            </view>
            <view class="bottomItem">
              <view class="smallItem">
                <text class="smallItemValue">46.47</text>
                <text class="smallItemLabel">2022年完成<text class="unit">/万元</text></text>
              </view>
              <view class="smallItem">
                <text class="smallItemValue">100.00</text>
                <text class="smallItemLabel">2023年预计<text class="unit">/万元</text></text>
              </view>
              <view class="otherItem">
                <text class="otherValue">46.47%</text>
                <text class="otherLabel">完成率</text>
              </view>
            </view>
          </view>
        </view>
      </view>

      <view class="detailItem">
        <view class="itemTop">
          <view class="itemTitle">分公司收入小计</view>
          <image class="monthSumBg" src="/static/images/revenueBox/expenditure.png"/>
          <view class="itemBox">
            <view class="leftChar">
              <OtherCharts :success="number" :colorList="['#1679FF', '#E7F1FF']"/>
              <text class="rateText">39.67%</text>
            </view>
            <view class="rightDetail">
              <view class="messageBox">
                <view class="success">
                  <text class="revenueValue">119.01</text>
                  <text class="revenueLabel">2022年完成<text class="revenueUnit">/万元</text></text>
                </view>
                <view class="rateBox">
                  <text class="rateValue">32.54%</text>
                  <text class="rateLabel">成本比</text>
                </view>
              </view>
              <view class="messageBox" style="margin-top: 32rpx">
                <view class="success">
                  <text class="revenueValue">119.01</text>
                  <text class="revenueLabel">2022年完成<text class="revenueUnit">/万元</text></text>
                </view>
                <view class="rateBox">
                  <text class="rateValue">32.54%</text>
                  <text class="rateLabel">成本比</text>
                </view>
              </view>
            </view>
          </view>
        </view>

        <view class="contentBox">
          <view class="contentItem" v-for="(item,index) in 3" :key="index">
            <view class="topItem">
              <view class="index" :style="{background:`url(${index===0?'/static/images/revenueBox/secondBg.svg':index===1?'/static/images/revenueBox/thirdBg.svg':'/static/images/revenueBox/otherBg.svg'})`}">{{index + 1}}</view>
              <view class="smallItemName">餐饮小吃</view>
            </view>
            <view class="bottomItem">
              <view class="smallItem">
                <text class="smallItemValue">46.47</text>
                <text class="smallItemLabel">2022年完成<text class="unit">/万元</text></text>
              </view>
              <view class="smallItem">
                <text class="smallItemValue">100.00</text>
                <text class="smallItemLabel">2023年预计<text class="unit">/万元</text></text>
              </view>
              <view class="otherItem">
                <text class="otherValue">46.47%</text>
                <text class="otherLabel">完成率</text>
              </view>
            </view>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>
<script>
import OtherCharts from "./component/otherCharts.vue";

export default {
  components:{OtherCharts},
  data(){
    return {
      windowHeight: null,
      statusBarHeight: null,
      menu:{},
      number:0,
      pageTab:[{label:'管理费用',value:1},{label:'销售费用',value:2},{label:'运营成本',value:3},{label:'其他费用',value:4}],
      selectTab:1
    }
  },
  onLoad(){
    //  获取手机参数对页面进行适配
    let systemInfo = uni.getSystemInfoSync()
    this.windowHeight = systemInfo.windowHeight
    this.statusBarHeight = Number(systemInfo.statusBarHeight)
    this.menu = uni.getMenuButtonBoundingClientRect()
    console.log('this.menu',this.menu)
    let _this = this
    setTimeout(()=>{
      _this.number = 40
    },100)
  },
  methods:{
// 返回按钮的方法
    handleBack(){
      uni.navigateBack({
        delta: 1
      });
    },
    handleChangePageTab(value){
      this.selectTab = value
    }
  }
}
</script>

<style scoped lang="scss">
@import '/static/public/font/stylesheet.css';
.main{
  width: 100%;
  min-height: 100vh;
  .header{
    width: 100%;
    height: 328rpx;
    background: linear-gradient(180deg, #D4E5FD 0%, #F5F5F5 100%);
    .headerTop{
      width: 100%;
      position: absolute;
      display: flex;
      align-items: center;
      .backIcon{
        width: 48rpx;
        height: 48rpx;
        margin-left: 32rpx;
      }
      .pageTitle{
        font-size: 36rpx;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 600;
        color: #202020;
        line-height: 56rpx;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
      }
    }
    .incomeTab{
      width: 100%;
      position: absolute;
      left: 0;
      box-sizing: border-box;
      padding-left: 24rpx;
      .incomeItem{
        font-size: 28rpx;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #160002;
        line-height: 40rpx;
        padding: 20rpx 22rpx;
        background: #FFFFFF;
        border: 1rpx solid #B6D4FB;
        display: inline-block;
        border-radius: 8rpx;
        margin-right: 16rpx;
      }
      .selectItem{
        font-size: 28rpx;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #096EF7;
        line-height: 40rpx;
        background: linear-gradient(360deg, #E9F2FF 0%, #FEFFFE 100%);
        box-shadow: 0rpx 4rpx 12rpx 0rpx rgba(4,36,79,0.08);
        border: 1rpx solid #B6D4FB;
        position: relative;
      }
      .selectItem:after{
        content:'';
        width: 32rpx;
        height: 32rpx;
        background: #EDF4FF;
        position: absolute;
        bottom: -18rpx;
        left: 50%;
        transform: translateX(-50%) rotate(45deg);
        border-right: 1rpx solid #B6D4FB;
        border-bottom: 1rpx solid #B6D4FB;
      }
    }
  }
  .contentDetail{
    width: calc(100% - 64rpx);
    margin-left: 32rpx;
    .detailItem{
      width: 100%;
      background: #FEFFFF;
      border-radius: 16rpx;
      box-sizing: border-box;
      padding: 4rpx;
      margin-bottom: 24rpx;
      .itemTop{
        width: 100%;
        height: 400rpx;
        box-sizing: border-box;
        padding: 22rpx 24rpx;
        background: linear-gradient(180deg, #F1F7FF 0%,  #FDFEFF 100%);
        border-radius: 12rpx 12rpx 0rpx 0rpx;
        position: relative;
        .monthSumBg{
          position: absolute;
          width: 320rpx;
          height: 320rpx;
          right: 0;top: 0;
          z-index: 1;
        }
        .itemTitle{
          font-size: 36rpx;
          font-family: Alimama ShuHeiTi;
          font-weight: bold;
          color: #096EF7;
          line-height: 44rpx;
        }
        .itemBox{
          position: relative;
          z-index:2;
          width: 100%;
          background: #fff;
          border-radius: 12rpx;
          box-sizing: border-box;
          padding: 32rpx;
          margin-top: 22rpx;
          display: flex;
          .leftChar{
            width: 224rpx;
            height: 100%;
            margin-bottom: 8rpx;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            .rateText{
              font-size: 40rpx;
              font-family: DINAlternate-Bold, DINAlternate;
              font-weight: bold;
              color: #1679FF;
              line-height: 48rpx;
            }
          }
          .rightDetail{
            flex: 1;
            .messageBox{
              display: flex;
              justify-content: space-between;
              .success{
                display: flex;
                flex-direction: column;

                .revenueValue{
                  font-size: 32rpx;
                  font-family: DINAlternate-Bold, DINAlternate;
                  font-weight: bold;
                  color: #160002;
                  line-height: 36rpx;
                }
                .revenueLabel{
                  font-size: 24rpx;
                  font-family: PingFangSC-Regular, PingFang SC;
                  font-weight: 400;
                  color: #786B6C;
                  line-height: 36rpx;
                  margin-top: 4rpx;
                  .revenueUnit{
                    font-size: 24rpx;
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                    color: #A69E9F;
                    line-height: 36rpx;
                    margin-left: 4rpx;
                  }
                }
              }
              .rateBox{
                display: flex;
                flex-direction: column;
                .rateValue{
                  font-size: 32rpx;
                  font-family: DINAlternate-Bold, DINAlternate;
                  font-weight: bold;
                  color: #E83944;
                  line-height: 36rpx;
                }
                .rateLabel{
                  font-size: 24rpx;
                  font-family: PingFangSC-Regular, PingFang SC;
                  font-weight: 400;
                  color: #786B6C;
                  line-height: 36rpx;
                  margin-top: 4rpx;
                }
              }
            }
          }
        }
      }
      .contentBox{
        width: 100%;
        background: #fff;
        box-sizing: border-box;
        padding: 0 24rpx;
        .contentItem{
          width: 100%;
          .topItem{
            display: flex;
            align-items: center;
            margin-bottom: 24rpx;
            .index{
              display: inline-block;
              width: 36rpx;
              height: 32rpx;
              font-size: 24rpx;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: #FEFFFF;
              line-height: 32rpx;
              text-align: center;
              box-sizing: border-box;
              padding-right: 4rpx;
            }
            .smallItemName{
              font-size: 28rpx;
              font-family: PingFangSC-Semibold, PingFang SC;
              font-weight: 600;
              color: #160002;
              line-height: 40rpx;
              margin-left: 4rpx;
            }
          }
          .bottomItem{
            width: 100%;
            display: flex;
            justify-content: space-between;
            padding-bottom: 32rpx;
            border-bottom: 1px solid #F7F4F4;
            .smallItem{
              display: flex;
              flex-direction: column;
              .smallItemValue{
                margin-bottom: 4rpx;
                font-size: 32rpx;
                font-family: DINAlternate-Bold, DINAlternate;
                font-weight: bold;
                color: #160002;
                line-height: 36rpx;
              }
              .smallItemLabel{
                font-size: 24rpx;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: #786B6C;
                line-height: 36rpx;
                .unit{
                  font-size: 24rpx;
                  font-family: PingFangSC-Regular, PingFang SC;
                  font-weight: 400;
                  color: #A69E9F;
                  line-height: 36rpx;
                  margin-left: 4rpx;
                }
              }
            }
            .otherItem{
              display: flex;
              flex-direction: column;
              .otherValue{
                font-size: 32rpx;
                font-family: DINAlternate-Bold, DINAlternate;
                font-weight: bold;
                color: #E83944;
                line-height: 36rpx;
                margin-bottom: 4rpx;
              }
              .otherLabel{
                font-size: 24rpx;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: #786B6C;
                line-height: 36rpx;
              }
            }
          }
        }
      }
    }
  }
}
</style>
