guhongwei 5 năm trước cách đây
mục cha
commit
c919054165
2 tập tin đã thay đổi với 175 bổ sung18 xóa
  1. 29 6
      src/views/dockCenter/applyInfo/index.vue
  2. 146 12
      src/views/dockCenter/vipInfo/index.vue

+ 29 - 6
src/views/dockCenter/applyInfo/index.vue

@@ -25,10 +25,9 @@
                   用户状态:<span>{{ item.status == '0' ? '待审核' : item.status == '1' ? '通过' : item.status == '2' ? '拒绝' : '未识别' }}</span>
                 </el-col>
                 <el-col :span="24" class="btn">
-                  <el-button type="success" size="mini">同意参展</el-button>
-                  <el-button type="danger" size="mini">拒绝参展</el-button>
-                  <!-- <el-button type="primary" size="mini" v-if="item.status == '1'"> 审核参展产品</el-button> -->
-                  <el-button type="primary" size="mini" @click="$router.push({ path: '/dockCenter/applyInfo/productList', query: { id: item.id } })">
+                  <el-button type="success" size="mini" @click="handlecheck(item)">同意参展</el-button>
+                  <el-button type="danger" size="mini" @click="handleclose(item)">拒绝参展</el-button>
+                  <el-button type="primary" size="mini" v-if="item.status == '1'"  @click="$router.push({ path: '/dockCenter/applyInfo/productList', query: { id: item.id } })">
                     审核参展产品</el-button
                   >
                 </el-col>
@@ -64,6 +63,7 @@
 import { mapState, createNamespacedHelpers } from 'vuex';
 import NavBar from '@/layout/common/topInfo.vue';
 const { mapActions: dock } = createNamespacedHelpers('dock');
