<template>
  <div id="index">
    <admin-frame topType="2" :rightArrow="false" :leftArrow="false" :usePage="false" :useNav="false">
      <template v-slot:info>
        <form-1 :form="form" @onSubmit="onSubmit"></form-1>
      </template>
    </admin-frame>
  </div>
</template>

<script>
import form1 from './parts/form-1.vue';
import adminFrame from '@frame/src/components/mobile-frame/mobile-main.vue';
import { mapState, createNamespacedHelpers } from 'vuex';
const { mapActions: patenttechol } = createNamespacedHelpers('patenttechol');
const moment = require('moment');
export default {
  name: 'index',
  props: {},
  components: {
    adminFrame,
    form1,
  },
  data: function () {
    return {
      form: {},
    };
  },
  async created() {},
  methods: {
    ...patenttechol(['create']),
    async onSubmit(data) {
      data.status = '0';
      data.order_num = 'HC' + moment(new Date()).valueOf();
      let res = await this.create(data);
      if (this.$checkRes(res)) {
        this.$toast({ type: `success`, message: `操作成功` });
      } else {
        this.$toast({ type: `error`, message: `${res.errmsg}` });
      }
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped></style>
