#
zhou zhou
2025-12-19 8dbae264b163b253e46bec4638914c7ec58f28c5
pages/stock/stockQuery.vue
@@ -1,83 +1,115 @@
<template>
   <view>
      <!-- 搜索框 -->
      <view class="code">
         <view class="item">
            <view class="code-decs">库位号:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="locNo">
   <view class="page-container">
      <!-- 搜索表单 -->
      <view class="form-section">
         <view class="form-item">
            <view class="form-label">
               <uni-icons type="location" size="18" color="#667eea"></uni-icons>
               <text class="label-text">库位号</text>
            </view>
            <view class="form-input-wrap">
               <input class="form-input" type="text" placeholder="扫码 / 输入库位号" v-model="locNo" />
               <uni-icons v-if="locNo" type="clear" size="18" color="#c0c4cc" @click="locNo=''"></uni-icons>
            </view>
         </view>
         <view class="item">
            <view class="code-decs">物料号:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="matnr">
            <view class="item-right">
         <view class="form-item">
            <view class="form-label">
               <uni-icons type="list" size="18" color="#667eea"></uni-icons>
               <text class="label-text">物料号</text>
            </view>
            <view class="form-input-wrap">
               <input class="form-input" type="text" placeholder="扫码 / 输入物料号" v-model="matnr" @input="findMat()" />
               <uni-icons v-if="matnr" type="clear" size="18" color="#c0c4cc" @click="matnr=''"></uni-icons>
            </view>
         </view>
      </view>
      <view class="mat-list-title">
         商品列表
      <!-- 列表头部 -->
      <view class="list-header">
         <view class="header-left">
            <text class="header-title">库存列表</text>
            <view class="count-badge" v-if="dataList.length > 0">
               <text class="count-text">{{dataList.length}}</text>
            </view>
         </view>
      </view>
      
      <scroll-view>
         <view class="list" v-for="(item,i) in dataList" :key="i">
            <view class="list-left">
               <view class="list-left-item">
                  <view class="desc">No:</view>
                  <view class="left-item">{{i + 1}}</view>
      <!-- 库存列表 -->
      <view class="list-container">
         <view class="stock-card" v-for="(item, i) in dataList" :key="i">
            <view class="card-header">
               <view class="card-index">{{i + 1}}</view>
               <view class="loc-info">
                  <text class="loc-no">{{item.locNo}}</text>
               </view>
               <view class="list-left-item">
                  <view class="desc">编码:</view>
                  <view class="left-item">
                     <uni-tag :text="item.matnr" type="primary"></uni-tag>
                  </view>
               </view>
               <view class="list-left-item">
                  <view class="desc">品名:</view>
                  <view class="left-item">{{item.maktx}}</view>
               </view>
               <view class="list-left-item">
                  <view class="desc">规格:</view>
                  <view class="left-item">{{item.specs}}</view>
               </view>
               <view class="list-left-item">
                  <view class="desc">批号:</view>
                  <view class="left-item">
                     <uni-tag :text="item.batch" type="warning"></uni-tag>
                  </view>
               </view>
               <view class="list-left-item">
                  <view class="desc">数量:</view>
                  <view class="left-item">{{item.anfme}}</view>
               </view>
               <!-- <view class="list-left-item">
                  <view class="desc">库位号:</view>
                  <view class="left-item">{{item.locNo}}</view>
               <!-- <view class="qty-badge">
                  <text class="qty-text">{{item.anfme}}</text>
               </view> -->
            </view>
            <!-- <view class="list-right">
               <uni-icons type="compose" color="#9add8b" size="24" @click="revise(item,i)"></uni-icons>
               <uni-icons type="trash" color="#f58a8a" size="24" @click="remove(item,i,'warn')"></uni-icons>
            </view> -->
            <view class="card-body">
               <view class="info-row">
                  <view class="info-col">
                     <text class="info-label">物料编码</text>
                     <text class="info-value code">{{item.matnr}}</text>
                  </view>
               </view>
               <view class="info-row">
                  <view class="info-col">
                     <text class="info-label">物料名称</text>
                     <text class="info-value">{{item.maktx || '-'}}</text>
                  </view>
               </view>
               <view class="info-row">
                  <view class="info-col half">
                     <text class="info-label">规格</text>
                     <text class="info-value">{{item.specs || '-'}}</text>
                  </view>
                  <view class="info-col half">
                     <text class="info-label">批号</text>
                     <text class="info-value batch">{{item.batch || '-'}}</text>
                  </view>
               </view>
               <view class="info-row">
                  <view class="info-col half">
                     <text class="info-label">数量</text>
                     <text class="info-value qty">{{item.anfme}}</text>
                  </view>
               </view>
            </view>
         </view>
      </scroll-view>
      <!-- 底部操作按钮 -->
      <view class="buttom">
         <button size="mini" @click="reset('warn')">重置</button>
         <button size="mini" type="primary" @click="search()">查询</button>
         <!-- 空状态 -->
         <view class="empty-state" v-if="dataList.length === 0 && !loading">
            <uni-icons type="search" size="50" color="#CCCCCC"></uni-icons>
            <text class="empty-text">暂无库存数据</text>
            <text class="empty-hint">请输入条件后点击查询</text>
         </view>
         <view class="bottom-placeholder"></view>
      </view>
      <view>
         <!-- 提示信息弹窗 -->
         <uni-popup ref="message" type="message">
            <uni-popup-message :type="msgType1" :message="messageText" :duration="2000"></uni-popup-message>
         </uni-popup>
      <!-- 底部操作栏 -->
      <view class="bottom-bar">
         <view class="btn-reset" @click="reset('warn')">
            <uni-icons type="refresh" size="16" color="#909399"></uni-icons>
            <text class="btn-text">重置</text>
         </view>
         <view class="btn-submit" @click="search()">
            <uni-icons type="search" size="16" color="#ffffff"></uni-icons>
            <text class="btn-text">查询</text>
         </view>
      </view>
      <!-- 提示信息弹窗 -->
      <uni-popup ref="message" type="message">
         <uni-popup-message :type="msgType1" :message="messageText" :duration="2000"></uni-popup-message>
      </uni-popup>
      <!-- 确认重置 -->
      <view>
         <uni-popup ref="resetConfirm" type="dialog">
            <uni-popup-dialog :type="msgType" cancelText="取消" confirmText="确认" :title="title" :content="content"
               @confirm="resetConfirm" @close="resetClose"></uni-popup-dialog>
         </uni-popup>
      </view>
      <uni-popup ref="resetConfirm" type="dialog">
         <uni-popup-dialog :type="msgType" cancelText="取消" confirmText="确认" :title="title" :content="content"
            @confirm="resetConfirm" @close="resetClose"></uni-popup-dialog>
      </uni-popup>
   </view>
