н¨Îļþ¼Ð/PDA/pages/stash/outboundorderDetail.vue
@@ -1,21 +1,27 @@
<template>
   <view>
      <!-- <u-sticky>
      <u-sticky>
         <view style="background-color: #ffffff;">
            <uni-search-bar @confirm="search" v-model="searchValue"></uni-search-bar>
         </view>
      </u-sticky> -->
      </u-sticky>
      <uni-list :border="true">
         <uni-list-item direction="column" clickable @click="groupClick(item.batch_num)" link
            :to="page+item.batch_num+'&order_qty='+item.order_qty+'&order_Inqty='+item.order_Outqty+'&goods_no='+item.goods_no"
            v-for="item in allReceivingOrders" :key="item.batch_num">
         <uni-list-item direction="column" clickable @click="groupClick(item.locationCode)" link
            :to="page+item.locationCode+'&stockQuantity='+item.stockQuantity+'&taskId='+item.taskId+'&materielCode='+item.materielCode+'&batchNo='+item.batchNo+'&materielName='+item.materielName"
            v-for="item in allReceivingOrders" :key="item.locationCode">
            <template v-slot:body>
               <uni-group margin-top="20">
                  <view> ç‰©æ–™åç§°:{{item.materielName}} </view>
                  <view> å“å/通用名:{{item.item || ''}} </view>
                  <view> ç‰©æ–™ç¼–号:{{item.materielCode}} </view>
                  <view> ç‰©æ–™è§„æ ¼:{{item.materielSpec}} </view>
                  <view> ç”Ÿäº§åނ家:{{item.factory || ''}} </view>
                  <view> åŸºæœ¬å•位:{{item.materielUnit}} </view>
                  <view> æ•ˆæœŸ:{{item.modifier || ''}} </view>
                  <view> æ‰¹å·:{{item.batchNo}} </view>
                  <view> å•据编号:{{orderNo}} </view>
                  <view> æ‰¹å·:{{item.batch_num}} </view>
                  <view> ç‰©æ–™ç¼–号:{{item.goods_no}} </view>
                  <view> å•据数量:{{item.order_qty}} </view>
                  <view> å‡ºåº“数量:{{item.order_Outqty}} </view>
                  <view> è´§ä½ç¼–号:{{item.locationCode}} </view>
                  <view> æ•°é‡:{{item.stockQuantity}} </view>
               </uni-group>
            </template>
         </uni-list-item>
