<style lang="scss" scoped>

</style>
<template>
    <div>
      <div
      class="rounded-borders bg-white q-py-md"
      style="width: 300px"
      :style="{
        width:
          $q.screen.width < 1200 || $q.platform.is.mobile
            ? 'unset'
            : '300px',
        position:$q.platform.is.mobile?'unset':'sticky',
        top:$q.platform.is.mobile?'unset':'50px',
      }"
    >
      <!-- <div class="text-subtitle1 text-weight-bolder">付款明細</div> -->
      <!-- <div class="q-mt-md text-grey-6">
        <div class="row q-pb-xs no-wrap" v-if="AirportObj&&AirportObj.Name">
          <div style="width: 80px">{{details.CarType==1?'接':'送'}}機機場：</div>
          <div class="q-ml-md ellipsis-2-lines">{{AirportObj.Name}}</div>
        </div>
        <div class="row q-pb-xs no-wrap" v-if="AirportObj&&AirportObj.Name">
          <div style="width: 80px">{{details.CarType==1?'抵達':'起飛'}}時間：</div>
          <div class="q-ml-md ellipsis-2-lines">{{parameters.FlightTime}}</div>
        </div>
        <div class="row q-pb-xs no-wrap" v-if="parameters.GetonAddress">
          <div style="width: 80px">上車點：</div>
          <div class="q-ml-md ellipsis-2-lines">{{parameters.GetonAddress}}</div>
        </div>
        <div class="row q-pb-xs no-wrap" v-if="parameters.GetoffAddress">
          <div style="width: 80px">下車點：</div>
          <div class="q-ml-md ellipsis-2-lines">{{parameters.GetoffAddress}}</div>
        </div>
        <div class="row">
          <div style="width: 80px">
            接駁日期：</div>
          <div class="q-ml-md">
            {{parameters.OrderDate}}
          </div>
        </div>
      </div>
      <q-separator color="grey-2" class="q-my-md"/> -->
      <div class="text-grey-9">
        <!-- <div class="row q-mb-sm" v-if="chosenObj.Count>0&&CarObj">
          <div class="col">{{CarObj.CarName}} x {{ chosenObj.Count }}</div>
          <div>CNY {{ moneyFormat(OrderDate.originalB2CPrice,2) }}</div>
        </div> -->
        <hr
          style="border: none;"
          class="bg-transparent q-mb-sm"
        />
        <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>
        <hr style="border:none;" class="bg-transparent q-mb-sm" />
        <div class="row q-mb-sm items-center">
            <div class="q-mr-lg">優惠金額</div>
            <div
              class="text-subtitle2 text-weight-bolder"
              v-if="DiscountsMoney > 0"
            >
              CNY - {{ moneyFormat(DiscountsMoney, 2) }}
            </div>
            <div class="text-grey-5" v-else>暫無優惠</div>
          </div>
        <!-- <hr style="border:none;" class="bg-transparent q-mb-sm" />
        <div class="row q-mb-sm items-center">
          <div class="col">支付金額</div>
          <div class="text-h6 text-weight-bolder text-primary product-price">CNY {{ moneyFormat(Money,2) }}</div>
        </div> -->
      </div>
      
    </div>
    </div>
</template>
<script>
export default {
    props: {
        orderInfo: {
            type: Object,
            default: () => ({})
        }
    },
    data() {
      return {
        details: null,
      sumPrice: 0,//总金额
      DiscountsMoney: 0,//优惠金额
      Money: 0, // 支付金額
      }
    },
    mounted() {
        this.getCarData()
        this.getCarOrder()
    },
    methods: {
    //  获取车的详情
    getCarData() {
      // this.$q.loading.show();
      this.apipost(
        "b2c_get_GetCarSingleProductDetail",
        { ProductId: this.orderInfo.GoodsId },
        (r) => {
          if (r.data.resultCode == 1) {
            this.dataList = r.data.data;
            this.details = r.data.data;
          } else {
            this.$q.notify({
              type: "negative",
              message: r.data.message,
              position: "top",
              timeout: 2000, // 以毫秒为单位; 0意味着没有超时
            });
          }
          // this.$q.loading.hide();
        },
        null
      );
    },
    getCarOrder() {
        
        this.$q.loading.show();
      this.apipost(
        "CarSingle_post_GetTYMyCarOrderInfo",
        { OrderId: this.orderInfo.ErpOrderId },
        (r) => {
          if (r.data.resultCode == 1) {
            this.dataList = r.data.data;
            this.Money = r.data.data.Money;
            const {DiscountsMoney,Money} = r.data.data;
            this.Money = Money;
            this.DiscountsMoney = DiscountsMoney
            this.sumPrice = Money + DiscountsMoney
          } else {
            this.$q.notify({
              type: "negative",
              message: r.data.message,
              position: "top",
              timeout: 2000, // 以毫秒为单位; 0意味着没有超时
            });
          }
          this.$q.loading.hide();
        },
        null
      );
    
    },
    }
}
</script>