lilei 1 年間 前
コミット
bfa6e4866f

+ 1 - 1
src/views/salesManagement/salesQueryNew/detail.vue

@@ -116,7 +116,7 @@
                         <a-select-option value="GIFT">
                           促销产品
                         </a-select-option>
-                        <a-select-option value="GIFT1" v-if="showConvertPromoGifts">
+                        <a-select-option value="convertPromoGiftsFlag" v-if="showConvertPromoGifts">
                           促销产品(转采购额)
                         </a-select-option>
                         <a-select-option value="GATE">

+ 305 - 287
src/views/salesManagement/waitDispatchNew/queryPart.vue

@@ -29,7 +29,7 @@
                 <a-select-option value="GIFT">
                   促销产品
                 </a-select-option>
-                <a-select-option value="GIFT1" v-if="showConvertPromoGifts">
+                <a-select-option value="convertPromoGiftsFlag" v-if="showConvertPromoGifts">
                   促销产品(转采购额)
                 </a-select-option>
                 <a-select-option value="GATE">
@@ -68,14 +68,26 @@
         </a-row>
       </a-form>
     </div>
-   
+
     <!-- alert -->
     <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="primary" :disabled="newLoading" class="button-info" v-if="showConvertPromoGifts" @click="handlePlPurchase">批量转采购额</a-button>
-        <a-button type="primary" v-if="hasNormalProduct" ghost style="margin-left:6px;" :disabled="newLoading" @click="handlePlCancel">批量取消</a-button>
-        <a-button type="primary" v-if="hasPrompActive&&hasNoPushedActive" ghost style="margin-left:6px;" :disabled="newLoading" @click="handleAllCancel">整单取消</a-button>
+        <a-button
+          type="primary"
+          v-if="hasNormalProduct"
+          ghost
+          style="margin-left:6px;"
+          :disabled="newLoading"
+          @click="handlePlCancel">批量取消</a-button>
+        <a-button
+          type="primary"
+          v-if="hasPrompActive&&hasNoPushedActive"
+          ghost
+          style="margin-left:6px;"
+          :disabled="newLoading"
+          @click="handleAllCancel">整单取消</a-button>
         <a-tooltip placement="top" v-if="hasPrompActive&&hasNoPushedActive" style="margin-left:6px;">
           <template slot="title">
             <span>参加促销活动的产品,不能单独取消,只能整单取消。</span>
@@ -98,28 +110,28 @@
         <span v-if="$hasPermissions('B_salesDispatch_salesPrice')&&detailData&&detailData.totalConvertPromoGiftsAmount" style="color:red;">促销产品转采购额金额:<strong>{{ toThousands(detailData.totalConvertPromoGiftsAmount) }}</strong>;</span>
       </div>
     </div>
-    
+
     <a-spin :spinning="spinning" tip="Loading...">
-        <ve-table
-              border-y
-              v-show="!showEmpty"
-              :scroll-width="0"
-              :max-height="tableHeight"
-              :show-header="showTableHead"
-              :row-style-option="{clickHighlight: true}"
-              :cellSelectionOption="{enable: false}"
-              :virtual-scroll-option="{enable: true}"
-              :columns="columns"
-              :table-data="tableData"
-              row-key-field-name="id"
-              :cell-style-option="cellStyleOption"
-              :cell-span-option="cellSpanOption"
-              :column-width-resize-option="columnWidthResizeOption"
-              :checkbox-option="checkboxOption"
-            />
-        <div v-show="showEmpty" class="empty-data"><a-empty description="暂无产品" :image="simpleImage"/></div>
-        <!-- 活动规则详情 -->
-        <detailModal :openModal="openDetailModal" :itemSn="detailSn" @close="closeDetailModal"></detailModal>
+      <ve-table
+        border-y
+        v-show="!showEmpty"
+        :scroll-width="0"
+        :max-height="tableHeight"
+        :show-header="showTableHead"
+        :row-style-option="{clickHighlight: true}"
+        :cellSelectionOption="{enable: false}"
+        :virtual-scroll-option="{enable: true}"
+        :columns="columns"
+        :table-data="tableData"
+        row-key-field-name="id"
+        :cell-style-option="cellStyleOption"
+        :cell-span-option="cellSpanOption"
+        :column-width-resize-option="columnWidthResizeOption"
+        :checkbox-option="checkboxOption"
+      />
+      <div v-show="showEmpty" class="empty-data"><a-empty description="暂无产品" :image="simpleImage"/></div>
+      <!-- 活动规则详情 -->
+      <detailModal :openModal="openDetailModal" :itemSn="detailSn" @close="closeDetailModal"></detailModal>
     </a-spin>
 
   </div>
@@ -129,7 +141,7 @@
 import { commonMixin } from '@/utils/mixin'
 import { salesPromoQueryList } from '@/api/salesNew'
 import detailModal from '@/views/promotionRulesManagement/dealerPromotions/detailModal.vue'
