| 
					
				 | 
			
			
				@@ -54,7 +54,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           <el-row v-if="isProductListVisible"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <div class="title"><span style="color: red">*</span> 产品列表</div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <el-table 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              :data="dataForm.cusCBookProducts" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              :data="productList" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               border 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               style="width: 100%;"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               <el-table-column 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -129,7 +129,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 label="操作"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 <template slot-scope="scope"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   <el-button type="text" size="small" @click="updateProductHandle(scope.row)">编辑</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                  <el-button style="color: red" type="text" size="small" @click="deleteProductHandle(scope.row.productId)">删除</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  <el-button style="color: red" type="text" size="small" @click="deleteProductHandle(scope.row.recordId)">删除</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               </el-table-column> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </el-table> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -145,9 +145,9 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           <el-button @click="onChose">取消</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           <el-button type="primary" @click="dataFormSubmit()">确定</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      <add-or-update v-if="productUpdateVisible"  ref="productDialog" @addItem="changeItem" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <add-or-update v-if="productUpdateVisible"  ref="productDialog" @addItem="addItem" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <!--      <add-or-update-product v-if="productUpdateVisible" ref="productDialog" @changeItem="changeItem"/>--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      <template-chose v-if="inboundVisible" ref="inbound" @addItems="addItems" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<!--      <template-chose v-if="inboundVisible" ref="inbound" @addItems="addItems" />--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -176,7 +176,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         getCommunicationList(d.coId).then(({data}) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           if (data && data.code === '200') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             this.isProductListVisible = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            this.dataForm.cusCBookProducts = data.data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.productList = data.data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -190,6 +190,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         isProductListVisible: false, // 产品列表是否显示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         productUpdateVisible: false, // 产品修改对话框是否显示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         inboundVisible: false, // 产品新增对话框是否显示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        productList: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         id: 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         dataForm: {}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         dataRule: { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -231,6 +232,11 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (data.data.cusCBookProducts) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              data.data.cusCBookProducts.forEach((item) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.addItem(item) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -258,6 +264,11 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               this.$message.error('请上传文件') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (this.productList.length === 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              this.$message.error('请选择订单产品明细') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.dataForm.cusCBookProducts = this.productList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 产品明细 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             this.$http({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               url: this.$http.adornUrl(`/biz-service/cusContractBook/${!this.id ? 'save' : 'update'}`), 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -282,8 +293,8 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 删除产品项 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      deleteProductHandle (productId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this.dataForm.cusCBookProducts.splice(this.dataForm.cusCBookProducts.findIndex((item) => item.productId === productId)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      deleteProductHandle (recordId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.productList.splice(this.productList.findIndex((item) => item.recordId === recordId)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 编辑产品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       updateProductHandle (row) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -294,42 +305,21 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 添加产品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       addProductHandle () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this.inboundVisible = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.productUpdateVisible = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.$nextTick(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          this.$refs.inbound.init(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.$refs.productDialog.init(1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      changeItem (item) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (!item) return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this.productUpdateVisible = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let i = this.dataForm.cusCBookProducts.findIndex((item1) => item1.productId === item.productId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (i > -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          this.dataForm.cusCBookProducts.splice(i) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this.dataForm.cusCBookProducts.push(item) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       addItem (item) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (!item) return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let i = this.dataForm.cusCBookProducts.findIndex((item1) => item1.productId === item.productId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (i > -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          this.dataForm.cusCBookProducts.splice(i) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!item.recordId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          item.recordId = Math.round(Math.random() * 1000000) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this.dataForm.cusCBookProducts.push({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          cnt: 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          price: 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          productId: item.productId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          rate: 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          productName: item.productName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          notes: item.notes 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      addItems (items) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (!this.dataForm.cusCBookProducts) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          this.dataForm.cusCBookProducts = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (this.productList.findIndex(item1 => item1.recordId === item.recordId) === -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.productList.push({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ...item 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        items.forEach((item) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          this.addItem(item) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 |