#
whycq
2022-07-25 06fc3eebef4e55e96b95ff0349e02de1f6f22771
pages/basics/checkout.vue
@@ -1,6 +1,6 @@
<template>
   <view >
      <scroll-view scroll-y catch:touchmove="touchmove">
      <scroll-view scroll-y class="scroll-Y">
         <view class="square-2">
            <view class="square-title">
               <view class="title-sign"><view class="sign"></view></view>
@@ -33,10 +33,11 @@
            <view class="square-title">
               <view class="title-sign"><view class="sign"></view></view>
               <view class="title-text"><text>商品列表</text></view>
               <view v-show="matCount > 0" style="display: inline-block;float: right;height: 100rpx;line-height: 100rpx;margin-right: 50rpx;">请扫码选取 {{matCount}} 件商品</view>
            </view>
         </view>
         <view class="square-none" v-show="matList.length === 0">
            <view class="v-show">请扫码选取 {{matCount}} 件商品</view>
            <view class="v-show">暂无更多数据. . . </view>
         </view>
         <checkbox-group @change="checkbox">
            <view v-for="(item,index) in matList" :key="index" class="data-list bg-false" :class="'bg-'+item.checked" >
@@ -83,14 +84,14 @@
            matList:[],
            result: '',
            siteList:[],
            desc:'',
            staNoList:[],
            satNo:'',
            listLen:0,
            msgType: 'success',
            messageText: '这是一条成功提示',
            fontColor:{color:'red'},
            matCount:'0'
            matCount:'',
            wrkNo:'',
         }
      },
      onReady() {
@@ -98,6 +99,13 @@
            // console.log(this.matList)
            // this.getMatListLen()
         },1000)
      },
      onLoad() {
         // #ifdef APP
         setInterval(()=>{
            uni.hideKeyboard()
         },20)
         // #endif
      },
      mounted(){
         const UIP = uni.getStorageSync('UIP');
@@ -107,17 +115,11 @@
         
      },
      methods: {
         // 出库分为两种 一:全板出库 扫描托盘码显示全板商品 可以直接确认 二是减料出库 扫描托盘码提示需要出库数量  扫描货品条码达到最大出库数量即可
         messageToggle(type) {
            this.msgType = type
            this.messageText = `这是一条${type}消息提示`
            this.$refs.message.open()
         },
         choseStaNo() {
            for (var i = 0;i < this.staNoList.length; i++) {
               if (this.desc == this.staNoList[i].desc) {
                  this.staNo = this.staNoList[i].siteId
               }
            }
         },
         getMatListLen() {
            // this.listLen = this.matList.length;
@@ -129,8 +131,10 @@
            this.matList = []
            this.barcode = ''
            this.matnr = ''
            this.desc = ''
            this.matCount = ''
            this.removeBarcode();
            uni.vibrateShort();
         },
         removeBarcode() {
            this.barcode = ''
@@ -139,6 +143,16 @@
            this.$nextTick(function() {
               this.barcodeFocus = true;
            });
         },
         foucss() {
            // #ifdef APP
            let that = this;
            that.focus = false;
            setTimeout(()=>{
               that.matnr = '';
               that.focus = true;
            }, 100);
            // #endif
         },
         removeMatnr() {
            this.matnr = ''
@@ -179,7 +193,7 @@
         findBarcode() {
            let that = this
            uni.request({
                url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/query/auth/v2',
                url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/confirm/barcode/auth',
                data: {
                  barcode:that.barcode
                },
@@ -187,10 +201,19 @@
                  'token':uni.getStorageSync('token'),
                },
               success(result) {
                  var res = result.data;
                  let res = result.data;
                  if (res.code === 200) {
                     if (res.data) {
                        that.matCount = res.data.length
                     if (res.data.ioType === 101) {
                        that.matList = res.data.list.concat(that.matList)
                        that.listLen = that.matList.length;
                        that.foucss();
                        return;
                     }
                     if (res.data.ioType === 103 || res.data.ioType === 104 || res.data.ioType === 107) {
                        that.matCount = res.data.list.length
                        that.wrkNo = res.data.list[0].wrkNo
                        that.foucss();
                        return;
                     }
                  } else if (res.code === 403) {
                     uni.showToast({title: res.msg, icon: "none", position: 'top'})
@@ -210,9 +233,9 @@
         findMat() {
            let that = this
            uni.request({
                url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/query/auth/v2',
                url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/confirm/pick/auth',
                data: {
                  staNo:that.staNo,
                  wrkNo:that.wrkNo,
                  matnr:that.matnr
                },
                header: {
@@ -222,26 +245,32 @@
                  var res = result.data;
                  if(res.code === 200 ) {
                     if(res.data) {
                        if (that.matList.length == 0) {
                           that.matList.push(res.data)
                           that.listLen = that.matList.length;
                           that.foucss();
                           return;
                        }
                        for(let i = 0;i<that.matList.length;i++) {
                           for (let j = 0;j < res.data.length; j++) {
                              if(JSON.stringify(that.matList[i]) === JSON.stringify(res.data[j])) {
                                 res.data.splice(j,1)
                           if (that.matList.length < that.matCount){
                              if(JSON.stringify(that.matList[i]) === JSON.stringify(res.data)) {
                                 that.messageToggle('warn');
                                 that.messageText = '该商品已添加';
                                 that.foucss();
                                 return;
                              } else {
                                 that.matList.unshift(res.data);
                                 that.listLen = that.matList.length;
                                 that.foucss();
                                 return;
                              }
                           } else {
                              that.messageToggle('warn');
                              that.messageText = '已出全部商品,请确认出库';
                              that.foucss();
                              return;
                           }
                        }
                        if (that.matList.length < that.matCount) {
                           that.matList = res.data.concat(that.matList)
                           that.listLen = that.matList.length;
                           that.focus = false;
                           that.$nextTick(function() {
                              that.focus = true;
                           });
                           that.matnr = ''
                        } else {
                           that.messageToggle('warn')
                           that.messageText = '商品已全部添加'
                        }
                     }
                  } else if (res.code == 403) {
                     uni.showToast({title: res.msg, icon: "none", position: 'top'})
@@ -252,21 +281,37 @@
                     }, 1000);
                  } else {
                     uni.showToast({title: res.msg, icon: "none",position: 'top'})
                     that.foucss();
                  }
                  
               }
            });
         },
         comb() {
            uni.vibrateShort();
            let that = this;
            uni.showLoading();
            if (that.barcode === '') {
               this.messageToggle('error')
               this.messageText = '请扫描托盘码'
               return;
            }
            if (that.barcode.length !== 8) {
               this.messageToggle('error')
               this.messageText = '托盘码必须为8位'
               return;
            }
            if (that.matList.length === 0) {
               this.messageToggle('error')
               this.messageText = '请添加商品列表'
               return;
            }
            if (that.matList.length < that.matCount) {
               var len = that.matCount - that.matList.length
               that.messageToggle('error')
               that.messageText = '还剩' + len + '件未扫描'
               return;
            }
            uni.showLoading();
            uni.request({
                url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/confirm/auth',
                data: that.matList,
@@ -278,15 +323,8 @@
                  uni.showLoading();
                  var res = result.data
                  if (res.code === 200) {
                     uni.showToast({
                        title: res.msg,
                        position: 'bottom',
                        duration: 1000
                     });
                     that.matList = []
                     that.barcode = ''
                     that.matnr = ''
                     that.desc = ''
                     uni.showToast({ title: res.msg,position: 'bottom',duration: 1000});
                     that.resst();
                  } else if (res.code == 403) {
                     uni.showToast({title: res.msg, icon: "none", position: 'top'})
                     setTimeout(() => {
@@ -339,7 +377,7 @@
<style>
   /* @import "../../colorui/main.css";
   @import "../../colorui/icon.css"; */
   .pak-seach-box {
      background-color: #FFFFFF;
      margin: 15rpx 15rpx 0rpx 15rpx;