-import { Empty } from 'ant-design-vue';
+import { Empty } from 'ant-design-vue'
 import { salesDetailAllList, salesPromoDetailCount, salesDetaiCount } from '@/api/salesDetailNew'
 import { STable, VSelect } from '@/components'
 import chooseWarehouse from '@/views/common/chooseWarehouse'
@@ -139,16 +151,16 @@ export default {
   components: { STable, VSelect, chooseWarehouse, detailModal },
   props: {
     newLoading: {
-        type: Boolean,
-        default: false
+      type: Boolean,
+      default: false
+    },
+    maxHeight: {
+      type: [String, Number],
+      default: '300'
     },
-    maxHeight:{
-          type: [String,Number],
-          default: '300'
-        },
     showHeader: {
-        type: Boolean,
-        default: true
+      type: Boolean,
+      default: true
     }
   },
   data () {
@@ -180,103 +192,103 @@ export default {
       tableData: [],
       cellStyleOption: {
         bodyCellClass: ({ row, column, rowIndex }) => {
-            if (row.id.indexOf('promo-')>=0 && column.field === "no") {
-                return "table-body-cell-no";
-            }
-        },
+          if (row.id.indexOf('promo-') >= 0 && column.field === 'no') {
+            return 'table-body-cell-no'
+          }
+        }
       },
       columnWidthResizeOption: {
-          // default false
-          enable: true,
-          // column resize min width
-          minWidth: 50
+        // default false
+        enable: true,
+        // column resize min width
+        minWidth: 50
       },
       cellSpanOption: {
-          bodyCellSpan: this.bodyCellSpan,
+        bodyCellSpan: this.bodyCellSpan
       },
       showEmpty: false,
       showTableHead: true,
       disableSelectedRowKeys: [],
       selectedRowKeys: [],
       colspanNums: 16,
-      hasNormalProduct: false,
+      hasNormalProduct: false
     }
   },
   computed: {
-    tableHeight(){
+    tableHeight () {
       return (this.showEmpty ? 200 : this.maxHeight) + 'px'
     },
-    hasPrompActive(){
-      return this.detailData&&this.detailData.promoFlag==1
+    hasPrompActive () {
+      return this.detailData && this.detailData.promoFlag == 1
     },
-    hasNoPushedActive(){
-      return this.detailData&&this.detailData.totalPushedQty==0||!this.detailData.totalPushedQty
+    hasNoPushedActive () {
+      return this.detailData && this.detailData.totalPushedQty == 0 || !this.detailData.totalPushedQty
     },
-    hasConvertPromoGifts(){
-      return this.detailData&&this.detailData.totalConvertPromoGiftsAmount > 0
+    hasConvertPromoGifts () {
+      return this.detailData && this.detailData.totalConvertPromoGiftsAmount > 0
     },
-    showConvertPromoGifts(){
-      return this.activeList&&this.activeList.find(item => item.promotionRule&&item.promotionRule.convertExpenseFlag==1&&item.promotionRule.promotionRuleType=='BUY_PROD_GIVE_PROD')
+    showConvertPromoGifts () {
+      return this.activeList && this.activeList.find(item => item.promotionRule && item.promotionRule.convertExpenseFlag == 1 && item.promotionRule.promotionRuleType == 'BUY_PROD_GIVE_PROD')
     },
     checkboxOption () {
       return {
-          disableSelectedRowKeys: this.disableSelectedRowKeys,
-          selectedRowKeys: this.selectedRowKeys,
-          // 行选择改变事件
-          selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
-            this.selectedRowChange({ row, isSelected, selectedRowKeys })
-          },
-          // 全选改变事件
-          selectedAllChange: ({ isSelected, selectedRowKeys }) => {
-            this.selectedAllChange({ isSelected, selectedRowKeys })
-          },
+        disableSelectedRowKeys: this.disableSelectedRowKeys,
+        selectedRowKeys: this.selectedRowKeys,
+        // 行选择改变事件
+        selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
+          this.selectedRowChange({ row, isSelected, selectedRowKeys })
+        },
+        // 全选改变事件
+        selectedAllChange: ({ isSelected, selectedRowKeys }) => {
+          this.selectedAllChange({ isSelected, selectedRowKeys })
+        }
       }
     },
     columns () {
       const _this = this
-          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 : '--'
-          }
-          const codeFormat = function(record,data,h){
-            let ftext = ''
-            let fcolor = ''
-            if(record.promotionFlag == 'GIFT'){
-              ftext = '促'
-              fcolor = '#52c41a'
-            }
-            if(record.promotionFlag == 'GATE'){
-              ftext = '槛'
-              fcolor = '#108ee9'
-            }
-             
-            return (
-                    <div>
-                        <span style="padding-right: 15px;">{data}</span>
-                        {ftext?(<a-badge count={ftext} number-style={{ backgroundColor: fcolor, zoom:'80%' }}></a-badge>):''}
-                        {record.bakConvertPromoGiftsQty?(<a-badge count="转" number-style={{ backgroundColor: '#ffaa00', zoom:'80%' }}></a-badge>):''}
-                        {Number(record.stockQty||0) < Number(record.unpushedQty||0)?(<a-badge count="缺" number-style={{ zoom:'80%' }}></a-badge>):''}
-                    </div>
-                )
-          }
+      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 : '--'
+      }
+      const codeFormat = function (record, data, h) {
+        let ftext = ''
+        let fcolor = ''
+        if (record.promotionFlag == 'GIFT') {
+          ftext = '促'
+          fcolor = '#52c41a'
+        }
+        if (record.promotionFlag == 'GATE') {
+          ftext = '槛'
+          fcolor = '#108ee9'
+        }
+
+        return (
+          <div>
+            <span style="padding-right: 15px;">{data}</span>
+            {ftext ? (<a-badge count={ftext} number-style={{ backgroundColor: fcolor, zoom: '80%' }}></a-badge>) : ''}
+            {record.bakConvertPromoGiftsQty ? (<a-badge count="转" number-style={{ backgroundColor: '#ffaa00', zoom: '80%' }}></a-badge>) : ''}
+            {Number(record.stockQty || 0) < Number(record.unpushedQty || 0) ? (<a-badge count="缺" number-style={{ zoom: '80%' }}></a-badge>) : ''}
+          </div>
+        )
+      }
       // 取消数量输入框
-      const inputFormat = function(record,data,h) {
-        if(record.unpushedQty>0){
+      const inputFormat = function (record, data, h) {
+        if (record.unpushedQty > 0) {
           return (
             <div>
               <a-input-number
                 size="small"
                 value={record.cancelNums}
-                onChange={e => _this.cancelNumsChange(e,record)}
+                onChange={e => _this.cancelNumsChange(e, record)}
                 precision={0}
                 min={0}
                 max={record.unpushedQty}
@@ -288,16 +300,16 @@ export default {
         return '--'
       }
       // 转采购额数量输入框
-      const inputFormat1 = function(record,data,h) {
-        if(record.unpushedQty>=0 && record.convertPromoGiftsFlag){
+      const inputFormat1 = function (record, data, h) {
+        if (record.unpushedQty >= 0 && record.convertPromoGiftsFlag) {
           // 已选
-          if(_this.selectedRowKeys.includes(record.id)){
+          if (_this.selectedRowKeys.includes(record.id)) {
             return (
               <div>
                 <a-input-number
                   size="small"
                   value={record.convertPromoGiftsQty}
-                  onChange={e => _this.convertPromoGiftsChange(e,record)}
+                  onChange={e => _this.convertPromoGiftsChange(e, record)}
                   precision={0}
                   min={0}
                   max={record.maxConvertNums}
@@ -305,100 +317,107 @@ export default {
                   placeholder="请输入" />
               </div>
             )
-          }else{
+          } else {
             return record.convertPromoGiftsQty || 0
           }
         }
         return '--'
       }
       // 操作按钮
-      const actionFormat = function(record,data,h) {
-        if(record.unpushedQty>0){
+      const actionFormat = function (record, data, h) {
+        if (record.unpushedQty > 0) {
           return (
             <div>
-               <a-button
+              <a-button
                 size="small"
                 type="link"
                 class="button-info"
-                onClick={()=>_this.handleAdd(record)}
-                >添加</a-button>
+                onClick={() => _this.handleAdd(record)}
+              >添加</a-button>
             </div>
           )
         }
         return '--'
       }
       // 编号,并且格式化活动分类行
-      const noFormat = function(record,data,h){
-        const isBuyPSendP = record.promo && record.promo.promotionRule.convertExpenseFlag==1&&record.promo.promotionRule.promotionRuleType=='BUY_PROD_GIVE_PROD'
+      const noFormat = function (record, data, h) {
+        const isBuyPSendP = record.promo && record.promo.promotionRule.convertExpenseFlag == 1 && record.promo.promotionRule.promotionRuleType == 'BUY_PROD_GIVE_PROD'
         return (
           <div>
-            {record.id.indexOf('promo-')>=0 ? (
+            {record.id.indexOf('promo-') >= 0 ? (
               <div class="active-title">
-                {record.promo?(
+                {record.promo ? (
                   <div>
                     <strong style="font-size:14px;">{record.promo.promotion.description} </strong>
                     <span>({record.promo.promotionRule.description})</span>
-                    <span style="margin-left:20px;color:#00aaff;cursor: pointer;" onClick={()=>_this.showDesc(record.promo)}>
+                    <span style="margin-left:20px;color:#00aaff;cursor: pointer;" onClick={() => _this.showDesc(record.promo)}>
                       <a-icon title="查看活动详情" type="eye"/> 活动详情
                     </span>
                   </div>
-                ):(<div></div>)}
+                ) : (<div></div>)}
                 <div>
-                  款数:<strong>{record.total&&record.total.totalCategory||'--'}</strong>;
-                  数量:<strong>{record.total&&record.total.totalQty||'--'}</strong>;
-                  {_this.$hasPermissions('B_salesEdit_salesPrice') ? (<span>总金额:<strong>{record.total&&record.total.totalAmount||'--'}</strong>;</span>):('')}
-                  {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.lossAmount ? (<span>优惠金额:<strong>{record.total.lossAmount}</strong>;</span>):('')}
-                  {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.cgejyAmount>0&&!isBuyPSendP ? (<span>采购额结余:<strong>{_this.toThousands(record.total.cgejyAmount)}</strong>;</span>):('')}
-                  {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.cgejyAmount<0&&!isBuyPSendP ? (<span>采购额超出:<strong>{_this.toThousands(record.total.cgeccAmount)}</strong>;</span>):('')}
-                  {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.totalPromoGiftsAmount&&isBuyPSendP ? (<span>促销产品转采购额金额:<strong>{_this.toThousands(record.total&&record.total.totalPromoGiftsAmount)||'--'}</strong>;</span>):('')}
-                  {record.expenseAccountFlag!='WAIT' ? record.expenseAccountFlagDictValue : ''}
+                  款数:<strong>{record.total && record.total.totalCategory || '--'}</strong>;
+                  数量:<strong>{record.total && record.total.totalQty || '--'}</strong>;
+                  {_this.$hasPermissions('B_salesEdit_salesPrice') ? (<span>总金额:<strong>{record.total && record.total.totalAmount || '--'}</strong>;</span>) : ('')}
+                  {_this.$hasPermissions('B_salesEdit_salesPrice') && record.promo && record.total && record.total.lossAmount ? (<span>优惠金额:<strong>{record.total.lossAmount}</strong>;</span>) : ('')}
+                  {_this.$hasPermissions('B_salesEdit_salesPrice') && record.promo && record.total && record.total.cgejyAmount > 0 && !isBuyPSendP ? (<span>采购额结余:<strong>{_this.toThousands(record.total.cgejyAmount)}</strong>;</span>) : ('')}
+                  {_this.$hasPermissions('B_salesEdit_salesPrice') && record.promo && record.total && record.total.cgejyAmount < 0 && !isBuyPSendP ? (<span>采购额超出:<strong>{_this.toThousands(record.total.cgeccAmount)}</strong>;</span>) : ('')}
+                  {_this.$hasPermissions('B_salesEdit_salesPrice') && record.promo && record.total && record.total.totalPromoGiftsAmount && isBuyPSendP ? (<span>促销产品转采购额金额:<strong>{_this.toThousands(record.total && record.total.totalPromoGiftsAmount) || '--'}</strong>;</span>) : ('')}
+                  {record.expenseAccountFlag != 'WAIT' ? record.expenseAccountFlagDictValue : ''}
                 </div>
               </div>
-            ):(<span>{data}</span>)}
+            ) : (<span>{data}</span>)}
           </div>
         )
       }
-       
-      let arr= [
-            { title: "", field: "", key: "acheck", width: 50, type: "checkbox", align: "center" },
-            { title: '序号', field: 'no',key: "a", width: 50, align: 'center', operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return noFormat(row,row[column.field],h)} },
-            { title: '产品编码', field: 'productCode',key: "b", width: 150, align: 'left',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return codeFormat(row,row[column.field],h)} },
-            { title: '产品名称', field: 'productName',key: "c", width: 250, align: 'left',operationColumn: false , ellipsis: { showTitle: true },renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
-            { title: '原厂编码', field: 'productOrigCode',key: "d", width: 150, align: 'left',operationColumn: false,ellipsis: { showTitle: true },renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'} },
-            { title: '出库仓库', field: 'warehouseName',key: "e", width: 100, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}}
-        ]
+
+      let arr = [
+        { title: '', field: '', key: 'acheck', width: 50, type: 'checkbox', align: 'center' },
+        { title: '序号', field: 'no', key: 'a', width: 50, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return noFormat(row, row[column.field], h) } },
+        { title: '产品编码', field: 'productCode', key: 'b', width: 150, align: 'left', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return codeFormat(row, row[column.field], h) } },
+        { title: '产品名称', field: 'productName', key: 'c', width: 250, align: 'left', operationColumn: false, ellipsis: { showTitle: true }, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
+        { title: '原厂编码', field: 'productOrigCode', key: 'd', width: 150, align: 'left', operationColumn: false, ellipsis: { showTitle: true }, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
+        { title: '出库仓库', field: 'warehouseName', key: 'e', width: 100, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } }
+      ]
       this.colspanNums = this.showConvertPromoGifts ? 7 : 6
       if (this.$hasPermissions('B_salesDispatch_salesPrice')) { //  售价权限
         this.colspanNums = this.colspanNums + 1
-        arr.push({ title: '销售价', field: 'price', width: 80,key: "f", align: 'right',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row,row[column.field],h)} })
+        arr.push({ title: '销售价', field: 'price', width: 80, key: 'f', align: 'right', 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: 'right',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return _this.toThousands(row[column.field])||'--'} })
-      }    
+        arr.push({ title: '成本价', field: 'showCost', width: 80, key: 'g', align: 'right', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return _this.toThousands(row[column.field]) || '--' } })
+      }
       this.colspanNums = this.colspanNums + 8
       arr = arr.concat([
-          { title: '单位', field: 'productOrigUnit',key: "i", width: 80, align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
-          { title: '可用库存', field: 'stockQty', width: 80,key: "j", align: 'center',fixed: 'right',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
-          { title: '销售数量', field: 'qty', width: 80,key: "k", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
-          { title: '已取消', field: 'cancelQty', width: 80,key: "o", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
-          { title: '已下推', field: 'pushedQty', width: 80,key: "p", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
-          { title: '待下推', field: 'unpushedQty', width: 80,key: "q", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
-          { title: '取消数量', field: 'cancelNums', width: 80,key: "r", align: 'center',fixed: 'right',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return inputFormat(row,row[column.field],h)} },
-        ])
-      if(this.showConvertPromoGifts){
-        arr.push({ title: '转采购额数量', field: 'convertPromoGiftsQty', width: 80,key: "z", align: 'center',fixed: 'right',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { 
-          return inputFormat1(row,row[column.field],h)
-        } })
+        { title: '单位', field: 'productOrigUnit', key: 'i', width: 80, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
+        { title: '可用库存', field: 'stockQty', width: 80, key: 'j', align: 'center', fixed: 'right', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } },
+        { title: '销售数量', field: 'qty', width: 80, key: 'k', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } },
+        { title: '已取消', field: 'cancelQty', width: 80, key: 'o', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } },
+        { title: '已下推', field: 'pushedQty', width: 80, key: 'p', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } },
+        { title: '待下推', field: 'unpushedQty', width: 80, key: 'q', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } },
+        { title: '取消数量', field: 'cancelNums', width: 80, key: 'r', align: 'center', fixed: 'right', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return inputFormat(row, row[column.field], h) } }
+      ])
+      if (this.showConvertPromoGifts) {
+        arr.push({ title: '转采购额数量',
+          field: 'convertPromoGiftsQty',
+          width: 80,
+          key: 'z',
+          align: 'center',
+          fixed: 'right',
+          operationColumn: false,
+          renderBodyCell: ({ row, column, rowIndex }, h) => {
+            return inputFormat1(row, row[column.field], h)
+          } })
       }
-      arr.push({ title: '操作', field: 'action', width: 80,key: "s", align: 'center',fixed: 'right',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return actionFormat(row,row[column.field],h)} })
-      
+      arr.push({ title: '操作', field: 'action', width: 80, key: 's', align: 'center', fixed: 'right', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return actionFormat(row, row[column.field], h) } })
+
       return arr
     }
   },
   methods: {
     // 查看活动详情
-    showDesc(row){
+    showDesc (row) {
       this.detailSn = row.promoRuleSn
       this.openDetailModal = true
     },
@@ -408,159 +427,159 @@ export default {
       this.openDetailModal = false
     },
     // 合并活动分类单元格
-    bodyCellSpan({ row, column, rowIndex }) {
-      if (row.id.indexOf('promo-')>=0) {
-        if(column.field=='no'){
+    bodyCellSpan ({ row, column, rowIndex }) {
+      if (row.id.indexOf('promo-') >= 0) {
+        if (column.field == 'no') {
           return {
-                    rowspan: 1,
-                    colspan: this.colspanNums,
-                };
-        }else{
+            rowspan: 1,
+            colspan: this.colspanNums
+          }
+        } else {
           return {
-                rowspan: 0,
-                colspan: 0,
-            }
+            rowspan: 0,
+            colspan: 0
+          }
         }
       }
     },
-    cancelNumsChange(v,record){
+    cancelNumsChange (v, record) {
       record.cancelNums = v
       this.dataSource.splice()
     },
-    convertPromoGiftsChange(v,record){
+    convertPromoGiftsChange (v, record) {
       record.convertPromoGiftsQty = v
       this.dataSource.splice()
     },
     // 选择单元格
-    selectedRowChange({ row, isSelected, selectedRowKeys }){
+    selectedRowChange ({ row, isSelected, selectedRowKeys }) {
       // console.log(row, isSelected, selectedRowKeys);
-      this.selectedRowKeys = selectedRowKeys;
-      if(!isSelected){
+      this.selectedRowKeys = selectedRowKeys
+      if (!isSelected) {
         row.convertPromoGiftsQty = row.bakConvertPromoGiftsQty
       }
     },
     // 全选行
-    selectedAllChange({ isSelected, selectedRowKeys }){
-      this.selectedRowKeys = selectedRowKeys;
+    selectedAllChange ({ isSelected, selectedRowKeys }) {
+      this.selectedRowKeys = selectedRowKeys
       // 取消全选后,重置数量
-      if(!isSelected && this.showConvertPromoGifts){
-        this.dataSource.filter(item=>item.convertPromoGiftsQty).map(item => {
+      if (!isSelected && this.showConvertPromoGifts) {
+        this.dataSource.filter(item => item.convertPromoGiftsQty).map(item => {
           item.convertPromoGiftsQty = item.bakConvertPromoGiftsQty
         })
       }
     },
     // 获取销售单参与的活动列表
-    getActiveList(){
+    getActiveList () {
       salesPromoQueryList({ salesBillSn: this.salesBillSn }).then(res => {
-        if(res.status == 200){
+        if (res.status == 200) {
           this.activeList = res.data.filter(item => item.enabledFlag == 1) || []
         }
-        this.$nextTick(()=>{
+        this.$nextTick(() => {
           this.searchTable()
         })
       })
     },
-    async searchTable(){
-        this.selectedRowKeys = []
-        this.disableSelectedRowKeys = []
-        this.dataSource = []
-        this.disabled = true
-        this.spinning = true
-        this.queryParam.salesBillSn = this.salesBillSn
-        this.queryParam.showStock = true
-        const params = this.queryParam
-        console.log(params)
-        const active = this.activeList
-        // 正常产品
-        const hasSearchNormal = !params.promotionFlag || params.promotionFlag == 0
-        const proList = hasSearchNormal ? await salesDetailAllList(params).then(res => res.data) : []
-        const norTotal = hasSearchNormal ? await salesDetaiCount(params).then(res => res.data) : null
-        // 是否有正常产品
-        this.hasNormalProduct = proList.length > 0
-        //没有活动时不显示统计
-        let listData = active.length ? (proList.length ? [{
-            id: 'promo-normal',
-            total: norTotal
-          },...proList] : []) : proList
-        
-        if(params.promotionFlag != 0){
-          // 循环获取活动产品
-          for(let i=0;i<active.length;i++){
-            const promo = active[i]
-            const activeParams = {
-              promoRuleSn: promo.promoRuleSn,
-              promoSn: promo.promoSn,
-              salesPromoSn: promo.salesPromoSn,
-              ...params
-            }
-            
-            // 获取活动产品统计
-            const acTotal = await salesPromoDetailCount(activeParams).then(res => res.data)
-            if(acTotal){
-              // 采购额结余
-              acTotal.cgejyAmount = (Number(acTotal.totalPromoGiftsAmount||0) - Number(acTotal.totalUsePromoGiftsAmount||0)).toFixed(2)
-              // 采购额超出
-              acTotal.cgeccAmount = (Number(acTotal.totalUsePromoGiftsAmount||0) - Number(acTotal.totalPromoGiftsAmount||0)).toFixed(2)
-            }
-             
-            // 有数据时才调用接口,避免做无用的调用
-            if(acTotal&&acTotal.totalQty){
-              // 获取活动产品列表
-              const aclist = await salesDetailAllList(activeParams).then(res => res.data)
-              const retList = aclist.length ? [{
-                id: 'promo-'+i,
-                promo: promo,
-                total: acTotal
-              },...aclist] : []
-              // 将活动产品数据拼接
-              listData = aclist&&aclist.length ? listData.concat(retList) : listData
-            }
+    async searchTable () {
+      this.selectedRowKeys = []
+      this.disableSelectedRowKeys = []
+      this.dataSource = []
+      this.disabled = true
+      this.spinning = true
+      this.queryParam.salesBillSn = this.salesBillSn
+      this.queryParam.showStock = true
+      const params = this.queryParam
+      console.log(params)
+      const active = this.activeList
+      // 正常产品
+      const hasSearchNormal = !params.promotionFlag || params.promotionFlag == 0
+      const proList = hasSearchNormal ? await salesDetailAllList(params).then(res => res.data) : []
+      const norTotal = hasSearchNormal ? await salesDetaiCount(params).then(res => res.data) : null
+      // 是否有正常产品
+      this.hasNormalProduct = proList.length > 0
+      // 没有活动时不显示统计
+      let listData = active.length ? (proList.length ? [{
+        id: 'promo-normal',
+        total: norTotal
+      }, ...proList] : []) : proList
+
+      if (params.promotionFlag != 0) {
+        // 循环获取活动产品
+        for (let i = 0; i < active.length; i++) {
+          const promo = active[i]
+          const activeParams = {
+            promoRuleSn: promo.promoRuleSn,
+            promoSn: promo.promoSn,
+            salesPromoSn: promo.salesPromoSn,
+            ...params
           }
-    
-          // 如果活动没有任何产品
-          if(active.length){
-            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) || []
-            }
+
+          // 获取活动产品统计
+          const acTotal = await salesPromoDetailCount(activeParams).then(res => res.data)
+          if (acTotal) {
+            // 采购额结余
+            acTotal.cgejyAmount = (Number(acTotal.totalPromoGiftsAmount || 0) - Number(acTotal.totalUsePromoGiftsAmount || 0)).toFixed(2)
+            // 采购额超出
+            acTotal.cgeccAmount = (Number(acTotal.totalUsePromoGiftsAmount || 0) - Number(acTotal.totalPromoGiftsAmount || 0)).toFixed(2)
           }
-        }
-        console.log(listData)
-        this.dataSource = listData
 
-        // 格式化数据
-        let f = 0
-        this.dataSource.map((item,i) => {
-          const isTjRow = item.id.indexOf('promo-')>=0
-          if(isTjRow){f = f - 1}
-          item.no = i + 1 + f
-          const productCode = (item.productEntity && item.productEntity.code) || (item.dealerProductEntity && item.dealerProductEntity.code)
-          const productName = (item.productEntity && item.productEntity.name) || (item.dealerProductEntity && item.dealerProductEntity.name)
-          const productOrigCode = (item.productEntity && item.productEntity.origCode) || (item.dealerProductEntity && item.dealerProductEntity.origCode)
-          const productOrigUnit = (item.productEntity && item.productEntity.unit) || (item.dealerProductEntity && item.dealerProductEntity.unit)
-          item.productCode = productCode || '--'
-          item.productName = productName || '--'
-          item.productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
-          item.productOrigUnit = productOrigUnit || '--'
-          item.cancelNums = item.unpushedQty
-          
-          if(item.convertPromoGiftsFlag == 1){
-            item.maxConvertNums = item.unpushedQty + item.convertPromoGiftsQty
-          }else{
-            item.maxConvertNums = 0
+          // 有数据时才调用接口,避免做无用的调用
+          if (acTotal && acTotal.totalQty) {
+            // 获取活动产品列表
+            const aclist = await salesDetailAllList(activeParams).then(res => res.data)
+            const retList = aclist.length ? [{
+              id: 'promo-' + i,
+              promo: promo,
+              total: acTotal
+            }, ...aclist] : []
+            // 将活动产品数据拼接
+            listData = aclist && aclist.length ? listData.concat(retList) : listData
           }
-          
-          item.bakConvertPromoGiftsQty = item.convertPromoGiftsQty
-          
-          // 库存为0或待下推数为0,不可添加
-          if(!item.convertPromoGiftsQty && (!item.unpushedQty || item.unpushedQty<0) || isTjRow){
-            this.disableSelectedRowKeys.push(item.id)
+        }
+
+        // 如果活动没有任何产品
+        if (active.length) {
+          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) || []
           }
-        })
-        this.showEmpty = this.dataSource.length <= 0
-        this.tableData = this.dataSource
-        this.spinning = false
-        this.disabled = false
+        }
+      }
+      console.log(listData)
+      this.dataSource = listData
+
+      // 格式化数据
+      let f = 0
+      this.dataSource.map((item, i) => {
+        const isTjRow = item.id.indexOf('promo-') >= 0
+        if (isTjRow) { f = f - 1 }
+        item.no = i + 1 + f
+        const productCode = (item.productEntity && item.productEntity.code) || (item.dealerProductEntity && item.dealerProductEntity.code)
+        const productName = (item.productEntity && item.productEntity.name) || (item.dealerProductEntity && item.dealerProductEntity.name)
+        const productOrigCode = (item.productEntity && item.productEntity.origCode) || (item.dealerProductEntity && item.dealerProductEntity.origCode)
+        const productOrigUnit = (item.productEntity && item.productEntity.unit) || (item.dealerProductEntity && item.dealerProductEntity.unit)
+        item.productCode = productCode || '--'
+        item.productName = productName || '--'
+        item.productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
+        item.productOrigUnit = productOrigUnit || '--'
+        item.cancelNums = item.unpushedQty
+
+        if (item.convertPromoGiftsFlag == 1) {
+          item.maxConvertNums = item.unpushedQty + item.convertPromoGiftsQty
+        } else {
+          item.maxConvertNums = 0
+        }
+
+        item.bakConvertPromoGiftsQty = item.convertPromoGiftsQty
+
+        // 库存为0或待下推数为0,不可添加
+        if (!item.convertPromoGiftsQty && (!item.unpushedQty || item.unpushedQty < 0) || isTjRow) {
+          this.disableSelectedRowKeys.push(item.id)
+        }
+      })
+      this.showEmpty = this.dataSource.length <= 0
+      this.tableData = this.dataSource
+      this.spinning = false
+      this.disabled = false
     },
     //  重置
     resetSearchForm (detailData) {
@@ -579,7 +598,7 @@ export default {
       this.clearSelectTable()
       this.searchTable()
 
-      if(detailData){
+      if (detailData) {
         this.detailData = detailData
       }
     },
@@ -591,7 +610,7 @@ export default {
     },
     // 清空选项
     clearSelectTable () {
-       this.selectedRowKeys = []
+      this.selectedRowKeys = []
     },
     // 添加
     handleAdd (row) {
@@ -602,14 +621,14 @@ export default {
       }
     },
     // 批量转采购额
-    handlePlPurchase(){
+    handlePlPurchase () {
       const _this = this
       const chooseList = this.selectedRowKeys
       if (chooseList.length == 0) {
         _this.$message.warning('请先选择产品!')
         return
       }
-      const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.convertPromoGiftsFlag==1)
+      const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.convertPromoGiftsFlag == 1)
       const noChooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && !item.convertPromoGiftsFlag)
       const obj = []
       const noObj = []
@@ -622,11 +641,11 @@ export default {
           'salesBillDetailSn': item.salesBillDetailSn
         })
       })
-      
-      if(obj.length){
+
+      if (obj.length) {
         this.$confirm({
           title: '提示',
-          content: <div><div style="text-align:center;padding:10px 0;font-weight:bold;">确定将选中的促销产品转成采购额吗?</div>{noObj.length?<div style="text-align:center;"><div>总共选择了 {chooseList.length} 个产品,其中 {obj.length} 个产品可转采购额。</div><div style="color:red;"> 产品 ({noObj.toString()}) 不可转采购额!</div></div>:''}<div style="font-size:12px;color:#999;padding:10px 0;text-align:center;">
+          content: <div><div style="text-align:center;padding:10px 0;font-weight:bold;">确定将选中的促销产品转成采购额吗?</div>{noObj.length ? <div style="text-align:center;"><div>总共选择了 {chooseList.length} 个产品,其中 {obj.length} 个产品可转采购额。</div><div style="color:red;"> 产品 ({noObj.toString()}) 不可转采购额!</div></div> : ''}<div style="font-size:12px;color:#999;padding:10px 0;text-align:center;">
 当该销售单完结后,可将采购额转成费用报销单。</div></div>,
           centered: true,
           closable: true,
@@ -635,7 +654,7 @@ export default {
             _this.$emit('convertPromoGifts', obj)
           }
         })
-      }else{
+      } else {
         _this.$message.warning('所选产品都不可转采购额!')
       }
     },
@@ -659,10 +678,10 @@ export default {
         noObj.push(item.productCode)
       })
 
-      if(obj.length){
+      if (obj.length) {
         this.$confirm({
           title: '提示',
-          content: <div><div style="text-align:center;padding:10px 0;font-weight:bold;">确认要批量添加到待下推列表吗?</div>{noObj.length?<div><div>总共选择了 {chooseList.length} 个产品,其中 {obj.length} 个产品可添加。</div><div> 产品 ({noObj.toString()}) 因库存为0不可添加!</div></div>:''}</div>,
+          content: <div><div style="text-align:center;padding:10px 0;font-weight:bold;">确认要批量添加到待下推列表吗?</div>{noObj.length ? <div><div>总共选择了 {chooseList.length} 个产品,其中 {obj.length} 个产品可添加。</div><div> 产品 ({noObj.toString()}) 因库存为0不可添加!</div></div> : ''}</div>,
           centered: true,
           closable: true,
           class: 'confirm-center',
@@ -670,10 +689,9 @@ export default {
             _this.$emit('addProduct', obj)
           }
         })
-      }else{
+      } else {
         _this.$message.warning('所选产品库存都为0,不可添加!')
       }
-      
     },
     // 整单取消
     handleAllCancel () {
@@ -696,9 +714,9 @@ export default {
         _this.$message.warning('请先选择产品!')
         return
       }
-      const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.id.indexOf('promo-')<0)
+      const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.id.indexOf('promo-') < 0)
       const hasActive = chooseRow && chooseRow.filter(item => item.promotionFlag != 0)
-      if(hasActive.length>0){
+      if (hasActive.length > 0) {
         _this.$message.warning('参与促销的产品只可进行整单取消!')
         return
       }
@@ -730,11 +748,11 @@ export default {
       background: #f3f8fa;
     }
   }
-  .ve-table .ve-table-container .ve-table-content-wrapper table.ve-table-content tbody.ve-table-body tr.ve-table-body-tr td.table-body-cell-no, 
+  .ve-table .ve-table-container .ve-table-content-wrapper table.ve-table-content tbody.ve-table-body tr.ve-table-body-tr td.table-body-cell-no,
   .ve-table .ve-table-container .ve-table-content-wrapper table.ve-table-content tbody.ve-table-body tr.ve-table-expand-tr td.table-body-cell-no{
     padding: 0;
-  } 
+  }
   .ve-table .ve-table-container .ve-table-content-wrapper{
       border-bottom: 1px solid #ddd;
     }
-</style>
+</style>