| 
					
				 | 
			
			
				@@ -20,7 +20,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <a-card size="small" :bordered="false" class="salesEdit-cont"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <!-- 总计 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <a-alert style="margin-bottom: 15px;" type="info"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <div slot="message">总售价:<strong>6</strong>;总款数:<strong>6</strong>;总数量:<strong>6</strong>;赠品总数量:<strong>6</strong>;</div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <div slot="message">总售价:<strong>{{ detailData&&detailData.totalAmount || 0 }}</strong>;总款数:<strong>{{ detailData&&detailData.totalCategory || 0 }}</strong>;总数量:<strong>{{ detailData&&detailData.totalQty || 0 }}</strong>;赠品总数量:<strong>{{ detailData&&detailData.giftQty || 0 }}</strong>;</div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </a-alert> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <!-- 查询条件 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <a-row :gutter="15"> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -81,6 +81,12 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </s-table> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </a-card> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <a-card size="small" :bordered="false" class="salesEdit-cont"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <!-- 提交按钮 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <div style="text-align: center;"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <a-button size="large" type="primary" class="button-primary" @click="handleSubmit()" id="productInfoList-handleSubmit">提交</a-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </a-card> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <!-- 选择客户弹框 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <choose-custom-modal ref="custModal" :show="openModal" @updateData="getOrderDetail" @cancel="openModal=false" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   </div> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -90,7 +96,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { STable, VSelect } from '@/components' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import queryPart from './queryPart.vue' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import chooseCustomModal from './chooseCustomModal.vue' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { salesDetail } from '@/api/sales' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { salesDetail, salesWriteSubmit } from '@/api/sales' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import EditableCell from '@/views/common/editInput.js' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { salesDetailList, salesDetailInsert, salesDetailUpdatePrice, salesDetailUpdateQty, salesDetailDel, salesDetailDelAll } from '@/api/salesDetail' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export default { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -101,6 +107,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       orderId: null, // 销售单id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       salesBillSn: null, // 销售单sn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       disabled: false, //  查询、重置按钮是否可操作 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      isInster: false, // 是否正在添加产品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       openModal: false, // 客户弹框 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       detailData: null, // 订单基础数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       dataSource: [], 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -119,15 +126,15 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { title: '仓位', dataIndex: 'warehouseLocationEntity.name', width: 100, align: 'center' }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { title: '售价', scopedSlots: { customRender: 'price' }, width: 150, align: 'center' }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: 150, align: 'center' }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center' }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { title: '售价小计', dataIndex: 'xj', width: 100, align: 'center' }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { title: '折后小计', dataIndex: 'zhxj', width: 100, align: 'center' }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { title: '售价小计', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return ('¥' + text) || '--' } }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { title: '折后小计', dataIndex: 'discountedAmount', width: 100, align: 'center', customRender: function (text) { return ('¥' + text) || '--' } }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { title: '操作', scopedSlots: { customRender: 'action' }, width: 170, align: 'center', fixed: 'right' } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       ], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 加载数据方法 必须为 Promise 对象 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       loadData: parameter => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.disabled = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this.productForm.id = this.$route.params.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.productForm.salesBillSn = this.$route.params.sn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return salesDetailList(Object.assign(parameter, this.productForm)).then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           const data = res.data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           const no = (data.pageNo - 1) * data.pageSize 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -158,7 +165,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           price: row.price 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }).then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           if (res.status == 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            this.$refs.table.refresh(true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.resetSearchForm(true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           this.$message.info(res.message) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -169,7 +176,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           qty: row.qty 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }).then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           if (res.status == 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            this.$refs.table.refresh(true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.resetSearchForm(true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           this.$message.info(res.message) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -181,12 +188,13 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.$refs.custModal.editCust(this.detailData) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //  重置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    resetSearchForm () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      this.$refs.table.refresh() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    resetSearchForm (flag) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.$refs.table.refresh(!!flag) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.getOrderDetail() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //  返回 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     handleBack () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      this.$router.push({ path: '/salesManagement/salesQuery/list' }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.$router.push({ name: 'salesQueryList' }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 整单删除 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     delSalerDetailAll () { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -201,7 +209,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     handleDel (row) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       salesDetailDel({ id: row.id }).then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (res.status == 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          this.resetSearchForm() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.resetSearchForm(true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.$message.info(res.message) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -209,6 +217,11 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 添加产品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     insterProduct (row) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       console.log(row) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (this.isInster) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.$message.loading('正在添加产品...') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.isInster = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       salesDetailInsert({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         productSn: row.productSn, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         price: row.dealerProduct.cityPrice, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -219,10 +232,11 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         warehouseLocationSn: row.warehouseLocationSn, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         stockSn: row.stockSn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }).then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        console.log(res) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (res.status == 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           this.resetSearchForm() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.$message.success('产品添加成功', 2.5) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.isInster = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //  销售单详情 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -234,6 +248,15 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           this.detailData = null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 提交销售单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    handleSubmit () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      salesWriteSubmit({ id: this.orderId }).then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (res.status == 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.handleBack() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.$message.success(res.message) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   beforeRouteEnter (to, from, next) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -241,6 +264,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 获取销售单详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       vm.getOrderDetail() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       vm.orderId = vm.$route.params.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      vm.salesBillSn = vm.$route.params.sn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |