#
whycq
2024-06-26 a817c1c191aec850a6a7794bc6e2ff3db4134eaa
pages/stock/stockCheck_merge.vue
@@ -29,26 +29,20 @@
               <view class="list-left-item">
                  <view class="desc">编码:</view>
                  <view class="left-item">
                     <uni-tag :text="item.matnr" type="primary"></uni-tag>
                     <uni-tag :text="item.matNo" type="primary"></uni-tag>
                  </view>
               </view>
               <view class="list-left-item">
                  <view class="desc">品名:</view>
                  <view class="left-item">{{item.maktx}}</view>
                  <view class="left-item">{{item.matName}}</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 class="desc">日期:</view>
                  <view class="left-item">{{item.date}}</view>
               </view>
               <view class="list-left-item">
                  <view class="desc">数量:</view>
                  <view class="left-item">{{item.anfme}}</view>
                  <view class="left-item">{{item.count}}</view>
               </view>
            </view>
            <view class="list-right">
@@ -77,8 +71,10 @@
                  </view>
               </view>
               <view class="popup-item">
                  <view class="popup-item-left">批号:</view>
                  <view class="popup-item-right"><input type="text" v-model="batch"></view>
                  <view class="popup-item-left">日期:</view>
                  <view class="popup-item-right">
                     <uni-datetime-picker type="date" v-model="date" />
                  </view>
               </view>
               <view class="popup-item">
                  <view class="popup-item-left">数量:</view>
@@ -143,8 +139,8 @@
            content: '',
            barcodeFocus: true,
            matFocus: false,
            matData: ''
            matData: '',
            date: ''
         }
      },
      onLoad() {
@@ -163,31 +159,41 @@
         search() {
            let that = this
            uni.request({
               url: that.baseUrl + '/mobile/checkDetl/auth2',
               header: {
                  'token':uni.getStorageSync('token')
               },
               data: {barcode: that.barcode},
               method:'GET',
               url: that.baseUrl + '/mobile/comb/form/barcode',
               header: { 'token': uni.getStorageSync('token') },
               data: { barcode: that.barcode },
               method: 'GET',
               success(res) {
                  console.log(res);
                  res = res.data
                  if(res.code === 200){
                     for(var i = 0; i < res.data.length;i++){
                  if (res.code === 200) {
                     for (var i = 0; i < res.data.length; i++) {
                        res.data[i]['maxAnfme'] = res.data[i].anfme
                        res.data[i]['matNo'] = res.data[i].matnr
                        res.data[i]['matName'] = res.data[i].maktx
                        res.data[i]['count'] = res.data[i].anfme
                        res.data[i]['date'] = res.data[i].date ? res.data[i].date : ''
                        that.dataList.push(res.data[i])
                     }
                  } 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'
                        });
                     }, 1000);
                  } else {
                     uni.showToast({title: res.msg, icon: "none",position: 'top'})
                     uni.showToast({
                        title: res.msg,
                        icon: "none",
                        position: 'top'
                     })
                  }
               }
            })
         },
         
@@ -215,9 +221,9 @@
         findMat() {
            let that = this
            uni.request({
               url: that.baseUrl + '/mat/auth',
               url: that.baseUrl + '/matCode/list/auth',
               data: {
                  matnr: that.matnr
                  mat_no: that.matnr
               },
               header: {
                  'token': uni.getStorageSync('token')
@@ -233,19 +239,20 @@
                        // 通过eventChannel向被打开页面传送数据
                        success: function(res) {
                           res.eventChannel.emit('mat', {
                              data: result.data
                              data: result.data.records[0]
                           })
                        },
                        // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                        events: {
                           matList: function(data) {
                              data.data['count'] = data.data.anfme
                              that.checkMat(data.data)
                           },
                        },
                     });
                  } else if (res.code == 403) {
                  } else if (result.code == 403) {
                     uni.showToast({
                        title: res.msg,
                        title: result.msg,
                        icon: "none",
                        position: 'top'
                     })
@@ -256,7 +263,7 @@
                     }, 1000);
                  } else {
                     uni.showToast({
                        title: res.msg,
                        title: result.msg,
                        icon: "none",
                        position: 'top'
                     })
@@ -292,7 +299,7 @@
            var len = this.dataList.length
            var add = true ,sameItem = false
            for (var i = 0; i < len; i++) {
               if (mat.matnr == this.dataList[i].matnr) {
               if (mat.matNo == this.dataList[i].matNo) {
                  for (var j = 0; j < len; j++) {
                     if (mat.batch == this.dataList[j].batch) {
                        sameItem = true
@@ -309,7 +316,7 @@
                     
                  } else {
                     // 相同物料相同批号 数量累加
                     this.dataList[i].anfme += mat.anfme
                     this.dataList[i].count += mat.count
                     this.$forceUpdate() // 强制刷新
                     add = false
                  }
@@ -318,13 +325,14 @@
            if (add) {
               this.dataList.unshift(mat)
            }
            console.log(len);
         },
         // 修改批号
         revise(item, i) {
            this.matnr = this.dataList[i].matnr
            this.count = this.dataList[i].anfme
            this.count = this.dataList[i].count
            this.batch = this.dataList[i].batch
            this.maxAnfme = this.dataList[i].maxAnfme
            this.date = this.dataList[i].date
            this.rowNum = i
            this.eject()
         },
@@ -350,13 +358,15 @@
            this.$refs.alertDialog.close()
         },
         reviseConfirm() {
            this.dataList[this.rowNum].anfme = this.count
            this.dataList[this.rowNum].batch = this.batch
            this.dataList[this.rowNum].count = this.count
            this.dataList[this.rowNum].date = this.date
            this.matnr = ''
            this.messageText = "修改成功"
            this.messageToggle('success')
            this.$refs.revise.close()
         },
         reviseClose() {
            this.matnr = ''
            this.$refs.revise.close()
         },
         changeValue(value) {
@@ -399,9 +409,9 @@
            var combMats = []
            var combParam = {}
            combParam['barcode'] = that.barcode
            combParam['wrkDetls'] = that.dataList
            combParam['combMats'] = that.dataList
            uni.request({
               url: that.baseUrl + '/mobile/adjustNew/auth',
               url: that.baseUrl + '/mobile/comb/form/mergeBoard',
               method: 'POST',
               data: JSON.stringify(combParam),
               header: {
@@ -433,6 +443,9 @@
<style>
   @import url('../../static/css/wms.css/wms.css');
   .list:first-child {
      margin-top: 320rpx;
   }
   .code {
      width: 100%;
      position: fixed;