123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <template>
- <div id="adviserList">
- <enterprisexuqiu-detail
- :info="info"
- :liebiaoList="liebiaoList"
- @onsave="onsaveClick"
- :demandForm="demandForm"
- @demandSubmit="demandSubmit"
- :columnList="columnList"
- @changeType="changeType"
- :totaltype="totaltype"
- ></enterprisexuqiu-detail>
- </div>
- </template>
- <script>
- import enterprisexuqiuDetail from '@/components/enterprise/enterprisexuqiu.vue';
- import { createNamespacedHelpers, mapGetters } from 'vuex';
- const { mapActions: mapSite } = createNamespacedHelpers('site');
- const { mapActions: mapMarkettype } = createNamespacedHelpers('markettype');
- const { mapActions: mapMarketproduct } = createNamespacedHelpers('marketproduct');
- export default {
- name: 'adviserList',
- props: {},
- components: {
- enterprisexuqiuDetail,
- },
- data: () => ({
- info: {},
- liebiaoList: [{ name: '基本信息' }, { name: '消息管理' }, { name: '我的发布' }, { name: '我的订购' }, { name: '注销账号' }],
- demandForm: {
- image: {},
- product_args: [],
- },
- columnList: [],
- totaltype: 0,
- }),
- created() {
- this.searchSite();
- this.maarkettype();
- this.searchInfo();
- },
- computed: {
- id() {
- return this.$route.query.id;
- },
- keyWord() {
- let meta = this.$route.meta;
- let main = meta.title || '';
- return main;
- },
- },
- methods: {
- ...mapSite(['showInfo']),
- ...mapMarkettype({ markettypeList: 'query' }),
- ...mapMarketproduct({ productFetch: 'fetch', productCreate: 'create', productUpdate: 'update' }),
- // 查询站点信息
- async searchSite() {
- let res = await this.showInfo();
- let object = JSON.parse(JSON.stringify(res.data));
- if (object) {
- this.$set(this, `info`, res.data);
- } else {
- this.$message.error(res.errmsg ? res.errmsg : 'error');
- }
- },
- 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 = '1234556677';
- console.log(data);
- 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 = 123, ...info } = {}) {
- const res = await this.markettypeList({ category, ...info });
- 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' });
- }
- },
- changeType(item) {
- console.log(item);
- this.$set(this, `totaltype`, item);
- },
- },
- };
- </script>
- <style lang="less" scoped></style>
|