@@ -31,7 +37,7 @@
   export default {
      data() {
         return {
            page: "/pages/stash/Outorderboxing?",
            page: "/pages/stash/outFinish?",
            loadVisible: false,
            searchValue: "",
            status: "more",
@@ -39,24 +45,77 @@
            orderNo: "",
            pageNo: 1,
            scrollTop: 0,
            warehouseId: ""
            outTask: false,
            warehouseId: "",
            hasDataLoaded: false,  // æ•°æ®æ˜¯å¦å·²åŠ è½½è¿‡
            shouldRefreshFromC: false,  //  å…³é”®ï¼šä»ŽC页面返回时需要刷新的标志
         }
      },
      onLoad(res) {
         this.warehouseId = res.warehouseId;
         this.orderNo = res.orderNo;
         this.allReceivingOrders=res.detail;
         this.page = this.page + "orderNo=" + this.orderNo +"&warehouseId=" + this.warehouseId + "&batchNo=";
         this.getData();
      // ç›‘听来自C页面的刷新事件
      const eventChannel = this.getOpenerEventChannel();
      if (eventChannel) {
         eventChannel.on('refreshData', (data) => {
         if (data.refresh) {
            this.pageNo = 1;
            this.allReceivingOrders = [];
            this.getData();
         }
         });
      }
      // ä¿å­˜ä¼ å…¥çš„初始数据
      if (res.detail && res.detail.length > 0) {
         this.allReceivingOrders = res.detail;
      }
      this.warehouseId = res.warehouseId;
      this.orderNo = res.orderNo;
      this.page = this.page + "orderNo=" + this.orderNo + "&warehouseId=" + this.warehouseId + "&locationCode=";
      },
      onReachBottom() {
   // åªæœ‰åœ¨è¿˜æœ‰æ›´å¤šæ•°æ®æ—¶æ‰åŠ è½½ä¸‹ä¸€é¡µ
      if (this.status === 'more') {
         this.pageNo += 1;
         this.getData();
  }
      },
        // æ·»åŠ è¿™ä¸ªç”Ÿå‘½å‘¨æœŸ
  onHide() {
    // é¡µé¢éšè—æ—¶ä¸åšä»»ä½•操作
  },
      onShow() {
  // æ£€æŸ¥æ˜¯å¦éœ€è¦åˆ·æ–°
         const needRefresh = uni.getStorageSync('needRefreshOutbound');
         if (needRefresh) {
            uni.removeStorageSync('needRefreshOutbound');
            this.pageNo = 1;
            this.allReceivingOrders = [];
            this.getData();
            return;
         }
         // å¦‚果还没有加载过数据,加载数据
         if (!this.hasDataLoaded) {
            this.pageNo = 1;
            this.allReceivingOrders = [];
            this.getData();
            this.hasDataLoaded = true;
         }
         },
      onPageScroll(e) {
         this.scrollTop = e.scrollTop;
      },
      methods: {
          // æ·»åŠ åˆ·æ–°æ–¹æ³•ä¾›å…¶ä»–é¡µé¢è°ƒç”¨
         // refreshData() {
         //    console.log('收到刷新请求');
         //    this.pageNo = 1;
         //    this.allReceivingOrders = [];
         //    this.getData();
         // },
         search(res) {
            this.pageNo = 1;
            this.getData();
@@ -64,46 +123,106 @@
         groupClick() {
         },
         getData() {
            // var postData = {
            //    MainData: {
            //       warehouseId: this.warehouseId,
            //       orderNo: this.searchValue,
            //       pageNo: this.pageNo
            //    },
            // }
            if (this.pageNo == 1) this.allReceivingOrders = [];
            this.$u.post('/api/DeliveryOrder/GetDeliveryOrderDetail?pageNo=' + this.warehouseId + '&orderNo=' + this.orderNo+'&isPick=false').then((
               res) => {
                  if (res.status) {
                     if (res.data.length > 0) {
                        if (this.searchValue == '') {
                           this.allReceivingOrders = this.allReceivingOrders.concat(res.data);
                           // this.allReceivingOrders = res.data;
                           if (this.allReceivingOrders.length > 3) {
                              this.loadVisible = true;
                           } else {
                              this.loadVisible = false;
                           }
                        } else {
                           this.allReceivingOrders = res.data;
                           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,
         //          locationCode: this.searchValue,
         //          orderNo: this.orderNo,
         //          pageNo: this.pageNo,
         //          isCheck:false,
         //       },
         //    }
         //    if (this.pageNo == 1) this.allReceivingOrders = [];
         //    this.$u.post('/api/DeliveryOrder/CheckOutTasks',postData).then((
         //       res) => {
         //          if (res.status) {
         //             if (res.data.length > 0) {
         //                if (this.searchValue == '') {
         //                   this.allReceivingOrders = this.allReceivingOrders.concat(res.data);
         //                   // this.allReceivingOrders = res.data;
         //                   if (this.allReceivingOrders.length > 3) {
         //                      this.loadVisible = true;
         //                   } else {
         //                      this.loadVisible = false;
         //                   }
         //                } else {
         //                   this.allReceivingOrders = res.data;
         //                   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,
         locationCode: this.searchValue,
         orderNo: this.orderNo,
         pageNo: this.pageNo,
         isCheck: false,
         },
      }
      // å¦‚果是第一页或搜索,清空数据
      if (this.pageNo === 1 || this.searchValue !== '') {
         this.allReceivingOrders = [];
         this.status = "more";
      }
      this.$u.post('/api/DeliveryOrder/CheckOutTasks', postData).then((res) => {
         if (res.status) {
         if (res.data && res.data.length > 0) {
            // è¿½åŠ æ•°æ®
            this.allReceivingOrders = [...this.allReceivingOrders, ...res.data];
            // åˆ†é¡µé€»è¾‘
            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 = [];
            }
            // ç›´æŽ¥è¿”回A页面,不需要提示
            if (this.allReceivingOrders.length === 0 && this.pageNo === 1) {
            setTimeout(() => {
               uni.navigateBack({
               delta: 1  // è¿”回A页面
               });
            }, 300); // ç¨å¾®å»¶è¿Ÿä¸€ä¸‹ï¼Œè®©ç”¨æˆ·çœ‹åˆ°"没有数据"的状态
            }
         }
         }
      }).catch(err => {
         console.error('请求失败:', err);
         this.status = 'noMore';
      })
      }
      }
   }
</script>
</script>
<style lang="scss">
   @import '@/common/uni-ui.scss';