| <template> | 
|     <view> | 
|         <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem"> | 
|         </uni-segmented-control> | 
|         <view class="content"> | 
|             <view v-if="current === 0" class="headerstyle"> | 
|                 <view class="itemstyle"> | 
|                     <uni-forms style="margin-left: 2%;margin-top: 20px;" label-width="180"> | 
|                         <uni-forms-item :label="label" style="margin-top: -20px;"></uni-forms-item> | 
|                         <uni-forms-item label="物料码:" style="margin-top: -20px;"> | 
|                             <uni-easyinput type="text" placeholder="请扫描物料码" ref='midInput' :focus="!focus" | 
|                                 v-model="materSn" @input="snInput" /> | 
|                         </uni-forms-item> | 
|                         <uni-list> | 
|                             <uni-list-item direction="column" v-for="(item,index) in matInfos" :key="index"> | 
|                                 <template v-slot:body> | 
|                                     <view class="uni-content"> | 
|                                         <!-- <view class="uni-title-sub uni-ellipsis-2">采购单号:{{item.purchaseOrderNo}}</view> --> | 
|                                         <view>物料编码:{{item.materielCode}}</view> | 
|                                         <view>批次号:{{item.lotNo}}</view> | 
|                                         <view>数量:{{item.quantity}}</view> | 
|                                         <!-- <view class="uni-note">生产日期:{{item.productionDate}}</view> | 
|                                         <view class="uni-note">有效期:{{item.effectiveDate}}</view> --> | 
|                                     </view> | 
|                                 </template> | 
|                             </uni-list-item> | 
|                         </uni-list> | 
|                         </uni-forms-item> | 
|                     </uni-forms> | 
|                     <uni-forms-item> | 
|                         <button @click="submit" type="primary" size="default" style="margin-top: 2%;">确认出库</button> | 
|                     </uni-forms-item> | 
|                 </view> | 
|             </view> | 
|             <view v-if="current === 1" class="headerstyle"> | 
|                 <view class="itemstyle"> | 
|                     <uni-list :border="true"> | 
|                         <uni-list-item direction="column" v-for="(item,index) in orderInfo" :key="index"> | 
|                             <template v-slot:body> | 
|                                 <view class="uni-list-box"> | 
|                                     <view class="uni-content"> | 
|                                         <view>单据号:{{orderNo}}</view> | 
|                                         <view>物料编码:{{item.materielCode}}</view> | 
|                                         <view>物料名称:{{item.materielName}}</view> | 
|                                         <view>数量:{{item.orderQuantity+item.unit}}</view> | 
|                                         <view>出库数量:{{item.orderQuantity+item.unit}}</view> | 
|                                         <view>已出数量:{{item.overOutQuantity+item.unit}}</view> | 
|                                     </view> | 
|                                 </view> | 
|                             </template> | 
|                         </uni-list-item> | 
|                     </uni-list> | 
|                 </view> | 
|             </view> | 
|         </view> | 
|         <u-toast ref="uToast" /> | 
|     </view> | 
| </template> | 
|   | 
| <script> | 
|     const innerAudioContext = uni.createInnerAudioContext(); | 
|     export default { | 
|         data() { | 
|             return { | 
|                 items: ['物料信息', '单据信息'], | 
|                 current: 0, | 
|                 matInfos: [], | 
|                 orderNo: "", | 
|                 label: "", | 
|                 orderInfo: [], | 
|                 focus: false, | 
|                 materSn: "", | 
|                 sn: "", | 
|                 warehouseId: "", | 
|             } | 
|         }, | 
|         onShow() {}, | 
|         onLoad(res) { | 
|             this.focus = false; | 
|             this.orderNo = res.orderNo; | 
|             this.warehouseId = res.warehouseId; | 
|             this.label = "单据编号:" + this.orderNo; | 
|             this.getData(); | 
|         }, | 
|         methods: { | 
|             // voiceSpeech(src) { | 
|             //     innerAudioContext.src = src; // '../../static/success.mp3'; | 
|             //     innerAudioContext.play(); | 
|             // }, | 
|             getData() { | 
|                 var postData = { | 
|                     MainData: { | 
|                         orderNo: this.orderNo | 
|                     }, | 
|                 } | 
|                 this.$u.post('/api/OutboundOrderDetail/GetOutboundOrderDetails', postData).then((res) => { | 
|                     if (res.status) { | 
|                         this.orderInfo = res.data; | 
|                         if (this.orderInfo.length > 3) { | 
|                             this.loadVisible = true; | 
|                         } | 
|                     } | 
|                 }) | 
|             }, | 
|             onClickItem(e) { | 
|                 this.focus = false; | 
|                 if (this.current !== e.currentIndex) { | 
|                     this.current = e.currentIndex; | 
|                     if (this.current == 2) { | 
|                         this.getData(); | 
|                     } | 
|                 } | 
|             }, | 
|             //扫码 | 
|             snInput() { | 
|                 this.$nextTick(() => { | 
|                     if (this.materSn != "") { | 
|                         this.focus = true; | 
|                         var matSn = this.materSn; | 
|                         setTimeout(() => { | 
|                             this.materSn = ""; | 
|                         }, 10); | 
|                         this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => { | 
|                             this.Testcheck = false; | 
|                             if (res.status) { | 
|                                 this.matInfos = []; | 
|                                 this.sn = res.data.serialNumber; | 
|                                 this.matInfos.push(res.data); | 
|                                 if (!res.status) { | 
|                                     this.$refs.uToast.show({ | 
|                                         title: res.message, | 
|                                         type: "error" | 
|                                     }) | 
|                                     // setTimeout(() => { | 
|                                     //     this.voiceSpeech('../../static/fail.mp3'); | 
|                                     // }, 100); | 
|                                     return; | 
|                                 } | 
|                                 // setTimeout(() => { | 
|                                 //     this.voiceSpeech('../../static/success.mp3'); | 
|                                 // }, 100); | 
|                             } else { | 
|                                 this.matInfos = []; | 
|                                 this.sns = []; | 
|                                 this.$refs.uToast.show({ | 
|                                     title: res.message, | 
|                                     type: "error" | 
|                                 }) | 
|                                 // setTimeout(() => { | 
|                                 //     this.voiceSpeech('../../static/fail.mp3'); | 
|                                 // }, 100); | 
|                             } | 
|                         }) | 
|                     } | 
|                 }) | 
|             }, | 
|             submit() { | 
|                 if (this.sn == "") { | 
|                     this.$refs.uToast.show({ | 
|                         title: "请扫描物料码", | 
|                         type: 'error' | 
|                     }) | 
|                     return; | 
|                 } | 
|                 debugger | 
|                 this.$u.post('/api/OutboundOrder/outpinku', { | 
|                     MainData: { | 
|                         "orderNo": this.orderNo, | 
|                         "sn": this.sn, | 
|                         "warehouseId": this.warehouseId | 
|                     } | 
|                 }).then(res => { | 
|                     if (res.status) { | 
|                         this.$refs.uToast.show({ | 
|                             title: "出库成功", | 
|                             type: "success" | 
|                         }) | 
|                         this.focus = false; | 
|                         this.matInfos = []; | 
|                         this.sn = ""; | 
|                     } else { | 
|                         this.$refs.uToast.show({ | 
|                             title: res.message, | 
|                             type: "error" | 
|                         }) | 
|                     } | 
|                 }) | 
|             } | 
|         } | 
|     } | 
| </script> | 
|   | 
| <style lang="scss"> | 
|     @import '@/common/uni-ui.scss'; | 
|   | 
|     .content { | 
|         display: flex; | 
|         height: 150px; | 
|     } | 
|   | 
|     .content-text { | 
|         font-size: 14px; | 
|         color: #666; | 
|     } | 
|   | 
|     .itemstyle { | 
|         margin-top: 30px; | 
|         margin-left: 5%; | 
|     } | 
|   | 
|     .headerstyle { | 
|         width: 90%; | 
|     } | 
| </style> |