| 
					
				 | 
			
			
				@@ -60,7 +60,8 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <div style="margin-bottom: 10px;display: flex;align-items: center;" v-if="detailData"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <div style="display: flex;align-items: center;"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <a-button type="primary" :disabled="newLoading" class="button-info" @click="handlePlAdd">批量添加</a-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <a-button type="danger" :disabled="newLoading" class="button-error" @click="handlePlCancel">批量取消</a-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <a-button type="danger" v-if="hasPrompActive" :disabled="newLoading" class="button-error" @click="handleAllCancel">整单取消</a-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <a-button type="danger" v-else :disabled="newLoading" class="button-error" @click="handlePlCancel">批量取消</a-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <span style="margin-left: 10px;" v-if="selectedRowKeys.length">已选 {{ selectedRowKeys.length }} 项</span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <div style="padding-left: 20px;"> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -176,10 +177,13 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       showTableHead: true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       disableSelectedRowKeys: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       selectedRowKeys: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      colspanNums: 16 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      colspanNums: 16, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   computed: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    hasPrompActive(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return this.detailData&&this.detailData.promoFlag==1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     checkboxOption () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           disableSelectedRowKeys: this.disableSelectedRowKeys, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -196,8 +200,15 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     columns () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const _this = this 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          const priceFormat = function(data){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return _this.toThousands(data) || '--' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          const priceFormat = function(record,data,h){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              <div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                {_this.toThousands(data)} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                {record.promotionFlag == 'GIFT' || record.promotionFlag == 'DISCOUNT' ? ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  <span title="原价">({ _this.toThousands(record.origPrice)})</span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ):''} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           const numsFormat = function(data){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return data || data == 0 ? data : '--' 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -209,10 +220,6 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               ftext = '促' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               fcolor = '#52c41a' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // if(record.promotionFlag == 'REGULAR'){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   ftext = '正' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //   fcolor = '#108ee9' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(record.promotionFlag == 'DISCOUNT'){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               ftext = '特' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               fcolor = '#faad14' 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -301,11 +308,11 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.colspanNums = 6 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if (this.$hasPermissions('B_salesDispatch_salesPrice')) { //  售价权限 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.colspanNums = this.colspanNums + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        arr.push({ title: '销售价', field: 'price', width: 80,key: "f", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        arr.push({ title: '销售价', field: 'price', width: 80,key: "f", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row,row[column.field],h)} }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if (this.$hasPermissions('B_salesDispatch_costPrice')) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.colspanNums = this.colspanNums + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        arr.push({ title: '成本价', field: 'showCost', width: 80,key: "g", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        arr.push({ title: '成本价', field: 'showCost', width: 80,key: "g", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return _this.toThousands(row[column.field])||'--'} }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.colspanNums = this.colspanNums + 8 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       arr = arr.concat([ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -389,11 +396,11 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         const proList = await salesDetailAllList(params).then(res => res.data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         const norTotal = await salesDetaiCount(params).then(res => res.data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //没有活动时不显示统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let listData = active.length ? [{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let listData = active.length ? (proList.length ? [{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             id: 'promo-normal', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             total: norTotal 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          },...proList] : proList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          },...proList] : []) : proList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 循环获取活动产品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for(let i=0;i<active.length;i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           const promo = active[i] 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -408,10 +415,12 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           const aclist = await salesDetailAllList(activeParams).then(res => res.data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           // 获取活动产品统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           const acTotal = await salesPromoDetailCount(activeParams).then(res => res.data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          // 采购额结余 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          acTotal.cgejyAmount = Number(acTotal.totalPromoGiftsAmount) - Number(acTotal.totalUsePromoGiftsAmount) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          // 采购额超出 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          acTotal.cgeccAmount = Number(acTotal.totalUsePromoGiftsAmount) - Number(acTotal.totalPromoGiftsAmount) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if(acTotal){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 采购额结余 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            acTotal.cgejyAmount = Number(acTotal.totalPromoGiftsAmount||0) - Number(acTotal.totalUsePromoGiftsAmount||0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 采购额超出 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            acTotal.cgeccAmount = Number(acTotal.totalUsePromoGiftsAmount||0) - Number(acTotal.totalPromoGiftsAmount||0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           const retList = [{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             id: 'promo-'+i, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             promo: promo, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -419,10 +428,11 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           },...aclist] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           listData = aclist&&aclist.length ? listData.concat(retList) : listData 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 如果活动没有任何产品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(active.length){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          const hasAcp = listData.filter(item => item.id.indexOf("promo-")>=0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          if(hasAcp && hasAcp.length==1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          const hasAcp = listData.filter(item => item.id!='promo-normal').filter(item => item.id.indexOf("promo-")>=0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if(hasAcp && hasAcp.length==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             listData = listData.filter(item => item.id.indexOf("promo-")<0) || [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -516,6 +526,19 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 整单取消 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    handleAllCancel () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const _this = this 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.$confirm({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        title: '提示', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        content: '确定整单取消订单?', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        centered: true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        closable: true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        onOk () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          _this.$emit('cancelAll') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 批量取消 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     handlePlCancel () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const _this = this 
			 |