<template>
  <section class="commonPagePadding">
    <ul class="cardListWrap">
      <li class="cardMain" v-for="(i,index) in mycardlist" @click="gotoNextPay(i)" :key="index">
        <p class="cardTags">
          <span>{{i.cardType | cardType}}</span>
          <span>{{i.carType | carType}}</span>
        </p>

        <p class="cardCarNum">{{i.carNumber}}</p>
        <p>{{i.parkName}}</p>
        <p class="cardDate">有效期：{{i.effDate}} 至 {{i.expDate}}</p>
        <div class="renewBtn">续费</div>
      </li>
    </ul>

    <!--<div style="text-align: center;padding-top: 60px;">-->
    <!--<van-image :src="require('../../assets/images/cards/novipcard.png')"></van-image>-->
    <!--<p>暂无购买会员卡记录</p>-->
    <!--</div>-->
  </section>
</template>

<script>
import { queryVipCardsByCustId } from "@/api/card/card";
export default {
  name: "ownCards",
  data() {
    return {
      mycardlist: []
    };
  },
  created() {
    this.queryVipCardsByCustId();
  },
  methods: {
    queryVipCardsByCustId() {
      let jsondata = {
        saleChannel: "2"
      };
      jsondata.sign = this.$utils.signObject(jsondata);
      queryVipCardsByCustId(jsondata).then(response => {
        console.log(response);
        this.mycardlist = response.data
      });
    },
    gotoNextPay(i) {
      this.$router.push({
          name: "buyVipCard",
          query: {
            cardName: i.cardName,
            carType: i.carType,
            cardType: i.cardType,
            actPrice: i.actPrice,
            discValue: i.discount,
            plName: i.parkName,
            plAddress: i.parkAddr,
            plNo: i.parkNo,
            cardNo: i.cardNo,
            carNumber: i.carNumber,
            effDate: i.effDate,
            expDate: i.expDate,
            orderPayedFee: i.orderPayedFee,
            custCardNo: i.custCardNo,
            xufeiFlag: 2
          }
        }
      )
      ;
    }
  }
};
</script>

<style scoped lang="less">
  .cardMain {
    height: 190px;
    padding: 20px;
    margin-top: 10px;
    position: relative;
    background: url("../../assets/images/cards/myvipcardBg.png") no-repeat;
    background-size: 100% 100%;
    color: #fff;
  }

  .cardTags {
    span {
      padding: 2px 25px;
      border-radius: 15px;
      background: rgba(255, 255, 255, .3);
      margin-right: 10px;
      font-size: 12px;

    }
  }

  .cardCarNum {
    padding: 20px 0 2px;
    font-size: 22px;
    font-weight: 600;
  }

  .cardDate {
    padding-top: 34px;
  }

  .renewBtn {
    width: 80px;
    height: 35px;
    line-height: 35px;
    text-align: center;
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: url("../../assets/images/cards/vipcardbtnBg.png") no-repeat;
  }
</style>
