#
whycq
2022-04-29 c1e688c8a52dd517a2b10125ff9fd1ede7499ce3
pages/basics/checkout.vue
@@ -1,19 +1,50 @@
<template>
   <view >
      <scroll-view scroll-y catch:touchmove="touchmove">
         <view class="pak-seach-box">
         <view class="square-2">
            <view class="square-title">
               <view class="title-sign"><view class="sign"></view></view>
               <view class="title-text"><text>托盘条码</text></view>
            </view>
            <view class="square-content">
               <view class="content-input">
                  <input v-model="barcode" type="text" placeholder="扫码 / 输入" maxlength="8"
                  @input="findBarcode()" :focus="barcodeFocus" @focus="focuss">
                  <uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons>
               </view>
            </view>
         </view>
         <!-- <view class="pak-seach-box">
            <view class="box-top">
               <view class="color-block-blue"></view>
               <text class="title">托盘条码</text>
            </view>
            <view class="box-buttom">
               <input v-model="barcode" type="text" placeholder="扫码 / 输入">
               <input v-model="barcode" type="text" placeholder="扫码 / 输入" maxlength="8" @input="findBarcode()">
               <view class="search-icon">
                  <uni-icons type="closeempty" size="20" color="#a5a5a5" @click="removeBarcode()"></uni-icons>
               </view>
            </view>
         </view> -->
         <view class="square-2">
            <view class="square-title">
               <view class="title-sign"><view class="sign"></view></view>
               <view class="title-text"><text>货品条码</text></view>
            </view>
            <view class="square-content">
               <view class="content-combox">
                  <uni-combox  emptyTips="暂无数据" :candidates="staNoList" v-model="staNo" placeholder="站台号"></uni-combox>
               </view>
               <view class="content-input-combox">
                  <input type="text" v-model="matnr" placeholder="扫码 / 输入" @input="findMat()"
                  :focus="focus" @focus="focuss">
                  <uni-icons type="closeempty" size="20" color="#dadada" @click="removeMatnr()"></uni-icons>
               </view>
            </view>
         </view>
         <view class="pak-seach-box">
         <!-- <view class="pak-seach-box">
            <view class="box-top">
               <view class="color-block-blue"></view>
               <text class="title">货品条码</text>
@@ -24,24 +55,26 @@
                  <uni-icons type="closeempty" size="20" color="#a5a5a5" @click="removeMatnr()"></uni-icons>
               </view>
            </view>
            <button class="cu-btn bg-blue" @click="selectMat()">+提取</button>
         </view>
         <view class="pak-data-box">
            <view class="box-top">
               <view class="color-block-blue"></view>
               <text class="title">商品列表</text>
            <view class="combox">
               <uni-combox  emptyTips="暂无数据" :candidates="staNoList" v-model="staNo" placeholder="站台号"></uni-combox>
            </view>
         </view> -->
         <view class="square-1">
            <view class="square-title">
               <view class="title-sign"><view class="sign"></view></view>
               <view class="title-text"><text>商品列表</text></view>
            </view>
         </view>
         <view class="pak-data-box"  v-show="matList.length === 0">
            <view style="text-align: center;">暂无更多数据</view>
         <view class="square-none" v-show="matList.length === 0">
            <view class="v-show">暂无更多数据...</view>
         </view>
         <!-- <view class="pak-data-box"  v-show="matList.length === 0">
            <view style="text-align: center;">暂无更多数据</view>
         </view> -->
         <checkbox-group @change="checkbox">
            <view v-for="(item,index) in matList" :key="index" class="data-list bg-false" :class="'bg-'+item.checked" >
               <view class="data-list-left">
                  <view class="matnr"><text style="width: 400rpx;">编码:{{item.matnr}}</text></view>
                  <view><text style="width: 400rpx;">品名:{{item.maktx}}</text></view>
                  <view><text style="width: 400rpx;">批号:{{item.batch}}</text></view>
                  <view><text style="width: 400rpx;">数量:{{item.anfme}}</text></view>
                  <view class="matnr">{{item.barcode}}</view>
               </view>
               <view class="data-list-right">
                  <uni-icons type="trash" size="25" color="#a5a5a5" @click="remove(item,index)"></uni-icons>
@@ -54,7 +87,7 @@
            <button class="cu-btn lg" @click="resst()">重置</button>
         </view>
         <view>
            <button class="cu-btn lg pakin-btn bg-blue" @click="comb()">组托</button>
            <button class="cu-btn lg pakin-btn bg-blue" @click="comb()">确认</button>
         </view>
      </view>
   </view>