</template>
@@ -87,9 +119,10 @@
         return {
            baseUrl: '',
            token: '',
            locNo: null,
            matnr: null,
            locNo: '',
            matnr: '',
            dataList: [],
            loading: false,
            msgType: '',
            msgType1: '',
            messageText: '',
@@ -102,121 +135,352 @@
         this.token = uni.getStorageSync('token');
      },
      methods: {
         // 搜索物料
         findMat() {
            let that = this;
            // let m = that.matnr.split(";");
            // let matnr1 = m[0].slice(3);
            // setTimeout(() => {
            //    that.matnr = matnr1;
            // }, 100);
         },
         search() {
            let that = this
            let that = this;
            that.loading = true;
            uni.request({
               url: that.baseUrl + '/manLocDetl/list/auth',
               header:{'token':uni.getStorageSync('token')},
               url: that.baseUrl + '/locDetl/list/auth',
               header: { 'token': uni.getStorageSync('token') },
               data: {
                  curr: 1,
                  limit: 100,
                  loc_no: that.locNo,
                  locNo: that.locNo,
                  matnr: that.matnr
               },
               method:"GET",
               method: "GET",
               success(result) {
                  console.log(result)
                  let res = result.data
                  let records = res.data.records
                  let res = result.data;
                  if (res.code == 200) {
                     if (records) {
                        that.dataList = records
                        console.log(that.dataList)
                     let records = res.data.records;
                     if (records && records.length > 0) {
                        that.dataList = records;
                     } else {
                        that.dataList = [];
                        uni.showToast({
                           title: "暂无更多数据",
                           title: "暂无数据",
                           icon: "none",
                           position: 'top',
                           duration: 1000
                           duration: 1500
                        });
                     }
                  } else if (res.code == 403) {
                     uni.showToast({title: res.msg, icon: "none", position: 'top'})
                     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;
               }
            })
            });
         },
         reset(type) {
            this.msgType = type
            this.title = '警告'
            this.content = '是否重置!'
            this.$refs.resetConfirm.open()
            this.msgType = type;
            this.title = '确认重置';
            this.content = '是否清空查询条件?';
            this.$refs.resetConfirm.open();
         },
         // 确认重置
         resetConfirm() {
            this.dataList = []
            this.matnr = ''
            this.locNo = ''
            this.messageText = "重置完成"
            this.messageToggle('success')
            this.dataList = [];
            this.matnr = '';
            this.locNo = '';
            this.messageText = "重置完成";
            this.messageToggle('success');
         },
         // 取消重置
         resetClose() {
         },
         resetClose() {},
         messageToggle(type) {
            this.msgType1 = type
            this.$refs.message.open()
            this.msgType1 = type;
            this.$refs.message.open();
         },
      }
   }
