|  |  | 
 |  |  | <template> | 
 |  |  |    <view> | 
 |  |  |       <view class="box" v-for="item in 10"> | 
 |  |  |          <view class="box-left"> | 
 |  |  |             <text class="text"> 库区 </text> | 
 |  |  |       <view class="container" v-for="(item,i) in tree" :key="i"> | 
 |  |  |          <view :class="item.key"> | 
 |  |  |             <view class="title"  > | 
 |  |  |                <view  style="width: 50%;">{{item.title}}</view> | 
 |  |  |                <view @click="switchbtn(item)"> | 
 |  |  |                   <uni-icons type="top" v-show="item.switch"></uni-icons> | 
 |  |  |                   <uni-icons type="bottom" v-show="!item.switch"></uni-icons> | 
 |  |  |                </view> | 
 |  |  |             </view> | 
 |  |  |             <view class="name" v-show="item.key == 'user_id'" @click="back()"> | 
 |  |  |                <view>{{item.title}}</view> | 
 |  |  |             </view> | 
 |  |  |             <view class="sub1" v-for="sub in item.children" style="margin-left: 1em;" v-show="item.switch"> | 
 |  |  |                <view :class="sub.key" class="title sub-title"  > | 
 |  |  |                   <view  @click="chose(sub)">{{sub.title}}</view> | 
 |  |  |                   <view @click="switchbtn(sub)"> | 
 |  |  |                      <uni-icons type="top" v-show="sub.switch"></uni-icons> | 
 |  |  |                      <uni-icons type="bottom" v-show="!sub.switch"></uni-icons> | 
 |  |  |                   </view> | 
 |  |  |                </view> | 
 |  |  | 					 | 
 |  |  |                <view :class="sub.key" class="name" v-show="sub.key == 'user_id'"  @click="back()"> | 
 |  |  |                   <view>{{sub.title}}</view> | 
 |  |  |                </view> | 
 |  |  | 					 | 
 |  |  |                <view class="sub2" v-for="it in sub.children" style="margin-left: 1em;" v-show="sub.switch"> | 
 |  |  |                   <!-- <view :class="it.key" class="title sub-title" >{{it.title}}</view> --> | 
 |  |  |                   <view :class="it.key" class="locarea name"  @click="chose(it)"> | 
 |  |  |                      <view>{{it.title}}</view> | 
 |  |  |                   </view> | 
 |  |  |                </view> | 
 |  |  |             </view> | 
 |  |  |          </view> | 
 |  |  |          <view class="box-right"> | 
 |  |  |             <text class="text"> {{item}} </text> | 
 |  |  |       </view> | 
 |  |  | 		 | 
 |  |  |       <view class="pick-list" v-show="pickData != ''"> | 
 |  |  |          <view class="list-item"> | 
 |  |  |             <text class="list-title">订单号:</text><text class="val-text">{{pickData.docNum ? pickData.docNum : '--'}}</text> | 
 |  |  |          </view> | 
 |  |  |          <view class="list-item"> | 
 |  |  |             <text>库位号:</text><text>{{pickData.locNo}}</text> | 
 |  |  |          </view> | 
 |  |  |          <view class="list-item"> | 
 |  |  |             <text>托盘码:</text><text>{{pickData.zpallet ? pickData.zpallet : '--'}}</text> | 
 |  |  |          </view> | 
 |  |  |          <view class="list-item"> | 
 |  |  |             <text>料箱码:</text><text>{{pickData.containerCode ? pickData.containerCode : '--'}}</text> | 
 |  |  |          </view> | 
 |  |  |          <view class="list-item"> | 
 |  |  |             <text>销售行号:</text><text>{{pickData.csocode ? pickData.csocode : '--'}}</text> | 
 |  |  |          </view> | 
 |  |  |          <view class="list-item"> | 
 |  |  |             <text>订单行号:</text><text>{{pickData.isoseg ? pickData.isoseg : '--'}}</text> | 
 |  |  |          </view> | 
 |  |  |          <view class="list-item"> | 
 |  |  |             <text>物料号:</text><text>{{pickData.matnr ? pickData.matnr : '--'}}</text> | 
 |  |  |          </view> | 
 |  |  |          <view class="list-item"> | 
 |  |  |             <text>物料名称:</text><text>{{pickData.maktx}}</text> | 
 |  |  |          </view> | 
 |  |  |          <view class="list-item"> | 
 |  |  |             <text>状态:</text><text>{{pickData.status$}}</text> | 
 |  |  |          </view> | 
 |  |  |          <view class="list-item"> | 
 |  |  |             <text>数量:</text><text class="val-num">{{pickData.anfme}}</text> | 
 |  |  |          </view> | 
 |  |  |       </view> | 
 |  |  | 		 | 
 |  |  |       <view style="height: 100rpx;"></view> | 
 |  |  | 		 | 
 |  |  |       <view class="z-floor" v-show="pickData != ''"> | 
 |  |  |          <button size="mini" type="primary" @click="picked()">拣货</button> | 
 |  |  |       </view> | 
 |  |  | 		 | 
 |  |  |       <view> | 
 |  |  |          <!-- 提示信息弹窗 --> | 
 |  |  |          <uni-popup ref="message" type="message"> | 
 |  |  |             <uni-popup-message :type="msgType1" :message="messageText" :duration="2000"></uni-popup-message> | 
 |  |  |          </uni-popup> | 
 |  |  |       </view> | 
 |  |  |    </view> | 
 |  |  | </template> | 
 |  |  | 
 |  |  |    export default { | 
 |  |  |       data() { | 
 |  |  |          return { | 
 |  |  | 				 | 
 |  |  |             tree: [], | 
 |  |  |             pickList: [], | 
 |  |  |             pickData: '', | 
 |  |  |             index: 1, | 
 |  |  |             len: 5, | 
 |  |  |             msgType1: 'success', | 
 |  |  |             msgType: 'success', | 
 |  |  |             messageText: '', | 
 |  |  |          } | 
 |  |  |       }, | 
 |  |  |       onShow() { | 
 |  |  |          this.baseUrl = uni.getStorageSync('baseUrl'); | 
 |  |  |          this.token = uni.getStorageSync('token'); | 
 |  |  |          this.getNodeTree() | 
 |  |  |       }, | 
 |  |  |       methods: { | 
 |  |  |          getNodeTree() { | 
 |  |  |             let _this = this | 
 |  |  |             uni.request({ | 
 |  |  |                url: `${_this.baseUrl}/node/tree/auth`, | 
 |  |  |                header: {'token': uni.getStorageSync('token')}, | 
 |  |  |                method: 'POST', | 
 |  |  |                success(res) { | 
 |  |  |                   this.tree = [] | 
 |  |  |                   res = res.data | 
 |  |  |                   // console.log(res.data[0].children); | 
 |  |  |                   if (res.data[0].children[0]) { | 
 |  |  |                      for (let k of res.data[0].children) { | 
 |  |  |                         // console.log(k); | 
 |  |  |                         if (k.children && k.children.length > 0) { | 
 |  |  |                            for (let i of k.children) { | 
 |  |  |                               i['switch'] = true | 
 |  |  |                               // console.log(i); | 
 |  |  |                            } | 
 |  |  |                         } | 
 |  |  |                         // console.log(k); | 
 |  |  |                         k['switch'] = true | 
 |  |  |                         _this.tree.push(k) | 
 |  |  |                      } | 
 |  |  |                      // console.log(_this.tree); | 
 |  |  |                   } else { | 
 |  |  |                      this.tree.push(res.data[0]) | 
 |  |  |                   } | 
 |  |  |                } | 
 |  |  |             }) | 
 |  |  |          }, | 
 |  |  |          async getUserTree() { | 
 |  |  |             let res = await user.getUserTree() | 
 |  |  |             if (res.code === 200) { | 
 |  |  |                this.tree = [] | 
 |  |  |                // console.log(res.data[0]); | 
 |  |  |                if (res.data[0].children) { | 
 |  |  |                   for (let k of res.data[0].children) { | 
 |  |  | 							 | 
 |  |  |                      if (k.children && k.children.length > 0) { | 
 |  |  |                         for (let i of k.children) { | 
 |  |  |                            i['switch'] = true | 
 |  |  |                            // console.log(i); | 
 |  |  |                         } | 
 |  |  |                      } | 
 |  |  |                      // console.log(k); | 
 |  |  |                      k['switch'] = true | 
 |  |  |                      this.tree.push(k) | 
 |  |  |                   } | 
 |  |  |                } else { | 
 |  |  |                   this.tree.push(res.data[0]) | 
 |  |  |                } | 
 |  |  |             } else if (res.code === 403) { | 
 |  |  |                this.backLogin(res) | 
 |  |  |             } | 
 |  |  |             console.log(this.tree); | 
 |  |  |          }, | 
 |  |  |          switchbtn(item) { | 
 |  |  |             // console.log(item); | 
 |  |  |             item.switch = item.switch ? false : true | 
 |  |  |          }, | 
 |  |  |          open(e) { | 
 |  |  |             // console.log('open', e) | 
 |  |  |          }, | 
 |  |  |          close(e) { | 
 |  |  |             // console.log('close', e) | 
 |  |  |          }, | 
 |  |  |          change(e) { | 
 |  |  |             // console.log('change', e) | 
 |  |  |          }, | 
 |  |  |          backLogin(res) { | 
 |  |  |             uni.showToast({title: res.msg, icon: "none", position: 'top'}) | 
 |  |  |             setTimeout(() => { | 
 |  |  |                uni.reLaunch({ | 
 |  |  |                   url: '../login/login' | 
 |  |  |                }); | 
 |  |  |             }, 1000); | 
 |  |  |          }, | 
 |  |  |          back() { | 
 |  |  |             uni.$emit('isRefresh', 1) | 
 |  |  |             uni.navigateBack({ | 
 |  |  | 					 | 
 |  |  |             }) | 
 |  |  |          }, | 
 |  |  |          chose(data) { | 
 |  |  |             let that = this  | 
 |  |  |             uni.request({ | 
 |  |  |                url: `${that.baseUrl}/node/order/pakout`, | 
 |  |  |                header: {'token': uni.getStorageSync('token')}, | 
 |  |  |                data: {locType: data.title}, | 
 |  |  |                success(res) { | 
 |  |  |                   // console.log(res); | 
 |  |  |                   res = res.data | 
 |  |  |                   if (res.code === 200 && res.data.length > 0) { | 
 |  |  |                      that.pickList = res.data | 
 |  |  |                      that.len = res.data.length | 
 |  |  |                      that.pickData = res.data[0] | 
 |  |  |                      that.index = 1 | 
 |  |  |                   } else if (res.data.length == 0) { | 
 |  |  |                      that.getNodeTree() | 
 |  |  |                   } | 
 |  |  |                } | 
 |  |  |             }) | 
 |  |  |             this.tree = [] | 
 |  |  |          }, | 
 |  |  |          picked() { | 
 |  |  |             let that = this | 
 |  |  |             // console.log(that.len); | 
 |  |  |             // console.log(that.index); | 
 |  |  |             if (that.len < that.index) { | 
 |  |  |                that.pickData = '' | 
 |  |  |                that.index = 1 | 
 |  |  |                that.getNodeTree() | 
 |  |  |                return | 
 |  |  |             } else { | 
 |  |  |                that.pickData.orderNo = that.pickData.docNum | 
 |  |  |                uni.request({ | 
 |  |  |                   url: `${that.baseUrl}/mobile/node/pakout`, | 
 |  |  |                   header: {'token': uni.getStorageSync('token')}, | 
 |  |  |                   data: that.pickData, | 
 |  |  |                   method: 'POST' | 
 |  |  |                }).then((res)=>{ | 
 |  |  |                   res = res.data | 
 |  |  |                   // console.log(res); | 
 |  |  |                   if (res.code === 200) { | 
 |  |  |                      if (that.index == that.len) { | 
 |  |  |                         that.pickData = '' | 
 |  |  |                         that.index = 1 | 
 |  |  |                         that.getNodeTree() | 
 |  |  |                      } else { | 
 |  |  |                         that.index++ | 
 |  |  |                         that.pickData = that.pickList[that.index] | 
 |  |  |                      } | 
 |  |  |                      that.messageText = "拣货成功" | 
 |  |  |                      that.messageToggle('success') | 
 |  |  |                   } | 
 |  |  |                }) | 
 |  |  | 					 | 
 |  |  |             } | 
 |  |  |          }, | 
 |  |  |          messageToggle(type) { | 
 |  |  |             this.msgType1 = type | 
 |  |  |             this.$refs.message.open() | 
 |  |  |          }, | 
 |  |  |           | 
 |  |  |       } | 
 |  |  |    } | 
 |  |  | </script> | 
 |  |  |  | 
 |  |  | <style> | 
 |  |  |    .box { | 
 |  |  |       margin: 16rpx; | 
 |  |  |    .container { | 
 |  |  |       margin:  16rpx; | 
 |  |  |       min-height: 35rpx; | 
 |  |  |       background-color: #FFF; | 
 |  |  |       padding: 16rpx; | 
 |  |  |    } | 
 |  |  |    .box1 { | 
 |  |  |       background-color: aqua; | 
 |  |  |    } | 
 |  |  |    .title { | 
 |  |  |       box-shadow: -3px 0px 0px #55aaff; | 
 |  |  |       padding-left: 5px; | 
 |  |  |       font-size: 15px; | 
 |  |  |       font-weight: 700; | 
 |  |  |       display: flex; | 
 |  |  |       align-items: stretch; | 
 |  |  | 		 | 
 |  |  |       justify-content: space-between; | 
 |  |  |       align-items: center; | 
 |  |  |    } | 
 |  |  |    .box-left { | 
 |  |  |       height: 80rpx; | 
 |  |  |       line-height: 80rpx; | 
 |  |  |       background-color: #499bff; | 
 |  |  |       background-color: #26edcf; | 
 |  |  |       color: #F7F6F9; | 
 |  |  |    .sub-title { | 
 |  |  |       margin: 32rpx 0; | 
 |  |  |       box-shadow: -3px 0px 0px #55aa7f; | 
 |  |  |    } | 
 |  |  |    .box-right { | 
 |  |  |       flex: 1; | 
 |  |  |    .name { | 
 |  |  |       padding: 16rpx; | 
 |  |  |       display: flex; | 
 |  |  |       justify-content: space-between; | 
 |  |  |       align-items: center; | 
 |  |  |    } | 
 |  |  |    .locarea:active { | 
 |  |  |       background-color: #55aa7f; | 
 |  |  |    } | 
 |  |  |    .pick-list { | 
 |  |  |       margin: 8px; | 
 |  |  |       background-color: #FFF; | 
 |  |  |       min-height: 70rpx; | 
 |  |  |       border-radius: 20rpx; | 
 |  |  |    } | 
 |  |  |    .list-item  { | 
 |  |  |       min-height: 70rpx; | 
 |  |  |       display: flex; | 
 |  |  |       align-items: center; | 
 |  |  |       background-color: #fff; | 
 |  |  |       color: #808080; | 
 |  |  |       padding-left: 32rpx; | 
 |  |  |    } | 
 |  |  |    .text  { | 
 |  |  |       padding: 10rpx 20rpx; | 
 |  |  |    .list-item:first-child { | 
 |  |  |       padding-top: 8rpx; | 
 |  |  |    } | 
 |  |  | </style> | 
 |  |  |    .list-item:last-child { | 
 |  |  |       padding-bottom: 8rpx; | 
 |  |  |    } | 
 |  |  |    .z-floor { | 
 |  |  |       position: fixed; | 
 |  |  |       bottom: 0; | 
 |  |  |       left: 0; | 
 |  |  |       height: 100rpx; | 
 |  |  |       width: 100%; | 
 |  |  |       background-color: #FFF; | 
 |  |  |       display: flex; | 
 |  |  |       align-items: center; | 
 |  |  | 		 | 
 |  |  |    } | 
 |  |  |    .list-title { | 
 |  |  |       vertical-align: text-bottom; | 
 |  |  |    } | 
 |  |  |    .val-text { | 
 |  |  |       background-color: #00aeec; | 
 |  |  |       padding: 2px 4px; | 
 |  |  |       border-radius: 4px; | 
 |  |  |       color: #FFF; | 
 |  |  |    } | 
 |  |  |    .val-num { | 
 |  |  |       font-weight: 900; | 
 |  |  |       color: #d19a66; | 
 |  |  |       font-size: 16px; | 
 |  |  |    } | 
 |  |  | </style> |