Browse Source

Merge commit '7588fb0598c306a90949b9e7aa30541a9e878e92' into HEAD

gitadmin 3 months ago
parent
commit
59a3fa9c57

BIN
public/templ/产品批量导入模板.xlsx


+ 1 - 1
public/version.json

@@ -1,4 +1,4 @@
 {
-    "version": "2.2.514",
+    "version": "2.2.53",
     "message": "发现有新版本发布,确定更新系统?"
 }

+ 11 - 1
src/api/dispatch.js

@@ -93,7 +93,17 @@ export const dispatchStockOut = (params) => {
     }
   })
 }
-
+// 修改库存类型
+export const dispatchUpdateStockType = (params) => {
+  return axios({
+    url: '/dispatch/updateStockType',
+    data: params,
+    method: 'post',
+    headers:{
+      'module': encodeURIComponent('下推单修改轮胎库存类型')
+    }
+  })
+}
 // 备货审核
 export const dispatchStockUpAduit = (params) => {
   return axios({

+ 4 - 0
src/views/productManagement/productInfo/chooseImportModal.vue

@@ -108,6 +108,8 @@ export default {
         { title: '颜色', dataIndex: 'color', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '产品内盒尺寸', dataIndex: 'boxSize', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '产品说明', dataIndex: 'description', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '出库仓库', dataIndex: 'outWarehouseName', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货仓库', dataIndex: 'returnWarehouseName', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '其他说明', dataIndex: 'otherDesc', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
       ],
       loadData: [], // 可导入数据
@@ -132,6 +134,8 @@ export default {
         { title: '产品内盒尺寸', dataIndex: 'boxSize', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '产品说明', dataIndex: 'description', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '其他说明', dataIndex: 'otherDesc', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '出库仓库', dataIndex: 'outWarehouseName', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货仓库', dataIndex: 'returnWarehouseName', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '备注', dataIndex: 'errorMsg', width: '5%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
       unLoadData: [], // 导入错误数据

+ 2 - 0
src/views/productManagement/productInfo/detailModal.vue

@@ -24,6 +24,8 @@
         </a-descriptions-item>
         <a-descriptions-item label="箭冠产品:">{{ detailsData&&detailsData.arrowFalgDictValue || '--' }}</a-descriptions-item>
         <a-descriptions-item label="条形码:" :span="2">{{ detailsData&&detailsData.qrCode || '--' }}</a-descriptions-item>
+        <a-descriptions-item label="出库仓库:">{{ detailsData&&detailsData.outWarehouseName || '--' }}</a-descriptions-item>
+        <a-descriptions-item label="退货仓库:">{{ detailsData&&detailsData.returnWarehouseName || '--' }}</a-descriptions-item>
         <a-descriptions-item label="产品图片:" :span="2">
           <div style="display: flex;">
             <p class="pic-box" v-for="(item,index) in fileList" :key="index">

+ 21 - 2
src/views/productManagement/productInfo/edit.vue

@@ -133,6 +133,16 @@
                   allowClear />
               </a-form-model-item>
             </a-col>
+            <a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+              <a-form-model-item label="出库仓库" prop="outWarehouseSn">
+                <chooseWarehouse ref="outWarehouse" id="productInfoEdit-outWarehouse" isPermission v-model="form.outWarehouseSn"></chooseWarehouse>
+              </a-form-model-item>
+            </a-col>
+            <a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+              <a-form-model-item label="退货仓库" prop="returnWarehouseSn">
+                <chooseWarehouse ref="returnWarehouse" id="productInfoEdit-returnWarehouse" isPermission v-model="form.returnWarehouseSn"></chooseWarehouse>
+              </a-form-model-item>
+            </a-col>
           </a-row>
           <a-row>
             <a-col :xs="24" :sm="24" :md="24" :lg="16" :xl="16">
@@ -221,6 +231,7 @@ import { commonMixin } from '@/utils/mixin'
 // 组件
 import { VSelect, Upload } from '@/components'
 import Editor from '@/components/WEeditor'
+import chooseWarehouse from '@/views/common/chooseWarehouse'
 // 接口
 import { productSave, productSnDetail } from '@/api/product'
 import { productTypeQueryAll } from '@/api/productType'
@@ -228,7 +239,7 @@ import { productBrandQuery } from '@/api/productBrand'
 export default {
   name: 'ProductInfoEdit',
   mixins: [commonMixin],
-  components: { VSelect, Upload, Editor },
+  components: { VSelect, Upload, Editor, chooseWarehouse },
   data () {
     return {
       spinning: false,
@@ -257,7 +268,9 @@ export default {
         color: undefined, // 颜色
         boxSize: '', // 内核尺寸
         description: '', // 产品说明
-        otherDesc: '' // 其他说明
+        otherDesc: '', // 其他说明
+        outWarehouseSn: undefined, // 出库仓库
+        returnWarehouseSn: undefined// 退货仓库
       },
       // 表单验证规则
       rules: {
@@ -287,6 +300,12 @@ export default {
         arrowFalg: [
           { required: true, message: '请选择是否为箭冠产品', trigger: 'change' }
         ],
+        outWarehouseSn: [
+          { required: true, message: '请选择出库仓库', trigger: 'change' }
+        ],
+        returnWarehouseSn: [
+          { required: true, message: '请选择退货仓库', trigger: 'change' }
+        ],
         qrCode: [
           { required: false, message: '请输入条形码', trigger: 'change' },
           { validator: this.validateQrCode }

+ 1 - 1
src/views/productManagement/productInfo/importGuideModal.vue

@@ -17,7 +17,7 @@
           <ul>
             <li>1) 请先下载导入模板,模板中已标示出必填项</li>
             <li>2) 产品编码具有唯一性,{{ guideType=='1'?'系统中已存在的无法导入':'下线导入,必须是系统中已存在的产品编码' }}</li>
-            <li v-if="guideType=='1'">3) 产品品牌、产品分类、单位、包装数单位,必须是系统中已经存在的值,否则无法导入</li>
+            <li v-if="guideType=='1'">3) 产品品牌、产品分类、单位、包装数单位、出库仓库、退货仓库,必须是系统中已经存在的值,否则无法导入</li>
             <li v-if="guideType=='2'"><a :href="filePath" style="margin: 5px 0 0 15px;display: block;">
               <a-icon type="download" style="padding-right: 5px;" />下载导入模板
             </a></li>

+ 33 - 33
src/views/productManagement/productInfo/list.vue

@@ -65,6 +65,16 @@
                   </a-select>
                 </a-form-item>
               </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="出库仓库">
+                  <chooseWarehouse ref="outWarehouse" id="productInfoList-outWarehouse" isPermission v-model="queryParam.outWarehouseSn"></chooseWarehouse>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="退货仓库">
+                  <chooseWarehouse ref="returnWarehouse" id="productInfoList-returnWarehouse" isPermission v-model="queryParam.returnWarehouseSn"></chooseWarehouse>
+                </a-form-model-item>
+              </a-col>
             </template>
             <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
               <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
@@ -246,12 +256,13 @@ import ProductBrand from '@/views/common/productBrand.js'
 import productTypeAll from '@/views/common/productTypeAll.js'
 import rangeDate from '@/views/common/rangeDate.vue'
 import importGuideModal from './importGuideModal.vue'
+import chooseWarehouse from '@/views/common/chooseWarehouse'
 // 接口
 import { productList, productAudit, productBatchAudit, productDel, productOnline, productBatchOnline, productExport, saveBatchImportProduct, importSaveBatch, updateHaltProdFlag } from '@/api/product'
 export default {
   name: 'ProductInfoList',
   mixins: [commonMixin],
-  components: { STable, VSelect, productInfoDetailModal, productInfoOfflineModal, ProductBrand, productTypeAll, rangeDate, importGuideModal },
+  components: { STable, VSelect, productInfoDetailModal, productInfoOfflineModal, ProductBrand, productTypeAll, rangeDate, importGuideModal, chooseWarehouse },
   data () {
     return {
       spinning: false,
@@ -272,7 +283,9 @@ export default {
         productTypeSn3: '', //  产品三级分类
         state: undefined, //  产品状态
         pricingState: undefined, //  定价状态
-        picFlag: undefined// 产品图片
+        picFlag: undefined, // 产品图片
+        outWarehouseSn: undefined, // 出库仓库
+        returnWarehouseSn: undefined// 退货仓库
       },
       productType: [], // 产品类型
 
@@ -280,7 +293,7 @@ export default {
       columns: [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'name', align: 'left', width: '14%', ellipsis: true, customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'name', align: 'left', width: '12%', ellipsis: true, customRender: function (text) { return text || '--' } },
         { title: '产品编码', dataIndex: 'code', width: '10%', align: 'left', customRender: function (text) { return text || '--' } },
         { title: '原厂编码', dataIndex: 'origCode', width: '10%', align: 'left', customRender: function (text) { return text || '--' } },
         { title: '品牌', dataIndex: 'productBrandName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
@@ -292,6 +305,8 @@ export default {
         { title: '定价状态', dataIndex: 'pricingStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '停产状态', width: '6%', align: 'center', scopedSlots: { customRender: 'stopStatus' } },
         { title: '产品图片', scopedSlots: { customRender: 'imageUrl' }, width: '5%', align: 'center' },
+        { title: '出库仓库', dataIndex: 'outWarehouseName', width: '8%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '退货仓库', dataIndex: 'returnWarehouseName', width: '8%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ],
       loadingAudit: false, // 审核按钮加载状态
@@ -351,21 +366,14 @@ export default {
     // 批量导入产品
     hanldeOk (obj) {
       this.spinning = true
-      if (obj && obj.type && obj.type == 'offline') { // 下线导入
-        importSaveBatch(obj).then(res => {
-          if (res.status == 200) {
-            this.resetSearchForm()
-          }
-          this.spinning = false
-        })
-      } else {
-        saveBatchImportProduct(obj).then(res => {
-          if (res.status == 200) {
-            this.resetSearchForm()
-          }
-          this.spinning = false
-        })
-      }
+      // importSaveBatch 下线导入
+      const ajaxName = obj && obj.type && obj.type == 'offline' ? importSaveBatch : saveBatchImportProduct
+      ajaxName(obj).then(res => {
+        if (res.status == 200) {
+          this.resetSearchForm()
+        }
+        this.spinning = false
+      })
     },
     // 审核
     handleAudit (row) {
@@ -380,10 +388,8 @@ export default {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
-              _this.spinning = false
-            } else {
-              _this.spinning = false
             }
+            _this.spinning = false
           })
         }
       })
@@ -420,10 +426,8 @@ export default {
               _this.$refs.table.clearSelected() // 清空表格选中项
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
-              _this.spinning = false
-            } else {
-              _this.spinning = false
             }
+            _this.spinning = false
           })
         }
       })
@@ -484,10 +488,8 @@ export default {
               _this.$refs.table.clearSelected() // 清空表格选中项
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
-              _this.spinning = false
-            } else {
-              _this.spinning = false
             }
+            _this.spinning = false
           })
         }
       })
@@ -525,6 +527,8 @@ export default {
       this.queryParam.pricingState = undefined
       this.queryParam.picFlag = undefined
       this.queryParam.haltProdFlag = undefined
+      this.queryParam.outWarehouseSn = undefined
+      this.queryParam.returnWarehouseSn = undefined
       this.productType = []
       if (this.advanced) {
         this.$refs.rangeDate.resetDate()
@@ -554,10 +558,8 @@ export default {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
-              _this.spinning = false
-            } else {
-              _this.spinning = false
             }
+            _this.spinning = false
           })
         }
       })
