#
whycq
2022-06-21 d3904fd730e095959d1ae4ade5d1bff76c25ae20
pages/basics/order.vue
@@ -1,42 +1,50 @@
<template>
   <view >
      <scroll-view scroll-y catch:touchmove="touchmove">
         <view class="pak-seach-box">
            <view class="box-top">
               <view class="color-block-blue"></view>
               <text class="title">托盘条码</text>
         <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="box-buttom">
               <input v-model="barcode" type="text" placeholder="扫码 / 输入">
               <view class="search-icon">
                  <uni-icons type="closeempty" size="20" color="#a5a5a5" @click="removeBarcode()"></uni-icons>
            <view class="square-content">
               <view class="content-input">
                  <input  v-model="barcode" type="text" placeholder="扫码 / 输入" maxlength="8"
                  :focus="barcodeFocus" @input="barcodeInput">
                  <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 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="box-buttom">
               <input v-model="orderNo" type="text" placeholder="扫码 / 输入" @input="findOrder()">
               <view class="search-icon">
                  <uni-icons type="closeempty" size="20" color="#a5a5a5" @click="removeOrderNo()"></uni-icons>
            <view class="square-content">
               <view class="content-input">
                  <input v-model="order" type="text" placeholder="扫码 / 输入" @input="findOrder()"
                  :focus="focus">
                  <uni-icons type="closeempty" size="20" color="#dadada" @click="removeOrder()"></uni-icons>
               </view>
            </view>
         </view>
         <view class="pak-data-box">
            <view class="box-top">
               <view class="color-block-blue"></view>
               <text class="title">商品列表</text>
         <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="orderList.length === 0">
            <view style="text-align: center;">暂无更多数据</view>
         <view class="square-none" v-show="orderList.length === 0">
            <view class="v-show">暂无更多数据...</view>
         </view>
         <checkbox-group>
            <view v-for="(item,index) in orderList" :key="index" class="data-list bg-false" :class="'bg-'+item.checked" >
               <view class="data-list-left">
                  <view class="data-list-left">
                      <checkbox :value="item.id+''" :checked="item.checked" style="display: block;" />
                  </view>
                  <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>
@@ -61,16 +69,20 @@
      </view>
      <view>
         <!-- 修改数量 -->
         <uni-popup ref="revise" background-color="#FFF" @change="change">
         <uni-popup ref="revise" background-color="#fff" @change="change">
            <view class="revise-box">
               <view class="revise-box-top">
                  <view class="color-block-blue"></view>
                  <text class="title">组托数量</text>
               </view>
               <view class="changeBox">
               <view class="text-box">
                  <text>可组数量:{{enableQty}}</text>
               </view>
               <view class="changeBox flex justify-around">
                  <view class="num-box">
                     <uni-number-box v-model="count" :min="minCount" :max="maxCount" color="#747474"  @change="changeValue"/>
                  </view> 
                  <button class="cu-btn" @click="changeMax">max</button>
               </view>
               <view class="revise-box-buttom">
                  <view>
