瀏覽代碼

合并yh53

lilei 4 月之前
父節點
當前提交
7d29b567eb

+ 1 - 0
src/views/salesManagement/salesQueryNew/comps/productActiveList.vue

@@ -889,6 +889,7 @@ export default {
           _this.$message.warning('暂无可设置的产品!')
           return
         }
+        _this.clearTableSelect()
         _this.warehouseTit = '全部仓库设置'
         _this.openWarehouseModal = true
       } else if (e.key == 4) { // 批量取消促销

+ 2 - 0
src/views/salesManagement/salesQueryNew/comps/productNormalList.vue

@@ -544,6 +544,8 @@ export default {
           _this.$message.warning('暂无可设置的产品!')
           return
         }
+        this.$refs.table.clearSelected()
+        this.rowSelectionInfo = null
         _this.warehouseTit = '全部仓库设置'
         _this.openWarehouseModal = true
       } else {

+ 13 - 1
src/views/salesManagement/salesQueryNew/list.vue

@@ -194,6 +194,18 @@
             <a-badge count="促" v-if="record.promoFlag==1" :number-style="{ backgroundColor: '#52c41a', zoom:'0.8' }"></a-badge>
             <a-badge count="转" v-if="record.transferFlag==1" :number-style="{ backgroundColor: '#ccb01e', zoom:'0.8' }"></a-badge>
           </template>
+          <!-- 出库仓库 -->
+          <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.filter(item => item != null).toString() }}</span>
+              </template>
+              <div class="warehouse_box">
+                <span>{{ record.warehouseNameSet.filter(item => item != null).toString() }}</span>
+              </div>
+            </a-tooltip>
+            <div v-else>--</div>
+          </template>
           <!-- 操作 -->
           <template slot="action" slot-scope="text, record">
             <div>
@@ -514,7 +526,7 @@ export default {
         { title: '提交时间', slots: { title: 'customDateTitle' }, dataIndex: 'firstSubmitDate', width: '6.5%', align: 'center', customRender: function (text) { return formatDate(text) }, sorter: true },
         { title: '客户名称', dataIndex: 'buyerName', width: '9%', align: 'left', customRender: function (text) { return text || '--' } },
         { title: '发货经销商', dataIndex: 'transferDealerName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '出库仓库', dataIndex: 'warehouseNameSet', width: '6.5%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '出库仓库', scopedSlots: { customRender: 'warehouseBox' }, width: '7%', align: 'center', ellipsis: true },
         { title: '总数量', dataIndex: 'totalQty', width: '4%', align: 'center' },
         { title: '总售价', dataIndex: 'totalAmount', width: '4%', align: 'right', isShow: false, customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '已下推数量', dataIndex: 'totalPushedQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },

+ 7 - 0
src/views/salesManagement/waitDispatchNew/detailProductList.vue

@@ -234,6 +234,7 @@ export default {
 
       // 格式化数据
       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
@@ -251,6 +252,11 @@ export default {
         item.promoRuleSnList = item.promotionRuleList && item.promotionRuleList.map(item => item.promotionRuleSn) // 规则sn
         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
       const len = this.dataSource.length
@@ -259,6 +265,7 @@ export default {
       } else {
         this.tableHeight = this.maxHeight
       }
+      this.$emit('upStockType', hasLt)
       this.spinning = false
       this.disabled = false
     },

+ 21 - 3
src/views/salesManagement/waitDispatchNew/edit.vue

@@ -18,7 +18,8 @@
           @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">
@@ -27,7 +28,7 @@
           </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, salesPromoQueryList } 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',
@@ -109,6 +110,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) {
       // 防止多次添加产品

+ 51 - 9
src/views/salesManagement/waitDispatchNew/queryPart.vue

@@ -72,6 +72,7 @@
     <!-- alert -->
     <div style="margin-bottom: 10px;display: flex;align-items: center;" v-if="detailData">
       <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"
@@ -102,14 +103,25 @@
           </template>
           <a-icon style="font-size: 14px;" type="question-circle" />
         </a-tooltip>
-        <span style="margin-left: 10px;" v-if="selectedRowKeys.length">已选 {{ selectedRowKeys.length }} 项</span>
+        <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: 15px"
+          style="margin-left: 6px"
           class="button-info"
-          id="dispatch-updateStock">整单转采购单</a-button>
+          id="dispatch-updateStock">轮胎转采购单</a-button>
+
       </div>
       <div style="padding-left: 20px;">
         总销售数量:<strong>{{ detailData&&(detailData.totalQty || detailData.totalQty==0) ? detailData.totalQty : '--' }}</strong>;
@@ -236,7 +248,10 @@ export default {
       selectedRowKeys: [], // 已选数据
       colspanNums: 16, // 列合并数量
       hasNormalProduct: false, // 是否有正常产品
-      showLockStockQty: false // 是否显示锁定库存列
+      showLockStockQty: false, // 是否显示锁定库存列
+      stockType: undefined, // 默认锁定库存
+      hasJGtire: false, // 是否轮胎产品
+      stockDisabled: false
     }
   },
   computed: {
@@ -573,6 +588,18 @@ export default {
         } else {
           item.maxConvertNums = 0
         }
+
+        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) {
+          this.hasJGtire = true
+          // 默认锁定库存类型
+          if (!this.stockType) {
+            this.stockType = 'LOCK_STOCK'
+            this.stockTypeChange('LOCK_STOCK')
+          }
+        }
         // 转采购额数量
         item.bakConvertPromoGiftsQty = item.convertPromoGiftsQty
 
@@ -618,15 +645,22 @@ export default {
     clearSelectTable () {
       this.selectedRowKeys = []
     },
+    // 修改库存类型
+    stockTypeChange (val) {
+      this.$emit('updateStockType', val)
+    },
     // 添加
     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 {
@@ -681,10 +715,18 @@ export default {
         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 = []