#
zhou zhou
2025-12-18 11c52061e55be42d4cd630a49fa2fbde82650f52
pages/order/orderList.vue
@@ -1,23 +1,55 @@
<template>
   <view>
   <view class="page-container">
      <!-- 搜索框 -->
      <view class="search-bar">
         <uni-search-bar v-model="condition" placeholder=" 扫码 / 输入" bgColor="#EEEEEE" @confirm="search" />
      </view>
      <view>
         <view class="tag-list" v-for="(item,i) in matList" :key="i" @click="toPrint(item)">
            <view class="tag">
               <view style="display: flex;">
                  <view class="wms-tag" :style="baColor" >单据</view>
         <uni-search-bar v-model="condition" placeholder=" 扫码 / 输入" bgColor="#F5F5F5" @confirm="search" @cancel="onCancelSearch" />
      </view>
      <!-- 订单列表 -->
      <view class="order-list">
         <view class="order-card" v-for="(item,i) in matList" :key="i" @click="toPrint(item)">
            <!-- 卡片头部 -->
            <view class="card-header">
               <view class="order-badge" :class="getSettleClass(item.settle)">
                  <text class="badge-text">{{item.settle$ || '未知'}}</text>
               </view>
               <view class="order-no">
                  <text class="order-no-label">单据号</text>
                  <text class="order-no-value">{{item.orderNo}}</text>
               </view>
            </view>
            <view class="tag-item">单据号: {{item.orderNo}}</view>
            <view class="tag-item">单据类型: {{item.docType$}}</view>
            <view class="tag-item">单据状态: {{item.settle$}}</view>
            <view class="tag-item">仓库: {{item.itemName}}</view>
            <!-- 卡片内容 -->
            <view class="card-body">
               <view class="info-row">
                  <view class="info-item">
                     <text class="info-label">单据类型</text>
                     <text class="info-value">{{item.docType$ || '-'}}</text>
                  </view>
                  <view class="info-item">
                     <text class="info-label">仓库</text>
                     <text class="info-value">{{item.itemName || '-'}}</text>
                  </view>
               </view>
            </view>
            <!-- 卡片底部 -->
            <view class="card-footer">
               <text class="view-detail">查看详情</text>
               <uni-icons type="right" size="14" color="#999"></uni-icons>
            </view>
         </view>
      </view>
      <uni-load-more v-show="matList.length != 0" :status="status" :icon-size="16" :content-text="contentText" />
      <!-- 空状态 -->
      <view class="empty-state" v-if="matList.length === 0 && !loading">
         <uni-icons type="search" size="60" color="#CCCCCC"></uni-icons>
         <text class="empty-text">暂无订单数据</text>
         <text class="empty-hint">下拉刷新试试</text>
      </view>
      <!-- 加载更多 -->
      <uni-load-more v-show="matList.length !== 0" :status="status" :icon-size="16" :content-text="contentText" />
   </view>
</template>
@@ -28,11 +60,8 @@
            tagList: [],
            matList: [],
            condition: '',
            reload: false,
            curr:1,
            tag: '分类',
            baColor: "background-color: #0081ff;",
            desc: '商品编号:',
            loading: false,
            curr: 1,
            baseUrl: '',
            token: '',
            status: 'more',
