Просмотр исходного кода

fix(goodsDetail): 更新收货和驳回逻辑,仅提交勾选的数据

xieyong 5 дней назад
Родитель
Сommit
bf18c2114b
1 измененных файлов с 9 добавлено и 11 удалено
  1. 9 11
      src/views/beEntrusted/components/goodsDetail.vue

+ 9 - 11
src/views/beEntrusted/components/goodsDetail.vue

@@ -362,12 +362,8 @@
           return this.$message.warning('请先选择一条收货数据!');
           return this.$message.warning('请先选择一条收货数据!');
         }
         }
 
 
-        const selectionIds = new Set(this.selection.map((it) => it.id));
-        this.goodsList.forEach((item) => {
-          if (!selectionIds.has(item.id)) {
-            item.receiveQuantity = 0;
-          }
-        });
+        // 仅提交勾选的数据
+        const selectedList = this.selection.map((item) => this.deepCopy(item));
 
 
         const totalNum = this.selection.reduce(
         const totalNum = this.selection.reduce(
           (total, pro) => total + Number(pro.receiveQuantity || 0),
           (total, pro) => total + Number(pro.receiveQuantity || 0),
@@ -393,7 +389,7 @@
             background: 'rgba(0, 0, 0, 0.7)'
             background: 'rgba(0, 0, 0, 0.7)'
           });
           });
 
 
-          confirmReceipt(this.goodsList)
+          confirmReceipt(selectedList)
             .then(() => {
             .then(() => {
               this.loading.close();
               this.loading.close();
               this.$message.success('收货成功');
               this.$message.success('收货成功');
@@ -423,13 +419,15 @@
       },
       },
 
 
       confirmReject() {
       confirmReject() {
+        if (this.selection.length === 0) {
+          return this.$message.warning('请先选择一条驳回数据!');
+        }
         this.$refs.rejectForm.validate((valid) => {
         this.$refs.rejectForm.validate((valid) => {
           if (!valid) return;
           if (!valid) return;
-          this.$confirm('确认要驳回该收货单吗?', '提示', { type: 'warning' })
+          this.$confirm('确认要驳回所选数据吗?', '提示', { type: 'warning' })
             .then(() => {
             .then(() => {
-              const ids = this.goodsList.map((it) => {
-                return it.id;
-              });
+              // 仅提交勾选的数据
+              const ids = this.selection.map((it) => it.id);
 
 
               console.log('7777');
               console.log('7777');