lilei 2 anos atrás
pai
commit
aaa1e4d5d7

+ 8 - 0
src/api/salesReturnDetail.js

@@ -63,6 +63,14 @@ export const salesReturnDetailUpdateReceiveQty = (params) => {
     method: 'post'
   })
 }
+// 修改销售退货明细良品数量
+export const salesReturnDetailUpdateBatchGoodQty = (params) => {
+  return axios({
+    url: '/salesReturn/detail/updateBatchGoodQty',
+    data: params,
+    method: 'post'
+  })
+}
 // 修改销售退货明细返库数量
 export const salesReturnDetailUpdateBackStockQty = (params) => {
   return axios({

+ 70 - 31
src/views/salesReturnManagement/receiveCheck/checking.vue

@@ -22,8 +22,8 @@
           </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="backStock">批量设置良品数量</a-button>
-          <a-button type="primary" :loading="loading" class="button-error" @click="backStock">批量设置返库数量</a-button>
+          <a-button type="primary" :loading="loading" class="button-info" @click="plSetQty">批量设置良品数量</a-button>
+          <a-button type="primary" :loading="loading" class="button-error" @click="plSetQty">批量设置返库数量</a-button>
           <div style="float:right;color:#999;margin-top:8px;">说明:红色行表示收货时新增的产品</div>
         </div>
         <!-- 已选配件列表 -->
@@ -31,6 +31,7 @@
           class="sTable"
           ref="table"
           :style="{ height: tableHeight+84.5+'px' }"
+          :rowClassName="(record, index) => record.addFlag == '1' ? (record.addType == 'WAREHOUSE_RECEIVE'?'redBg-row':'orgBg-row'):''"
           size="small"
           :rowKey="(record) => record.id"
           :row-selection="{ columnWidth: 40 }"
@@ -40,6 +41,19 @@
           :scroll="{ y: tableHeight }"
           :defaultLoadData="false"
           bordered>
+          <!-- 良品数量 -->
+          <template slot="goodQty" slot-scope="text, record">
+            <a-input-number
+              id="salesReturn-goodQty"
+              size="small"
+              v-model="record.goodQty"
+              :precision="0"
+              :min="0"
+              :max="record.receiveQty"
+              placeholder="请输入"
+              @blur="e => updateBatchGoodQty(e.target.value, record)"
+              style="width: 100%;" />
+          </template>
           <!-- 返库数量 -->
           <template slot="backStockQty" slot-scope="text, record">
             <a-input-number
@@ -48,9 +62,9 @@
               v-model="record.backStockQty"
               :precision="0"
               :min="0"
-              :max="record.qty"
+              :max="record.goodQty"
               placeholder="请输入"
-              @blur="e => onCellBlur(e.target.value, record)"
+              @blur="e => updateBackStockQty(e.target.value, record)"
               style="width: 100%;" />
           </template>
         </s-table>
@@ -73,10 +87,7 @@
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import { salesReturnDetail, salesReturnCheck } from '@/api/salesReturn'
-import {
-  salesReturnDetailList,
-  updateBackStockQty
-} from '@/api/salesReturnDetail'
+import { salesReturnDetailList, salesReturnDetailUpdateBackStockQty, salesReturnDetailUpdateBatchGoodQty } from '@/api/salesReturnDetail'
 export default {
   name: 'SalesReturnCheck',
   mixins: [commonMixin],
@@ -113,6 +124,9 @@ 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].goodQty = data.list[i].goodQty || 0
+              data.list[i].backStockQty = data.list[i].backStockQty || 0
+              data.list[i].goodQtyBackups = data.list[i].goodQty
               data.list[i].backStockQtyBackups = data.list[i].backStockQty
             }
             this.disabled = false
@@ -133,14 +147,14 @@ export default {
       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.name', width: '25%', align: 'left', customRender: function (text) { return text || '--' } },
         { title: '单位', dataIndex: 'productEntity.unit', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '申请退货数量', dataIndex: 'qty', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '仓库实收数量', dataIndex: 'qty', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '仓库实收数量', dataIndex: 'receiveQty', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '坏件数量', dataIndex: 'badQty', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '良品数量', dataIndex: 'backStockQty', width: '10%', align: 'center', scopedSlots: { customRender: 'backStockQty' } },
+        { title: '良品数量', dataIndex: 'goodQty', width: '10%', align: 'center', scopedSlots: { customRender: 'goodQty' } },
         { title: '返库数量', dataIndex: 'backStockQty', width: '10%', align: 'center', scopedSlots: { customRender: 'backStockQty' } },
-        { title: '退货原因', dataIndex: 'productEntity.name', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true }
+        { title: '退货原因', dataIndex: 'returnReasonDictValue', width: '25%', align: 'left', customRender: function (text) { return text || '--' } }
       ]
       return arr
     }
@@ -154,8 +168,8 @@ export default {
     handleBack () {
       this.$router.push({ name: 'receiveCheckList' })
     },
-    // 批量返库
-    backStock () {
+    // 批量设置
+    plSetQty () {
       const _this = this
       if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
         _this.$message.warning('请先选择产品!')
@@ -178,31 +192,50 @@ export default {
         }
       })
     },
-    // 已选产品  blur
-    onCellBlur (val, record) {
+    // 修改良品数量
+    updateBatchGoodQty (val, record) {
+      //  光标移出,值发生改变再调用编辑接口
+      if (val && val != record.goodQtyBackups) {
+        this.spinning = true
+        salesReturnDetailUpdateBatchGoodQty({
+          salesReturnDetailSn: record.salesReturnDetailSn,
+          goodQty: record.goodQty
+        }).then(res => {
+          if (res.status == 200) {
+            this.resetSearchForm(true)
+            this.$message.success(res.message)
+            record.goodQtyBackups = record.goodQty
+          } else {
+            record.goodQty = record.goodQtyBackups
+          }
+          this.spinning = false
+        })
+      } else {
+        record.goodQty = record.goodQtyBackups
+      }
+    },
+    // 修改返库数量
+    updateBackStockQty (val, record) {
       //  光标移出,值发生改变再调用编辑接口
       if (val && val != record.backStockQtyBackups) {
-        this.submitCheck([{
+        this.spinning = true
+        salesReturnDetailUpdateBackStockQty({
           salesReturnDetailSn: record.salesReturnDetailSn,
           backStockQty: record.backStockQty
-        }])
+        }).then(res => {
+          if (res.status == 200) {
+            this.resetSearchForm(true)
+            this.$message.success(res.message)
+            record.backStockQtyBackups = record.backStockQty
+          } else {
+            record.backStockQty = record.backStockQtyBackups
+          }
+          this.spinning = false
+        })
       } else {
         record.backStockQty = record.backStockQtyBackups
       }
     },
-    // 品检
-    submitCheck (data) {
-      this.loading = true
-      this.spinning = true
-      updateBackStockQty(data).then(res => {
-        if (res.status == 200) {
-          this.resetSearchForm(true)
-          this.$message.success(res.message)
-        }
-        this.loading = false
-        this.spinning = false
-      })
-    },
     // 获取单据详细
     getOrderDetail () {
       this.rowSelectionInfo = null
@@ -290,5 +323,11 @@ export default {
         }
       }
     }
+    .redBg-row{
+      background-color: #f5beb4;
+    }
+    .orgBg-row{
+      background-color: #fffca2;
+    }
   }
 </style>