enterprisexuqiu.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <div id="adviserList">
  3. <enterprisexuqiu-detail
  4. :info="info"
  5. :liebiaoList="liebiaoList"
  6. @onsave="onsaveClick"
  7. :demandForm="demandForm"
  8. @demandSubmit="demandSubmit"
  9. :columnList="columnList"
  10. @changeType="changeType"
  11. :totaltype="totaltype"
  12. :anniu="anniu"
  13. ></enterprisexuqiu-detail>
  14. </div>
  15. </template>
  16. <script>
  17. import enterprisexuqiuDetail from '@/components/enterprise/enterprisexuqiu.vue';
  18. import { createNamespacedHelpers, mapGetters, mapState } from 'vuex';
  19. const { mapActions: mapMarkettype } = createNamespacedHelpers('markettype');
  20. const { mapActions: mapMarketproduct } = createNamespacedHelpers('marketproduct');
  21. const { mapActions: login } = createNamespacedHelpers('login');
  22. export default {
  23. name: 'adviserList',
  24. props: {},
  25. components: {
  26. enterprisexuqiuDetail,
  27. },
  28. data: () => ({
  29. anniu: 23,
  30. info: {},
  31. liebiaoList: [
  32. { name: '基本信息' },
  33. { name: '消息管理' },
  34. { name: '我的发布' },
  35. { name: '事项管理' },
  36. { name: '展会管理' },
  37. // { name: '返回首页' },
  38. { name: '修改密码' },
  39. { name: '注销账号' },
  40. ],
  41. demandForm: {
  42. image: {},
  43. product_args: [],
  44. },
  45. columnList: [],
  46. totaltype: 0,
  47. }),
  48. created() {
  49. this.maarkettype();
  50. this.searchInfo();
  51. },
  52. computed: {
  53. ...mapState(['user']),
  54. id() {
  55. return this.$route.query.id;
  56. },
  57. keyWord() {
  58. let meta = this.$route.meta;
  59. let main = meta.title || '';
  60. return main;
  61. },
  62. },
  63. methods: {
  64. ...mapMarkettype({ markettypeList: 'query' }),
  65. ...mapMarketproduct({ productFetch: 'fetch', productCreate: 'create', productUpdate: 'update' }),
  66. ...login({ logout: 'logout', transactiondtetle: 'delete' }),
  67. async searchInfo() {
  68. if (this.$route.query.id) {
  69. const res = await this.productFetch(this.id);
  70. this.$set(this, `demandForm`, res.data);
  71. }
  72. },
  73. async demandSubmit(demandForm) {
  74. let data = this.demandForm;
  75. console.log(data);
  76. data.userid = this.user.uid;
  77. console.log(data.userid);
  78. let res;
  79. let msg;
  80. if (data.id) {
  81. res = await this.productUpdate(data);
  82. msg = `${this.keyWord}修改成功`;
  83. } else {
  84. res = await this.productCreate(data);
  85. msg = `${this.keyWord}添加成功`;
  86. }
  87. if (this.$checkRes(res, msg)) this.$router.push({ path: '/enterprise/enterprisefabu' });
  88. },
  89. // 查询类型
  90. async maarkettype({ category = 54, ...info } = {}) {
  91. const res = await this.markettypeList({ category, ...info });
  92. console.log(res.data);
  93. if (this.$checkRes(res)) {
  94. this.$set(this, `columnList`, res.data);
  95. }
  96. },
  97. // 栏目跳转
  98. async onsaveClick({ id }) {
  99. if (id === '基本信息') {
  100. this.$router.push({ path: '/enterprise/enterprisejb' });
  101. } else if (id === '消息管理') {
  102. this.$router.push({ path: '/enterprise/enterprisexx' });
  103. } else if (id === '我的发布') {
  104. this.$router.push({ path: '/enterprise/enterprisefabu' });
  105. } else if (id === '事项管理') {
  106. this.$router.push({ path: '/enterprise/enterprisedg' });
  107. } else if (id === '修改密码') {
  108. this.$router.push({ path: '/enterprise/xiugai' });
  109. } else if (id === '展会管理') {
  110. this.$router.push({ path: '/enterprise/appointment' });
  111. } else if (id === '返回首页') {
  112. this.$router.push({ path: '/' });
  113. } else if (id === '注销账号') {
  114. this.logout();
  115. this.$message({
  116. message: '注销成功',
  117. type: 'success',
  118. });
  119. this.toLogin();
  120. }
  121. },
  122. async toLogin() {
  123. this.$router.push({ path: '/platlive' });
  124. },
  125. changeType(item) {
  126. console.log(item);
  127. this.$set(this, `totaltype`, item);
  128. },
  129. },
  130. };
  131. </script>
  132. <style lang="less" scoped></style>