<template>
  <div class="record record--sign"></div>
</template>

<script>
import { Yun } from "./namespace";
import { getYun } from "../api";
export default {
  name: Yun.name,
  data() {
    return {};
  },
  created() {
    if (this.$route.params.id) {
      this.getYun();
      localStorage.setItem("send_order_id",this.$route.params.id)
    } else {
      this.$router.replace("/");
    }
  },
  methods: {
    getYun() {
      getYun(this.$route.params.id).then(res => {
        const { bid, cid } = res;
        if (bid === 0) {
          this.$router.replace("/");
        } else {
          this.$router.replace(`/reader?yun=1&bid=${bid}&cid=${cid}`);
        }
      });
    }
  }
};
</script>
