#
whycq
2024-01-19 dc2accf9c90ee7aa2a3f5b3132b6c8407330604e
pages/order/orderPakin2.vue
@@ -4,23 +4,28 @@
         <view class="item">
            <view class="code-decs">订单号:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="orderNo" :focus="orderNoFocus" @input="findOrder()">
            <view class="item-right" @click="clearOrderNo()">
               <uni-icons type="close" color="#c1c1c1"></uni-icons>
            </view>
         </view>
         <view class="item">
         <!-- <view class="item">
            <view class="code-decs">木箱类型:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="boxType" :focus="boxTypeFocus">
         </view>
         <view class="item">
         </view> -->
         <!-- <view class="item">
            <view class="code-decs">码垛位:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="palletizingNo2" :focus="palletizingNo2Focus">
            <view class="item-right" @click="selectPst()">
               <uni-icons type="right" color="#c1c1c1"></uni-icons>
            </view>
         </view>
         </view> -->
      </view>
      <view class="mat-list-title">
         <view class="title-item"></view>
         <view class="title-item">商品列表</view>
         <view class="title-item"><button size="mini" type="primary" @click="addMat()">添加</button></view>
         <view class="title-item">
            <button size="mini" type="primary" @click="orderSelect()">提取</button>
         </view>
         
      </view>
      <u-empty v-show="dataList.length == 0" mode="list" icon="http://cdn.uviewui.com/uview/empty/list.png" style="position:fixed;top: 60%;left: 50%;transform: translate(-50%, -50%);">
@@ -60,7 +65,7 @@
                  <view class="left-item">{{item.anfme}}</view>
               </view> -->
               <view class="list-left-item">
                  <view class="desc">批号:</view>
                  <view class="desc">箱号:</view>
                  <view class="left-item">
                     <uni-tag :text="item.batch" type="warning"></uni-tag>
                  </view>
@@ -139,11 +144,11 @@
      <!-- 弹窗选择 -->
      <uni-popup ref="inputDialog" type="dialog">
         <view class="pop">
            <view class="pop-btn" @click="select('1')">
               1号码垛位
            <view class="pop-btn" @click="select('118')">
               118号码垛位
            </view>
            <view class="pop-btn" @click="select('2')">
               2号码垛位
            <view class="pop-btn" @click="select('119')">
               119号码垛位
            </view>
         </view>
      </uni-popup>
@@ -162,8 +167,8 @@
            palletizingNo2: '',
            boxType: '',
            createTime: '',
            dataList: [{}],
            count: 0,
            dataList: [],
            count: 1,
            rowNum: '',
            matnr: '',
            batch: '',
@@ -175,6 +180,7 @@
            title: '',
            content: '',
            barcodeFocus: true,
            orderNoFocus: false,
            palletizingNoFocus: false,
            palletizingNo2Focus: false,
            boxTypeFocus: false,
