look.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <div id="adviserList">
  3. <look-detail
  4. :liebiaoList="liebiaoList"
  5. @deleteRow="deleteRow"
  6. @success="success"
  7. @shibai="shibai"
  8. :resultTable="resultTable"
  9. @onsave="onsaveClick"
  10. :limit="limit"
  11. :total="total"
  12. @handleCurrentChange="handleCurrentChange"
  13. :pageSize="pageSize"
  14. :display="display"
  15. ></look-detail>
  16. </div>
  17. </template>
  18. <script>
  19. import lookDetail from '@/components/enterprise/look.vue';
  20. import { createNamespacedHelpers, mapGetters, mapState } from 'vuex';
  21. const { mapActions: apply } = createNamespacedHelpers('apply');
  22. const { mapActions: login } = createNamespacedHelpers('login');
  23. export default {
  24. name: 'adviserList',
  25. props: {},
  26. components: {
  27. lookDetail,
  28. },
  29. data: () => ({
  30. total: 0,
  31. limit: 4,
  32. display: 'list',
  33. pageSize: 4,
  34. info: {},
  35. liebiaoList: [
  36. { name: '基本信息' },
  37. { name: '消息管理' },
  38. { name: '我的发布' },
  39. { name: '事项管理' },
  40. { name: '展会管理' },
  41. // { name: '返回首页' },
  42. { name: '修改密码' },
  43. { name: '退出账号' },
  44. ],
  45. resultTable: [],
  46. form: {},
  47. }),
  48. created() {
  49. this.search();
  50. },
  51. computed: {
  52. data() {
  53. return this.$route.query.data;
  54. },
  55. ...mapState(['user']),
  56. },
  57. methods: {
  58. ...apply(['query', 'delete', 'update']),
  59. ...login({ logout: 'logout', transactiondtetle: 'delete' }),
  60. //查询
  61. async search({ skip = 0, limit = 4, currentPage } = { skip: 0, limit: 10 }) {
  62. console.log(this.data);
  63. console.log(this.data.apply.length);
  64. this.$set(this, `total`, this.data.apply.length);
  65. console.log();
  66. const newProducts = [];
  67. for (let index = skip; index < skip + limit; index++) {
  68. if (this.data.apply[index]) {
  69. newProducts.push(this.data.apply[index]);
  70. }
  71. }
  72. console.log(newProducts);
  73. this.$set(this, `resultTable`, newProducts);
  74. },
  75. handleCurrentChange({ currentPage }) {
  76. this.search({ skip: (currentPage - 1) * this.pageSize, limit: this.pageSize, currentPage });
  77. console.log(currentPage);
  78. },
  79. async onsaveClick({ id }) {
  80. console.log(id);
  81. if (id === '基本信息') {
  82. this.$router.push({ path: '/enterprise/enterprisejb' });
  83. } else if (id === '消息管理') {
  84. this.$router.push({ path: '/enterprise/enterprisexx' });
  85. } else if (id === '我的发布') {
  86. this.$router.push({ path: '/enterprise/enterprisefabu' });
  87. } else if (id === '事项管理') {
  88. this.$router.push({ path: '/enterprise/enterprisedg' });
  89. } else if (id === '展会管理') {
  90. this.$router.push({ path: '/enterprise/appointment' });
  91. } else if (id === '修改密码') {
  92. this.$router.push({ path: '/enterprise/xiugai' });
  93. } else if (id === '返回首页') {
  94. this.$router.push({ path: '/home' });
  95. } else if (id === '退出账号') {
  96. this.logout();
  97. this.$message({
  98. message: '注销成功',
  99. type: 'success',
  100. });
  101. this.toLogin();
  102. }
  103. },
  104. async toLogin() {
  105. this.$router.push({ path: '/platlive' });
  106. },
  107. async success(row) {
  108. row.status = '1';
  109. row.dock_id = this.data.id;
  110. row.id = data._id;
  111. console.log(row);
  112. let res = await this.update(row);
  113. this.$checkRes(res, '通过审核', '添加失败');
  114. },
  115. async shibai(row) {
  116. row.status = '2';
  117. row.dock_id = this.data.id;
  118. row.id = data._id;
  119. console.log(row);
  120. let res = await this.update(row);
  121. this.$checkRes(res, '审核拒绝', '添加失败');
  122. },
  123. async deleteRow(id) {
  124. const res = await this.delete(id);
  125. if (this.$checkRes(res, '删除成功', res.errmsg || '删除失败')) this.search();
  126. },
  127. },
  128. };
  129. </script>
  130. <style lang="less" scoped></style>