<template>
  <view class="bottom">
    <view class="all" @click="selectAll">
      <img :src="all?'../../static/img/cartselected.png':'../../static/img/cartselect.png'" alt class="qx" />
      <text class="quanxuan">全选</text>
    </view>

    <view class="heji">
      合计
      <text class="price">
        <text>￥</text>
        <text class="money">{{zhengshu}}</text>
        <text>.{{xiaoshu}}</text>
      </text>
    </view>
    <view class="btn" @click="jiesuan">结算({{sum}})</view>
  </view>
</template>

<script>
export default {
  name: "shoppingCartbottom",
  data() {
    return {
      zhengshu:0,
      xiaoshu:0
    };
  },
  props: ["total","price","sum","all"],
  computed:{
  
  },
  watch:{
    price(price){
      this.zhengshu =(price-(price % 100))/100
      this.xiaoshu = price % 100
      this.xiaoshu = this.xiaoshu < 10 ? "0"+this.xiaoshu:this.xiaoshu
      console.log(this.zhengshu,this.xiaoshu)
    }
  },
  methods:{
  // zhengshu(price){
    //   console.log(price-(price % 100))
    //   return price-(price % 100)
    // },
    // xiaoshu(price){
    //   console.log(price % 100)
    //   return  price % 100
    // },
    jiesuan(){
      this.$emit("jiesuan",true)
    },
    selectAll(){
      this.$emit("selectAll",!this.all)
    }
  },
  mounted() {
    // var money = this.heji.toString().split(".");
    // this.zhengshu = money[0];
    // this.xiaoshu = money[1];
    // console.log(this.zhengshu, 100);
    // console.log(this.xiaoshu, 100);
  }
};
</script>

<style lang="scss">
.bottom {
  width: 100%;
  height: 83upx;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  padding-left: 20rpx;
box-sizing: border-box;

  .qx {
    width: 21upx;
    height: 21upx;
    margin-right:9upx;
  }
  .quanxuan {
    font-size: 23upx;
    color: #666666;
    line-height: 83upx;
  }
  .heji {
    color: #666666;
    font-size: 24upx;
    line-height: 83upx;
    position:relative;
   left: -10rpx;
width: 330rpx;

    .price {
      color: #e13249;
      font-size: 26upx;
    }
  }
  .btn {
    width: 275upx;
    height: 83upx;
    background-color: #de3548;
    color: white;
    font-size: 26upx;
    text-align: center;
    line-height: 83upx;
  }
  .all{
    width: 100upx;
  }
}
</style>