@@ -580,10 +582,8 @@ export default {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
-              _this.spinning = false
-            } else {
-              _this.spinning = false
             }
+            _this.spinning = false
           })
         }
       })

+ 4 - 2
src/views/salesManagement/salesQueryNew/comps/productList.vue

@@ -659,7 +659,7 @@ export default {
         salesBillDetailSnList: snArr,
         salesBillSn: _this.salesBillSn,
         salesPromoSn: _this.promo.salesPromoSn,
-        allFlag: _this.warehouseTit ? true : undefined
+        allFlag: _this.warehouseTit == '全部仓库设置' ? true : undefined
       }
       _this.setWarehouseInfo(ajax_data)
     },
@@ -672,9 +672,10 @@ export default {
         if (res.status == 200) {
           _this.$message.success(res.message)
           _this.$emit('insterOk', 'promo')
+          _this.$refs.table.refresh(false)
+          _this.$refs.table.clearSelected()
         }
         _this.openWarehouseModal = false
-        _this.$refs.table.refresh(false)
         _this.spinning = false
       })
     },
@@ -685,6 +686,7 @@ export default {
         if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
           _this.$message.warning('请先选择要设置的产品!')
         } else {
+          _this.warehouseTit = '部分仓库设置'
           _this.openWarehouseModal = true
         }
       } else if (e.key == 1) { // 删除已选项

+ 4 - 3
src/views/salesManagement/salesQueryNew/comps/productNormalList.vue

@@ -464,7 +464,7 @@ export default {
         warehouseSn: sn,
         salesBillDetailSnList: snArr,
         salesBillSn: _this.salesBillSn,
-        allFlag: _this.warehouseTit ? true : undefined
+        allFlag: _this.warehouseTit == '全部仓库设置' ? true : undefined
       }
       _this.setWarehouseInfo(ajax_data)
     },