@@ -43,168 +72,165 @@
            },
            // 当前tagId
            tagIdNow: 1,
         }
      },
      // 下拉刷新
      onPullDownRefresh() {
         this.refreshData();
      },
      // 上拉加载更多
      onReachBottom() {
         this.status = 'more';
         this.showMat(this.tagIdNow);
         if (this.status !== 'noMore') {
            this.status = 'loading';
            this.loadMoreData();
         }
      },
      onLoad() {
         // 没啥用了
         let that = this
         // const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
         const eventChannel = this.getOpenerEventChannel();
         // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
         eventChannel.on('commonUrl', function(data) {
            that.commonUrl = data.commonUrl
         })
         if (eventChannel) {
            eventChannel.on('commonUrl', function(data) {
               that.commonUrl = data.commonUrl
            })
         }
      },
      onShow() {
         this.baseUrl = uni.getStorageSync('baseUrl');
         this.token = uni.getStorageSync('token');
         this.showMat(1)
         // 每次进入页面重新加载
         this.refreshData();
      },
      methods: {
         search() {
            let that = this
            uni.request({
                url: that.baseUrl + '/order/search/pda/auth',
                data: {
                  condition: that.condition
                },
               method:"GET",
                header: {
                  'token':uni.getStorageSync('token'),
                },
               success(result) {
                  console.log(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'})
                  }
               }
            });
         // 刷新数据
         refreshData() {
            this.curr = 1;
            this.matList = [];
            this.status = 'more';
            this.loading = true;
            this.fetchOrderList(true);
         },
         showTag(parentId) {
            let that = this
         // 加载更多数据
         loadMoreData() {
            this.fetchOrderList(false);
         },
         // 获取订单列表
         fetchOrderList(isRefresh) {
            let that = this;
            uni.request({
                url: that.baseUrl + '/tag/list/pda/auth',
               header: {
                  'token':uni.getStorageSync('token'),
               url: that.baseUrl + '/order/pakin/order/list/pda/page/auth',
               data: {
                  curr: that.curr,
                  limit: 20,
                  tagId: that.tagIdNow
               },
                data: {
                  limit: 100000,
                  parentId: parentId
                },
               method: "GET",
               header: {
                  'token':uni.getStorageSync('token'),
                  'token': uni.getStorageSync('token'),
               },
               success(result) {
                  that.tagList = null
                  that.matList = []
                  var res = result.data
                  var res = result.data;
                  if (res.code === 200) {
                     if (res.data != null && res.data.length > 0) {
                        that.tagList = res.data
                     let records = res.data.records || [];
                     if (records.length > 0) {
                        if (isRefresh) {
                           that.matList = records;
                        } else {
                           that.matList = that.matList.concat(records);
                        }
                        that.curr = that.curr + 1;
                        that.status = 'more';
                     } else {
                        that.showMat(parentId)
                        that.status = 'noMore';
                     }
                     that.baColor = "background-color: #0081ff;"
                  } else if (res.code === 403 ) {
                     uni.showToast({title: res.msg, icon: "none", position: 'top'})
                  } else if (res.code === 403) {
                     uni.showToast({ title: res.msg, icon: "none", position: 'top' });
                     setTimeout(() => {
                        uni.reLaunch({
                           url: '../login/login'
                        });
                        uni.reLaunch({ url: '../login/login' });
                     }, 1000);
                  } else {
                     uni.showToast({title: res.msg, icon: "none",position: 'top'})
                     uni.showToast({ title: res.msg, icon: "none", position: 'top' });
                  }
               },
               fail(err) {
                  uni.showToast({ title: '网络请求失败', icon: "none", position: 'top' });
               },
               complete() {
                  that.loading = false;
                  uni.stopPullDownRefresh();
               }
            });
         },
         showMat(tagId) {
            let that = this
            // wms端 补接口
            // @RequestMapping(value = "/mat/list/pda/page/auth")
            // @ManagerAuth
            // public R pdaPageList(@RequestParam(required = true)Long tagId,
            //                 @RequestParam(defaultValue = "1")Integer curr,
            //                 @RequestParam(defaultValue = "10")Integer limit){
            //    EntityWrapper<Mat> wrapper = new EntityWrapper<>();
            //    wrapper.eq("tag_id", tagId);
            //    wrapper.orderBy("create_time", false);
            //    return R.ok().add(matService.selectPage(new Page<>(curr, limit), wrapper));
            // }
         // 搜索
         search() {
            if (!this.condition.trim()) {
               this.refreshData();
               return;
            }
            let that = this;
            that.loading = true;
            uni.request({
                url: that.baseUrl + '/order/list/pda/page/auth',
                data: {
                  curr:that.curr,
                  limit: 100,
                  tagId: tagId
                },
               method:"GET",
                header: {
                  'token':uni.getStorageSync('token'),
                },
               url: that.baseUrl + '/order/search/pda/auth',
               data: {
                  condition: that.condition
               },
               method: "GET",
               header: {
                  'token': uni.getStorageSync('token'),
               },
               success(result) {
                  that.tagList = null
                  var res = result.data
                  var res = result.data;
                  if (res.code === 200) {
                     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 ) {
                     uni.showToast({title: res.msg, icon: "none", position: 'top'})
                     that.matList = res.data || [];
                     that.status = 'noMore';
                  } else if (res.code === 403) {
                     uni.showToast({ title: res.msg, icon: "none", position: 'top' });
                     setTimeout(() => {
                        uni.reLaunch({
                           url: '../login/login'
                        });
                        uni.reLaunch({ url: '../login/login' });
                     }, 1000);
                  } else {
                     uni.showToast({title: res.msg, icon: "none",position: 'top'})
                     uni.showToast({ title: res.msg, icon: "none", position: 'top' });
                  }
               },
               fail() {
                  uni.showToast({ title: '搜索请求失败', icon: "none", position: 'top' });
               },
               complete() {
                  that.loading = false;
               }
            });
         },
         // 取消搜索
         onCancelSearch() {
            this.condition = '';
            this.refreshData();
         },
         // 根据状态返回样式类名
         getSettleClass(settle) {
            // settle: 1-待处理, 2-处理中, 3-已完成, 4-已取消 (根据实际情况调整)
            const classMap = {
               1: 'badge-pending',
               2: 'badge-processing',
               3: 'badge-completed',
               4: 'badge-cancelled'
            };
            return classMap[settle] || 'badge-default';
         },
         // 跳转到订单详情
         toPrint(item) {
            let that = this
            let that = this;
            uni.navigateTo({
               url: "../order/orderDetlList",
               success: function(res) {
                  // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的
                  res.eventChannel.emit('data', {
                     data: item
                  })
                  });
               },
               events: {
                  // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据  另外一个页面传过来的
                  acceptDataFromOpenedPage: function(data) {
                     that.matnr = data.data
                     that.findMat(that.matnr)
                     that.matnr = data.data;
                     that.findMat(that.matnr);
                  },
               },
            });
         }
      }
@@ -213,34 +239,155 @@
<style>
   @import url('../../static/css/wms.css/wms.css');
   .tag-list {
      width: 94%;
      min-height: 160rpx;
      margin: 10px auto;
      background-color: #FFF;
      border-radius: 5px;
      box-shadow: 0 5upx 20upx rgba(0, 0, 0, 0.2);
   .page-container {
      min-height: 100vh;
      background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
      padding-bottom: 20rpx;
   }
   .tag {
   .search-bar {
      padding: 0rpx 14rpx;
      background: #ffffff;
      box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
   }
   .order-list {
      padding: 0 24rpx;
   }
   .order-card {
      background: #ffffff;
      border-radius: 16rpx;
      margin-top: 20rpx;
      box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08);
      overflow: hidden;
      transition: transform 0.2s ease, box-shadow 0.2s ease;
   }
   .order-card:active {
      transform: scale(0.98);
      box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.12);
   }
   .card-header {
      display: flex;
      align-items: center;
      padding: 24rpx 28rpx;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
   }
   .order-badge {
      padding: 6rpx 16rpx;
      border-radius: 20rpx;
      margin-right: 20rpx;
   }
   .badge-text {
      font-size: 22rpx;
      font-weight: 500;
      color: #ffffff;
   }
   /* 状态徽章颜色 */
   .badge-pending {
      background: rgba(255, 255, 255, 0.3);
   }
   .badge-processing {
      background: #ffc107;
   }
   .badge-completed {
      background: #28a745;
   }
   .badge-cancelled {
      background: #dc3545;
   }
   .badge-default {
      background: rgba(255, 255, 255, 0.25);
   }
   .order-no {
      flex: 1;
   }
   .order-no-label {
      font-size: 22rpx;
      color: rgba(255, 255, 255, 0.7);
      display: block;
   }
   .order-no-value {
      font-size: 28rpx;
      color: #ffffff;
      font-weight: 600;
      display: block;
      margin-top: 4rpx;
   }
   .card-body {
      padding: 24rpx 28rpx;
   }
   .info-row {
      display: flex;
      flex-wrap: wrap;
   }
   .info-item {
      width: 50%;
      margin-bottom: 16rpx;
   }
   .info-label {
      font-size: 24rpx;
      color: #909399;
      display: block;
   }
   .info-value {
      font-size: 28rpx;
      color: #303133;
      font-weight: 500;
      display: block;
      margin-top: 6rpx;
   }
   .card-footer {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      padding: 20rpx 28rpx;
      border-top: 1rpx solid #f0f0f0;
   }
   .view-detail {
      font-size: 26rpx;
      color: #909399;
      margin-right: 8rpx;
   }
   /* 空状态 */
   .empty-state {
      display: flex;
      flex-direction: column;
      min-height: 80rpx;
      border-bottom: 1px solid #e2e2e2;
      align-items: center;
      justify-content: center;
      padding: 120rpx 0;
   }
   .wms-tag {
      min-width: 60rpx;
      margin-left: 50rpx;
   .empty-text {
      font-size: 30rpx;
      color: #909399;
      margin-top: 30rpx;
      color: #FFF;
      font-size: 14px;
      padding: 4rpx 12rpx;
   }
   .tag-item {
      width: 100%;
      min-height: 60rpx;
      line-height: 2;
      padding-left: 50rpx;
      color: #606266;
      font-size: 14px;
   .empty-hint {
      font-size: 24rpx;
      color: #c0c4cc;
      margin-top: 12rpx;
   }
</style>