#
zjj
2024-04-17 e4dc67055ea0c21e72815054c044b56a76ec625e
pages/pakin/goodsDown.vue
@@ -11,6 +11,8 @@
            <input type="text" placeholder=" 扫码 / 输入" v-model="matnr" :focus="barcodeFocus" @input="findMat()">
            <view class="item-right">
               <button></button>
               <text style="text-align: right;color: #409EFF;" @click="selectMat()">提取+</text>
               <uni-icons type="right" color="#c1c1c1"></uni-icons>
            </view>
         </view>
      </view>
@@ -31,12 +33,12 @@
                  </view>
               </view> -->
               <view class="list-left-item">
                  <view class="desc">料号:</view>
                  <view class="desc">编码:</view>
                  <view class="left-item">
                     <uni-tag :text="item.matnr" type="primary" style="width: 350rpx; overflow: auto;"></uni-tag>
                     <view class="left-item">{{item.matnr}}</view>
                  </view>
               </view>
               <!-- <view class="list-left-item">
               <view class="list-left-item">
                  <view class="desc">名称:</view>
                  <view class="left-item">{{item.maktx}}</view>
               </view>
@@ -50,14 +52,14 @@
                     <uni-tag :text="item.batch" type="warning"></uni-tag>
                  </view>
               </view>
               <view class="list-left-item">
               <!-- <view class="list-left-item">
                  <view class="desc">重量:</view>
                  <view class="left-item">
                     <uni-tag :text="item.weight" type="warning"></uni-tag>
                  </view>
               </view> -->
               <view class="list-left-item">
                  <view class="desc">数量:</view>
                  <view class="desc">公斤:</view>
                  <view class="left-item">{{item.anfme}}</view>
               </view>
            </view>
@@ -86,16 +88,16 @@
                        style="background-color: #f7f7f7;padding: 0;color: #d5d5d5;">
                  </view>
               </view>
               <!-- <view class="popup-item">
               <view class="popup-item">
                  <view class="popup-item-left">批号:</view>
                  <view class="popup-item-right"><input type="text" v-model="batch"></view>
               </view> -->
               <view class="popup-item">
               </view>
               <!-- <view class="popup-item">
                  <view class="popup-item-left">重量:</view>
                  <view class="popup-item-right"><input type="text" v-model="weight"></view>
               </view>
               </view> -->
               <view class="popup-item">
                  <view class="popup-item-left">数量:</view>
                  <view class="popup-item-left">公斤:</view>
                  <view class="popup-item-right" style="border: none;justify-content: center;">
                     <uni-number-box :value="count" :step='0.01' :max="9999999" color="#747474" @change="changeValue" />
                  </view>
@@ -171,11 +173,34 @@
            removeNum: 0
         }
      },
      onShow() {
         this.baseUrl = uni.getStorageSync('baseUrl');
         this.token = uni.getStorageSync('token');
      },
      methods: {
         selectMat() {
            let that = this
            uni.navigateTo({
               url: "../mat/matQuery",
               success: function(res) {
                  // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的
                  res.eventChannel.emit('commonUrl', {
                     commonUrl: ''
                  })
               },
               events: {
                  // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据  另外一个页面传过来的
                  acceptDataFromOpenedPage: function(data) {
                     that.matnr = data.data
                     that.findMat(that.matnr)
                  },
               },
            });
            that.matnr = ''
         },
         messageToggle(type) {
            this.msgType1 = type
            this.$refs.message.open()
@@ -205,15 +230,64 @@
         // 搜索物料
         findMat() {
            let that = this
            if(that.matnr.length < 10){
               that.barcodeFocuss()
               return;
            }
            if(that.orderNo ===''){
               return;
            }
            that.checkMat({"matnr":that.matnr,"anfme":0,"origin":that.orderNo})
            that.barcodeFocuss()
            uni.request({
               url: that.baseUrl + '/mat/auth',
               data: {
                  matnr: that.matnr
               },
               header: {
                  'token': uni.getStorageSync('token')
               },
               success(result) {
                  result = result.data
                  if (result.code === 200 && result.data) {
                     that.matData = result.data
                     that.matnr = ''
                     that.matData['batch'] = ''
                     uni.navigateTo({
                        url: "../mat/matSelected",
                        // 通过eventChannel向被打开页面传送数据
                        success: function(res) {
                           res.eventChannel.emit('mat', {
                              data: result.data
                           })
                        },
                        // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                        events: {
                           matList: function(data) {
                              if(data.data.batch == "" || data.data.batch == null){
                                 const now = new Date();
                                 const year = now.getFullYear();
                                 const month = now.getMonth() + 1; // 月份从0开始,需要加1
                                 const day = now.getDate();
                                 data.data.batch = (""+year+month+day)
                              }
                              that.checkMat(data.data)
                           },
                        },
                     });
                  } else if (result.code == 403) {
                     uni.showToast({
                        title: result.msg,
                        icon: "none",
                        position: 'top'
                     })
                     setTimeout(() => {
                        uni.reLaunch({
                           url: '../login/login'
                        });
                     }, 1000);
                  } else {
                     uni.showToast({
                        title: result.msg,
                        icon: "none",
                        position: 'top'
                     })
                  }
               }
            });
         },
         checkMat(mat) {
            var len = this.dataList.length
@@ -377,7 +451,7 @@
      box-shadow: 0px 0px 30px 0px rgba(0,0,0,0.2);
   }
   .list:first-child {
      margin-top: 410rpx;
      margin-top:320rpx;
   }
   .list:last-child {
      margin-bottom: 120rpx;
@@ -430,4 +504,7 @@
      text-align: center;
      box-shadow: 0px 0px 30px 0px rgba(0, 0, 0, 0.5);
   }
   .list-left-item{
      margin-bottom: 2px;
   }
</style>