#
whycq
2024-07-29 3d5efbc419d3ddff189d8d0c36cf743887d28eaa
pages/mat/matQuery.vue
@@ -2,13 +2,13 @@
   <view>
      <!-- 搜索框 -->
      <view class="search-bar">
         <uni-search-bar placeholder=" 扫码 / 输入" bgColor="#EEEEEE" @confirm="search" />
         <uni-search-bar v-model="condition" placeholder=" 掃碼 / 輸入" bgColor="#EEEEEE" @confirm="search" />
      </view>
      <scroll-view>
         <view class="tag-list" v-for="(item,i) in tagList" :key="i" @click="showTag(item.id)">
            <view class="tag">
               <view style="display: flex;">
                  <view class="wms-tag" :style="baColor" >分类</view>
                  <view class="wms-tag" :style="baColor" >分類</view>
               </view>
            </view>
            <view class="tag-item">{{item.name}}</view>
@@ -21,9 +21,9 @@
                  <view class="wms-tag" :style="baColor" >商品</view>
               </view>
            </view>
            <view class="tag-item">商品编号: {{item.matnr}}</view>
            <view class="tag-item">商品名称: {{item.maktx  ? item.maktx : '--'}}</view>
            <view class="tag-item">商品规格: {{item.specs  ? item.specs : '--'}}</view>
            <view class="tag-item">商品編號: {{item.matnr}}</view>
            <view class="tag-item">商品名稱: {{item.maktx  ? item.maktx : '--'}}</view>
            <view class="tag-item">商品規格: {{item.specs  ? item.specs : '--'}}</view>
         </view>
      </view>
      <uni-load-more v-show="matList.length != 0" :status="status" :icon-size="16" :content-text="contentText" />
@@ -36,18 +36,19 @@
         return {
            tagList: [],
            matList: [],
            condition: '',
            reload: false,
            curr:1,
            tag: '分类',
            baColor: "background-color: #0081ff;",
            desc: '商品编号:',
            desc: '商品編號:',
            baseUrl: '',
            token: '',
            status: 'more',
            contentText: {
               contentdown: '上拉加载更多',
               contentrefresh: '加载中',
               contentnomore: '没有更多'
               contentdown: '上拉加載更多',
               contentrefresh: '加載中',
               contentnomore: '沒有更多'
            },
            // 当前tagId
            tagIdNow: 1
@@ -55,7 +56,9 @@
      },
      onReachBottom() {
         this.status = 'more';
         this.showMat(this.tagIdNow);
         if (this.tagList == null) {
            this.showMat(this.tagIdNow);
         }
      },
      onLoad() {
         // 没啥用了
@@ -75,6 +78,35 @@
      },
      methods: {
         search() {
            let that = this
            that.tagList = []
            that.matList = []
            uni.request({
                url: that.baseUrl + '/mat/search/pda/auth',
                data: {
                  condition: that.condition
                },
               method:"GET",
                header: {
                  'token':uni.getStorageSync('token'),
                },
               success(result) {
                  var res = result.data
                  if (res.code === 200 ) {
                     that.matList = res.data
                     // that.save()
                  } else if (res.code == 403) {
                     uni.showToast({title: res.msg, icon: "none", position: 'top'})
                     setTimeout(() => {
                        uni.reLaunch({
                           url: '../login/login'
                        });
                     }, 1000);
                  } else {
                     uni.showToast({title: res.msg, icon: "none",position: 'top'})
                  }
               }
            });
         },
         showTag(parentId) {
            let that = this
@@ -91,6 +123,7 @@
                  'token':uni.getStorageSync('token'),
               },
               success(result) {
                  console.log(result);
                  that.tagList = null
                  that.matList = []
                  var res = result.data
@@ -98,6 +131,7 @@
                     if (res.data != null && res.data.length > 0) {
                        that.tagList = res.data
                     } else {
                        that.tagList = []
                        that.showMat(parentId)
                     }
                  } else if (res.code === 403 ) {
@@ -123,7 +157,7 @@
                url: that.baseUrl + '/mat/list/pda/page/auth',
                data: {
                  curr:that.curr,
                  limit: 100,
                  limit: 20,
                  tagId: tagId
                },
               method:"GET",
@@ -193,11 +227,11 @@
      padding: 4rpx 12rpx;
   }
   .tag-item {
      width: 100%;
      min-height: 60rpx;
      line-height: 2;
      padding-left: 50rpx;
      color: #606266;
      font-size: 14px;
      word-wrap: break-word;
   }
</style>