#
whycq
2023-04-02 9e52dcf4615e6b50cef57a56c37fd13b777d1051
pages/pakin/pakin.vue
@@ -43,7 +43,7 @@
               </view>
               <view class="list-left-item">
                  <view class="desc">数量:</view>
                  <view class="left-item"><uni-tag :text="item.anfme"></uni-tag></view>
                  <view class="left-item">{{item.anfme}}</view>
               </view>
            </view>
            <view class="list-right">
@@ -211,9 +211,8 @@
                        },
                        // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                        events: {
                            dataList: function(data) {
                            matList: function(data) {
                              that.checkMat(data.data)
                              // that.matList.push(data.data)
                           },
                        },
                     });
@@ -225,7 +224,6 @@
                        });
                     }, 1000);
                  } else {
                     console.log(res);
                     uni.showToast({title: res.msg, icon: "none",position: 'top'})
                  }
                  
@@ -235,12 +233,11 @@
         },
         selectMat() {
            let that = this
            uni.vibrateShort();
            uni.navigateTo({
               url: "../mat/matQuery",
               success: function(res) {
                   // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的
                   res.eventChannel.emit('commonUrl', {commonUrl:that.commonUrl })
                   res.eventChannel.emit('commonUrl', {commonUrl: '' })
               },
               events: {
                   // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据  另外一个页面传过来的
@@ -320,8 +317,55 @@
            this.$refs.combConfirm.close()
         },
         comb() {
            this.messageText = "组托成功"
            this.messageToggle('success')
            uni.vibrateShort();
            let that = this;
            if (that.barcode === '') {
               this.messageText = "请扫描托盘条码"
               this.messageToggle('error')
               return;
            }
            if (that.dataList.length === 0) {
               this.messageText = "请添加商品列表"
               this.messageToggle('error')
               return;
            }
            for (var i = 0; i < that.dataList.length; i++) {
               if (that.dataList[i].anfme == 0 || that.dataList[i].anfme == '') {
                  this.messageText = that.dataList[i].matnr + '组托数量不能为0'
                  this.messageToggle('error')
                  return;
               }
            }
            uni.request({
                url: that.baseUrl + '/mobile/comb/auth',
                data: JSON.stringify({
                  barcode: that.barcode,
                  combMats: that.dataList
               }),
               method: 'POST',
                header: {
                  'token':uni.getStorageSync('token')
                },
               success(result) {
                  var res = result.data
                  if (res.code === 200) {
                     that.resst();
                     that.messageText = "组托成功"
                     that.messageToggle('success')
                  } else if (res.code == 403) {
                     that.messageText = res.msg
                     that.messageToggle('error')
                     setTimeout(() => {
                        uni.reLaunch({
                           url: '../login/login'
                        });
                     }, 1000);
                  } else {
                     that.messageText = res.msg
                     that.messageToggle('error')
                  }
               }
            });
         },
         reset(type) {
            this.msgType = type
@@ -338,7 +382,13 @@
         // 取消重置
         resetClose() {
            
         }
         },
         // 清空
         resst() {
            this.dataList = []
            this.barcode = ''
            this.barcodeFocuss()
         },
      }
   }
</script>