<template>
  <div class="total-panel normal-panel flex-align-center flex-between">
    <p class="text-grey" @click="deleSelectProd">删除选中商品</p>
    <div class="flex-align-center">
      <div class="prcieInfo">
        <p>共&nbsp;{{data.length}}&nbsp;件商品&emsp;总价 : <span class="price">¥&nbsp;{{tool.formatAmount(total,2)}}</span></p>
        <p class="text-grey">已节省:-¥0.00</p>
      </div>
      <div class="submitBtn">生成订单</div>
    </div>
  </div>
</template>

<script>
export default {
  props:['data'],
  data () {
    return {
      total:0
    }
  },
  methods:{
    totalPrice (val) {
      this.total = 0
      val.forEach(element => {
        this.total += element.gradeprice * element.qty
      });
    },
    async deleSelectProd ()  {
      const res = await this.$api.requested({
        "id": 20220924095202,
        "content": {
          "sa_shoppingcartids": this.data.map(e=>{return e.sa_shoppingcartid})
        },
      })
      this.tool.showMessage(res,()=>{
        this.$emit('onSuccess')
      })
    }
  }
}

</script>
<style>
</style>
<style scoped>
.total-panel{
  height: 60px;
  text-align: right;
  border-top:1px solid rgb(0 0 0 / 5%);
  padding-left:10px
}
.submitBtn{
  width: 150px;
  height: 60px;
  line-height: 60px;
  text-align: center;
  color:#fff;
  background: red;
  cursor: pointer;
}
.prcieInfo{
  height: 50px;
  font-size: 14px;
  padding: 5px 0;
  margin-right: 10px;
}
.text-grey{
  font-size: 12px;
  color: #999;
  cursor: pointer;
}
.deletBtn:hover{
  color: red;
}
.price{
  font-size: 1.25rem;
  color: red;
}
</style>