@@ -475,9 +475,10 @@ export default {
       updateWarehouse(data).then(res => {
         if (res.status == 200) {
           _this.$message.success(res.message)
-          _this.$emit('insterOk', 'promo')
+          _this.$emit('insterOk', 'normal')
+          _this.$refs.table.refresh(false)
+          _this.$refs.table.clearSelected()
         }
-        _this.$refs.table.refresh(false)
         _this.openWarehouseModal = false
         _this.spinning = false
       })

+ 2 - 2
src/views/salesManagement/salesQueryNew/list.vue

@@ -203,10 +203,10 @@
           <template slot="warehouseBox" slot-scope="text, record">
             <a-tooltip placement="right" v-if="record.warehouseNameSet && record.warehouseNameSet.length>0">
               <template slot="title">
-                <span>{{ record.warehouseNameSet.toString() }}</span>
+                <span>{{ record.warehouseNameSet.filter(item => item != null).toString() }}</span>
               </template>
               <div class="warehouse_box">
-                <span>{{ record.warehouseNameSet.toString() }}</span>
+                <span>{{ record.warehouseNameSet.filter(item => item != null).toString() }}</span>
               </div>
             </a-tooltip>
             <div v-else>--</div>

+ 8 - 2
src/views/salesManagement/waitDispatchNew/detailProductList.vue

@@ -232,11 +232,11 @@ export default {
       this.spinning = true
       const params = this.productForm
       // 带下推产品
-      const listData = await waitDispatchDetailAllList(params).then(res => res.data)
-      this.dataSource = listData
+      this.dataSource = await waitDispatchDetailAllList(params).then(res => res.data)
 
       // 格式化数据
       let f = 0
+      let hasLt = false
       this.dataSource.map((item, i) => {
         if (item.id.indexOf('promo-') >= 0) { f = f - 1 }
         item.no = i + 1 + f
@@ -253,9 +253,15 @@ export default {
         item.warehouseName = warehouseName || '--'
         item.qtyBackups = item.qty
         item.prompName = prompName || '--'
+        const productBrand = (item.productEntity && item.productEntity.productBrandName) || (item.dealerProductEntity && item.dealerProductEntity.productBrandName)
+        const productType3 = (item.productEntity && item.productEntity.productTypeName3) || (item.dealerProductEntity && item.dealerProductEntity.productTypeName3)
+        if (productBrand && productBrand.indexOf('箭冠') >= 0 && productBrand && productType3.indexOf('轮胎') >= 0) {
+          hasLt = true
+        }
       })
       this.showEmpty = this.dataSource.length <= 0
       this.tableHeight = (this.showEmpty ? 300 : this.maxHeight) + 'px'
+      this.$emit('upStockType', hasLt)
       this.spinning = false
       this.disabled = false
     },

+ 23 - 5
src/views/salesManagement/waitDispatchNew/edit.vue

@@ -17,7 +17,9 @@
           @cancelProduct="cancelProduct"
           @cancelAll="cancelAll"
           @convertPromoGifts="convertPromoGifts"
-          @addProduct="insterProduct"></queryPart>
+          @addProduct="insterProduct"
+          @updateStockType="updateStockType"
+        ></queryPart>
       </a-card>
       <a-card size="small" :bordered="false" class="waitDispatch-cont">
         <div slot="title">
@@ -25,9 +27,8 @@
             待下推产品
           </div>
         </div>
-
         <!-- 已选配件列表 -->
-        <detailProductList ref="waitProduct" @refashTable="refashTable">
+        <detailProductList ref="waitProduct" @refashTable="refashTable" @upStockType="upStockType">
           <!-- 统计数据 -->
           <template slot="total">
             本次下推款数:<strong>{{ totalData&&(totalData.totalCategory || totalData.totalCategory==0) ? totalData.totalCategory : '--' }}</strong>;
@@ -62,7 +63,7 @@ import dsModal from './dsModal.vue'
 import { salesDetailBySn } from '@/api/salesNew'
 import { insertBatchOfWaitDispatch, salesDetailUpdateCancelQty, salesDetailCancleOfAll, batchTransferOfPurchaseAmount } from '@/api/salesDetailNew'
 import { pushDown } from '@/api/waitDispatchDetail'
-import { findBySalesBillSn } from '@/api/dispatch'
+import { findBySalesBillSn, dispatchUpdateStockType } from '@/api/dispatch'
 
 export default {
   name: 'WaitDispatch',
@@ -91,12 +92,12 @@ export default {
     },
     // 统计查询
     getTotalData (flag) {
+      const _this = this
       findBySalesBillSn({ salesBillSn: this.$route.params.salesBillSn }).then(res => {
         if (res.status == 200) {
           this.totalData = res.data || null
           if (res.data && Object.keys(res.data).length > 0) {
             this.productForm.dispatchBillSn = res.data.dispatchBillSn
-            const _this = this
             if (flag) {
               _this.$refs.waitProduct.pageInit(this.productForm, this.detailData, this.$refs.partQuery.activeList)
             } else {
@@ -108,6 +109,23 @@ export default {
         }
       })
     },
+    // 更新轮胎库存类型
+    updateStockType (val) {
+      this.spinning = true
+      dispatchUpdateStockType({ stockType: val, dispatchBillSn: this.productForm.dispatchBillSn }).then(res => {
+        if (res.status != 200) {
+          this.$refs.partQuery.stockType = val == 'LOCK_STOCK' ? 'CURRENT_STOCK' : 'LOCK_STOCK'
+        }
+        this.spinning = false
+      })
+    },
+    // 禁用库存类型选项
+    upStockType (hasLt) {
+      this.$refs.partQuery.stockDisabled = hasLt
+      if (hasLt) {
+        this.$refs.partQuery.stockType = this.totalData.stockType
+      }
+    },
     // 添加产品
     insterProduct (list) {
       // 防止多次添加产品

+ 103 - 69
src/views/salesManagement/waitDispatchNew/queryPart.vue

@@ -70,62 +70,71 @@
     </div>
 
     <!-- alert -->
-    <div style="margin-bottom: 10px;display: flex;align-items: center;" v-if="detailData">
-      <div style="display: flex;align-items: center;">
-        <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
-          style="margin-left:6px;"
-          :disabled="newLoading"
-          @click="handlePlCancel">批量取消</a-button>
-        <a-button
-          id="dispatch-cancelAll"
-          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>
-          </template>
-          <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
-          @click="confirPurchaseModal"
-          :loading="loading"
-          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>;
-        已取消数量:<strong>{{ detailData&&(detailData.totalCancelQty || detailData.totalCancelQty==0) ? detailData.totalCancelQty : '--' }}</strong>;
-        已下推数量:<strong>{{ detailData&&(detailData.totalPushedQty || detailData.totalPushedQty==0) ? detailData.totalPushedQty : '--' }}</strong>;
-        待下推数量:<strong>{{ detailData&&(detailData.totalUnpushedQty || detailData.totalUnpushedQty==0) ? detailData.totalUnpushedQty : '--' }}</strong>;
-        <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">总售价:<strong>{{ detailData&&(detailData.totalAmount || detailData.totalAmount==0) ? toThousands(detailData.totalAmount) : '--' }}</strong>;</span>
-        <span v-if="$hasPermissions('B_salesDispatch_costPrice')">总成本:<strong>{{ detailData&&(detailData.totalCost || detailData.totalCost==0) ? toThousands(detailData.totalCost) : '--' }}</strong>;</span>
-        <span v-if="$hasPermissions('B_salesDispatch_costPrice')&&$hasPermissions('B_salesDispatch_salesPrice')">总毛利:<strong>{{ detailData&&(detailData.grossProfit || detailData.grossProfit==0) ? toThousands(detailData.grossProfit) : '--' }}</strong>;</span>
-        <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">已取消金额:<strong>{{ detailData&&(detailData.totalCancelAmount || detailData.totalCancelAmount==0) ? toThousands(detailData.totalCancelAmount) : '--' }}</strong>;</span>
-        <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">已下推金额:<strong>{{ detailData&&(detailData.totalPushedAmount || detailData.totalPushedAmount==0) ? toThousands(detailData.totalPushedAmount) :'--' }}</strong>;</span>
-        <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">待下推金额:<strong>{{ detailData&&(detailData.totalUnpushedAmount || detailData.totalUnpushedAmount==0) ? toThousands(detailData.totalUnpushedAmount) : '--' }}</strong>;</span>
-        <span v-if="$hasPermissions('B_salesDispatch_salesPrice')&&detailData&&detailData.totalConvertPromoGiftsAmount" style="color:red;">促销产品转采购额金额:<strong>{{ toThousands(detailData.totalConvertPromoGiftsAmount) }}</strong>;</span>
-      </div>
-    </div>
+    <div style="display: flex;align-items: center;">
+      <span v-if="selectedRowKeys.length">已选 {{ selectedRowKeys.length }} 项</span>
+      <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
+        style="margin-left:6px;"
+        :disabled="newLoading"
+        @click="handlePlCancel">批量取消</a-button>
 
+      <a-button
+        id="dispatch-cancelAll"
+        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>
+        </template>
+        <a-icon style="font-size: 14px;" type="question-circle" />
+      </a-tooltip>
+      <v-select
+        v-if="hasJGtire"
+        :disabled="stockDisabled"
+        style="margin-left: 15px;width:150px;"
+        v-model="stockType"
+        id="dispatch-stockType"
+        code="TIRE_STOCK_TYPE"
+        placeholder="请选择库存类型"
+        @change="stockTypeChange"
+      ></v-select>
+      <a-button
+        v-if="hasJGtire && stockType=='LOCK_STOCK'"
+        @click="confirPurchaseModal"
+        :loading="loading"
+        type="primary"
+        style="margin-left: 6px"
+        class="button-info"
+        id="dispatch-updateStock">轮胎转采购单</a-button>
+    </div>
+    <div style="padding:10px 0;" v-if="detailData">
+      总销售数量:<strong>{{ detailData&&(detailData.totalQty || detailData.totalQty==0) ? detailData.totalQty : '--' }}</strong>;
+      已取消数量:<strong>{{ detailData&&(detailData.totalCancelQty || detailData.totalCancelQty==0) ? detailData.totalCancelQty : '--' }}</strong>;
+      已下推数量:<strong>{{ detailData&&(detailData.totalPushedQty || detailData.totalPushedQty==0) ? detailData.totalPushedQty : '--' }}</strong>;
+      待下推数量:<strong>{{ detailData&&(detailData.totalUnpushedQty || detailData.totalUnpushedQty==0) ? detailData.totalUnpushedQty : '--' }}</strong>;
+      <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">总售价:<strong>{{ detailData&&(detailData.totalAmount || detailData.totalAmount==0) ? toThousands(detailData.totalAmount) : '--' }}</strong>;</span>
+      <span v-if="$hasPermissions('B_salesDispatch_costPrice')">总成本:<strong>{{ detailData&&(detailData.totalCost || detailData.totalCost==0) ? toThousands(detailData.totalCost) : '--' }}</strong>;</span>
+      <span v-if="$hasPermissions('B_salesDispatch_costPrice')&&$hasPermissions('B_salesDispatch_salesPrice')">总毛利:<strong>{{ detailData&&(detailData.grossProfit || detailData.grossProfit==0) ? toThousands(detailData.grossProfit) : '--' }}</strong>;</span>
+      <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">已取消金额:<strong>{{ detailData&&(detailData.totalCancelAmount || detailData.totalCancelAmount==0) ? toThousands(detailData.totalCancelAmount) : '--' }}</strong>;</span>
+      <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">已下推金额:<strong>{{ detailData&&(detailData.totalPushedAmount || detailData.totalPushedAmount==0) ? toThousands(detailData.totalPushedAmount) :'--' }}</strong>;</span>
+      <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">待下推金额:<strong>{{ detailData&&(detailData.totalUnpushedAmount || detailData.totalUnpushedAmount==0) ? toThousands(detailData.totalUnpushedAmount) : '--' }}</strong>;</span>
+      <span v-if="$hasPermissions('B_salesDispatch_salesPrice')&&detailData&&detailData.totalConvertPromoGiftsAmount" style="color:red;">促销产品转采购额金额:<strong>{{ toThousands(detailData.totalConvertPromoGiftsAmount) }}</strong>;</span>
+    </div>
     <a-spin :spinning="spinning" tip="Loading...">
       <ve-table
         border-y
@@ -234,7 +243,10 @@ export default {
       selectedRowKeys: [], // 已选数据
       colspanNums: 16, // 列合并数量
       hasNormalProduct: false, // 是否有正常产品
-      showLockStockQty: false // 是否显示锁定库存列
+      showLockStockQty: false, // 是否显示锁定库存列
+      stockType: undefined, // 默认锁定库存
+      hasJGtire: false, // 是否轮胎产品
+      stockDisabled: false
     }
   },
   computed: {
@@ -524,6 +536,10 @@ export default {
         })
       })
     },
+    // 修改库存类型
+    stockTypeChange (val) {
+      this.$emit('updateStockType', val)
+    },
     // 查询列表
     async searchTable () {
       this.selectedRowKeys = []
@@ -602,6 +618,8 @@ export default {
         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)
+        const productBrand = (item.productEntity && item.productEntity.productBrandName) || (item.dealerProductEntity && item.dealerProductEntity.productBrandName)
+        const productType3 = (item.productEntity && item.productEntity.productTypeName3) || (item.dealerProductEntity && item.dealerProductEntity.productTypeName3)
         item.productCode = productCode || '--'
         item.productName = productName || '--'
         item.productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
@@ -613,6 +631,17 @@ export default {
         } else {
           item.maxConvertNums = 0
         }
+
+        // 判断是否有箭冠轮胎产品
+        if (productBrand && productBrand.indexOf('箭冠') >= 0 && productBrand && productType3.indexOf('轮胎') >= 0) {
+          this.hasJGtire = true
+          // 默认锁定库存类型
+          if (!this.stockType) {
+            this.stockType = 'LOCK_STOCK'
+            this.stockTypeChange('LOCK_STOCK')
+          }
+        }
+
         // 转采购额数量
         item.bakConvertPromoGiftsQty = item.convertPromoGiftsQty
 
@@ -661,13 +690,16 @@ export default {
     },
     // 添加
     handleAdd (row) {
-      if (row && row.productEntity && row.productEntity.productBrandName == '箭冠' && row.productEntity.productTypeName3 == '轮胎') {
+      const isLt = row && row.productEntity && row.productEntity.productBrandName == '箭冠' && row.productEntity.productTypeName3 == '轮胎'
+      // 如果库存类型是锁定库存 且 轮胎产品
+      if (this.stockType && this.stockType == 'LOCK_STOCK' && isLt) {
         if (!row.lockStockQty) {
           this.$message.warning('锁定库存为0,不可添加!')
         } else {
           this.$emit('addProduct', [row.salesBillDetailSn])
         }
       } else {
+        // 库存类型可用库存或非轮胎产品
         if (row.stockQty > 0) { //  可用库存大于0才可添加
           this.$emit('addProduct', [row.salesBillDetailSn])
         } else {
@@ -721,11 +753,18 @@ export default {
         _this.$message.warning('请先选择产品!')
         return
       }
-
-      // 库存为0的产品,不包括箭冠轮胎产品
-      const noStockRow = this.dataSource.filter(item => chooseList.includes(item.id) && !item.stockQty && item.productEntity && item.productEntity.productBrandName != '箭冠' && item.productEntity.productTypeName3 != '轮胎')
-      // 锁定库存为0的产品,只判断箭冠轮胎产品
-      const noLockStockRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.productEntity && item.productEntity.productBrandName == '箭冠' && item.productEntity.productTypeName3 == '轮胎' && !item.lockStockQty)
+      let noStockRow = []
+      let noLockStockRow = []
+      // 库存类型是 锁定库存
+      if (this.stockType && this.stockType == 'LOCK_STOCK') {
+        // 库存为0的产品,不包括箭冠轮胎产品
+        noStockRow = this.dataSource.filter(item => chooseList.includes(item.id) && !item.stockQty && item.productEntity && item.productEntity.productBrandName != '箭冠' && item.productEntity.productTypeName3 != '轮胎')
+        // 锁定库存为0的产品,只判断箭冠轮胎产品
+        noLockStockRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.productEntity && item.productEntity.productBrandName == '箭冠' && item.productEntity.productTypeName3 == '轮胎' && !item.lockStockQty)
+      } else {
+        // 库存类型是 可用库存
+        noStockRow = this.dataSource.filter(item => chooseList.includes(item.id) && !item.stockQty)
+      }
 
       // 库存为0产品编码列表
       const noObj = []
@@ -743,14 +782,9 @@ export default {
       })
 
       // 可添加产品,不包括库存未0和箭冠轮胎锁定库存为0的产品
-      const chooseRow = this.dataSource.filter(item => {
-        return chooseList.includes(item.id) && !noObjSn.includes(item.salesBillDetailSn) && !noLockObjSn.includes(item.salesBillDetailSn)
-      })
+      const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && !noObjSn.includes(item.salesBillDetailSn) && !noLockObjSn.includes(item.salesBillDetailSn))
       // 可添加产品sn列表
-      const obj = []
-      chooseRow && chooseRow.map(item => {
-        obj.push(item.salesBillDetailSn)
-      })
+      const obj = chooseRow.map(item => item.salesBillDetailSn)
       if (obj.length) {
         this.$confirm({
           title: '提示',