skyouc
2024-12-21 c9c263dc43ad90f95f24a036cee9e6b47afb596c
pages/mat/matSelected.vue
@@ -1,134 +1,147 @@
<template>
   <view>
      <view class="form">
         <view class="form-item">
            <view class="form-item-desc"><text>商品编码</text></view>
            <view class="form-item-content"><text>{{mat.matnr}}</text></view>
         </view>
         <view class="form-item">
            <view class="form-item-desc"><text>商品名称</text></view>
            <view class="form-item-content"><text style="word-wrap:break-word">{{mat.maktx}}</text></view>
         </view>
         <view class="form-item">
            <view class="form-item-desc"><text>规格</text></view>
            <view class="form-item-content"><text>{{mat.specs}}</text></view>
         </view>
         <view class="form-item">
            <view class="form-item-desc"><text>批号</text></view>
            <view class="form-item-content">
               <view class="form-input">
                  <input type="text" v-model="mat.batch">
               </view>
            </view>
         </view>
         <view class="form-item">
            <view class="form-item-desc"><text>数量</text></view>
            <view class="form-item-content">
               <uni-number-box :value="mat.anfme" :max="99999999" :step='1' color="#747474" @change="changeValue" />
            </view>
         </view>
      </view>
      <!-- 底部操作按钮 -->
      <view class="buttom">
         <button size="mini" type="primary" @click="back()">提取</button>
      </view>
   </view>
</template>
<script>
   export default {
      data() {
         return {
            mat: {
               matnr: null,
               maktx: null,
               specs: null,
               batch: null,
               anfme: 0,
            },
            baseIP:'',
            basePORT:'',
         }
      },
      onLoad(option) {
         let that = this
         // #ifdef APP-NVUE
         const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
         // #endif
         // #ifndef APP-NVUE
         const eventChannel = this.getOpenerEventChannel();
         // #endif
         // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
         eventChannel.on('mat', function(data) {
            that.mat = data.data
            that.mat.anfme = 0
         })
      },
      methods: {
         blur() {
         },
         focus() {
         },
         changeValue(value) {
            this.mat.anfme = value
         },
         back() {
            if (this.mat.anfme === 0) {
               uni.showToast({title: '请输入数量', icon: "none", position: 'top'});
               return;
            }
            this.getOpenerEventChannel().emit('matList', {data: this.mat});
            uni.navigateBack({
            })
         }
      }
   }
</script>
<style>
   @import url('../../static/css/wms.css/wms.css');
   .form {
      min-height: 80rpx;
      background-color: #FFF;
      margin-top: 10px;
      color: #606266;
      box-shadow: 0px 0px 50px 0px rgba(0,0,0,0.2) ;
   }
   .form-item {
      min-height: 100rpx;
      line-height: 1.3;
      border-bottom: 1px solid #DCDFE6;
      margin-left: 40rpx;
      display: flex;
      align-items: center;
      word-wrap: break-word;
   }
   .form-item-desc {
      width: 30%;
   }
   .form-item-content {
      width: 60%;
   }
   .form-item:last-child {
      border: none;
   }
   .form-input {
      display: flex;
      align-items: center;
      width: 50vw;
      height: 50rpx;
      padding: 2px 5px;
      border-bottom: 1px solid #E4E7ED;
      border-radius: 5rpx;
   }
   .form-input input{
      color: #606266;
   }
<template>
   <view>
      <view class="form">
         <view class="form-item">
            <view class="form-item-desc"><text>商品编码</text></view>
            <view class="form-item-content"><text>{{mat.matnr}}</text></view>
         </view>
         <view class="form-item">
            <view class="form-item-desc"><text>商品名称</text></view>
            <view class="form-item-content"><text style="word-wrap:break-word">{{mat.maktx}}</text></view>
         </view>
         <view class="form-item">
            <view class="form-item-desc"><text>规格</text></view>
            <view class="form-item-content"><text>{{mat.specs}}</text></view>
         </view>
         <view class="form-item">
            <view class="form-item-desc"><text>批号</text></view>
            <view class="form-item-content">
               <view class="form-input">
                  <input type="text" v-model="mat.batch">
               </view>
            </view>
         </view>
         <view class="form-item">
            <view class="form-item-desc"><text>数量</text></view>
            <view class="form-item-content">
               <uni-number-box :value="mat.mergeNum" :max="mat.maxQty" :step='1' color="#747474" @change="changeValue" />
            </view>
         </view>
      </view>
      <!-- 底部操作按钮 -->
      <view class="buttom">
         <button size="mini" type="primary" @click="back()">提取</button>
      </view>
   </view>
</template>
<script>
   export default {
      data() {
         return {
            mat: {
               matnr: null,
               maktx: null,
               specs: null,
               batch: null,
               mergeNum: 0,
               maxQty: 0,
            },
            baseIP:'',
            basePORT:'',
         }
      },
      onLoad(option) {
         let that = this
         // #ifdef APP-NVUE
         const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
         // #endif
         // #ifndef APP-NVUE
         const eventChannel = this.getOpenerEventChannel();
         // #endif
         // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
         eventChannel.on('mat', function(data) {
            that.mat = data.data
            that.mat.maxQty = data.data.mergeNum
         })
      },
      methods: {
         blur() {
         },
         focus() {
         },
         changeValue(value) {
            if (value > this.mat.maxQty) {
               uni.showToast({title: '已是最大可组拖数!!', icon: "none", position: 'top'});
               return
            } else {
               this.mat.mergeNum = value;
            }
         },
         back() {
            let that = this
            if (this.mat.mergeNum === 0) {
               uni.showToast({title: '请输入数量', icon: "none", position: 'top'});
               return;
            }
            //将选中内容,返回至组拖主页
            let pages = getCurrentPages();
            let prePage = pages[pages.length - 3]
            uni.navigateBack({
               delta: 2,
               success() {
                  prePage.$vm.getMatsList({data: that.mat})
               }
            })
         }
      }
   }
</script>
<style>
   @import url('../../static/css/wms.css/wms.css');
   .form {
      min-height: 80rpx;
      background-color: #FFF;
      margin-top: 10px;
      color: #606266;
      box-shadow: 0px 0px 50px 0px rgba(0,0,0,0.2) ;
   }
   .form-item {
      min-height: 100rpx;
      line-height: 1.3;
      border-bottom: 1px solid #DCDFE6;
      margin-left: 40rpx;
      display: flex;
      align-items: center;
      word-wrap: break-word;
   }
   .form-item-desc {
      width: 30%;
   }
   .form-item-content {
      width: 60%;
   }
   .form-item:last-child {
      border: none;
   }
   .form-input {
      display: flex;
      align-items: center;
      width: 50vw;
      height: 50rpx;
      padding: 2px 5px;
      border-bottom: 1px solid #E4E7ED;
      border-radius: 5rpx;
   }
   .form-input input{
      color: #606266;
   }
</style>