index.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <div id="index">
  3. <admin-frame @search="search" :limit="limit" :total="total" :useNav="false">
  4. <template v-slot:info>
  5. <van-tabs v-model="active" @change="changeActive">
  6. <van-tab title="成交专利">
  7. <list-1 :list="list" @detail="detail"></list-1>
  8. </van-tab>
  9. <van-tab title="转让信息">
  10. <list-1 :list="list" @detail="detail"></list-1>
  11. </van-tab>
  12. </van-tabs>
  13. </template>
  14. </admin-frame>
  15. </div>
  16. </template>
  17. <script>
  18. import list1 from './parts/list-1.vue';
  19. import adminFrame from '@frame/src/components/mobile-frame/mobile-main.vue';
  20. import { mapState, createNamespacedHelpers } from 'vuex';
  21. const { mapActions: patenttrans } = createNamespacedHelpers('patenttrans');
  22. export default {
  23. name: 'index',
  24. props: {},
  25. components: {
  26. adminFrame,
  27. list1,
  28. },
  29. data: function () {
  30. return {
  31. active: 0,
  32. limit: 5,
  33. total: 0,
  34. // 转让信息
  35. list: [],
  36. };
  37. },
  38. async created() {
  39. await this.search();
  40. },
  41. methods: {
  42. ...patenttrans(['query']),
  43. async search({ skip = 0, limit = this.limit, searchName, ...info } = {}) {
  44. if (searchName) info.patent_name = searchName;
  45. if (this.active == 0) {
  46. let res = await this.query({ skip, limit, status: '4', ...info });
  47. if (this.$checkRes(res)) {
  48. this.$set(this, `list`, res.data);
  49. this.$set(this, `total`, res.total);
  50. }
  51. } else if (this.active == 1) {
  52. let res = await this.query({ skip, limit, status: '0', ...info });
  53. if (this.$checkRes(res)) {
  54. this.$set(this, `list`, res.data);
  55. this.$set(this, `total`, res.total);
  56. }
  57. }
  58. },
  59. // 详情
  60. detail(data) {
  61. if (this.active == '1') {
  62. this.$router.push({ path: '/market/transfer/detail', query: { id: data.id } });
  63. }
  64. },
  65. // 选择类型
  66. changeActive(value) {
  67. this.$set(this, `active`, Number(value));
  68. this.search();
  69. },
  70. },
  71. computed: {
  72. ...mapState(['user']),
  73. },
  74. metaInfo() {
  75. return { title: this.$route.meta.title };
  76. },
  77. watch: {
  78. test: {
  79. deep: true,
  80. immediate: true,
  81. handler(val) {},
  82. },
  83. },
  84. };
  85. </script>
  86. <style lang="less" scoped></style>