<template>
  <view class="container" @click="navTo(`/pages/template/materialBoardChild/ReceiptSummary/ReceiptSummary?materialset_id=${item.materialset_id}&materialset_name=${item.materialset_name}`)">
    <view class="header">
      <view class="left">
        <view class="bg_img">
          <text>{{item.introductory}}</text>
        </view>
      </view>
      <view class="right">
        <span>{{item.materialset_name}}</span>
        <span @click="dianji('today')">
          本日:<text class="right-content">{{ Number(item.today).toFixed(2) }}</text>
        </span>
        <span @click="dianji('this_month')">
          本月:<text class="right-content">{{Number(item.month).toFixed(2)}}</text>
        </span>
      </view>
    </view>
    <view class="footer" @click="dianji('all')">
      <view class="total">
        开累：{{Number(item.sum).toFixed(2)}}
      </view>
      <!-- <tui-progress class="progressBar"
                    :percent="item.progress"
                    show-info></tui-progress> -->
    </view>
  </view>
</template>

<script>
import { setStorage, getStorage } from "@/utils/storage.js";
export default {
  name: "Material-Info",
  props: {
    item: { type: Object, required: true },
  },
  data() {
    return {
    };
  },
  methods: {
    navTo(url) {
      uni.navigateTo({
        url,
      });
    },
    // 击穿带时间参数
    dianji(value) {
      setStorage("CarTime",value)
    }
  },
};
</script>

<style lang="scss">
.container {
  padding: 20rpx;
  width: 48%;
  height: 250rpx;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  box-shadow: #ededed 3px 3px 0px 0px ;
  margin: 1%;
  .header {
    display: flex;
    height: 60%;

    .left {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      width: 35%;
      height: 100%;

      .bg_img {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 43px;
        height: 43px;
        border-radius: 50%;
        background-color: #5179ef;

        text {
          font-size: 38rpx;
          color: white;
          font-weight: bold;
        }
      }
    }

    .right {
      display: flex;
      flex-direction: column;
      justify-content: space-around;
      // width: 65%;
      width: 100%; 
      height: 100%;
      margin-left: 20rpx;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;

      span:nth-child(1) {
        font-weight: bold;
        color: #5a5a5a;
      }

      .right-content {
        font-weight: bold;
        color: #5a5a5a;
      }
    }
  }

  .footer {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 40%;

    .total {
      font-weight: bold;
      color: royalblue;
    }

    .progressBar {
      .tui-progressbar__bg {
        height: 15px !important;
      }

      .tui-progress__bar {
        height: 15px !important;
      }
    }
  }
}
</style>