</script>
<style>
   @import url('../../static/css/wms.css/wms.css');
   .code {
      width: 100%;
      position: fixed;
      min-height: 200rpx;
      background-color: #FFF;
      z-index: 10;
   page {
      background: #f5f7fa;
   }
   
   .item {
   .page-container {
      min-height: 100vh;
      background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
      padding-bottom: 110rpx;
      box-sizing: border-box;
   }
   /* 表单区域 */
   .form-section {
      background: #ffffff;
      padding: 12rpx 20rpx;
      box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
   }
   .form-item {
      display: flex;
      align-items: center;
      height: 100rpx;
      margin-left: 20rpx;
      border-bottom: 1px solid #DCDFE6;
      padding: 12rpx 0;
      border-bottom: 1rpx solid #f0f0f0;
   }
   
   .item input {
      height: 50rpx;
      line-height: 50rpx;
      /* font-family: PingFang SC; uniapp 默认字体不居中 */
      font-size: 36upx;
      font-family: PingFang SC;
      width: 55vw;
   .form-item:last-child {
      border-bottom: none;
   }
   
   .code-decs {
      width: 20vw;
      font-size: 18px;
   .form-label {
      display: flex;
      align-items: center;
      width: 140rpx;
      flex-shrink: 0;
   }
   .label-text {
      font-size: 26rpx;
      color: #303133;
      margin-left: 6rpx;
   }
   .form-input-wrap {
      flex: 1;
      display: flex;
      align-items: center;
      background: #f5f7fa;
      border-radius: 6rpx;
      padding: 0 16rpx;
      height: 60rpx;
   }
   .form-input {
      flex: 1;
      height: 60rpx;
      font-size: 26rpx;
      color: #303133;
   }
   
   .item-right {
      margin-left: auto;
      margin-right: 20rpx;
   /* 列表头部 */
   .list-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16rpx 20rpx;
      background: #ffffff;
      margin-top: 12rpx;
      box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
   }
   
   .mat-list-title {
      height: 80rpx;
      line-height: 80rpx;
      width: 100%;
      background-color: white;
   .header-left {
      display: flex;
      align-items: center;
   }
   .header-title {
      font-size: 28rpx;
      color: #303133;
      font-weight: 600;
   }
   .count-badge {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      border-radius: 16rpx;
      padding: 2rpx 12rpx;
      margin-left: 12rpx;
   }
   .count-text {
      font-size: 20rpx;
      color: #ffffff;
      font-weight: 500;
   }
   /* 库存列表 */
   .list-container {
      padding: 0 20rpx;
   }
   .stock-card {
      background: #ffffff;
      border-radius: 12rpx;
      margin-top: 12rpx;
      box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
      overflow: hidden;
   }
   .card-header {
      display: flex;
      align-items: center;
      padding: 14rpx 16rpx;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
   }
   .card-index {
      width: 36rpx;
      height: 36rpx;
      background: rgba(255, 255, 255, 0.3);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 22rpx;
      color: #ffffff;
      font-weight: 600;
      margin-right: 12rpx;
   }
   .loc-info {
      flex: 1;
   }
   .loc-no {
      font-size: 26rpx;
      color: #ffffff;
      font-weight: 600;
   }
   .qty-badge {
      background: rgba(255, 255, 255, 0.3);
      padding: 4rpx 14rpx;
      border-radius: 16rpx;
   }
   .qty-text {
      font-size: 24rpx;
      color: #ffffff;
      font-weight: 600;
   }
   /* 卡片内容 */
   .card-body {
      padding: 12rpx 16rpx;
   }
   .info-row {
      display: flex;
      margin-bottom: 8rpx;
   }
   .info-row:last-child {
      margin-bottom: 0;
   }
   .info-col {
      flex: 1;
   }
   .info-col.half {
      width: 50%;
      flex: none;
   }
   .info-label {
      font-size: 20rpx;
      color: #909399;
      display: block;
   }
   .info-value {
      font-size: 24rpx;
      color: #303133;
      display: block;
      margin-top: 2rpx;
   }
   .info-value.code {
      color: #303133;
      font-weight: 600;
   }
   .info-value.batch {
      color: #667eea;
   }
   .info-value.qty {
      font-size: 28rpx;
      color: #303133;
      font-weight: 600;
   }
   /* 空状态 */
   .empty-state {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 80rpx 0;
   }
   .empty-text {
      font-size: 26rpx;
      color: #909399;
      margin-top: 16rpx;
   }
   .empty-hint {
      font-size: 22rpx;
      color: #c0c4cc;
      margin-top: 8rpx;
   }
   .bottom-placeholder {
      height: 20rpx;
   }
   /* 底部操作栏 */
   .bottom-bar {
      position: fixed;
      margin-top: 200rpx;
      z-index: 9;
      /* border-top: 1px solid #DCDFE6; */
      text-align: center;
      box-shadow: 0px 0px 30px 0px rgba(0, 0, 0, 0.5);
      bottom: 0;
      left: 0;
      right: 0;
      display: flex;
      padding: 16rpx 20rpx;
      background: #ffffff;
      box-shadow: 0 -2rpx 12rpx rgba(0, 0, 0, 0.06);
   }
   .btn-reset {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 160rpx;
      height: 72rpx;
      background: #f5f7fa;
      border-radius: 36rpx;
      margin-right: 16rpx;
   }
   .btn-reset .btn-text {
      font-size: 26rpx;
      color: #909399;
      margin-left: 6rpx;
   }
   .btn-submit {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      height: 72rpx;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      border-radius: 36rpx;
   }
   .btn-submit .btn-text {
      font-size: 28rpx;
      color: #ffffff;
      font-weight: 500;
      margin-left: 6rpx;
   }
</style>