yanjinhui
2025-12-01 2b49f7643d15b74889d190f216630559006ed93a
н¨Îļþ¼Ð/PDA/pages/stash/inboundorder.vue
@@ -71,9 +71,11 @@
         this.getData();
      },
      onReachBottom() {
         this.pageNo += 1;
         if (this.status === 'more') {
            this.pageNo += 1;
         this.getData();
         this.isLoaded = true;
         }
      },
      onShow() {
         this.isLoaded = uni.getStorageSync('isLoaded');
@@ -90,61 +92,66 @@
      },
      methods: {
         search(res) {
            this.pageNo = 1;
            this.getData();
         },
         groupClick() {
         },
         getData() {
            var postData = {
               MainData: {
                  warehouseId: this.warehouseId,
                  orderNo: this.searchValue,
                  pageNo: this.pageNo
               },
            }
            // if (this.pageNo == 1) this.allReceivingOrders = [];
            this.$u.post('/api/CabinOrder/GetCabinOrders', postData).then((res) => {
               if (res.status) {
                  if (res.data.length > 0) {
                     if (this.searchValue == '') {
                        this.allReceivingOrders = res.data.map(i => ({
                           ...i,
                           InboundOrderStatus: i.odrderStatus.label,
                           SumQty: i.details.map(item => item.order_qty).reduce((prev,
                              next) => prev + next, 0),
                           OverQty: i.details.map(item => item.order_Inqty).reduce((prev,
                              next) => prev + next, 0)
                        }));
                        // this.allReceivingOrders = res.data;
                        if (this.allReceivingOrders.length > 3) {
                           this.loadVisible = true;
                        } else {
                           this.loadVisible = false;
                        }
                     } else {
                        this.allReceivingOrders = res.data.map(i => ({
                           ...i,
                           InboundOrderStatus: i.odrderStatus.label,
                           SumQty: i.details.map(item => item.order_qty).reduce((prev,
                              next) => prev + next, 0),
                           OverQty: i.details.map(item => item.order_Inqty).reduce((prev,
                              next) => prev + next, 0)
                        }));
                        if (this.allReceivingOrders.length > 3) {
                           this.loadVisible = true;
                        } else {
                           this.loadVisible = false;
                        }
                     }
                  } else {
                     this.status = 'noMore';
                     //this.allReceivingOrders = [];
                     this.loadVisible = true;
                  }
               }
            })
         }
   getData() {
  var postData = {
    MainData: {
      warehouseId: this.warehouseId,
      orderNo: this.searchValue,
      pageNo: this.pageNo
    },
  }
  // å¦‚果是第一页或搜索,清空数据
  if (this.pageNo === 1 || this.searchValue !== '') {
    this.allReceivingOrders = [];
    this.status = "more";
  }
  this.$u.post('/api/CabinOrder/GetCabinOrders', postData).then((res) => {
    if (res.status) {
      if (res.data && res.data.length > 0) {
        const newData = res.data.map(i => ({
          ...i,
          InboundOrderStatus: i.odrderStatus.label,
          SumQty: i.details.map(item => item.order_qty).reduce((prev, next) => prev + next, 0),
          OverQty: i.details.map(item => item.order_Inqty).reduce((prev, next) => prev + next, 0)
        }));
        // å…³é”®ä¿®æ”¹ï¼šè¿½åŠ æ•°æ®è€Œä¸æ˜¯æ›¿æ¢
        this.allReceivingOrders = [...this.allReceivingOrders, ...newData];
        // å¦‚果返回的数据少于5条,说明没有更多数据了
        if (res.data.length < 5) {
          this.status = 'noMore';
        } else {
          this.status = 'more';
        }
        // æŽ§åˆ¶åŠ è½½æç¤ºæ˜¾ç¤º
        this.loadVisible = this.allReceivingOrders.length > 0;
      } else {
        // æ²¡æœ‰æ•°æ®
        this.status = 'noMore';
        this.loadVisible = this.allReceivingOrders.length > 0;
        // å¦‚果是第一页且没有数据,显示空状态
        if (this.pageNo === 1) {
          this.allReceivingOrders = [];
        }
      }
    }
  }).catch(err => {
    console.error('请求失败:', err);
    this.status = 'noMore';
  })
}
      }
   }
</script>