<style lang="scss" scoped>

</style>
<template>
  <div>
    <div class="row q-mb-sm items-center">
      <div class="q-mr-lg">總金額</div>
      <div class="text-subtitle2 text-weight-bolder ">
        CNY {{ moneyFormat(sumPrice, 2) }}
      </div>
    </div>
    <div class="row q-mb-sm items-center">
      <div class="q-mr-lg">優惠金額</div>
      <div class="text-subtitle2 text-weight-bolder text-teal" v-if="DiscountMoney > 0">
        CNY - {{ moneyFormat(DiscountMoney, 2) }}
      </div>
      <div class="text-grey-5" v-else>暫無優惠</div>
    </div>
  </div>
</template>
<script>
  export default {
    props: {
      orderInfo: {
        type: Object,
        default: () => ({})
      }
    },
    data() {
      return {
        details: null,
        sumPrice: 0, //总金额
        DiscountMoney: 0, //优惠金额
        TotalPrice: 0, // 支付金額
      }
    },
    mounted() {
      this.getGroupData()
    },
    methods: {
      //  获取团的详情
      getGroupData() {
        if (!this.orderInfo.ErpOrderId) return this.sumPrice = this.orderInfo.TotalPrice
        this.apipost(
          "dmc_post_GetThirdHotelOrder", {
            OrderID: this.orderInfo.ErpOrderId
          },
          (r) => {
            if (r.data.resultCode == 1) {
              this.dataList = r.data.data;
              const {
                DiscountMoney,
                TotalPrice
              } = r.data.data;

              this.TotalPrice = TotalPrice;
              this.DiscountMoney = DiscountMoney
              this.sumPrice = TotalPrice + DiscountMoney

            } else {
              this.$q.notify({
                type: "negative",
                message: r.data.message,
                position: "top",
                timeout: 2000, // 以毫秒为单位; 0意味着没有超时
              });
            }
          },
          null
        );
      },
    }
  }

</script>
