lilei 4 месяцев назад
Родитель
Сommit
038fd0e445

+ 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({

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

@@ -232,11 +232,12 @@ 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
+      let stockType
       this.dataSource.map((item, i) => {
         if (item.id.indexOf('promo-') >= 0) { f = f - 1 }
         item.no = i + 1 + f
@@ -253,9 +254,16 @@ 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
+          stockType = item.dispatchBill && item.dispatchBill.stockType
+        }
       })
       this.showEmpty = this.dataSource.length <= 0
       this.tableHeight = (this.showEmpty ? 300 : this.maxHeight) + 'px'
+      this.$emit('upStockType', hasLt, stockType)
       this.spinning = false
       this.disabled = false
     },

+ 20 - 4
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',
@@ -108,6 +109,14 @@ export default {
         }
       })
     },
+    // 更新轮胎库存类型
+    updateStockType (val) {
+      dispatchUpdateStockType({ stockType: val, dispatchBillSn: this.productForm.dispatchBillSn }).then(res => {
+        if (res.status != 200) {
+          this.$refs.partQuery.stockType = val == 'LOCK_STOCK' ? 'CURRENT_STOCK' : 'LOCK_STOCK'
+        }
+      })
+    },
     // 添加产品
     insterProduct (list) {
       // 防止多次添加产品
@@ -134,6 +143,13 @@ export default {
         this.isInster = false
       })
     },
+    // 禁用库存类型选项
+    upStockType (hasLt, stockType) {
+      console.log(hasLt, stockType)
+      this.$refs.partQuery.stockDisabled = hasLt
+      this.$refs.partQuery.hasJGtire = hasLt
+      this.$refs.partQuery.stockType = stockType
+    },
     // 整单取消
     cancelAll () {
       salesDetailCancleOfAll({ salesBillSn: this.salesBillSn }).then(res => {

+ 81 - 56
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,13 @@ export default {
         } else {
           item.maxConvertNums = 0
         }
+
+        // 判断是否有箭冠轮胎产品
+        if (productBrand && productBrand.indexOf('箭冠') >= 0 && productBrand && productType3.indexOf('轮胎') >= 0 && !this.stockType) {
+          this.hasJGtire = true
+          this.stockType = 'LOCK_STOCK'
+        }
+
         // 转采购额数量
         item.bakConvertPromoGiftsQty = item.convertPromoGiftsQty