@@ -90,9 +102,12 @@
      data() {
         return {
            barcode: '',
            barcodeFocus:true,
            focus:false,
            type: 'center',
            searchBox: 'hide',
            pick:'hide',
            order:null,
            orderNo:null,
            orderList:[],
            result: '',
@@ -100,6 +115,8 @@
            minCount:0,
            maxCount:'',
            rowNum:'',
            enableQty:'',
         }
      },
      mounted(){
@@ -109,34 +126,86 @@
         this.basePORT = UPORT
      },
      methods: {
         // barcode input 事件
         barcodeInput() {
            var len = this.barcode.length
            if (len != 8) {
               uni.showToast({title: '托盘码有误请重试', icon: "none", position: 'top'});
               this.barcodeFocuss()
               return;
            }
            if (len == 8) {
               this.focuss()
            }
         },
         // 托盘码有误重置
         barcodeFocuss() {
            // #ifdef APP
            let that = this;
            that.barcodeFocus = false;
            setTimeout(()=>{
               that.barcode = '';
               that.barcodeFocus = true;
            }, 100);
            // #endif
         },
         focuss() {
            // #ifdef APP
            let that = this;
            that.focus = false;
            setTimeout(()=>{
               that.matnrId = '';
               that.focus = true;
            }, 100);
            // #endif
         },
         resst() {
            this.orderList = []
            this.barcode = ''
            this.orderNo = ''
            this.order = ''
            uni.vibrateShort();
         },
         removeBarcode() {
            this.barcode = ''
            uni.vibrateShort();
            this.barcodeFocus = false;
            this.$nextTick(function() {
               this.barcodeFocus = true;
            });
         },
         removeOrderNo() {
            this.orderNo = ''
         removeOrder() {
            this.order = ''
            uni.vibrateShort();
            this.focus = false;
            this.$nextTick(function() {
               this.focus = true;
            });
         },
         eject(type) {
            this.type = type
            // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
            this.$refs.revise.open(type)
         },
         initAnfme() {
            for (var i = 0; i < this.orderList.length; i++) {
               this.orderList[i].anfme = 0
            }
            uni.hideLoading();
         },
         revise(item,index) {
            var maxCount = this.orderList[index].maxCount
            if (maxCount == undefined ) {
               this.orderList[index]["maxCount"] = item.anfme
               this.orderList[index]["maxCount"] = item.enableQty
            } 
            this.enableQty = item.enableQty
            this.count = this.minCount
            this.maxCount = item.maxCount
            this.rowNum = index
            this.eject()
         },
         changeMax() {
            this.count = this.enableQty
         },
         changeValue() {
            
@@ -156,14 +225,25 @@
               uni.showToast({title: '请扫描托盘条码', icon: "none", position: 'top'});
               return;
            }
            if (that.barcode.length !== 8) {
               uni.showToast({title: '托盘码必须为8位', icon: "none", position: 'top'});
               return;
            }
            if (that.orderList.length === 0) {
               uni.showToast({title: '请添加商品列表', icon: "none", position: 'top'});
               return;
            }
            for (var i = 0; i < that.orderList.length; i++) {
               if (that.orderList[i].anfme === 0) {
                  uni.showToast({title: '商品组托数量为0不能组托', icon: "none", position: 'top'});
                  return;
               }
            }
            uni.showLoading();
            uni.request({
                url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/comb/auth',
                data: JSON.stringify({
                  orderNo: that.orderNo,
                  barcode: that.barcode,
                  combMats: that.orderList
               }),
@@ -182,6 +262,7 @@
                     });
                     that.barcode = ''
                     that.orderNo = ''
                     that.order = ''
                     that.orderList = []
                  } else if (res.code == 403) {
                     uni.showToast({title: res.msg, icon: "none", position: 'top'})
@@ -201,7 +282,7 @@
            uni.request({
                url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/order/search/orderNo/auth',
                data: {
                  orderNo: that.orderNo
                  orderNo: that.order
                },
                header: {
                  'token':uni.getStorageSync('token')
@@ -210,7 +291,11 @@
                  let res = result.data
                  if (res.code === 200) {
                     if(res.data) {
                        that.orderList = res.data
                           uni.showLoading();
                        that.orderList = res.data;
                        that.orderNo = that.order
                        that.initAnfme()
                        console.log(that.orderList)
                     }
                  } else if (res.code == 403) {
                     uni.showToast({title: res.msg, icon: "none", position: 'top'})
@@ -368,7 +453,7 @@
   }
   .revise-box {
      width: 500rpx;
      height: 360rpx;
      height: 500rpx;
   }
   .revise-box-top {
      width: 100%;
@@ -378,14 +463,29 @@
   }
   .changeBox {
      width: 100%;
      height: 120rpx;
      line-height: 150rpx;
      height: 100rpx;
      line-height: 120rpx;
      text-align: center;
      background-color: #FFFFFF;
      background-color: #FFF;
      margin-top: 20rpx;
      border-bottom: 1px solid #e3e3e3;
   }
   .text-box {
      width: 100%;
      height: 100rpx;
      line-height: 120rpx;
      text-align: center;
      /* padding-left: 120rpx; */
      background-color: #FFF;
      margin-top: 20rpx;
      border-bottom: 1px solid #e3e3e3;
   }
   .changeBox .num-box {
      display: inline-block;
      display:  inline-block;
      float: left;
   }
   .changeBox button {
      float: left;
   }
   .revise-box-buttom {
      position: absolute;