@@ -66,12 +99,16 @@
      data() {
         return {
            barcode: '',
            barcodeFocus:true,
            focus:false,
            type: 'center',
            searchBox: 'hide',
            pick:'hide',
            matnr:'',
            matList:[],
            result: ''
            matList:[{barcode:'92992929292'}],
            result: '',
            staNoList:[],
            staNo:'',
         }
      },
      mounted(){
@@ -79,8 +116,12 @@
         this.baseIP = UIP;
         const UPORT = uni.getStorageSync('UPORT');
         this.basePORT = UPORT
         this.getOutBound();
      },
      methods: {
         focuss() {
            uni.hideKeyboard()
         },
         resst() {
            this.matList = []
            this.barcode = ''
@@ -90,10 +131,18 @@
         removeBarcode() {
            this.barcode = ''
            uni.vibrateShort();
            this.barcodeFocus = false;
            this.$nextTick(function() {
               this.barcodeFocus = true;
            });
         },
         removeMatnr() {
            this.matnr = ''
            uni.vibrateShort();
            this.focus = false;
            this.$nextTick(function() {
               this.focus = true;
            });
         },
         remove(item,index) {
            this.matList.splice(index,1)
@@ -166,37 +215,80 @@
         findMat() {
            let that = this
            uni.request({
                url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/auth',
                url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/query/auth',
                data: {
                  staNo:that.staNo,
                  matnr:that.matnr
                },
                header: {
                  'token':uni.getStorageSync('token')
                },
               success(result) {
                  uni.vibrateShort();
                  let res = result.data
                  if (res.code === 200 && res.data) {
                     that.matData = res.data
                     uni.navigateTo({
                        url: "matQuery",
                        events: {
                            // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                            matList: function(data) {
                              that.matList.push(data.data)
                            },
                          },
                          success: function(res) {
                            // 通过eventChannel向被打开页面传送数据
                            res.eventChannel.emit('matData', { data: that.matData })
                          }
                     });
                  }
                  console.log(result)
                  
               }
            });
         },
         addMatList(mat) {
            let barcode = this.mat.barcode
            let toUnshift = true
            for (var i = 0; i < this.matList.length; i++) {
               if (barcode === this.matList[i].barcode) {
                  this.messageToggle('warn')
                  this.messageText = barcode + '已经扫描,请勿重复扫描'
                  toUnshift = false
               }
            }
            if (toUnshift) {
               this.matList.unshift(mat)
            }
         },
         findBarcode() {
            let that = this
            uni.request({
                url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/query/auth',
                data: {
                  barcode:that.barcode
                },
                header: {
                  'token':uni.getStorageSync('token')
                },
               success(result) {
                  console.log(result)
               }
            });
         },
         getOutBound() {         // 获取出库口
            let that = this
            uni.request({
               url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/available/take/check/site',
               method: 'POST',
               header: {
                  'token':uni.getStorageSync('token')
               },
               success(result) {
                  var res = result.data
                  if (res.code === 200) {
                     that.staNoList = res.data
                  } else if (res.code == 403) {
                     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'})
                  }
               },
            });
         }, // getOutBound
         getCheckDetl() {   // 获取出库口货物信息
            let that = this
         }, // getCheckDetl
         change(e) {
            console.log('当前模式:' + e.type + ',状态:' + e.show);
         },
@@ -267,7 +359,7 @@
   }
   .box-buttom {
      display: inline-block;
      background-color: #ededed;
      background-color: #f0f0f0;
      width: 65%;
      height: 60rpx;
      border-radius: 20rpx;
@@ -284,6 +376,12 @@
      float: right;
      margin-top: 5rpx;
      margin-right: 10rpx;
   }
   .combox {
      position: fixed;
      display: inline-block;
      width: 28%;
      float: right;
   }
   /* .pak-seach-box input {
      background-color: #ededed;
@@ -330,7 +428,7 @@
   }
   .data-list {
      border-bottom: 1px solid #d8d8d8;
      height: 180rpx;
      height: 130rpx;
      margin: 15rpx;
      border-radius: 20rpx;
   }
@@ -349,20 +447,28 @@
      line-height: 180rpx;
   } */
   .data-list-left {
      width: 550rpx;
      /* background-color: #007AFF; */
      display: inline-block;
      float: left;
      margin-left: 6%;
      height: 180rpx;
      margin-left: 4%;
      height: 130rpx;
      color: #676767;
   }
   .matnr {
      padding-top: 10rpx;
      display: inline-block;
      width: 100%;
      font-size: 16px;
      font-weight: 700;
      height: 130rpx;
      line-height: 130rpx;
   }
   .data-list-right {
      /* background-color: #6739B6; */
      display: inline-block;
      float: right;
      height: 180rpx;
      line-height: 180rpx;
      margin-right: 10%;
      width: 100rpx;
      height: 130rpx;
      line-height: 130rpx;
   }
</style>