guhongwei 4 лет назад
Родитель
Сommit
999ac65473

+ 3 - 1
src/store/index.js

@@ -13,6 +13,8 @@ import product from '@common/src/store/product';
 import productIndex from '@common/src/store/productIndex';
 // 展会
 import dock from '@common/src/store/dock/dock';
+// 申请管理
+import dockUser from '@common/src/store/dock/dock_user';
 // // 展会图文
 // import dockPw from '@common/src/store/dockPw';
 // // 展会用户
@@ -70,7 +72,7 @@ export default new Vuex.Store({
     product,
     productIndex,
     dock,
-    // dockUser,
+    dockUser,
     trainLive,
     trainchat,
     // transaction,

+ 101 - 25
src/views/achieveLive/apply.vue

@@ -3,7 +3,7 @@
     <el-row>
       <el-col :span="24" class="main">
         <div class="w_1200">
-          <el-col :span="24" class="top">
+          <el-col :span="24" class="one">
             <el-col :span="3">
               <el-image :src="img_path" style="width:105px;height:105px;"></el-image>
             </el-col>
@@ -14,15 +14,33 @@
               <p>3、信息完整度越高,将在我们的平台搜索结果排序靠前、获得推荐机会,以及享受增值服务试用机会!</p>
             </el-col>
           </el-col>
-          <el-col :span="24" class="down">
-            <el-tabs v-model="active" type="card">
-              <el-tab-pane label="技术成果" name="first">
-                <applyAchieve :dock_id="dock_id" @toRest="toRest"></applyAchieve>
-              </el-tab-pane>
-              <el-tab-pane label="科技需求" name="second" disabled>
-                <applyTechol></applyTechol>
-              </el-tab-pane>
-            </el-tabs>
+          <el-col :span="24" class="two">
+            <el-form :model="form" :rules="rules" ref="form" label-width="100px">
+              <el-form-item label="用户名称" prop="name">
+                <el-input v-model="form.name"></el-input>
+              </el-form-item>
+              <el-form-item label="联系电话" prop="phone">
+                <el-input v-model="form.phone"></el-input>
+              </el-form-item>
+              <el-form-item label="申请时间" prop="create_time">
+                <el-date-picker v-model="form.create_time" placeholder="请选择" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date"> </el-date-picker>
+              </el-form-item>
+              <el-form-item label="参展项目" prop="productList">
+                <el-select v-model="form.productList" value-key="id" clearable filterable multiple collapse-tags placeholder="请选择选择产品">
+                  <el-option v-for="(item, index) in goodsList" :key="index" :label="`${item.name}(${getType(item.type)})`" :value="item"> </el-option>
+                </el-select>
+                <!-- <el-select v-model="form.productList" value-key="id" clearable filterable multiple collapse-tags placeholder="请选择选择产品">
+                  <el-option v-for="(item, index) in goodsList" :key="index" :label="item.name" :value="item">
+                    <span style="float: left">{{ item.name }}</span>
+                    <span style="float: right; color: #8492a6; font-size: 13px">{{ item.type }}</span>
+                  </el-option>
+                </el-select> -->
+              </el-form-item>
+              <el-col :span="24" class="btn">
+                <el-button type="danger" size="mini" @click="resetBtn">取消申请</el-button>
+                <el-button type="success" size="mini" @click="onSubmit('form')">提交申请</el-button>
+              </el-col>
+            </el-form>
           </el-col>
         </div>
       </el-col>
@@ -31,29 +49,67 @@
 </template>
 
 <script>
-import applyAchieve from './apply/applyAchieve.vue';
-import applyTechol from './apply/applyTechol.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: product } = createNamespacedHelpers('product');
+const { mapActions: dockUser } = createNamespacedHelpers('dockUser');
+
 export default {
-  metaInfo() {
-    return { title: this.$route.meta.title };
-  },
   name: 'apply',
   props: {},
-  components: {
-    applyAchieve,
-    applyTechol,
-  },
+  components: {},
   data: function() {
     return {
       img_path: require('@common/src/assets/product.png'),
-      active: 'first',
+      form: {},
+      rules: {
+        productList: [],
+      },
+      // 企业成果
+      goodsList: [],
     };
   },
-  created() {},
+  created() {
+    if (this.user) this.search();
+  },
   methods: {
-    // 取消
-    toRest() {
+    ...product(['query']),
+    ...dockUser(['create']),
+    async search() {
+      let data = { name: this.user.name, phone: this.user.phone, user_id: this.user.id, dock_id: this.dock_id };
+      this.$set(this, `form`, data);
+      let res = await this.query({ user_id: this.user.id });
+      if (this.$checkRes(res)) {
+        this.$set(this, `goodsList`, res.data);
+      }
+    },
+
+    // 提交申请
+    onSubmit(formName) {
+      this.$refs[formName].validate(async valid => {
+        if (valid) {
+          let data = this.form;
+          let res = await this.create(data);
+          if (this.$checkRes(res)) {
+            this.$message({
+              message: '申请参展成功!',
+              type: 'success',
+            });
+            this.search();
+          }
+        } else {
+          console.log('error submit!!');
+          return false;
+        }
+      });
+    },
+    // 整理类型
+    getType(type) {
+      if (type == '0') return '科技需求';
+      else if (type == '1') return '技术成果';
+      else if (type == '2') return '商务服务';
+    },
+    // 取消申请
+    resetBtn() {
       this.$router.push({ path: '/live/index' });
     },
   },
@@ -63,7 +119,16 @@ export default {
       return this.$route.query.id;
     },
   },
-  watch: {},
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
 };
 </script>
 
@@ -71,7 +136,7 @@ export default {
 .main {
   min-height: 557px;
   padding: 15px 0;
-  .top {
+  .one {
     background: #f3faff;
     padding: 15px;
     border: 1px solid #ccc;
@@ -80,5 +145,16 @@ export default {
       font-size: 16px;
     }
   }
+  .two {
+    .el-date-editor {
+      width: 100%;
+    }
+    .el-select {
+      width: 100%;
+    }
+    .btn {
+      text-align: center;
+    }
+  }
 }
 </style>

+ 0 - 112
src/views/achieveLive/apply/applyAchieve.vue

@@ -1,112 +0,0 @@
-<template>
-  <div id="applyAchieve">
-    <el-row>
-      <el-col :span="24">
-        <data-form :data="form" :fields="fields" :rules="{}" :needSave="false">
-          <template #custom="{item,form}">
-            <template v-if="item.model === 'goodsList'">
-              <el-select v-model="form.goodsList" value-key="id" multiple collapse-tags placeholder="请选择选择产品">
-                <el-option v-for="(item, index) in goodsList" :key="index" :label="item.name" :value="item"> </el-option>
-              </el-select>
-            </template>
-          </template>
-          <template slot="submit">
-            <el-button type="danger" size="mini" @click="toRest">取消</el-button>
-            <el-button type="primary" size="mini" @click="toSave">确认</el-button>
-          </template>
-        </data-form>
-      </el-col>
-    </el-row>
-  </div>
-</template>
-
-<script>
-import dataForm from '@common/src/components/frame/form.vue';
-import { mapState, createNamespacedHelpers } from 'vuex';
-const { mapActions: product } = createNamespacedHelpers('product');
-const { mapActions: dockUser } = createNamespacedHelpers('dockUser');
-export default {
-  name: 'applyAchieve',
-  props: {
-    dock_id: { type: String },
-  },
-  components: { dataForm },
-  data: function() {
-    return {
-      fields: [
-        { label: '用户名称', model: 'user_name' },
-        { label: '联系电话', model: 'contact_tel' },
-        { label: '申请时间', model: 'apply_time', type: 'date' },
-        { label: '成果列表', model: 'goodsList', custom: true },
-      ],
-      form: {},
-      // 成果列表
-      goodsList: [],
-      isNews: true,
-    };
-  },
-  async created() {
-    await this.searchOther();
-  },
-  methods: {
-    ...product({ productQuery: 'query' }),
-    ...dockUser(['query', 'fetch', , 'update', 'create']),
-    async searchOther() {
-      // 查询用户
-      let res = await this.query({ dock_id: this.dock_id, user_id: this.user.id });
-      if (this.$checkRes(res)) {
-        if (res.total > 0) {
-          this.$set(this, `form`, res.data[0]);
-          this.$set(this, `isNews`, false);
-        } else {
-          let data = {
-            dock_id: this.dock_id,
-            user_id: this.user.id,
-            user_name: this.user.name,
-            contact_tel: this.user.phone,
-          };
-          this.$set(this, `form`, data);
-        }
-      }
-      // 查询用户产品
-      res = await this.productQuery({ type: '1', status: '2', user_id: this.user.id });
-      if (this.$checkRes(res)) {
-        this.$set(this, `goodsList`, res.data);
-      }
-    },
-    // 确认
-    async toSave() {
-      let data = this.form;
-      if (this.isNews) {
-        let res = await this.create(data);
-        if (this.$checkRes(res)) {
-          this.$message({
-            message: '创建参展信息成功',
-            type: 'success',
-          });
-          this.toRest();
-        }
-      } else {
-        let res = await this.update(data);
-        if (this.$checkRes(res)) {
-          this.$message({
-            message: '修改参展信息成功',
-            type: 'success',
-          });
-          this.toRest();
-        }
-      }
-    },
-    // 取消
-    toRest() {
-      this.$emit('toRest');
-    },
-  },
-  computed: {
-    ...mapState(['user']),
-  },
-  watch: {},
-};
-</script>
-
-<style lang="less" scoped></style>

+ 0 - 32
src/views/achieveLive/apply/applyTechol.vue

@@ -1,32 +0,0 @@
-<template>
-  <div id="applyTechol">
-    <el-row>
-      <el-col :span="24">
-        <p>applyTechol</p>
-      </el-col>
-    </el-row>
-  </div>
-</template>
-
-<script>
-import { mapState, createNamespacedHelpers } from 'vuex';
-export default {
-  metaInfo() {
-    return { title: this.$route.meta.title };
-  },
-  name: 'applyTechol',
-  props: {},
-  components: {},
-  data: function() {
-    return {};
-  },
-  created() {},
-  methods: {},
-  computed: {
-    ...mapState(['user']),
-  },
-  watch: {},
-};
-</script>
-
-<style lang="less" scoped></style>