瀏覽代碼

发货经销商 转单

chenrui 6 月之前
父節點
當前提交
50a9a9aa0c

+ 51 - 2
src/views/salesManagement/salesQueryNew/comps/detailProductList.vue

@@ -97,6 +97,18 @@ export default {
     activeList: { // 参与的活动列表
       type: Array,
       default: () => []
+    },
+    transferQty: {// 发货经销商库存
+      type: [String, Number],
+      default: ''
+    },
+    chooseList: { // 发货经销商库存
+      type: Array,
+      default: function () { return [] }
+    },
+    showTransferDealer: {// 显示发货经销商库存
+      type: Boolean,
+      default: true
     }
   },
   data () {
@@ -136,6 +148,13 @@ export default {
       const numsFormat = function (data) {
         return data || data == 0 ? data : '--'
       }
+      // 发货经销商库存
+      const transferDealerInfo = function (record, data, h) {
+        return (
+          <div>
+            {(!data || data && data * 1 < record.qty * 1) ? <span style="color:#ed1c24;">{data || '--'}</span> : <span>{data}</span>}
+          </div>)
+      }
       // 编号
       const codeFormat = function (record, data, h) {
         return (
@@ -230,6 +249,10 @@ export default {
           arr.push({ title: '第三方库存', field: 'thirdStockQty', width: 80, key: 'mm', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } })
         }
       }
+      if (this.showTransferDealer) {
+        arr.push({ title: '发货经销商库存', field: 'transferDealerStockQty', width: 100, key: 'tt', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return transferDealerInfo(row, row[column.field], h) } })
+        this.colspanNums = this.colspanNums + 1
+      }
       arr = arr.concat([
         { title: '待下推数', field: 'unpushedQty', width: 80, key: 'o', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } },
         { title: '已下推数', field: 'pushedQty', width: 80, key: 'p', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field]) } }
