|  |  |  | 
|---|
|  |  |  | <view class="item"> | 
|---|
|  |  |  | <view class="code-decs">托盘码:</view> | 
|---|
|  |  |  | <input type="text" placeholder=" 扫码 / 输入" v-model="barcode" :focus="barcodeFocus" | 
|---|
|  |  |  | @confirm="barcodeInput()"> | 
|---|
|  |  |  | @input="search()"> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | <view class="item"> | 
|---|
|  |  |  | <view class="code-decs">物料码:</view> | 
|---|
|  |  |  | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | <view class="list-right"> | 
|---|
|  |  |  | <uni-icons type="compose" color="#9add8b" size="24" @click="revise(item,i)"></uni-icons> | 
|---|
|  |  |  | <uni-icons type="trash" color="#f58a8a" size="24" @click="remove(item,i,'warn')"></uni-icons> | 
|---|
|  |  |  | <!-- <uni-icons type="trash" color="#f58a8a" size="24" @click="remove(item,i,'warn')"></uni-icons> --> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | </scroll-view> | 
|---|
|  |  |  | <!-- 底部操作按钮 --> | 
|---|
|  |  |  | <view class="buttom"> | 
|---|
|  |  |  | <button size="mini" @click="reset('warn')">重置</button> | 
|---|
|  |  |  | <button size="mini" type="primary" @click="combConfirm('warn')">组托</button> | 
|---|
|  |  |  | <button size="mini" type="primary" @click="combConfirm('warn')">确认</button> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | <!-- 弹窗 --> | 
|---|
|  |  |  | <!-- 修改数量 --> | 
|---|
|  |  |  | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | <view class="popup-item"> | 
|---|
|  |  |  | <view class="popup-item-left">合同号:</view> | 
|---|
|  |  |  | <view class="popup-item-left">批号:</view> | 
|---|
|  |  |  | <view class="popup-item-right"><input type="text" v-model="batch"></view> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | <view class="popup-item"> | 
|---|
|  |  |  | 
|---|
|  |  |  | <view> | 
|---|
|  |  |  | <uni-popup ref="combConfirm" type="dialog"> | 
|---|
|  |  |  | <uni-popup-dialog :type="msgType" cancelText="取消" confirmText="确认" :title="title" :content="content" | 
|---|
|  |  |  | @confirm="comb" @close="combClose"></uni-popup-dialog> | 
|---|
|  |  |  | @confirm="adjust" @close="combClose"></uni-popup-dialog> | 
|---|
|  |  |  | </uni-popup> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | <!-- 确认重置 --> | 
|---|
|  |  |  | 
|---|
|  |  |  | <uni-popup-dialog :type="msgType" cancelText="取消" confirmText="确认" :title="title" :content="content" | 
|---|
|  |  |  | @confirm="resetConfirm" @close="resetClose"></uni-popup-dialog> | 
|---|
|  |  |  | </uni-popup> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <view class="keyboard" :class="hidebg" mode="aspectFit" @click="hideKeyboard"> | 
|---|
|  |  |  | <image src="@/static/img/keyboard1.png" style="height: 70%;width: 70%;"></image> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | 
|---|
|  |  |  | content: '', | 
|---|
|  |  |  | barcodeFocus: true, | 
|---|
|  |  |  | matFocus: false, | 
|---|
|  |  |  | matData: '' | 
|---|
|  |  |  | matData: '', | 
|---|
|  |  |  | hide: true, | 
|---|
|  |  |  | hidebg: 'kb-bgtr' | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | onLoad() { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // #ifdef APP | 
|---|
|  |  |  | setInterval(()=>{ | 
|---|
|  |  |  | if (this.hide) { | 
|---|
|  |  |  | uni.hideKeyboard() | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | },20) | 
|---|
|  |  |  | // #endif | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | onBackPress() { | 
|---|
|  |  |  | this.hide = false | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | onShow() { | 
|---|
|  |  |  | this.baseUrl = uni.getStorageSync('baseUrl'); | 
|---|
|  |  |  | this.token = uni.getStorageSync('token'); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | hideKeyboard() { | 
|---|
|  |  |  | this.hide = this.hide ? false : true | 
|---|
|  |  |  | if (this.hide) { | 
|---|
|  |  |  | this.hidebg = 'kb-bgtr' | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.hidebg = 'kb-bgfa' | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | messageToggle(type) { | 
|---|
|  |  |  | this.msgType1 = type | 
|---|
|  |  |  | this.$refs.message.open() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // barcode input 事件 | 
|---|
|  |  |  | barcodeInput() { | 
|---|
|  |  |  | // 不设置定时器 会出现扫入的字符串不全 | 
|---|
|  |  |  | setTimeout(() => { | 
|---|
|  |  |  | var len = this.barcode.length | 
|---|
|  |  |  | if (len != 8) { | 
|---|
|  |  |  | uni.showToast({ | 
|---|
|  |  |  | title: '托盘码有误请重试', | 
|---|
|  |  |  | icon: "none", | 
|---|
|  |  |  | position: 'top' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | this.barcodeFocuss() | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | // 根据托盘码搜索 | 
|---|
|  |  |  | search() { | 
|---|
|  |  |  | let that = this | 
|---|
|  |  |  | uni.request({ | 
|---|
|  |  |  | url: that.baseUrl + '/mobile/checkDetl/auth2', | 
|---|
|  |  |  | header: { | 
|---|
|  |  |  | 'token':uni.getStorageSync('token') | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | data: {barcode: that.barcode}, | 
|---|
|  |  |  | method:'GET', | 
|---|
|  |  |  | success(res) { | 
|---|
|  |  |  | console.log(res); | 
|---|
|  |  |  | res = res.data | 
|---|
|  |  |  | if(res.code === 200){ | 
|---|
|  |  |  | for(var i = 0; i < res.data.length;i++){ | 
|---|
|  |  |  | that.dataList.push(res.data[i]) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } 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'}) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.focuss() | 
|---|
|  |  |  | }, 200) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 托盘码有误重置 | 
|---|
|  |  |  | barcodeFocuss() { | 
|---|
|  |  |  | let that = this; | 
|---|
|  |  |  | 
|---|
|  |  |  | combConfirm(type) { | 
|---|
|  |  |  | this.msgType = type | 
|---|
|  |  |  | this.title = '警告' | 
|---|
|  |  |  | this.content = '是否现在组托!' | 
|---|
|  |  |  | this.content = '是否确认盘点!' | 
|---|
|  |  |  | this.$refs.combConfirm.open() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | combClose() { | 
|---|
|  |  |  | this.$refs.combConfirm.close() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | comb() { | 
|---|
|  |  |  | uni.vibrateShort(); | 
|---|
|  |  |  | let that = this; | 
|---|
|  |  |  | if (that.barcode === '') { | 
|---|
|  |  |  | this.messageText = "请扫描托盘条码" | 
|---|
|  |  |  | this.messageToggle('error') | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (that.dataList.length === 0) { | 
|---|
|  |  |  | this.messageText = "请添加商品列表" | 
|---|
|  |  |  | this.messageToggle('error') | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (var i = 0; i < that.dataList.length; i++) { | 
|---|
|  |  |  | if (that.dataList[i].anfme == 0 || that.dataList[i].anfme == '') { | 
|---|
|  |  |  | this.messageText = that.dataList[i].matnr + '组托数量不能为0' | 
|---|
|  |  |  | this.messageToggle('error') | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | uni.request({ | 
|---|
|  |  |  | url: that.baseUrl + '/mobile/comb/auth', | 
|---|
|  |  |  | data: JSON.stringify({ | 
|---|
|  |  |  | barcode: that.barcode, | 
|---|
|  |  |  | combMats: that.dataList | 
|---|
|  |  |  | }), | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | header: { | 
|---|
|  |  |  | 'token': uni.getStorageSync('token') | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | success(result) { | 
|---|
|  |  |  | var res = result.data | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | that.resst(); | 
|---|
|  |  |  | that.messageText = "组托成功" | 
|---|
|  |  |  | that.messageToggle('success') | 
|---|
|  |  |  | } else if (res.code == 403) { | 
|---|
|  |  |  | that.messageText = res.msg | 
|---|
|  |  |  | that.messageToggle('error') | 
|---|
|  |  |  | setTimeout(() => { | 
|---|
|  |  |  | uni.reLaunch({ | 
|---|
|  |  |  | url: '../login/login' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }, 1000); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | that.messageText = res.msg | 
|---|
|  |  |  | that.messageToggle('error') | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | reset(type) { | 
|---|
|  |  |  | this.msgType = type | 
|---|
|  |  |  | 
|---|
|  |  |  | // 确认重置 | 
|---|
|  |  |  | resetConfirm() { | 
|---|
|  |  |  | this.dataList = [] | 
|---|
|  |  |  | this.barcode = '' | 
|---|
|  |  |  | this.messageText = "重置完成" | 
|---|
|  |  |  | this.messageToggle('success') | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 
|---|
|  |  |  | this.barcode = '' | 
|---|
|  |  |  | this.barcodeFocuss() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | adjust() { | 
|---|
|  |  |  | let that = this | 
|---|
|  |  |  | var combMats = [] | 
|---|
|  |  |  | var combParam = {} | 
|---|
|  |  |  | combParam['barcode'] = that.barcode | 
|---|
|  |  |  | combParam['wrkDetls'] = that.dataList | 
|---|
|  |  |  | uni.request({ | 
|---|
|  |  |  | url: that.baseUrl + '/mobile/adjustNew/auth', | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | data: JSON.stringify(combParam), | 
|---|
|  |  |  | header: { | 
|---|
|  |  |  | 'token':uni.getStorageSync('token') | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | success(result) { | 
|---|
|  |  |  | var res = result.data | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | that.dataList = [] | 
|---|
|  |  |  | that.barcode = '' | 
|---|
|  |  |  | uni.showToast({title: res.msg, icon: "none", position: 'top'}) | 
|---|
|  |  |  | } 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'}) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </script> | 
|---|