#
whycq
2023-04-02 25f5f7850bbdf013b8dd4cb88e9d485170e9e799
pages/mat/matQuery.vue
@@ -14,7 +14,7 @@
            <view class="tag-item">{{item.name}}</view>
         </view>
      </scroll-view>
      <scroll-view>
      <view>
         <view class="tag-list" v-for="(item,i) in matList" :key="i" @click="findBySelect(item.matnr)">
            <view class="tag">
               <view style="display: flex;">
@@ -25,7 +25,8 @@
            <view class="tag-item">商品名称: {{item.maktx}}</view>
            <view class="tag-item">商品规格: {{item.specs}}</view>
         </view>
      </scroll-view>
      </view>
      <uni-load-more v-show="matList.length != 0" :status="status" :icon-size="16" :content-text="contentText" />
   </view>
</template>
@@ -34,15 +35,30 @@
      data() {
         return {
            tagList: [],
            matList: '',
            matList: [],
            reload: false,
            curr:1,
            tag: '分类',
            baColor: "background-color: #0081ff;",
            desc: '商品编号:',
            baseUrl: '',
            token: ''
            token: '',
            status: 'more',
            contentText: {
               contentdown: '上拉加载更多',
               contentrefresh: '加载中',
               contentnomore: '没有更多'
            },
            // 当前tagId
            tagIdNow: 1
         }
      },
      onReachBottom() {
         this.status = 'more';
         this.showMat(this.tagIdNow);
      },
      onLoad() {
         // 没啥用了
         let that = this
         // const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
         const eventChannel = this.getOpenerEventChannel();
@@ -50,7 +66,6 @@
         // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
         eventChannel.on('commonUrl', function(data) {
            that.commonUrl = data.commonUrl
            that.showTag(1)
         })
      },
      onShow() {
@@ -77,7 +92,7 @@
               },
               success(result) {
                  that.tagList = null
                  that.matList = null
                  that.matList = []
                  var res = result.data
                  if (res.code === 200) {
                     if (res.data != null && res.data.length > 0) {
@@ -100,12 +115,16 @@
         },
         showMat(tagId) {
            let that = this
            that.tagIdNow = tagId
            if (tagId == null || tagId == '' || tagId == undefined) {
               return;
            }
            console.log(tagId);
            uni.request({
                url: that.baseUrl + '/mat/list/pda/auth',
                url: that.baseUrl + '/mat/list/pda/page/auth',
                data: {
                  curr:that.curr,
                  limit: 100,
                  tagId: tagId
                },
               method:"GET",
@@ -116,8 +135,13 @@
                  that.tagList = null
                  var res = result.data
                  if (res.code === 200) {
                     if (res.data != null && res.data.length > 0) {
                        that.matList = res.data
                     if (res.data.records != null && res.data.records.length > 0) {
                        let list = res.data.records
                        that.matList = that.reload ? list : that.matList.concat(list);
                        that.curr = that.curr + 1
                        if (res.data.records.length == 0) {
                           that.status = 'noMore'
                        }
                        that.baColor = "background-color: #1cbbb4;"
                     }
                  } else if (res.code === 403 ) {