123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <template>
- <div id="adviserList">
- <enterprisexuqiu-detail
- :info="info"
- :liebiaoList="liebiaoList"
- @onsave="onsaveClick"
- :demandForm="demandForm"
- @demandSubmit="demandSubmit"
- :columnList="columnList"
- @changeType="changeType"
- :totaltype="totaltype"
- :anniu="anniu"
- ></enterprisexuqiu-detail>
- </div>
- </template>
- <script>
- import enterprisexuqiuDetail from '@/components/enterprise/enterprisexuqiu.vue';
- import { createNamespacedHelpers, mapGetters, mapState } from 'vuex';
- const { mapActions: mapMarkettype } = createNamespacedHelpers('markettype');
- const { mapActions: mapMarketproduct } = createNamespacedHelpers('marketproduct');
- const { mapActions: login } = createNamespacedHelpers('login');
- export default {
- name: 'adviserList',
- props: {},
- components: {
- enterprisexuqiuDetail,
- },
- data: () => ({
- anniu: 23,
- info: {},
- liebiaoList: [
- { name: '基本信息' },
- { name: '消息管理' },
- { name: '我的发布' },
- { name: '事项管理' },
- { name: '展会管理' },
- // { name: '返回首页' },
- { name: '修改密码' },
- { name: '注销账号' },
- ],
- demandForm: {
- image: {},
- product_args: [],
- },
- columnList: [],
- totaltype: 0,
- }),
- created() {
- this.maarkettype();
- this.searchInfo();
- },
- computed: {
- ...mapState(['user']),
- id() {
- return this.$route.query.id;
- },
- keyWord() {
- let meta = this.$route.meta;
- let main = meta.title || '';
- return main;
- },
- },
- methods: {
- ...mapMarkettype({ markettypeList: 'query' }),
- ...mapMarketproduct({ productFetch: 'fetch', productCreate: 'create', productUpdate: 'update' }),
- ...login({ logout: 'logout', transactiondtetle: 'delete' }),
- async searchInfo() {
- if (this.$route.query.id) {
- const res = await this.productFetch(this.id);
- this.$set(this, `demandForm`, res.data);
- }
- },
- async demandSubmit(demandForm) {
- let data = this.demandForm;
- console.log(data);
- data.userid = this.user.uid;
- console.log(data.userid);
- let res;
- let msg;
- if (data.id) {
- res = await this.productUpdate(data);
- msg = `${this.keyWord}修改成功`;
- } else {
- res = await this.productCreate(data);
- msg = `${this.keyWord}添加成功`;
- }
- if (this.$checkRes(res, msg)) this.$router.push({ path: '/enterprise/enterprisefabu' });
- },
- // 查询类型
- async maarkettype({ category = 54, ...info } = {}) {
- const res = await this.markettypeList({ category, ...info });
- console.log(res.data);
- if (this.$checkRes(res)) {
- this.$set(this, `columnList`, res.data);
- }
- },
- // 栏目跳转
- async onsaveClick({ id }) {
- if (id === '基本信息') {
- this.$router.push({ path: '/enterprise/enterprisejb' });
- } else if (id === '消息管理') {
- this.$router.push({ path: '/enterprise/enterprisexx' });
- } else if (id === '我的发布') {
- this.$router.push({ path: '/enterprise/enterprisefabu' });
- } else if (id === '事项管理') {
- this.$router.push({ path: '/enterprise/enterprisedg' });
- } else if (id === '修改密码') {
- this.$router.push({ path: '/enterprise/xiugai' });
- } else if (id === '展会管理') {
- this.$router.push({ path: '/enterprise/appointment' });
- } else if (id === '返回首页') {
- this.$router.push({ path: '/' });
- } else if (id === '注销账号') {
- this.logout();
- this.$message({
- message: '注销成功',
- type: 'success',
- });
- this.toLogin();
- }
- },
- async toLogin() {
- this.$router.push({ path: '/platlive' });
- },
- changeType(item) {
- console.log(item);
- this.$set(this, `totaltype`, item);
- },
- },
- };
- </script>
- <style lang="less" scoped></style>
|