#
whycq
2022-02-24 c8dc3d4f33e7548e2d02ba14e9cb770afda5df2b
pages/basics/comb.vue
@@ -12,7 +12,7 @@
         <uni-table border stripe emptyText="暂无更多数据">
            <uni-tr>
               <uni-th width="50">数量</uni-th>
               <uni-th width="100">产品代号</uni-th>
               <uni-th width="100">产品ID</uni-th>
               <uni-th width="100">产品名称</uni-th>
            </uni-tr>
            <uni-tr v-for="(item, index) in matData" :key="index" @input="tabRender()">
@@ -24,8 +24,8 @@
         
      </view>
      <view>
         <button class="cu-btn bg-yellow pda-btn" @click="comb()">组托</button>
         <button class="cu-btn bg-grey pda-btn" @click="reset">重置</button>
         <button class="cu-btn bg-yellow pda-btn" @click="comb()">组 托</button>
         <button class="cu-btn bg-grey pda-btn" @click="reset">重 置</button>
      </view>
      <view>
         <!-- 普通弹窗 -->
@@ -113,24 +113,22 @@
         // 根据产品代号查询产品详情
         find(){
            let that = this
            console.log(that.matNo)
            let thatId = that.matNo
            if(that.matNo.length===0){
               console.log(1)
               return;
            }
            uni.request({
               url:that.baseUrl+"/matCode/auth",
               url: that.baseHttp + that.baseIP + that.baseUrl + "/matCode/auth",
               header:{
                  'content-type':'application/x-www-form-urlencoded',
                  'token':localStorage.getItem('token'),
               },
                  'token':uni.getStorageSync('token')
                  },
               data:{
                  id:thatId
               },
               method:'POST',
               success:function(res){
                  console.log(res)
                  let data = res.data.data
                  
                  if(res.data.code === 200){
@@ -140,9 +138,12 @@
                        that.unit = data.unit
                     }
                  } else if (res.data.code ===403 ){
                     // 待定
                     uni.navigateBack({
                         delta: 1
                     })
                  } else {
                     // 待定
                     this.messageToggle('error')
                     this.messageText = res.data.msg
                  }
               }
               
@@ -156,20 +157,17 @@
               matName:that.matName,
               count:that.count
            }
            that.addTbaleData(data)
            that.addTableData(data)
            
         },
         // 添加表格数据
         addTbaleData(data){
            console.log(data.matName)
         addTableData(data){
            if(data.matName===''){
               this.messageToggle('error')
               return
            }
            
            this.$refs.popup.close()
            console.log(this.matData.length)
            for(var i=0;i<this.matData.length;i++){   
               if(data.matNo === this.matData[i].matNo){
                  this.matData[i].count = Number(this.matData[i].count) + Number(data.count);
@@ -202,7 +200,6 @@
            let that = this
            let barcode = that.code
            if(barcode.length === 0){
               console.log(1)
               that.messageToggle('error')
               that.messageText = '托盘条码为空'
               return;
@@ -219,23 +216,34 @@
            }
            uni.request({
               
               url:that.baseUrl+"/mobile/comb/auth",
               header:{'token':localStorage.getItem('token')},
               url: that.baseHttp + that.baseIP + that.baseUrl + "/mobile/comb/auth",
               header:{
                  // #ifdef H5
                  'token':uni.getStorageSync('token')
                  // #endif
                  // #ifdef APP-PLUS
                  'token': uni.getStorageSync('token')
                  // Authorization:uni.getStorageSync('token')
                  // #endif
                  },
               data:{
                  barcode:barcode,
                  combMats:that.matData
               },
               method:'POST',
               success:function(res){
                  console.log(res)
                  if(res.data.code===200){
                     that.reset()
                     that.messageToggle('success')
                     that.messageText = '组托成功'
                  }else if(res.data.data===403){
                     uni.navigateBack({
                         delta: 1
                     })
                  }else {
                     this.messageToggle('error')
                     this.messageText = res.data.msg
                  }
               }
            })