appointment.vue 4.1 KB

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