@@ -277,6 +300,16 @@ export default {
     showThreeStock () {
       this.showStockCol = true
     },
+    // 当满足发货经销商显示条件时  查询
+    searchTableData (list) {
+      this.dataSource = list.filter(item => {
+        if (this.transferQty == '0') { // 不满足
+          return (!item.transferDealerStockQty || (item.transferDealerStockQty && item.transferDealerStockQty * 1 < item.qty * 1))
+        } else if (this.transferQty == '1') { // 满足
+          return (item.transferDealerStockQty && item.transferDealerStockQty * 1 >= item.qty * 1)
+        }
+      })
+    },
     // 查询表格数据
     async searchTable () {
       this.dataSource = []
@@ -295,8 +328,24 @@ export default {
       this.countData = this.type == 'normal' ? await salesDetaiCount(params).then(res => res.data) : null
       // 查询活动产品明细列表
       const activeList = this.type == 'active' ? await salesDetailExtPromoList({ salesPromoSnSet: [], ...params }).then(res => res.data) : []
-      // 赋值
-      this.dataSource = this.type == 'normal' ? normalList : activeList
+      // 发货经销商时 查询
+
+      if (this.type == 'normal') {
+        if (this.chooseList && this.chooseList.length) {
+          this.dataSource = this.chooseList
+          if (this.transferQty) {
+            this.searchTableData(this.chooseList)
+          }
+        } else {
+          // 赋值
+          this.dataSource = normalList
+          if (this.transferQty) {
+            this.searchTableData(normalList)
+          }
+        }
+      } else {
+        this.dataSource = activeList
+      }
 
       // 没用数据,则不显示当前表格
       if (this.dataSource.length == 0) {

+ 133 - 8
src/views/salesManagement/salesQueryNew/detail.vue

@@ -57,10 +57,13 @@
             <a-descriptions-item label="收货电话">{{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.consigneeTel || '--' }}</a-descriptions-item>
             <a-descriptions-item label="收款方式">{{ detailData&&detailData.settleStyleSnDictValue || '--' }}</a-descriptions-item>
             <a-descriptions-item label="审核时间">{{ detailData&&detailData.auditDate || '--' }}</a-descriptions-item>
-            <a-descriptions-item label="业务状态">{{ detailData&&detailData.billStatusDictValue || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="业务状态" v-if="detailData">{{ detailData.billStatusDictValue || '--' }}{{ (detailData.billStatus=='SUPERIOR_AUDIT_REJECT'||detailData.billStatus=='TRANSFER_AUDIT_REJECT')?'('+detailData.transferDealerName+')':'' }}</a-descriptions-item>
+            <a-descriptions-item label="财务状态">{{ detailData&&detailData.financialStatusDictValue || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="改单时间" v-if="detailData&&detailData.salesBillSource=='PURCHASE'&&detailData.submitDate">{{ detailData.submitDate }}</a-descriptions-item>
             <a-descriptions-item label="财务状态">{{ detailData&&detailData.financialStatusDictValue || '--' }}</a-descriptions-item>
             <a-descriptions-item label="改单时间" v-if="detailData&&detailData.salesBillSource=='PURCHASE'&&detailData.submitDate">{{ detailData.submitDate }}</a-descriptions-item>
             <a-descriptions-item label="最新提交时间" v-if="detailData&&detailData.salesBillSource=='SALES'&&detailData.submitDate">{{ detailData.submitDate }}</a-descriptions-item>
+            <a-descriptions-item label="发货经销商" v-if="detailData&&detailData.billStatus&&(detailData.billStatus=='TRANSFER_YES'||detailData.billStatus=='TRANSFER_FINISH')">{{ detailData.transferDealerName || '--' }}</a-descriptions-item>
             <a-descriptions-item label="备注" :span="3">{{ detailData&&detailData.remarks || '--' }}</a-descriptions-item>
           </a-descriptions>
         </div>
@@ -125,6 +128,17 @@
                       </a-select>
                     </a-form-item>
                   </a-col>
+                  <a-col flex="260px" v-if="showTransferDealer">
+                    <a-form-item label="发货经销商库存">
+                      <v-select
+                        code="STOCK_LABEL"
+                        id="purchaseOrder-basicInfo-transferQty"
+                        v-model="transferQty"
+                        allowClear
+                        placeholder="请选择发货经销商库存是否满足"
+                      ></v-select>
+                    </a-form-item>
+                  </a-col>
                   <a-col :md="6" :sm="24">
                     <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>
@@ -133,6 +147,14 @@
               </a-form>
             </div>
             <div>
+              <span v-if="selectedDealer">(发货经销商:{{ selectedDealer }})</span>
+              <a-button
+                id="salesDetail-updateStock"
+                type="primary"
+                v-if="showTransferDealer"
+                style="margin:0 10px;"
+                @click="openDealerModal"
+                class="button-dealerStock">选择发货经销商</a-button>
               <a-button id="salesDetail-updateStock" type="primary" v-if="showStock" @click="getThreeStock" class="button-info">第三方库存</a-button>
               <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>
@@ -185,17 +207,40 @@
       </a-card>
     </a-spin>
     <div class="affix-cont" :style="{padding:hideFooter?0:'7px 0 4px'}">
+      <a-button
+        style="width: 100px;margin-right:20px;"
+        :disabled="spinning"
+        type="primary"
+        class="button-info"
+        id="salesDetail-audit-btn"
+        v-if="$hasPermissions('B_salesTransfer')&&$route.params.pageType!='salesNewDetailAudit'&&(detailData&&detailData.promoFlag!=1&&(detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'SUPERIOR_AUDIT_REJECT' || detailData.billStatus == 'TRANSFER_AUDIT_REJECT')&&detailData.salesBillSource=='PURCHASE'&&detailData.orderType=='TIRE')"
+        @click="handleOrder()"
+      >
+        转单
+      </a-button>
       <a-button
         style="width: 100px;"
         :disabled="spinning"
         type="primary"
         class="button-info"
         id="salesDetail-audit-btn"
-        v-if="(detailData&&(detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus=='WAIT_UP_AUDIT_PASS'))&&$hasPermissions('B_salesAudit')"
+        v-if="detailData&&(detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'SUPERIOR_AUDIT_REJECT' || detailData.billStatus == 'TRANSFER_AUDIT_REJECT')&&$hasPermissions('B_salesAudit')&&$route.params.pageType!='salesNewDetailTransfer'"
         @click="handleAudit()"
       >
         审核
       </a-button>
+      <!-- 转单审核 -->
+      <a-button
+        style="width: 100px;"
+        :disabled="spinning"
+        type="primary"
+        class="button-info"
+        id="salesDetail-audit-btn"
+        v-if="$hasPermissions('B_higherLevelAudit')&&detailData&&detailData.billStatus == 'SUPERIOR_WAIT_AUDIT'"
+        @click="handleTransferAudit"
+      >
+        审核
+      </a-button>
       <a-button
         type="primary"
         :disabled="spinning"
@@ -211,7 +256,7 @@
         :disabled="spinning"
         type="primary"
         id="salesDetail-edit1-btn"
-        v-if="detailData&&detailData.salesBillSource == 'PURCHASE' && (detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')&&$hasPermissions('B_salesEdit')"
+        v-if="detailData&&detailData.salesBillSource == 'PURCHASE' && (detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE'||detailData.billStatus == 'SUPERIOR_AUDIT_REJECT' || detailData.billStatus == 'TRANSFER_AUDIT_REJECT')&&$hasPermissions('B_salesEdit')"
         @click="handleChangeOrder()"
       >
         改单
@@ -222,7 +267,7 @@
         type="primary"
         class="button-success"
         id="salesDetail-batchAudit-btn"
-        v-if="detailData&&detailData.billStatus == 'WAIT_AUDIT'&&$hasPermissions('B_salesAudit')"
+        v-if="detailData&&(detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'SUPERIOR_AUDIT_REJECT' || detailData.billStatus == 'TRANSFER_AUDIT_REJECT')&&$hasPermissions('B_salesAudit')&&$route.params.pageType!='salesNewDetailTransfer'"
         @click="handleAudit('batch')"
       >
         一键审核
@@ -260,6 +305,10 @@
       :dataObj="tempData"
       @close="openVaildPriceModal=false"
       @ok="vaildPriceOk"></vaildPriceModal>
+    <!-- 发货经销商库存 弹窗 -->
+    <dealerStockModal :itemSn="$route.params.sn" :openModal="openDealerStock" @close="openDealerStock = false" @ok="openDealerStockOk"></dealerStockModal>
+    <!-- 审核弹窗 -->
+    <auditConfirmModal :openModal="openTransferOrder" :detailData="detailData" @ok="transferOrderAuditOk" @close="openTransferOrder=false"></auditConfirmModal>
   </div>
 </template>
 
@@ -278,6 +327,8 @@ import detailProductList from './comps/detailProductList.vue'
 import activeStatisticsList from './comps/activeStatisticsList.vue'
 import tipModal from './tipModal.vue'
 import vaildPriceModal from './vaildPriceModal.vue'
+import dealerStockModal from './comps/dealerStockModal.vue'
+import auditConfirmModal from './auditModal.vue'
 // 接口
 import {
   salesPromoQueryList,
@@ -293,11 +344,12 @@ import {
   salesPromoValidaAudit,
   changeBillCheckUpdatePrice,
   changeBillCheck } from '@/api/salesNew'
+import { transferVerify, transfer, transferAudit } from '@/api/sales'
 
 export default {
   name: 'SalesDetailNew',
   mixins: [commonMixin],
-  components: { VSelect, printModal, auditModal, dsModal, stockOutDetail, chooseWarehouse, detailProductList, activeStatisticsList, tipModal, vaildPriceModal },
+  components: { VSelect, printModal, auditModal, dsModal, stockOutDetail, chooseWarehouse, detailProductList, activeStatisticsList, tipModal, vaildPriceModal, dealerStockModal, auditConfirmModal },
   props: {
     bizSn: { //  有值则为弹框,无值则为页面
       type: [Number, String],
@@ -330,7 +382,13 @@ export default {
       openTipModal: false, // 改单弹窗
       sourceData: undefined, // 价格变动数据
       tempData: undefined, // 校验临时数据
-      openVaildPriceModal: false // 校验价格弹框
+      openVaildPriceModal: false, // 校验价格弹框
+      transferQty: undefined, // 发货经销商库存查询
+      openDealerStock: false, // 打开经销商库存弹窗
+      openTransferOrder: false, // 打开转单弹窗
+      selectedDealer: '', // 发货经销商名称
+      selectedDealerSn: undefined, // 发货经销商sn
+      chooseDealerList: []// 发货经销商数据
     }
   },
   computed: {
@@ -346,10 +404,10 @@ export default {
         return shippingAddrProvinceName + shippingAddrCityName + shippingAddrCountyName + shippingAddr
       }
     },
-    // 是否隐藏底部栏按钮
+    // 是否因此底部栏按钮
     hideFooter () {
       const detailData = this.detailData
-      return detailData && (detailData.billStatus == 'HQ_CHANGE' || (detailData.salesBillSource != 'SALES' && detailData.billStatus == 'AUDIT_REJECT') || detailData.billStatus == 'FINISH' || detailData.billStatus == 'OUTING_WAREHOUSE')
+      return detailData && ((detailData.salesBillSource != 'SALES' && detailData.billStatus == 'AUDIT_REJECT') || detailData.billStatus == 'FINISH' || detailData.billStatus == 'OUTING_WAREHOUSE' || detailData.billStatus == 'TRANSFER_FINISH' || detailData.billStatus == 'TRANSFER_YES')
     },
     // 是否有促销活动产品
     hasPrompActive () {
@@ -380,6 +438,19 @@ export default {
     handleBack () {
       this.$router.push({ name: 'salesQueryNewList' })
     },
+    // 打开 发货经销商库存弹窗
+    openDealerModal () {
+      this.openDealerStock = true
+    },
+    openDealerStockOk (val, data) {
+      this.selectedDealer = val.dealerName
+      this.selectedDealerSn = val.dealerSn
+      this.chooseDealerList = data
+      this.openDealerStock = false
+      this.$nextTick(() => {
+        this.searchTable()
+      })
+    },
     // 编辑
     handleEdit () {
       const row = this.detailData
@@ -520,6 +591,60 @@ export default {
     handleDispatch (row) {
       this.$router.push({ name: 'waitDispatchNew', params: { salesBillSn: row.salesBillSn } })
     },
+    // 验证转单
+    handleOrder () {
+      const _this = this
+      if (!_this.selectedDealerSn) {
+        _this.$message.warning('请选择发货经销商!')
+        return
+      }
+      transferVerify({ salesBillSn: _this.$route.params.sn, transferDealerSn: _this.selectedDealerSn }).then(res => {
+        if (res.status == 200) {
+          if (res.data && Object.keys(res.data).length) {
+            _this.$confirm({
+              title: '提示',
+              content: <div><strong style="color:#ed1c24;">{res.data.dealerName}</strong>非<strong style="color:#ed1c24;">{res.data.buyerName}</strong>的轮胎上级或省仓,提交后待上级审核通过完成转单</div>,
+              centered: true,
+              closable: true,
+              okText: '提交',
+              onOk () {
+                _this.spinning = true
+                // 验证成功
+                _this.handleTransfer()
+              }
+            })
+          } else {
+            this.handleTransfer()
+          }
+        }
+      })
+    },
+    // 转单
+    handleTransfer () {
+      transfer({ salesBillSn: this.$route.params.sn, transferDealerSn: this.selectedDealerSn }).then(res => {
+        if (res.status == 200) {
+          this.spinning = false
+          this.$message.success(res.message)
+          //  转单成功 关闭详情跳列表
+          this.handleBack()
+        }
+      })
+    },
+    // 打开 转单审核弹窗
+    handleTransferAudit () {
+      this.openTransferOrder = true
+    },
+    // 转单审核
+    transferOrderAuditOk (val) {
+      transferAudit({ salesBillSn: this.$route.params.sn, auditPassFlag: val }).then(res => {
+        if (res.status == 200) {
+          this.openTransferOrder = false
+          this.$message.success(res.message)
+          //  转单成功 关闭详情跳列表
+          this.handleBack()
+        }
+      })
+    },
     // 打开审核/一键审核弹框
     async handleAudit (isBatch) {
       const _this = this