| 
					
				 | 
			
			
				@@ -14,7 +14,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           </el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <!--<el-button type="primary" size="small" v-if="form.confirmStatus == 1" @click="newAddfun">新建销售单--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <!--</el-button>--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <el-button type="warning" size="small" :disabled="form.purchaseAmount == form.settlmentAmount" v-if="form.confirmStatus == 1" @click.stop="clickPayment">收款 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <el-button type="warning" size="small" :disabled="form.debitAmount == form.settlmentAmount" v-if="form.confirmStatus == 1" @click.stop="clickPayment">收款 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           <el-button type="info" icon="el-icon-printer" size="small" @click.stop="openReport()">报表打印 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           </el-button> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -63,7 +63,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               <!--@change="amountChange"--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <template slot="memberBalance"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                <el-input-number v-model="form.memberBalance" :disabled="detailData.status == 1" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <el-input-number v-model="form.memberBalance" :disabled="form.debitAmount == form.settlmentAmount && mebertype" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                  placeholder="请输入" size="small" :controls="false" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                  @change="memberchange"></el-input-number> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 <span style="margin-left: 10px;border: 1px solid #E4E7ED;padding: 6px;border-radius: 4px"> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -162,7 +162,13 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           width="35%" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           :before-close="paymentClose"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           <div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              <div>本次收款需要支付金额为{{this.form.currentAmount}}</div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              <div>本次收款需要支付金额为{{form.currentAmount}}</div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              <div style="display: flex;align-items: center;margin-top: 20px"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  <div style="margin-right: 10px">支付金额:</div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  <div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                      <el-input v-model="form.currentAmount" placeholder="请输入支付金额"></el-input> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               <div style="display: flex;align-items: center;margin-top: 20px"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   <div style="margin-right: 10px">支付账户:</div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   <div> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -210,6 +216,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   name: "index", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   data() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mebertype:false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 收款账户 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         accountdata:[], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 付款的弹窗开启和关闭 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -357,7 +364,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         column: [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             label: "订单金额", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            prop: "purchaseAmount", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            prop: "orderAmount", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             disabled: true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             span: 4, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           }, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -373,7 +380,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             label: "应收金额", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            prop: "balanceAmount", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            prop: "debitAmount", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             disabled: true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             span: 8, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           }, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -542,6 +549,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       optionList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (this.detailData.id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.mebertype = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.getDetail(this.detailData.id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (this.detailData.status == 1) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -575,14 +583,14 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   this.form.thisUsedProfit = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          if (Number(this.form.thisUsedProfit) > Number(this.form.purchaseAmount)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if (Number(this.form.thisUsedProfit) > Number(this.form.orderAmount)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               this.$nextTick(()=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                  this.form.thisUsedProfit = Number(this.form.purchaseAmount) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  this.form.thisUsedProfit = Number(this.form.orderAmount) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   this.form.memberBalance = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   this.form.currentAmount = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          let sum = Number(this.form.purchaseAmount) - Number(this.form.memberBalance) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          let sum = Number(this.form.orderAmount) - Number(this.form.memberBalance) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           if (Number(this.form.thisUsedProfit) > sum){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               this.$nextTick(()=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   console.log(this.form.thisUsedProfit) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -594,6 +602,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           this.$nextTick(()=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               console.log(sum - this.form.thisUsedProfit) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               this.form.currentAmount = sum - this.form.thisUsedProfit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              this.form.debitAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 会员卡金额的监听 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -615,7 +624,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   this.form.memberBalance = Number(this.balanceAmounts) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          let sum = Number(this.form.purchaseAmount) - Number(this.form.thisUsedProfit) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          let sum = Number(this.form.orderAmount) - Number(this.form.thisUsedProfit) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           if (this.form.memberBalance > sum) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               this.$nextTick(()=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   this.form.memberBalance = sum 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -654,14 +663,21 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 收款弹窗的确认 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       querenfun(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if(this.this.form.currentAmount <= 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              return this.$message.error('支付金额不能为零和负数'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          let balance = Number(this.form.debitAmount) - Number(this.form.settlmentAmount) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if(this.this.form.currentAmount > balance){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              return this.$message.error('支付金额不能大于未收金额'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           let form = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               ...this.form, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               orderFilesList: this.orderFilesList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           collectPayment(form).then(res=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               this.$message.success('收款成功'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              this.paymentVisible = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               this.getDetail(this.detailData.id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              this.paymentClose = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // // 付款弹窗的关闭 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -743,14 +759,18 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     countChange(row) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       row.amount = multiply(row.price, row.storageInQuantity) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       row.storageAmount = multiply(row.purchaseAmount, row.storageInQuantity) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       let val = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.data.forEach(e => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         val = sum(val, e.amount) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          console.log(val,'val') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.form.purchaseAmount = val 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.form.orderAmount = val 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.form.debitAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.$refs.crud.refreshTable(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -894,6 +914,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.form.currentAmount = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           this.loadingBtn = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           save({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             .then(res => { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -964,6 +985,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           this.loadingBtn = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.form.currentAmount = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           submit({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             .then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               this.$message.success("提交成功"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -988,6 +1010,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         type: 'warning' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }).then(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.loadingBtn = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.form.currentAmount = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         revoke({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           .then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             this.$message.success("撤销成功"); 
			 |