coupon.vue 2.9 KB
<template>
  <div class="containerbox">
    <div class="flextwo sharetopk" @click="back">
      <div class="leftrow leftrowkimg">
        <img src="../../../assets/leftrow.png" alt />
      </div>
      <div class="sharemiddle">获得奖券</div>
      <div class="sharebtn">
        <!-- <img src="../../../assets/sharebtn.png" alt /> -->
      </div>
    </div>
    <div class="couponbox">
      <div class="couponimg" v-if="ticket.status==0">
        <img src="../../../assets/couponone.png" alt />
        <img src="../../../assets/unused.png" alt class="useimg" />
        <div class="couponhezi">
          <div class="coupontop flextwo">
            <div class="moneynumber">
              <span class="moneysign">¥</span>
              <span class="moneynum">{{ticket.num}}</span>
            </div>
          </div>
          <div class="couponname">抵扣优惠券(全场可用)</div>
          <div class="coupondate">{{ticket.createtime}}---{{ticket.end_time}}</div>
        </div>
      </div>
      <div class="couponimg" v-if="ticket.status==1">
        <img src="../../../assets/coupontwo.png" alt />
        <img src="../../../assets/shiyong.png" alt class="useimg" />
        <div class="couponhezi">
          <div class="coupontop flextwo">
            <div class="moneynumber">
              <span class="moneysign">¥</span>
              <span class="moneynum">{{ticket.num}}</span>
            </div>
          </div>
          <div class="couponname">抵扣优惠券(全场可用)</div>
          <div class="coupondate">{{ticket.createtime}}---{{ticket.end_time}}</div>
        </div>
      </div>
      <div class="couponimg" v-if="ticket.status==2">
        <img src="../../../assets/coupontwo.png" alt />
        <img src="../../../assets/used.png" alt class="useimg" />
        <div class="couponhezi">
          <div class="coupontop flextwo">
            <div class="moneynumber">
              <span class="moneysign">¥</span>
              <span class="moneynum">{{ticket.num}}</span>
            </div>
          </div>
          <div class="couponname">抵扣优惠券(全场可用)</div>
          <div class="coupondate">{{ticket.createtime}}---{{ticket.end_time}}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      ticket: ''
    }
  },
  created() {
    document.title = '唐元集'
    this.getcoupon()
  },
  methods: {
    back() {
      this.$router.go(-1)
    },
    getcoupon() {
      let that = this;
      var url = "/api/user/my_ticket";
      let param = {

      };

      that.$axios
        .post(url, param)
        .then(function (res) {
          console.log(res);
          that.ticket = res.data.ticket

        })
        .catch(function (err) {
          console.log(err);
        });
    }
  }

}
</script>


<style scoped>
@import "../../../style/usercenter.css";
.couponbox {
  margin-top: 1.2rem;
}
</style>