Jelajahi Sumber

渠道通过此接口增加或修改邮箱,保证各企业关联1个邮箱,如果修改多次,以最后一次修改的邮箱为该企业最新邮箱

mashengyi 7 bulan lalu
induk
melakukan
6c62ce3b2c
1 mengubah file dengan 113 tambahan dan 2 penghapusan
  1. 113 2
      src/views/customer/customerComPanyDetail.vue

+ 113 - 2
src/views/customer/customerComPanyDetail.vue

@@ -9,6 +9,7 @@
               <el-input  placeholder="经办人姓名" class="input-demo" v-model="operatorName"></el-input>
               <el-button type="success" style="margin-left: 1%;" @click="firstLoadData">查询</el-button>
               <el-button type="success" style="margin-left: 1%;" @click="addOperatorList = true">添加经办人</el-button>
+              <el-button type="info" style="margin-left: 1%;" @click="addEditEmailList = true">更新备案邮箱</el-button>
               <el-button type="primary" style="margin-left: 1%;" @click="exportExcel">导出报表</el-button>
             </div>
           </el-col>
@@ -152,6 +153,52 @@
           <el-button type="primary" @click="addData('ruleForm')">新 增</el-button>
         </div>
       </el-dialog>
+
+
+ <!-- 更新邮箱 -->
+      <el-dialog
+        @close="handleEditDialogClose"
+        :visible.sync="addEditEmailList"
+        style="font-size: 0px;">
+        <div class="tou">更新备案邮箱--添加</div>
+        <div class="line"></div>
+        <el-form
+          label-position="right"
+          label-width="120px"
+          :rules="ruleEmails"
+          ref="ruleEmailForm"
+          :model="formEditEmailList">
+
+
+          <el-form-item label="企业名称" prop="companyName">
+            <el-select v-model="formEditEmailList.companyName"  @change="changeRowEditEmail" filterable placeholder="请选择企业名称" style="width: 100%">
+              <el-option
+                v-for="item in comPanyNumList"
+                :key="item.companyName"
+                :label="item.companyName"
+                :value="item.companyName">
+              </el-option>
+            </el-select>
+          </el-form-item>
+           <el-form-item label="客户号" prop="customerName">
+                      <el-input v-model="formEditEmailList.customerName"  placeholder="客户号" auto-complete="off" :disabled="true"></el-input>
+                    </el-form-item>
+          <el-form-item label="企业编码" prop="companyNum">
+            <el-input v-model="formEditEmailList.companyNum" placeholder="企业编码" auto-complete="off" :disabled="true" ></el-input>
+          </el-form-item>
+
+         <el-form-item label="邮箱" prop="invoiceMail">
+            <el-input v-model="formEditEmailList.invoiceMail" auto-complete="off" placeholder="请输入邮箱"></el-input>
+          </el-form-item>
+
+        </el-form>
+        <div slot="footer" class="dialog-footer">
+          <el-button @click="addEditEmailList = false" type="info">取 消</el-button>
+          <el-button type="primary" @click="editEmail('ruleEmailForm')">更 新</el-button>
+        </div>
+      </el-dialog>
+
+
        <el-dialog
            @close="handleEditDialogClose"
            :visible.sync="operatorEvidence"
@@ -217,6 +264,15 @@ export default{
         ]
 
       },
+       ruleEmails: {
+              companyName: [
+                { required: true, message: `请输入企业名称`, trigger: `blur` }
+              ],
+              invoiceMail: [
+                { required: true, message: `请输入公司邮箱`, trigger: `blur` }
+              ]
+
+            },
       companyNum: ``,
       operatorName: ``,
       comPanyNumList: [],
@@ -231,11 +287,18 @@ export default{
         'contractFileName': ``,
         'base64Str': ``
       },
+       formEditEmailList: {
+              'companyName': ``,
+              'companyNum': ``,
+              'customerName': ``,
+              'invoiceMail': ``
+            },
       current: 1,
       pagesize: 8,
       // 总共有多少条数据
       total: 0,
       addOperatorList: false,
+      addEditEmailList: false,
       operatorEvidence: false
     }
   },
@@ -344,7 +407,6 @@ httpRequest(data) {
     const selectedOption = this.comPanyNumList.find(function(item) {
       return item.companyName === this.formOperatorList.companyName;
     }.bind(this));
-
     if (selectedOption) {
       this.formOperatorList.companyNum = selectedOption.companyNum;
       this.formOperatorList.custId = selectedOption.customerName;
@@ -353,7 +415,18 @@ httpRequest(data) {
       this.formOperatorList.companyNum = '';
     }
   },
-
+  changeRowEditEmail() {
+         // 根据选择的企业名称查找对应的对象,并获取企业编码值
+          const selectedOption = this.comPanyNumList.find(function(item) {
+            return item.companyName === this.formEditEmailList.companyName;
+          }.bind(this));
+          if (selectedOption) {
+            this.formEditEmailList.companyNum = selectedOption.companyNum;
+            this.formEditEmailList.customerName = selectedOption.customerName;
+          } else {
+            this.formEditEmailList.companyNum = '';
+          }
+    },
     firstLoadData() {
       this.current = 1
       this.pagesize = 8
@@ -417,6 +490,39 @@ httpRequest(data) {
         }
       })
     },
+
+     // 修改邮箱
+        editEmail(formName) {
+          this.$refs[formName].validate(async(valid) => {
+            if (valid) {
+                const loading = this.$loading({
+                 lock: true,
+                 text: '保存中,请稍后...',
+                 spinner: 'el-icon-loading',
+                 background: 'rgba(0, 0, 0, 0.7)'
+               });
+              const response = await this.$http.post(`customer/customerRecEditMail`, this.formEditEmailList)
+              if (response.data.code == 0) {
+                this.loadData()
+                this.addEditEmailList = false
+                loading.close();
+                this.$message({
+                  type: `success`,
+                  message: `更新成功`
+                })
+              } else {
+              loading.close();
+                this.$message({
+                  type: `error`,
+                  message: response.data.msg
+                })
+              }
+            } else {
+              this.$message.error(`请查看是否有选项未填写或填错项`)
+              return false
+            }
+          })
+        },
     // 证明材料
     async openChange(recoder) {
       this.operatorEvidence = true;
@@ -431,6 +537,11 @@ httpRequest(data) {
       for (var key in this.formOperatorList) {
         this.formOperatorList[key] = ``
       };
+
+      for (var key1 in this.formEditEmailList) {
+              this.formEditEmailList[key1] = ``
+       };
+
       this.operatorEvidence = false;
       this.current = 1
       this.pagesize = 8