| 
					
				 | 
			
			
				@@ -19,6 +19,13 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <el-row :gutter="10" class="mb8"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <el-col :span="1.5"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <el-button 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          type="primary" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          icon="el-icon-plus" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          size="mini" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          @click="handleAdd" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          v-hasPermi="['company:companyVoice:add']" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        >充值</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <el-button 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           type="warning" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           icon="el-icon-download" 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -50,18 +57,35 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <!-- 添加或修改企业通话对话框 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <el-form ref="form" :model="form" :rules="rules" label-width="80px"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <el-form-item label="公司ID" prop="companyId"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          <el-input v-model="form.companyId" placeholder="请输入公司ID" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <el-form-item label="剩余时长 分" prop="times"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          <el-input v-model="form.times" placeholder="请输入剩余时长 分" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <el-form-item label="公司" prop="companyId"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <el-select style="width: 320px" v-model="form.companyId" placeholder="请选择公司" clearable size="small"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <el-option 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              v-for="item in companys" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              :key="item.companyId" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              :label="item.companyName" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              :value="item.companyId" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          </el-select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <el-form-item label="累计时长 分" prop="totalTimes"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          <el-input v-model="form.totalTimes" placeholder="请输入累计时长 分" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <el-form-item label="通话套餐" prop="packageId"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <el-select style="width: 320px" v-model="form.packageId" placeholder="请选择套餐" clearable size="small"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <el-option 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              v-for="item in allVoicePackageData" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              :key="item.packageId" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              :label="item.packageName" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              :value="item.packageId" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          </el-select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<!--        <el-form-item label="剩余时长 分" prop="times">--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<!--          <el-input v-model="form.times" placeholder="请输入剩余时长 分" />--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<!--        </el-form-item>--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<!--        <el-form-item label="累计时长 分" prop="totalTimes">--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<!--          <el-input v-model="form.totalTimes" placeholder="请输入累计时长 分" />--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<!--        </el-form-item>--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </el-form> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <div slot="footer" class="dialog-footer"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <el-button type="primary" @click="submitForm">确 定</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <el-button type="primary" @click="submitForm" :disabled="buyBtnDisable">确 定</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <el-button @click="cancel">取 消</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </el-dialog> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -69,7 +93,14 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { listCompanyVoice, getCompanyVoice, delCompanyVoice, addCompanyVoice, updateCompanyVoice, exportCompanyVoice } from "@/api/company/companyVoice"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  listCompanyVoice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  getCompanyVoice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  updateCompanyVoice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  exportCompanyVoice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  companyBuyVoice 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} from "@/api/company/companyVoice"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import {listAllCompanyVoicePackage} from "@/api/company/companyVoicePackage"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { getCompanyList } from "@/api/company/company"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   name: "CompanyVoice", 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -86,10 +117,12 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       multiple: true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 显示搜索条件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       showSearch: true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      buyBtnDisable: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 总条数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       total: 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 企业通话表格数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       companyVoiceList: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      allVoicePackageData: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 弹出层标题 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       title: "", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 是否显示弹出层 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -115,6 +148,9 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.companys = response.data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    listAllCompanyVoicePackage({status:1}).then(response => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.allVoicePackageData = response.data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   methods: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 查询企业通话列表 */ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -134,10 +170,8 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 表单重置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     reset() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.form = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        voiceId: null, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         companyId: null, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        times: null, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        totalTimes: null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        packageId: null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.resetForm("form"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -177,23 +211,22 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     submitForm() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.$refs["form"].validate(valid => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (valid) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          if (this.form.voiceId != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            updateCompanyVoice(this.form).then(response => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              if (response.code === 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                this.msgSuccess("修改成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                this.open = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                this.getList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            addCompanyVoice(this.form).then(response => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              if (response.code === 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                this.msgSuccess("新增成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                this.open = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                this.getList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.buyBtnDisable = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          companyBuyVoice(this.form).then(response=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (response.code === 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              this.msgSuccess("充值成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              this.open = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              this.getList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }).catch(err=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.msgError(err.message) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.open = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }).finally(()=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.reset(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            setTimeout(()=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              this.buyBtnDisable = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            },1000) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 |