lmx 1 день назад
Родитель
Сommit
28d054ade8
1 измененных файлов с 45 добавлено и 3 удалено
  1. 45 3
      src/views/company/wxAccount/index.vue

+ 45 - 3
src/views/company/wxAccount/index.vue

@@ -105,6 +105,13 @@
             @click="handleDelete(scope.row)"
             v-hasPermi="['company:companyWx:remove']"
           >删除</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-refresh"
+            @click="handleSyncCustomer(scope.row)"
+            v-hasPermi="['company:companyWx:edit']"
+          >同步客户</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -118,8 +125,8 @@
     />
 
     <!-- 添加或修改个微账号对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
         <el-form-item label="微信昵称" prop="wxNickName">
           <el-input v-model="form.wxNickName" placeholder="请输入微信昵称" />
         </el-form-item>
@@ -134,6 +141,9 @@
             <el-option v-for="item in qwUserList" :label="item.nickName" :value="item.userId" />
           </el-select>
         </el-form-item>
+        <el-form-item label="微信备注前缀" prop="wxRemark">
+          <el-input :disabled="title=='修改个微账号'" v-model="form.wxRemark"  :maxlength="6" placeholder="请输入六位微信备注前缀" />
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
@@ -144,7 +154,7 @@
 </template>
 
 <script>
-import { listCompanyAccount, getCompanyAccount, delCompanyAccount, addCompanyAccount, updateCompanyAccount, exportCompanyAccount, companyListAll } from "@/api/company/companyAccount";
+import { listCompanyAccount, getCompanyAccount, delCompanyAccount, addCompanyAccount, updateCompanyAccount, exportCompanyAccount, companyListAll, syncWx } from "@/api/company/companyAccount";
 import {getAllUserlist} from "@/api/company/companyUser";
 
 
@@ -184,6 +194,24 @@ export default {
       form: {},
       // 表单校验
       rules: {
+        wxNickName: [
+          { required: true, message: '请输入微信昵称', trigger: 'blur' }
+        ],
+        wxNo: [
+          { required: true, message: '请输入微信号', trigger: 'blur' }
+        ],
+        phone: [
+          { required: true, message: '请输入手机号', trigger: 'blur' },
+          { pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号', trigger: 'blur' }
+        ],
+        companyUserId: [
+          { required: true, message: '请选择员工', trigger: 'change' }
+        ],
+        wxRemark: [
+          { required: true, message: '请输入微信备注前缀', trigger: 'blur' },
+          { len: 6, message: '微信备注前缀必须为6位', trigger: 'blur' },
+          { pattern: /^\d{6}$/, message: '微信备注前缀只能输入6位数字', trigger: 'blur' }
+        ]
       }
     };
   },
@@ -303,6 +331,20 @@ export default {
           this.download(response.msg);
         }).catch(function() {});
     },
+    /** 同步客户按钮操作 */
+    handleSyncCustomer(row) {
+      this.$confirm('是否确认同步该个微账号的客户数据?', "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          return syncWx({ accountId: row.id });
+        }).then(response => {
+          if (response.code === 200) {
+            this.msgSuccess("同步客户成功");
+          }
+        }).catch(function() {});
+    },
   }
 };
 </script>