+const { mapActions: apply } = createNamespacedHelpers('apply');
 export default {
   name: 'index',
   props: {},
@@ -105,16 +105,39 @@ export default {
   },
   methods: {
     ...dock({ dockQuery: 'query', dockfetch: 'fetch',dockupdate:'update' }),
+        ...apply({ applyUpdate: 'update' }),
     async searchInfo() {
       let res = await this.dockfetch(this.user.uid);
       if (this.$checkRes(res)) {
-        var oneList = res.data.apply.filter(item => item.status === '0');
         var twoList = res.data.apply.filter(item => item.status === '1');
-        this.$set(this, `oneList`, oneList);
+        this.$set(this, `oneList`, res.data.apply);
         this.$set(this, `twoList`, twoList);
         this.$set(this, `dock_id`, res.data.id);
       }
     },
+     // 同意参展
+    async handlecheck(data) {
+      data.status = '1';
+      data.dock_id = this.dock_id;
+      data.id = data._id;
+      let res = await this.applyUpdate(data);
+           this.$notify({
+            message: '审核通过',
+            type: 'success',
+          });
+          this.searchInfo();
+    },
+    // 拒绝参展
+    async handleclose(data) {
+      data.status = '2';
+      data.dock_id = this.dock_id;
+      data.id = data._id;
+      let res = await this.applyUpdate(data);
+        this.$notify({
+            message: '审核拒绝',
+            type: 'success',
+          });
+    },
   },
   computed: { ...mapState(['user']) },
   mounted() {

+ 146 - 12
src/views/dockCenter/vipInfo/index.vue

@@ -7,7 +7,7 @@
         </el-col>
         <el-col :span="24" class="main">
           <el-col :span="24" class="add">
-            <el-button type="primary" size="mini" @click="$router.push({ path: '/dockCenter/vipInfo/addUser' })">添加用户</el-button>
+            <el-button type="primary" size="mini" @click="add()">添加用户</el-button>
           </el-col>
           <el-col :span="24" class="info">
             <el-col :span="24" class="list" v-for="(item, index) in list" :key="index">
@@ -24,19 +24,50 @@
                 email:<span>{{ item.email }}</span>
               </el-col>
               <el-col :span="24" class="btn">
-                <el-button type="primary" size="mini" @click="$router.push({ path: '/dockCenter/vipInfo/addUser', query: { id: item.id } })">编辑</el-button>
+                <el-button type="primary" size="mini" @click="editViP(item)">编辑</el-button>
               </el-col>
             </el-col>
           </el-col>
         </el-col>
       </el-col>
     </el-row>
+     <el-dialog title="添加用户" :visible.sync="dialogVisible" width="90%" :before-close="handleClose">
+      <el-col :span="24">
+        <el-form :model="form">
+          <el-form-item label="用户名" :label-width="formLabelWidth">
+            <el-input v-model="form.name" autocomplete="off" placeholder="请输入用户名"></el-input>
+          </el-form-item>
+          <el-form-item label="手机号" :label-width="formLabelWidth">
+            <el-input v-model="form.phone" autocomplete="off" maxlength="11" placeholder="请输入手机号" :disabled="disabled"></el-input>
+          </el-form-item>
+          <el-form-item label="密码" :label-width="formLabelWidth">
+            <el-input v-model="form.passwd" autocomplete="off" placeholder="请输入密码" show-password :disabled="disabled"></el-input>
+          </el-form-item>
+          <el-form-item label="单位名称" :label-width="formLabelWidth">
+            <el-input v-model="form.company" autocomplete="off" placeholder="请输入单位名称"></el-input>
+          </el-form-item>
+          <el-form-item label="email" :label-width="formLabelWidth">
+            <el-input v-model="form.email" autocomplete="off" placeholder="请输入email"></el-input>
+          </el-form-item>
+          <el-form-item label="简介" :label-width="formLabelWidth">
+            <el-input v-model="form.content" type="textarea" autocomplete="off" placeholder="请输入简介"></el-input>
+          </el-form-item>
+          <el-col :span="24" style="text-align:center">
+            <el-button @click="closeBtn">取 消</el-button>
+            <el-button type="primary" @click="onSubmit">确 定</el-button>
+          </el-col>
+        </el-form>
+      </el-col>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import { mapState, createNamespacedHelpers } from 'vuex';
 import NavBar from '@/layout/common/topInfo.vue';
+const { mapActions: dock } = createNamespacedHelpers('dock');
+const { mapActions: apply } = createNamespacedHelpers('apply');
+const { mapActions: authUser } = createNamespacedHelpers('authUser');
 export default {
   name: 'index',
   props: {},
@@ -49,18 +80,118 @@ export default {
       isleftarrow: '',
       // 返回
       navShow: true,
-      list: [
-        {
-          vipname: '测试联系人',
-          vipphone: '11111111111',
-          company: '长春市福瑞科技有限公司',
-          email: '12345678901@163.com',
-        },
-      ],
+      list: [],
+      dock_id:'',
+      dialogVisible:false,
+          disabled: false,
+      form:{},
+      formLabelWidth:'80px'
     };
   },
-  created() {},
-  methods: {},
+  created() {
+        this.searchInfo();
+  },
+  methods: {
+     ...dock({ dockQuery: 'query', dockfetch: 'fetch',dockupdate:'update',dockupdateVip: 'updateVip', createvipuser: 'createvipuser' }),
+         ...apply({ applyUpdate: 'update' }),
+    ...authUser({ authUserQuery: 'query', authUserCreate: 'create', authUserUpdate: 'update' }),
+    async searchInfo() {
+      let res = await this.dockfetch(this.user.uid);
+     if (this.$checkRes(res)) {
+          this.$set(this, `list`, res.data.vipuser);
+        this.$set(this, `dock_id`, res.data.id);
+      }
+    },
+  // 添加用户
+    add() {
+      this.dialogVisible = true;
+      this.disabled = false;
+    },
+    // 保存
+    async onSubmit(){
+ if (this.form.id) {
+        const res = await this.authUserUpdate(this.form);
+        if (this.$checkRes(res)) {
+          let data = {
+            vipname: this.form.name,
+            vipphone: this.form.phone,
+            company: this.form.company,
+            email: this.form.email,
+            content: this.form.content,
+            role: '8',
+            status: '1',
+            id: this.dock_id,
+            vipid: this.form.vipid,
+          };
+          const arr = await this.dockupdateVip(data);
+          if (this.$checkRes(arr)) {
+            this.$notify({
+              message: '信息修改成功',
+              type: 'success',
+            });
+            this.dialogVisible = false;
+            this.searchInfo();
+          }
+        }
+      } else {
+        const authUserList = await this.authUserQuery();
+        let r = authUserList.data.some(f => f.phone == this.form.phone);
+        if (r) {
+          this.$notify({
+            message: '手机号已经被注册,请重新输入',
+            type: 'warning',
+          });
+        } else {
+          this.form.role = '8';
+          const res = await this.authUserCreate(this.form);
+          if (this.$checkRes(res)) {
+            let data = {
+              vipname: this.form.name,
+              vipphone: this.form.phone,
+              company: this.form.company,
+              email: this.form.email,
+              content: this.form.content,
+              role: this.form.role,
+              uid: res.data.id,
+              id: this.dock_id,
+            };
+            const arr = await this.createvipuser(data);
+            if (this.$checkRes(arr)) {
+              this.dialogVisible = false;
+              this.searchInfo();
+            }
+          }
+        }
+      }
+    },
+    // 修改
+      // 修改
+    editViP(data) {
+      this.dialogVisible = true;
+      let newDate = {};
+      newDate.name = data.vipname;
+      newDate.phone = data.vipphone;
+      newDate.passwd = data.passwd;
+      newDate.company = data.company;
+      newDate.email = data.email;
+      newDate.content = data.content;
+      newDate.id = data.uid;
+      newDate.vipid = data._id;
+      console.log(newDate);
+
+      this.disabled = true;
+      this.$set(this, `form`, newDate);
+    },
+    // 取消
+    closeBtn() {
+      this.form = {};
+      this.dialogVisible = false;
+    },
+     // 取消
+    handleClose(done) {
+      done();
+    },
+  },
   computed: { ...mapState(['user']) },
   mounted() {
     this.title = this.$route.meta.title;
@@ -119,4 +250,7 @@ export default {
     }
   }
 }
+/deep/.el-dialog__body{
+height: 420px;
+}
 </style>