yyb
5 天以前 80e5e05360baedb95e20b8cb11746a7776c85acf
pages/product/WorkshopOrderIssued/comp.vue
@@ -9,7 +9,7 @@
      </u-search>
    </view>
    <view class="wrap">
      <scroll-view class="finishProductIn-locno-scroll-list" scroll-y="true" @scrolltolower="loadMore">
         <scroll-view class="finishProductIn-locno-scroll-list" scroll-y="true" @scrolltolower="getmoreList()">
        <u-cell-group class="finishProductIn-locno-scroll-list-group" :border="false">
          <view class="content" v-for="(item, index) in list" :key="item.locNo" :index="index"
            @click="selectNo(item.index)">
@@ -80,8 +80,8 @@
            </view>
          </view>
        </u-cell-group>
        <view class="loadmore" @click="loadMore">
          <u-loadmore :status="loadStatus"></u-loadmore>
            <view class="loadmore" @click="getmoreList()">
               <u-loadmore :status="status" :load-text="loadText" @loadmore="getmoreList()" />
        </view>
      </scroll-view>
    </view>
@@ -99,62 +99,74 @@
        backgroundRepeat: 'no-repeat',
      },
      keywords: '',
      alllist: [],
      originList: [],
      query: {
        current: 1,
        size: 10
            list: [],
            total: 0,
            pageNum: 1,
            pageSize: 10,
            status:'loading',
            loadText: {
               loadmore: "加载更多...",
               loading: "努力加载中...",
               nomore: "没有更多了",
      },
      list: [
        {
          index: 1,
          value0: '123456789',
          value1: '123456789',
          value2: '123456789',
          value3: '123456789',
          value4: '123456789',
          value5: '123456789'
        }
      ],
      count: 0,
      loadStatus: 'loading'
    };
  },
  onLoad() {
    this.$u.api.finishProductIn.fetchList().then(res => {
      this.alllist = res.data
      this.originList = res.data
      this.loadList()
    })
         this.getlist();
  },
  methods: {
    loadMore() {
      if (this.loadStatus == "nomore" || this.loadStatus == "loading") {
        return
         getmoreList() {
            if (this.pageSize >= this.total) {
               this.status = "nomore";
               return;
      }
      this.loadStatus = "loading";
            this.status = "loading";
      setTimeout(() => {
        this.query.current += 1;
        this.loadList();
      }, 100);
               this.pageSize += this.pageSize;
               this.getlist();
            }, 1000);
    },
    loadList() {
      const data = this.originList.slice((this.query.current - 1) * this.query.size, this.query.current * this.query.size)
      this.list = this.list.concat(data);
      this.loadStatus = "loadmore";
      if (!data || data.length < this.query.size) {
        this.loadStatus = "nomore";
         getlist() {
            this.$u.api.workReporting
               ._({
                  current: this.pageNum,
                  size: this.pageSize
               })
               .then((res) => {
                  console.log("res", res);
                  this.list = res.data.records;
                  this.total = res.data.total;
                  if (this.pageSize >= this.total) {
                     this.status = "nomore";
                  } else {
                     this.status = "loadmore";
      }
               });
    },
    search(value) {
      this.list = [];
      this.query.current = 1;
            console.log("111", value);
      if (value) {
        this.originList = this.alllist.filter(item => item.locNo.includes(value))
               this.list = [];
               this.pageSize = 10;
               this.$u.api.workReporting
                  ._({
                     current: this.pageNum,
                     size: this.pageSize,
                     moNo: value,
                  })
                  .then((res) => {
                     console.log("res", res);
                     this.list = res.data.records;
                     this.total = res.data.total;
                     if (this.pageSize >= this.total) {
                        this.status = "nomore";
      } else {
        this.originList = this.alllist
                        this.status = "loadmore";
      }
      this.loadList()
                  });
            } else {
               this.getlist();
            }
    },
    selectNo(no) {
      this.refreshLastPage(no)
@@ -170,7 +182,7 @@
      let prevPage = pages[pages.length - 2]
      // 触发上一页 upData 函数(并携带参数)
      prevPage.$vm.setNo(no)
            prevPage.$vm.compNo(no)
      // 返回上一页
      uni.navigateBack({