lilei 2 lat temu
rodzic
commit
3bc2731c11

+ 7 - 0
src/api/salesReturn.js

@@ -150,6 +150,13 @@ export const customerServiceConfirm = (params) => {
     method: 'get'
   })
 }
+// 收货提交审核
+export const salesReturnReceive = (params) => {
+  return axios({
+    url: `/salesReturn/receive/${params.salesReturnBillSn}`,
+    method: 'get'
+  })
+}
 
 // 退货确认 退货确认
 export const salesReturnFinancial = (params) => {

+ 35 - 1
src/api/salesReturnDetail.js

@@ -47,7 +47,6 @@ export const salesReturnDetailUpdateQty = (params) => {
     method: 'post'
   })
 }
-
 // 修改销售退货明细退货原因
 export const salesReturnDetailUpdateReason = (params) => {
   return axios({
@@ -73,6 +72,15 @@ export const salesReturnDetailUpdateBackStockQty = (params) => {
   })
 }
 
+// 收货 批量实收
+export const salesReturnDetailReceiveBatch = (params) => {
+  return axios({
+    url: '/salesReturn/detail/receiveBatch',
+    data: params,
+    method: 'post'
+  })
+}
+
 // 客服确认单行保存
 export const updateByCustomerService = (params) => {
   return axios({
@@ -97,4 +105,30 @@ export const deleteByCustomerService = (params) => {
     url: `/salesReturn/detail/deleteByCustomerService/${params.salesReturnDetailSn}`,
     method: 'get'
   })
+}
+
+// 收货删除销售退货明细
+export const deleteByReceiver = (params) => {
+  return axios({
+    url: `/salesReturn/detail/deleteByReceiver/${params.salesReturnDetailSn}`,
+    method: 'get'
+  })
+}
+
+// 新增销售退货明细(收货添加)
+export const insertByReceive = (params) => {
+  return axios({
+    url: '/salesReturn/detail/insertByReceive',
+    data: params,
+    method: 'post'
+  })
+}
+
+// 新增销售退货明细(客服确认添加)
+export const insertByCustomerService = (params) => {
+  return axios({
+    url: '/salesReturn/detail/insertByCustomerService',
+    data: params,
+    method: 'post'
+  })
 }

+ 5 - 3
src/config/router.config.js

@@ -557,7 +557,7 @@ export const asyncRouterMap = [
                  }
                },
                {
-                 path: 'custConfirm/:sn',
+                 path: 'custConfirm/:sn/:buyerSn',
                  name: 'custConfirm',
                  component: () => import(/* webpackChunkName: "salesReturnManagement" */ '@/views/salesReturnManagement/custConfirm/list.vue'),
                  meta: {
@@ -673,23 +673,25 @@ export const asyncRouterMap = [
                  }
                },
                {
-                 path: 'receiving/:sn',
+                 path: 'receiving/:sn/:buyerSn',
                  name: 'salesReturnReceiving',
                  component: () => import(/* webpackChunkName: "salesReturnManagement" */ '@/views/salesReturnManagement/receiveCheck/receiving.vue'),
                  meta: {
                    title: '收货',
                    icon: 'fund',
                    hidden: true,
+                   replaceTab: true
                  }
                },
                {
-                 path: 'checking/:sn',
+                 path: 'checking/:sn/:buyerSn',
                  name: 'salesReturnCheck',
                  component: () => import(/* webpackChunkName: "salesReturnManagement" */ '@/views/salesReturnManagement/receiveCheck/checking.vue'),
                  meta: {
                    title: '品检',
                    icon: 'fund',
                    hidden: true,
+                   replaceTab: true
                  }
                },
              ]

+ 0 - 0
src/views/salesReturnManagement/salesReturn/auditDetail.vue → src/views/common/auditDetail.vue


+ 23 - 7
src/views/salesReturnManagement/custConfirm/list.vue

@@ -22,7 +22,7 @@
           </a-form-item>
         </a-form>
         <div style="border-top:1px solid #eee;padding-top:10px;">
-          <a-button type="primary" :loading="loading" class="button-info" @click="handleAdd">新增产品</a-button>
+          <a-button type="primary" :loading="loading" class="button-info" @click="openProductModal=true">新增产品</a-button>
           <a-button type="primary" :loading="loading" class="button-error" @click="handlePlss">批量设置退货单价</a-button>
           <div style="float:right;color:#999;margin-top:8px;">说明:红色行表示收货时新增的产品;黄色表示客服确认时新增的产品</div>
         </div>
@@ -192,6 +192,8 @@
       :openModal="showSetPriceModal"
       @setOk="setPriceOk"
       @cancel="showSetPriceModal=false"></setPriceModal>
+    <!-- 添加产品 -->
+    <chooseProductsModal :openModal="openProductModal" :buyerSn="$route.params.buyerSn" @close="openProductModal=false" @addProduct="addProduct"></chooseProductsModal>
   </div>
 </template>
 
@@ -199,15 +201,17 @@
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import setPriceModal from './setPriceModal.vue'
+import chooseProductsModal from '../receiveCheck/chooseProductsModal.vue'
 import { salesReturnDetail, customerServiceConfirm } from '@/api/salesReturn'
-import { salesReturnDetailList, updateByCustomerService, deleteByCustomerService } from '@/api/salesReturnDetail'
+import { salesReturnDetailList, updateByCustomerService, deleteByCustomerService, insertByCustomerService } from '@/api/salesReturnDetail'
 export default {
   name: 'CustConfirm',
   mixins: [commonMixin],
   components: {
     STable,
     VSelect,
-    setPriceModal
+    setPriceModal,
+    chooseProductsModal
   },
   data () {
     return {
@@ -244,7 +248,8 @@ export default {
       rowSelectionInfo: null,
       returnReasonList: [], // 申请退货列表
       showSetPriceModal: false,
-      chooseData: []
+      chooseData: [],
+      openProductModal: false
     }
   },
   computed: {
@@ -277,9 +282,20 @@ export default {
     handleBack () {
       this.$router.push({ name: 'salesReturnList', query: { closeLastOldTab: true } })
     },
-    // 新增产品
-    handleAdd () {
-
+    // 添加产品
+    addProduct (data) {
+      const params = {
+        'salesReturnBillSn': this.orderSn,
+        'salesReturnBillNo': this.ordeDetail.salesReturnBillNo,
+        ...data
+      }
+      insertByCustomerService(params).then(res => {
+        if (res.status == 200) {
+          this.resetSearchForm(true)
+          this.$message.info(res.message)
+        }
+        this.$refs.chooseProduct.resetLoading()
+      })
     },
     // 设置价格
     handleSetPrice (record) {

+ 108 - 0
src/views/salesReturnManagement/receiveCheck/chooseProductsModal.vue

@@ -0,0 +1,108 @@
+<template>
+  <a-modal
+    centered
+    class="chooseProducts-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="选择产品"
+    v-model="isShow"
+    @cancel="isShow=false"
+    width="70%">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div class="products-con">
+        <div>
+          <!-- 查询配件列表 -->
+          <queryPart ref="partQuery" :returnReasonList="returnReasonList" :newLoading="isInster" @add="saveProduct"></queryPart>
+        </div>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import queryPart from '@/views/salesReturnManagement/salesReturn/queryPart.vue'
+export default {
+  name: 'ChooseProductsModal',
+  components: { queryPart },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    chooseData: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    buyerSn: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      spinning: false,
+      isShow: this.openModal, //  是否打开弹框
+      returnReasonList: [],
+      isInster: false //  表格加载中
+    }
+  },
+  methods: {
+    // 添加或修改产品
+    saveProduct (row) {
+      // 防止多次添加产品
+      if (this.isInster) {
+        return
+      }
+      if (!row.returnReason) {
+        this.$message.info('请选择退货原因')
+        return
+      }
+      const params = {
+        'price': row.productPrice,
+        'cost': row.lastStockCost,
+        'returnReason': row.returnReason,
+        'productSn': row.productSn,
+        'qty': row.qty
+      }
+      this.isInster = true
+      this.$emit('addProduct', params)
+    },
+    resetLoading () {
+      this.isInster = false
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      } else {
+        this.returnReasonList = this.$store.state.app.returnReason
+        this.$nextTick(() => {
+          this.$refs.partQuery.pageInit(this.buyerSn, 0)
+        })
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .chooseProducts-modal{
+    .products-con{
+      .btn-con{
+        text-align: center;
+        margin: 30px 0 20px;
+        .button-cancel{
+          font-size: 12px;
+        }
+      }
+    }
+  }
+</style>

+ 3 - 3
src/views/salesReturnManagement/receiveCheck/list.vue

@@ -170,15 +170,15 @@ export default {
     },
     // 详情
     handleDetail (row) {
-      this.$router.push({ name: 'billOfLadingDetail', params: { sn: row.salesReturnBillSn } })
+      this.$router.push({ name: 'salesReturnDetail', params: { sn: row.salesReturnBillSn } })
     },
     // 收货
     handleReceiving (row) {
-      this.$router.push({ name: 'salesReturnReceiving', params: { sn: row.salesReturnBillSn } })
+      this.$router.push({ name: 'salesReturnReceiving', params: { sn: row.salesReturnBillSn, buyerSn: row.buyerSn } })
     },
     // 品检
     handleCheck (row) {
-      this.$router.push({ name: 'salesReturnCheck', params: { sn: row.salesReturnBillSn } })
+      this.$router.push({ name: 'salesReturnCheck', params: { sn: row.salesReturnBillSn, buyerSn: row.buyerSn } })
     },
     resetSearchForm () {
       this.$refs.rangeExamineDate.resetDate()

+ 127 - 56
src/views/salesReturnManagement/receiveCheck/receiving.vue

@@ -22,7 +22,7 @@
           </a-form-item>
         </a-form>
         <div style="border-top:1px solid #eee;padding-top:10px;">
-          <a-button type="primary" :loading="loading" class="button-info" @click="handleAdd">新增产品</a-button>
+          <a-button type="primary" :loading="loading" class="button-info" @click="openModal = true">新增产品</a-button>
           <a-button type="primary" :loading="loading" class="button-error" @click="handlePlss">批量实收</a-button>
           <div style="float:right;color:#999;margin-top:8px;">说明:红色行表示收货时新增的产品</div>
         </div>
@@ -34,7 +34,7 @@
           :rowClassName="(record, index) => record.addFlag == '1' ? (record.addType == 'WAREHOUSE_RECEIVE'?'redBg-row':'orgBg-row'):''"
           size="small"
           :rowKey="(record) => record.id"
-          :row-selection="{ columnWidth: 40 }"
+          :row-selection="{ columnWidth: 40, getCheckboxProps:record =>({props: { disabled: record.addFlag == '1' }}) }"
           @rowSelection="rowSelectionFun"
           :columns="columns"
           :data="loadData"
@@ -49,6 +49,7 @@
               :precision="0"
               :min="0"
               :max="999999"
+              @blur="e => onCellBlurReceiveQty(e.target.value, record)"
               placeholder="请输入"
               style="width: 100%;" />
           </template>
@@ -57,6 +58,7 @@
             <a-select
               style="width:100%;"
               v-model="record.returnReason"
+              @change="e => onCellBlurReturnReason(e, record)"
               placeholder="请选择退货原因"
               allowClear>
               <a-select-option v-for="item in returnReasonList" :value="item.code">
@@ -66,12 +68,15 @@
           </template>
           <!-- 操作 -->
           <template slot="action" slot-scope="text, record">
-            <a-button
-              size="small"
-              type="link"
-              class="button-warning"
-              @click="handleDel(record)"
-              id="salesReturn-eexamine-btn">删除</a-button>
+            <div>
+              <a-button
+                v-if="record.addFlag == '1'&&record.addType == 'WAREHOUSE_RECEIVE'"
+                size="small"
+                type="link"
+                class="button-warning"
+                @click="handleDel(record)"
+              >删除</a-button>
+            </div>
           </template>
         </s-table>
       </a-card>
@@ -86,34 +91,36 @@
         @click="handleSubmit()"
         id="salesReturn-handleSubmit">提交</a-button>
     </div>
+
+    <!-- 添加产品 -->
+    <chooseProductsModal ref="chooseProduct" :openModal="openModal" :buyerSn="$route.params.buyerSn" @close="openModal=false" @addProduct="addProduct"></chooseProductsModal>
   </div>
 </template>
 
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
-import { salesReturnDetail, salesReturnCheck } from '@/api/salesReturn'
+import chooseProductsModal from './chooseProductsModal.vue'
+import { salesReturnDetail, salesReturnReceive } from '@/api/salesReturn'
 import {
-  salesReturnDetailList,
-  updateBackStockQty
+  salesReturnDetailList, salesReturnDetailReceiveBatch, salesReturnDetailUpdateReceiveQty, salesReturnDetailUpdateReason, insertByReceive, deleteByReceiver
 } from '@/api/salesReturnDetail'
 export default {
-  name: 'SalesReturnCheck',
+  name: 'Receiving',
   mixins: [commonMixin],
   components: {
     STable,
-    VSelect
+    VSelect,
+    chooseProductsModal
   },
   data () {
     return {
       spinning: false,
       tableHeight: 0, // 表格高度
-      orderId: null,
       orderSn: null,
-      buyerSn: null,
       disabled: false,
-      isInster: false, // 是否正在添加产品
-      ordeDetail: { discountAmount: 0 },
+      openModal: false, // 添加产品
+      ordeDetail: null,
       loading: false,
       // 已选产品
       dataSource: [],
@@ -133,6 +140,8 @@ export default {
             const no = (data.pageNo - 1) * data.pageSize
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
+              data.list[i].receiveQtyBackups = data.list[i].receiveQty
+              data.list[i].returnReasonBackups = data.list[i].returnReason
             }
             this.disabled = false
             this.chooseLoadData = data.list
@@ -152,13 +161,13 @@ export default {
     columns () {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productEntity.code', align: 'center', width: '23%', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productEntity.name', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '产品编码', dataIndex: 'productEntity.code', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productEntity.name', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '申请退货数量', dataIndex: 'qty', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '仓库实收数量', dataIndex: 'receiveQty', align: 'center', width: '10%', scopedSlots: { customRender: 'receiveQty' } },
-        { title: '单位', dataIndex: 'productEntity.unit', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '单位', dataIndex: 'productEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '退货单价', dataIndex: 'price', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货原因', dataIndex: 'returnReason', width: '10%', align: 'center', scopedSlots: { customRender: 'returnReason' } },
+        { title: '退货原因', dataIndex: 'returnReason', width: '20%', align: 'center', scopedSlots: { customRender: 'returnReason' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ]
       return arr
@@ -173,57 +182,110 @@ export default {
     handleBack () {
       this.$router.push({ name: 'receiveCheckList' })
     },
-    // 添加
-    handleAdd (row) {
-
+    // 添加产品
+    addProduct (data) {
+      const params = {
+        'salesReturnBillSn': this.orderSn,
+        'salesReturnBillNo': this.ordeDetail.salesReturnBillNo,
+        ...data
+      }
+      insertByReceive(params).then(res => {
+        if (res.status == 200) {
+          this.resetSearchForm()
+          this.$message.info(res.message)
+        }
+        this.$refs.chooseProduct.resetLoading()
+      })
     },
-    // 删除
+    // 删除产品
     handleDel (row) {
-
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '确认要删除吗?',
+        centered: true,
+        closable: true,
+        onOk () {
+          _this.loading = true
+          _this.spinning = true
+          deleteByReceiver({ salesReturnDetailSn: row.salesReturnDetailSn }).then(res => {
+            if (res.status == 200) {
+              _this.resetSearchForm(false)
+            }
+            _this.$message.info(res.message)
+            _this.loading = false
+            _this.spinning = false
+          })
+        }
+      })
     },
-    // 批量返库
+    // 批量实收
     handlePlss () {
       const _this = this
-      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+      const snList = []
+      _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
+        snList.push(item.salesReturnDetailSn)
+      })
+      if (snList.length == 0) {
         _this.$message.warning('请先选择产品!')
         return
       }
-      this.$confirm({
+      _this.$confirm({
         title: '提示',
         content: '确认要批量实收吗?',
         centered: true,
         onOk () {
-          const obj = []
-          _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
-            obj.push({
-              salesReturnDetailSn: item.salesReturnDetailSn,
-              backStockQty: item.qty
-            })
+          _this.loading = true
+          _this.spinning = true
+          salesReturnDetailReceiveBatch(snList).then(res => {
+            if (res.status == 200) {
+              _this.rowSelectionInfo = null
+              _this.$refs.table.clearTable()
+              _this.resetSearchForm()
+              _this.$message.success(res.message)
+            }
+            _this.loading = false
+            _this.spinning = false
           })
-          _this.submitCheck(obj)
         }
       })
     },
-    // 已选产品  blur
-    onCellBlur (val, record) {
+    // 仓库实收数量修改
+    onCellBlurReceiveQty (val, record) {
       //  光标移出,值发生改变再调用编辑接口
-      if (val && val != record.backStockQtyBackups) {
-        this.submitCheck([{
+      if (val && val != record.receiveQtyBackups) {
+        this.loading = true
+        this.spinning = true
+        salesReturnDetailUpdateReceiveQty({
           salesReturnDetailSn: record.salesReturnDetailSn,
-          backStockQty: record.backStockQty
-        }])
+          receiveQty: val
+        }).then(res => {
+          if (res.status == 200) {
+            this.$refs.table.refresh()
+            this.$message.success(res.message)
+          } else {
+            record.receiveQty = record.receiveQtyBackups
+          }
+          this.loading = false
+          this.spinning = false
+        })
       } else {
-        record.backStockQty = record.backStockQtyBackups
+        record.receiveQty = record.receiveQtyBackups
       }
     },
-    // 品检
-    submitCheck (data) {
+    // 修改退货原因
+    onCellBlurReturnReason (e, record) {
       this.loading = true
       this.spinning = true
-      updateBackStockQty(data).then(res => {
+      salesReturnDetailUpdateReason({
+        salesReturnDetailSn: record.salesReturnDetailSn,
+        returnReason: record.returnReason
+      }).then(res => {
         if (res.status == 200) {
-          this.resetSearchForm(true)
+          this.$refs.table.refresh()
           this.$message.success(res.message)
+        } else {
+          record.returnReason = record.returnReasonBackups
         }
         this.loading = false
         this.spinning = false
@@ -236,16 +298,25 @@ export default {
         this.ordeDetail = res.data || null
       })
     },
-    // 提交销售单
+    // 审核销售单
     handleSubmit () {
-      this.spinning = true
-      salesReturnCheck({ salesReturnBillSn: this.orderSn }).then(res => {
-        if (res.status == 200) {
-          this.handleBack()
-          this.$message.success(res.message)
-          this.spinning = false
-        } else {
-          this.spinning = false
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '提交后将进入品检环节,确认提交吗?',
+        centered: true,
+        closable: true,
+        onOk () {
+          _this.spinning = true
+          salesReturnReceive({ salesReturnBillSn: _this.orderSn }).then(res => {
+            if (res.status == 200) {
+              _this.handleBack()
+              _this.$message.success(res.message)
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
         }
       })
     },

+ 1 - 1
src/views/salesReturnManagement/salesReturn/detail.vue

@@ -87,7 +87,7 @@ import { commonMixin } from '@/utils/mixin'
 import { getOperationalPrecision } from '@/libs/tools.js'
 import { STable, VSelect } from '@/components'
 import { printFun, exportExcel } from '@/libs/JGPrint.js'
-import auditDetail from './auditDetail.vue'
+import auditDetail from '@/views/common/auditDetail.vue'
 import { salesReturnDetail, salesReturnPrint, salesReturnExport } from '@/api/salesReturn'
 import { salesReturnDetailList } from '@/api/salesReturnDetail'
 export default {

+ 1 - 1
src/views/salesReturnManagement/salesReturn/list.vue

@@ -299,7 +299,7 @@ export default {
     },
     // 客服确认
     handleConfirm (row) {
-      this.$router.push({ name: 'custConfirm', params: { sn: row.salesReturnBillSn } })
+      this.$router.push({ name: 'custConfirm', params: { sn: row.salesReturnBillSn, buyerSn: row.buyerSn } })
     },
     // 申请提货
     handlePickUp (row) {

+ 1 - 1
src/views/salesReturnManagement/salesReturn/verifyModal.vue

@@ -12,7 +12,7 @@
 </template>
 
 <script>
-import auditDetail from './auditDetail.vue'
+import auditDetail from '@/views/common/auditDetail.vue'
 export default {
   name: 'VerifyModal',
   components: { auditDetail },