@@ -190,20 +196,46 @@
         this.token = uni.getStorageSync('token');
      },
      methods: {
         // clearOrderNo
         clearOrderNo() {
            this.orderNo = ''
            this.orderNoFocus = false
            setTimeout(()=>{
               this.orderNoFocus = true
            },100)
         },
         // 获取退库单
         findOrder() {
            let _this = this 
            uni.request({
               url: `${_this.baseUrl}/order/search/orderNo/auth/v2`,
               header: { 'token': uni.getStorageSync('token') },
               data: { orderNo: _this.orderNo },
               url: `${_this.baseUrl}/mobile/order/search/orderNo/auth/v2`,
               header: {
                  'token': uni.getStorageSync('token'),
                  'content-type': 'application/x-www-form-urlencoded'
               },
               data: {orderNo: _this.orderNo},
               method: 'POST',
               success(res) {
                  res = res.data
                  if (res.code === 200 && res.data) {
                     _this.dataList = res.data
               success(result) {
                  result = result.data
                  if (result.code === 200 && result.data) {
                     uni.navigateTo({
                        url: "../order/orderDetls",
                        // 通过eventChannel向被打开页面传送数据
                        success: function(res) {
                           res.eventChannel.emit('orderDetls', {
                              data: result.data[0].combMats
                           })
                        },
                        // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                        events: {
                           detl: function(data) {
                              _this.dataList.push(data.data)
                           },
                        },
                     });
                  } else {
                     uni.showToast({ title: res.msg, icon: "none", position: 'top' })
                     uni.showToast({ title: result.msg, icon: "none", position: 'top' })
                  }
               }
            })
@@ -215,7 +247,43 @@
         select(e) {
            this.palletizingNo2 = e
            this.$refs.inputDialog.close()
            console.log(this.palletizingNo);
         },
         // 提取订单
         orderSelect() {
            let _this = this
            uni.request({
               url: `${_this.baseUrl}/mobile/order/search/orderNo/auth/v2`,
               header: {
                  'token': uni.getStorageSync('token'),
                  'content-type': 'application/x-www-form-urlencoded'
               },
               data: {orderNo: ''},
               method: 'POST',
               success(result) {
                  result = result.data
                  if (result.code === 200 && result.data) {
                     uni.navigateTo({
                        url: "../order/orderDetls2",
                        // 通过eventChannel向被打开页面传送数据
                        success: function(res) {
                           res.eventChannel.emit('orderDetls', {
                              data: result.data
                           })
                        },
                        // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                        events: {
                           detls: function(data) {
                              _this.orderNo = data.data.orderNo
                              _this.findOrder()
                           },
                        },
                     });
                  } else {
                     uni.showToast({ title: result.msg, icon: "none", position: 'top' })
                  }
               }
            })
         },
         // 添加物料
         addMat() {
@@ -390,6 +458,7 @@
            this.count = this.dataList[i].anfme
            this.batch = this.dataList[i].batch
            this.weight = this.dataList[i].weight
            this.position = this.dataList[i].position
            this.rowNum = i
            this.eject()
         },
@@ -419,6 +488,7 @@
            this.dataList[this.rowNum].anfme = this.count
            this.dataList[this.rowNum].batch = this.batch
            this.dataList[this.rowNum].weight = this.weight
            this.dataList[this.rowNum].position = this.position
            this.matnr = ''
            this.messageText = "修改成功"
            this.messageToggle('success')
@@ -441,15 +511,16 @@
         },
         comb() {
            let that = this;
            that.combCheck(that.palletizingNo,that.boxType,that.createTime);
            that.combCheck(that.palletizingNo2,that.boxType,that.createTime);
            if (that.checkFlag) {
               return
            }
            uni.request({
               url: that.baseUrl + '/mobile/truss/auth',
               url: that.baseUrl + '/mobile/truss/order/auth',
               data: JSON.stringify({
                  orderNo: that.orderNo,
                  barcode: that.barcode,
                  combMats: that.dataList
                  matList: that.dataList
               }),
               method: 'POST',
               header: {
@@ -461,9 +532,6 @@
                     that.resst();
                     that.messageText = "退库成功"
                     that.messageToggle('success')
                     const innerAudioContext = uni.createInnerAudioContext();
                     innerAudioContext.src = '/static/music/pakinOk.mp3';
                     innerAudioContext.play()
                  } else if (res.code == 403) {
                     that.messageText = res.msg
                     that.messageToggle('error')
@@ -480,8 +548,8 @@
            });
         },
         // 提交校验
         combCheck(palletizingNo,boxType,createTime) {
            if (palletizingNo === '') {
         combCheck(palletizingNo2,boxType,createTime) {
            if (palletizingNo2 === '') {
               this.messageText = "请添加码垛位"
               this.messageToggle('error')
               this.checkFlag = true;
@@ -493,33 +561,11 @@
               this.checkFlag = true;
               return
            }
            if (createTime === '') {
               this.messageText = "请添加创建时间"
               this.messageToggle('error')
               this.checkFlag = true;
               return
            }
            if (this.dataList.length === 0) {
               this.messageText = "请添加退库商品"
               this.messageToggle('error')
               this.checkFlag = true;
               return
            }
            for (let i = 0; i < this.dataList.length; i++) {
               if (this.dataList[i].anfme == 0 || this.dataList[i].anfme == '') {
                  this.messageText = this.dataList[i].matnr + '退库数量不能为0'
                  this.messageToggle('error')
                  this.checkFlag = true;
                  return
               }
            }
            for (let i = 0; i < this.dataList.length; i++) {
               if (this.dataList[i].anfme == 0 || this.dataList[i].anfme == '') {
                  this.messageText = this.dataList[i].matnr + '退库数量不能为0'
                  this.messageToggle('error')
                  this.checkFlag = true;
                  return
               }
            }
            this.checkFlag = false;
         },
@@ -552,7 +598,7 @@
<style>
   @import url('../../static/css/wms.css/wms.css');
   .list:first-child {
      margin-top: 320rpx;
      margin-top: 200rpx;
   }
   .empty-list {
      height: 50%;
@@ -564,7 +610,7 @@
   .code {
      width: 100%;
      position: fixed;
      min-height: 200rpx;
      min-height: 70rpx;
      background-color: #FFF;
      z-index: 10;
   }
@@ -612,7 +658,7 @@
      width: 100%;
      background-color: white;
      position: fixed;
      margin-top: 210rpx;
      margin-top: 70rpx;
      z-index: 9;
      /* border-top: 1px solid #DCDFE6; */
      text-align: center;