lilei 1 سال پیش
والد
کامیت
cb89bf6ac0

+ 11 - 5
src/views/salesManagement/salesQueryNew/comps/detailProductList.vue

@@ -165,7 +165,7 @@ export default {
                   <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 id="salesDetail-activeDesc" style="margin-left:20px;color:#00aaff;cursor: pointer;" onClick={() => _this.showDesc(record.promo)}>
                       <a-icon title="查看活动详情" type="eye"/> 活动详情
                     </span>
                   </div>
@@ -236,8 +236,9 @@ export default {
       }
       //  审核,需用到库存
       if (this.showStock) {
-        this.colspanNums = this.colspanNums + 1
+        this.colspanNums = this.colspanNums + 2
         arr.push({ title: '库存', field: 'stockQty', width: 80, key: 'm', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } })
+        arr.push({ title: '第三方库存', field: 'stockQty', width: 80, key: 'mm', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } })
       }
       this.colspanNums = this.colspanNums + 3
       arr = arr.concat([
@@ -324,8 +325,9 @@ export default {
       // 参与活动数据
       const active = this.activeList.filter(item => item.enabledFlag == 1)
 
-      // 正常产品
+      // 是否有活动产品
       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
 
@@ -335,7 +337,7 @@ export default {
         total: norTotal
       }, ...proList] : []) : proList
 
-      // 有促销活动产品
+      // 有促销活动产品时,循环获取每个活动的数据
       if (params.promotionFlag != 0) {
         // 循环获取活动产品
         for (let i = 0; i < active.length; i++) {
@@ -371,6 +373,7 @@ export default {
         }
         // 如果活动没有任何产品,不显示统计一行
         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) || []
@@ -379,6 +382,7 @@ export default {
       }
       // 赋值
       this.dataSource = listData
+
       // 格式化数据
       let f = 0
       let str = ''
@@ -386,7 +390,7 @@ export default {
       this.dataSource.map((item, i) => {
         if (item.id.indexOf('promo-') >= 0) { 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)
@@ -396,6 +400,7 @@ export default {
         item.productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
         item.productOrigUnit = productOrigUnit || '--'
         item.epushedQty = Number(item.pushedQty) - Number(item.pushQty)
+        // 判断是否有转采购单
         if (item.unpushedQty && (Number(item.stockQty) < Number(item.unpushedQty))) {
           str += item.productCode + '、'
           if (item.promotionFlag != 0) {
@@ -403,6 +408,7 @@ export default {
           }
         }
       })
+      // 是否有缺货明细
       if (str.length > 0) {
         str = str.substr(0, str.length - 1)
         this.outStockStr = '产品编号为:' + str + '的产品库存不足;'

+ 30 - 21
src/views/salesManagement/salesQueryNew/comps/productList.vue

@@ -40,32 +40,33 @@
         <a-row :gutter="15">
           <a-col :md="4" :sm="24">
             <a-form-item label="出库仓库" prop="warehouseSn">
-              <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn" @load="warehouseLoad"></chooseWarehouse>
+              <chooseWarehouse :id="'salesEdit-warehouseSn-'+id" ref="warehouse" v-model="queryParam.warehouseSn" @load="warehouseLoad"></chooseWarehouse>
             </a-form-item>
           </a-col>
           <a-col :md="4" :sm="24">
             <a-form-item label="产品编码" prop="productCode">
-              <a-input id="salesEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
+              <a-input :id="'salesEdit-productCode-'+id" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
             </a-form-item>
           </a-col>
           <a-col :md="4" :sm="24">
             <a-form-item label="产品名称" prop="productName">
-              <a-input id="salesEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
+              <a-input :id="'salesEdit-productName-'+id" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
             </a-form-item>
           </a-col>
           <a-col :md="4" :sm="24">
             <a-form-item label="品牌">
-              <ProductBrand id="salesEdit-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
+              <ProductBrand :id="'salesEdit-productBrandSn-'+id" v-model="queryParam.productBrandSn"></ProductBrand>
             </a-form-item>
           </a-col>
           <a-col :md="4" :sm="24">
             <a-form-item label="产品分类">
-              <productTypeAll placeholder="请选择产品分类" @change="changeProductType" v-model="productType" id="salesEdit-productType"></productTypeAll>
+              <productTypeAll :id="'salesEdit-productType-'+id" placeholder="请选择产品分类" @change="changeProductType" v-model="productType"></productTypeAll>
             </a-form-item>
           </a-col>
           <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
-            <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesEdit-refresh">查询</a-button>
-            <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesEdit-reset">重置</a-button>
+            <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" :id="'salesEdit-refresh-'+id">查询</a-button>
+            <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" :id="'salesEdit-reset-'+id">重置</a-button>
+            <a-button type="primary" style="margin-left: 15px" class="button-info" :id="'salesEdit-updateStock-'+id">第三方库存</a-button>
           </a-col>
         </a-row>
       </a-form>
@@ -78,52 +79,56 @@
         </a-col>
         <a-col :md="12" :sm="24" style="text-align:right;">
           <a-button
+            :id="'salesEdit-searchBox-'+id"
             type="link"
             class="button-info"
             @click="showSearchBox=!showSearchBox" ><a-icon :type="showSearchBox?'close':'search'"/> 筛选</a-button>
           <!-- // 操作按钮 -->
           <a-dropdown>
-            <a-menu slot="overlay" @click="handleMenuClick">
-              <a-menu-item key="3" :disabled="disablePromo">
+            <a-menu slot="overlay" @click="handleMenuClick" :id="'salesEdit-menu-'+id">
+              <a-menu-item key="3" :disabled="disablePromo" :id="'salesEdit-menu-3'+id">
                 全部仓库设置
               </a-menu-item>
-              <a-menu-item key="0" :disabled="disablePromo">
+              <a-menu-item key="0" :disabled="disablePromo" :id="'salesEdit-menu-0'+id">
                 部分仓库设置
               </a-menu-item>
-              <a-menu-item key="1">
+              <a-menu-item key="1" :id="'salesEdit-menu-1'+id">
                 删除已选项
               </a-menu-item>
-              <a-menu-item key="2">
+              <a-menu-item key="2" :id="'salesEdit-menu-2'+id">
                 全部删除
               </a-menu-item>
             </a-menu>
             <a-button
+              :id="'salesEdit-plaction-'+id"
               type="link"
               class="button-info"
             > 批量操作 <a-icon type="down" /> </a-button>
           </a-dropdown>
           <!-- 导入操作 -->
           <a-dropdown :disabled="disablePromo">
-            <a-menu slot="overlay" @click="handleImportClick">
-              <a-menu-item key="GATE" v-if="promo&&promo.promotionRule&&promo.promotionRule.gateFlag==='1'">
+            <a-menu slot="overlay" @click="handleImportClick" :id="'salesEdit-menu-import-'+id">
+              <a-menu-item :id="'salesEdit-menu-import-gate-'+id" key="GATE" v-if="promo&&promo.promotionRule&&promo.promotionRule.gateFlag==='1'">
                 导入门槛产品
               </a-menu-item>
-              <a-menu-item key="REGULAR" v-if="promo&&promo.promotionRule&&promo.promotionRule.promotionRuleType!='PROMO_PROD'">
+              <a-menu-item :id="'salesEdit-menu-import-regular-'+id" key="REGULAR" v-if="promo&&promo.promotionRule&&promo.promotionRule.promotionRuleType!='PROMO_PROD'">
                 导入正价产品
               </a-menu-item>
-              <a-menu-item key="GIFT" v-if="promo&&promo.promotionRule&&(promo.promotionRule.regularPromotionSameFlag==='0'||promo.promotionRule.scopeFlag==='0'||(promo.promotionRule.promotionRuleType=='BUY_PROD_GIVE_MONEY'&&promo.promotionRule.scopeFlag==='1'))">
+              <a-menu-item :id="'salesEdit-menu-import-gift-'+id" key="GIFT" v-if="promo&&promo.promotionRule&&(promo.promotionRule.regularPromotionSameFlag==='0'||promo.promotionRule.scopeFlag==='0'||(promo.promotionRule.promotionRuleType=='BUY_PROD_GIVE_MONEY'&&promo.promotionRule.scopeFlag==='1'))">
                 导入促销产品
               </a-menu-item>
-              <a-menu-item key="DISCOUNT" v-if="promo&&promo.promotionRule&&promo.promotionRule.promotionRuleType=='PROMO_PROD'">
+              <a-menu-item :id="'salesEdit-menu-import-discount-'+id" key="DISCOUNT" v-if="promo&&promo.promotionRule&&promo.promotionRule.promotionRuleType=='PROMO_PROD'">
                 导入特价产品
               </a-menu-item>
             </a-menu>
             <a-button
+              :id="'salesEdit-menu-import-plaction-'+id"
               type="link"
               :class="disablePromo?'button-gray':'button-info'"
             > 导入产品 <a-icon type="down" /> </a-button>
           </a-dropdown>
           <a-button
+            :id="'salesEdit-menu-newProduct-'+id"
             type="link"
             :class="disablePromo?'button-gray':'button-info'"
             :disabled="disablePromo"
@@ -180,7 +185,7 @@
       <!-- 销售数量 -->
       <template slot="salesNums" slot-scope="text, record">
         <a-input-number
-          id="salesEdit-qty"
+          :id="'salesEdit-qty-'+id+'-'+record.id"
           v-if="!(record.promotionFlag == 'GIFT'&&record.salesPromoDetailParentSn)"
           size="small"
           v-model="record.qty"
@@ -203,6 +208,7 @@
       <!-- 出库仓库 -->
       <template slot="warehouseBox" slot-scope="text, record">
         <a-select
+          :id="'salesEdit-warehouse-'+id+'-'+record.id"
           size="small"
           style="width:100%;"
           placeholder="请选择仓库"
@@ -218,6 +224,7 @@
       <template slot="action" slot-scope="text, record">
         <div>
           <a-button
+            :id="'salesEdit-del-'+id+'-'+record.id"
             size="small"
             type="link"
             :loading="delLoading"
@@ -227,6 +234,7 @@
           >删除</a-button>
 
           <a-button
+            :id="'salesEdit-upactive-'+id+'-'+record.id"
             size="small"
             type="link"
             :loading="delLoading"
@@ -413,10 +421,11 @@ export default {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
         { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '13%', align: 'center' },
-        { title: '产品名称', dataIndex: 'productEntity.name', scopedSlots: { customRender: 'productName' }, width: this.promo.promotionRule.promotionRuleType == 'PROMO_PROD' ? '20%' : '26%', align: 'left' },
+        { title: '产品名称', dataIndex: 'productEntity.name', scopedSlots: { customRender: 'productName' }, width: this.promo.promotionRule.promotionRuleType == 'PROMO_PROD' ? '14%' : '20%', align: 'left' },
         { title: '起订量', dataIndex: 'unitQtyV', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: '6%', align: 'center' },
         { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '6%', align: 'center' },
+        { title: '第三方库存', dataIndex: 'stockQty', width: '6%', align: 'center', customRender: text => ((text || text == 0) ? text : '--') },
         { title: '出库仓库', scopedSlots: { customRender: 'warehouseBox' }, width: '10%', align: 'center' },
         { title: '单位', dataIndex: 'productEntity.unit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '12%', align: 'center' }
@@ -426,12 +435,12 @@ export default {
         arr.splice(3, 0, { title: '售价', dataIndex: 'price', width: '6%', align: 'right', scopedSlots: { customRender: 'price' } })
         arr.splice(4, 0, { title: '价格级别', dataIndex: 'priceLevelDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } })
         let idx = 0
-        // 如果是特价活动
+        // 如果是特价活动,显示折扣
         if (this.promo.promotionRule.promotionRuleType == 'PROMO_PROD') {
           idx = idx + 1
           arr.splice(5, 0, { title: '折扣', dataIndex: 'discountPrice', width: '6%', align: 'right', scopedSlots: { customRender: 'discountPrice' } })
         }
-        arr.splice(8 + idx, 0, { title: '售价小计', dataIndex: 'totalAmount', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
+        arr.splice(9 + idx, 0, { title: '售价小计', dataIndex: 'totalAmount', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
       }
       return arr
     }

+ 18 - 11
src/views/salesManagement/salesQueryNew/comps/productNormalList.vue

@@ -6,7 +6,7 @@
         <a-row :gutter="15">
           <a-col :md="4" :sm="24">
             <a-form-item label="出库仓库" prop="warehouseSn">
-              <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn" @load="warehouseLoad"></chooseWarehouse>
+              <chooseWarehouse id="salesEdit-warehouseSn" ref="warehouse" v-model="queryParam.warehouseSn" @load="warehouseLoad"></chooseWarehouse>
             </a-form-item>
           </a-col>
           <a-col :md="4" :sm="24">
@@ -32,6 +32,7 @@
           <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
             <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesEdit-refresh">查询</a-button>
             <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesEdit-reset">重置</a-button>
+            <a-button type="primary" style="margin-left: 15px" class="button-info" id="salesEdit-updateStock">第三方库存</a-button>
           </a-col>
         </a-row>
       </a-form>
@@ -45,22 +46,23 @@
         <a-col :md="16" :sm="24" style="text-align:right;">
           <a-dropdown>
             <a-menu slot="overlay" @click="handleMenuClick">
-              <a-menu-item key="3">
+              <a-menu-item key="3" id="salesEdit-pl-3">
                 全部仓库设置
               </a-menu-item>
-              <a-menu-item key="0">
+              <a-menu-item key="0" id="salesEdit-pl-0">
                 部分仓库设置
               </a-menu-item>
-              <a-menu-item key="1">
+              <a-menu-item key="1" id="salesEdit-pl-1">
                 删除已选项
               </a-menu-item>
-              <a-menu-item key="2">
+              <a-menu-item key="2" id="salesEdit-pl-2">
                 全部删除
               </a-menu-item>
             </a-menu>
             <a-button
               type="link"
               class="button-info"
+              id="salesEdit-plaction"
             > 批量操作 <a-icon type="down" /> </a-button>
           </a-dropdown>
           <!-- <a-button
@@ -70,8 +72,10 @@
           <a-button
             type="link"
             class="button-info"
+            id="salesEdit-import-product"
             @click="openGuideModal=true"><a-icon type="login" /> 导入产品</a-button>
           <a-button
+            id="salesEdit-new-product"
             type="link"
             class="button-info"
             @click="openCpModal"><a-icon type="plus" /> 添加产品</a-button>
@@ -115,7 +119,7 @@
       <!-- 销售数量 -->
       <template slot="salesNums" slot-scope="text, record">
         <a-input-number
-          id="salesEdit-qty"
+          :id="'salesEdit-qty-'+record.id"
           size="small"
           v-model="record.qty"
           :precision="0"
@@ -138,6 +142,7 @@
         <a-select
           size="small"
           style="width:100%;"
+          :id="'salesEdit-warehouse-'+record.id"
           placeholder="请选择仓库"
           v-model="record.warehouseSn"
           :showSearch="true"
@@ -154,6 +159,7 @@
           type="link"
           :loading="delLoading"
           class="button-error"
+          :id="'salesEdit-del-'+record.id"
           @click="handleDel(record)"
         >删除</a-button>
       </template>
@@ -289,12 +295,13 @@ export default {
     columns () {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '13%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '12%', align: 'center' },
         { title: '产品名称', dataIndex: 'productEntity.name', scopedSlots: { customRender: 'productName' }, width: '20%', align: 'left' },
-        { title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: '8%', align: 'center' },
-        { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '8%', align: 'center' },
-        { title: '出库仓库', scopedSlots: { customRender: 'warehouseBox' }, width: '15%', align: 'center' },
-        { title: '单位', dataIndex: 'productEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: '7%', align: 'center' },
+        { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '7%', align: 'center' },
+        { title: '第三方库存', dataIndex: 'stockQty', width: '8%', align: 'center', customRender: text => ((text || text == 0) ? text : '--') },
+        { title: '出库仓库', scopedSlots: { customRender: 'warehouseBox' }, width: '10%', align: 'center' },
+        { title: '单位', dataIndex: 'productEntity.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ]
       // 售价权限

+ 15 - 9
src/views/salesManagement/salesQueryNew/detail.vue

@@ -3,7 +3,7 @@
     <a-spin :spinning="spinning" tip="Loading...">
       <a-page-header :ghost="false" :backIcon="false" class="salesDetail-cont">
         <template slot="subTitle" v-if="!bizSn">
-          <a id="salesEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+          <a id="salesDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
           <span style="margin: 0 15px;color: #666;font-weight: bold;">单号:{{ detailData&&detailData.salesBillNo }}</span>
           <span v-if="detailData&&detailData.salesBillNoSource">(原:{{ detailData&&detailData.salesBillNoSource || '--' }})</span>
           <span style="margin: 0 10px;color: #666;">客户名称:{{ detailData&&detailData.buyerName }}</span>
@@ -41,7 +41,7 @@
             key="4"
             type="default"
             class="button-info"
-            id="salesDetail-export-btn"
+            id="salesDetail-exportType-btn"
             v-if="$hasPermissions('B_salesTypeExport')"
             :disabled="hasData"
             @click="handlePrint('typeExport','B_salesTypeExport')">销售分类导出</a-button>
@@ -98,12 +98,12 @@
                 <a-row :gutter="15" type="flex">
                   <a-col flex="300px">
                     <a-form-item label="出库仓库">
-                      <chooseWarehouse ref="warehouse" v-model="warehouseSn"></chooseWarehouse>
+                      <chooseWarehouse id="salesDetail-warehouse" ref="warehouse" v-model="warehouseSn"></chooseWarehouse>
                     </a-form-item>
                   </a-col>
                   <a-col flex="300px" v-if="hasPrompActive">
                     <a-form-item label="产品类型">
-                      <a-select v-model.trim="promoFlag" allowClear :dropdownMatchSelectWidth="false" placeholder="请选择产品类型">
+                      <a-select v-model.trim="promoFlag" id="salesDetail-promoFlag" allowClear :dropdownMatchSelectWidth="false" placeholder="请选择产品类型">
                         <a-select-option value="0">
                           正常产品
                         </a-select-option>
@@ -126,15 +126,16 @@
                     </a-form-item>
                   </a-col>
                   <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
-                    <a-button type="primary" @click="searchTable" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
-                    <a-button style="margin-left: 5px" @click="resetSearchForm" id="productInfoList-reset">重置</a-button>
+                    <a-button type="primary" @click="searchTable" :disabled="disabled" id="salesDetail-refresh">查询</a-button>
+                    <a-button style="margin-left: 5px" @click="resetSearchForm" id="salesDetail-reset">重置</a-button>
+                    <a-button v-if="showStock" type="primary" style="margin-left: 15px" class="button-info" id="salesDetail-updateStock">第三方库存</a-button>
                   </a-col>
                 </a-row>
               </a-form>
             </div>
             <div>
-              <a-button v-if="detailData && (detailData.billStatus == 'WAIT_AUDIT' || detailData.billStatus == 'HQ_CHANGE')" type="link" @click="openStockOut">缺货明细</a-button>
-              <a-checkbox v-model="isCityPrice" v-if="$hasPermissions(authCode + '_cityPrice')"><span style="display: inline-block;margin-top: 1px;">市级价</span></a-checkbox>
+              <a-button id="salesDetail-stockOut" v-if="detailData && (detailData.billStatus == 'WAIT_AUDIT' || detailData.billStatus == 'HQ_CHANGE')" type="link" @click="openStockOut">缺货明细</a-button>
+              <a-checkbox id="salesDetail-cityPrice" v-model="isCityPrice" v-if="$hasPermissions(authCode + '_cityPrice')"><span style="display: inline-block;margin-top: 1px;">市级价</span></a-checkbox>
             </div>
           </div>
         </div>
@@ -179,7 +180,7 @@
         style="width: 100px;margin: 0 20px;"
         :disabled="spinning"
         type="primary"
-        id="salesDetail-edit-btn"
+        id="salesDetail-edit1-btn"
         v-if="detailData&&detailData.salesBillSource == 'PURCHASE' && (detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')&&$hasPermissions('B_salesEdit')"
         @click="handleEdit()"
       >
@@ -197,6 +198,7 @@
         一键审核
       </a-button>
       <a-button
+        id="salesDetail-dispatch"
         style="width: 100px;"
         type="primary"
         class="button-warning"
@@ -300,6 +302,10 @@ export default {
     showConvertPromoGifts () {
       return this.$refs.productList && this.$refs.productList.showConvertPromoGifts
     },
+    // 是否显示库存列
+    showStock () {
+      return this.detailData && (this.detailData.billStatus == 'WAIT_AUDIT' || this.detailData.billStatus == 'HQ_CHANGE') && this.$hasPermissions('B_salesAudit')
+    },
     // 表格高度计算
     pageHeight () {
       return window.innerHeight - 305 + (this.hideFooter ? 45 : 0)

+ 50 - 26
src/views/salesManagement/waitDispatchNew/queryPart.vue

@@ -72,9 +72,16 @@
     <!-- 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 id="dispatch-plAdd" type="primary" :disabled="newLoading" class="button-info" @click="handlePlAdd">批量添加</a-button>
         <a-button
+          id="dispatch-plPurchase"
+          type="primary"
+          :disabled="newLoading"
+          class="button-info"
+          v-if="showConvertPromoGifts"
+          @click="handlePlPurchase">批量转采购额</a-button>
+        <a-button
+          id="dispatch-plCancel"
           type="primary"
           v-if="hasNormalProduct"
           ghost
@@ -82,6 +89,7 @@
           :disabled="newLoading"
           @click="handlePlCancel">批量取消</a-button>
         <a-button
+          id="dispatch-cancelAll"
           type="primary"
           v-if="hasPrompActive&&hasNoPushedActive"
           ghost
@@ -95,6 +103,7 @@
           <a-icon style="font-size: 14px;" type="question-circle" />
         </a-tooltip>
         <span style="margin-left: 10px;" v-if="selectedRowKeys.length">已选 {{ selectedRowKeys.length }} 项</span>
+        <a-button type="primary" style="margin-left: 15px" class="button-info" id="dispatch-updateStock">整单转采购单</a-button>
       </div>
       <div style="padding-left: 20px;">
         总销售数量:<strong>{{ detailData&&(detailData.totalQty || detailData.totalQty==0) ? detailData.totalQty : '--' }}</strong>;
@@ -150,15 +159,15 @@ export default {
   mixins: [commonMixin],
   components: { STable, VSelect, chooseWarehouse, detailModal },
   props: {
-    newLoading: {
+    newLoading: { // loading
       type: Boolean,
       default: false
     },
-    maxHeight: {
+    maxHeight: { // 最大高度
       type: [String, Number],
       default: '300'
     },
-    showHeader: {
+    showHeader: { // 是否显示表格头部
       type: Boolean,
       default: true
     }
@@ -166,12 +175,12 @@ export default {
   data () {
     return {
       advanced: true, // 高级搜索 展开/关闭
-      openDetailModal: false,
+      openDetailModal: false, // 活动规则详情弹框
       simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
-      detailSn: null,
-      productType: [],
-      salesBillSn: '',
-      detailData: null,
+      detailSn: null, // 活动详情sn
+      productType: [], // 产品类型
+      salesBillSn: '', // 销售单sn
+      detailData: null, // 详情数据
       queryParam: {
         pushProductType: '', // 类型
         productCode: '', //  产品编码
@@ -181,15 +190,15 @@ export default {
         productTypeSn1: '', //  产品一级分类
         productTypeSn2: '', //  产品二级分类
         productTypeSn3: '', //  产品三级分类
-        salesBillSn: '',
-        warehouseSn: undefined,
-        convertPromoGiftsFlag: undefined
+        salesBillSn: '', // 销售单sn
+        warehouseSn: undefined, // 仓库sn
+        convertPromoGiftsFlag: undefined // 转采购额
       },
       disabled: false, //  查询、重置按钮是否可操作
       activeList: [], // 活动列表
       spinning: false,
-      dataSource: [],
-      tableData: [],
+      dataSource: [], // 原始数据
+      tableData: [], // 表格数据
       cellStyleOption: {
         bodyCellClass: ({ row, column, rowIndex }) => {
           if (row.id.indexOf('promo-') >= 0 && column.field === 'no') {
@@ -206,30 +215,36 @@ export default {
       cellSpanOption: {
         bodyCellSpan: this.bodyCellSpan
       },
-      showEmpty: false,
-      showTableHead: true,
-      disableSelectedRowKeys: [],
-      selectedRowKeys: [],
-      colspanNums: 16,
-      hasNormalProduct: false
+      showEmpty: false, // 空图片
+      showTableHead: true, // 表格头部
+      disableSelectedRowKeys: [], // 禁用数据
+      selectedRowKeys: [], // 已选数据
+      colspanNums: 16, // 列合并数量
+      hasNormalProduct: false // 是否有正常产品
     }
   },
   computed: {
+    // 表格高度
     tableHeight () {
       return (this.showEmpty ? 200 : this.maxHeight) + 'px'
     },
+    // 是否有促销活动产品
     hasPrompActive () {
       return this.detailData && this.detailData.promoFlag == 1
     },
+    // 是否有下推产品
     hasNoPushedActive () {
       return this.detailData && this.detailData.totalPushedQty == 0 || !this.detailData.totalPushedQty
     },
+    // 是否有转采购额
     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')
     },
+    // 表格复选框
     checkboxOption () {
       return {
         disableSelectedRowKeys: this.disableSelectedRowKeys,
@@ -246,6 +261,7 @@ export default {
     },
     columns () {
       const _this = this
+      // 价格
       const priceFormat = function (record, data, h) {
         return (
           <div>
@@ -256,9 +272,11 @@ export default {
           </div>
         )
       }
+      // 数字
       const numsFormat = function (data) {
         return data || data == 0 ? data : '--'
       }
+      // 单号
       const codeFormat = function (record, data, h) {
         let ftext = ''
         let fcolor = ''
@@ -286,6 +304,7 @@ export default {
           return (
             <div>
               <a-input-number
+                id={'dispacth-cancelNums-' + record.productSn}
                 size="small"
                 value={record.cancelNums}
                 onChange={e => _this.cancelNumsChange(e, record)}
@@ -307,6 +326,7 @@ export default {
             return (
               <div>
                 <a-input-number
+                  id={'dispacth-maxConvertNums-' + record.productSn}
                   size="small"
                   value={record.convertPromoGiftsQty}
                   onChange={e => _this.convertPromoGiftsChange(e, record)}
@@ -329,6 +349,7 @@ export default {
           return (
             <div>
               <a-button
+                id={'dispacth-handleAdd-' + record.productSn}
                 size="small"
                 type="link"
                 class="button-info"
@@ -350,7 +371,7 @@ export default {
                   <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 id={'dispacth-desc-' + record.promo.promoRuleSn} style="margin-left:20px;color:#00aaff;cursor: pointer;" onClick={() => _this.showDesc(record.promo)}>
                       <a-icon title="查看活动详情" type="eye"/> 活动详情
                     </span>
                   </div>
@@ -384,7 +405,7 @@ export default {
         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) } })
       }
-      if (this.$hasPermissions('B_salesDispatch_costPrice')) {
+      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]) || '--' } })
       }
@@ -398,6 +419,7 @@ export default {
         { 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',
@@ -442,10 +464,12 @@ export default {
         }
       }
     },
+    // 取消数量变更
     cancelNumsChange (v, record) {
       record.cancelNums = v
       this.dataSource.splice()
     },
+    // 转采购数量变更
     convertPromoGiftsChange (v, record) {
       record.convertPromoGiftsQty = v
       this.dataSource.splice()
@@ -479,6 +503,7 @@ export default {
         })
       })
     },
+    // 查询列表
     async searchTable () {
       this.selectedRowKeys = []
       this.disableSelectedRowKeys = []
@@ -488,7 +513,7 @@ export default {
       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
@@ -544,7 +569,6 @@ export default {
           }
         }
       }
-      console.log(listData)
       this.dataSource = listData
 
       // 格式化数据
@@ -568,7 +592,7 @@ export default {
         } else {
           item.maxConvertNums = 0
         }
-
+        // 转采购额数量
         item.bakConvertPromoGiftsQty = item.convertPromoGiftsQty
 
         // 库存为0或待下推数为0,不可添加