# 1. 添加自定义toast组件
    2. 上架商品不显示问题修复
    3. 播种库位订单绑定功能
 
	
	
	
	
	
	
	
	
	
	
	
	
	
| New file | 
 |  |  | 
 |  |  |  | 
 |  |  | function loading(title) { | 
 |  |  |     uni.showLoading({ | 
 |  |  |         mask: true, | 
 |  |  |         title: title, | 
 |  |  |     }) | 
 |  |  | } | 
 |  |  |  | 
 |  |  | function hideLoading() { | 
 |  |  |     uni.hideLoading() | 
 |  |  | } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | module.exports = { | 
 |  |  |     loading, | 
 |  |  |     hideLoading | 
 |  |  | }; | 
 
 |  |  | 
 |  |  | import store from '@/store/index.js';
 | 
 |  |  | Vue.prototype.$store = store;
 | 
 |  |  | //全局公用静态数据
 | 
 |  |  | import Mock from '@/common/mock/index.js';
 | 
 |  |  | Vue.prototype.$Mock = Mock;
 | 
 |  |  | import Mock from '@/common/mock/index.js'; | 
 |  |  | import toast from "@/common/utils/toast.js" | 
 |  |  |  | 
 |  |  | 
 | 
 |  |  | Vue.prototype.$Mock = Mock; | 
 |  |  | Vue.prototype.$toast = toast | 
 |  |  | 
 | 
 |  |  | App.mpType = 'app'
 | 
 |  |  | 
 | 
 
 |  |  | 
 |  |  |         },
 | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  |         methods: { | 
 |  |  | 			 | 
 |  |  | 			 | 
 |  |  |         methods: {
 | 
 |  |  |             selectLoc() {
 | 
 |  |  |                 this.$refs['showLeft'].open()
 | 
 |  |  |             },
 | 
 
 |  |  | 
 |  |  |             fetchGoods() { | 
 |  |  |                 let that = this  | 
 |  |  |                 setTimeout(() => { | 
 |  |  |                     if (that.barcode.length < 1) { | 
 |  |  |                         return | 
 |  |  |                     }else if (that.barcode.length != 8) { | 
 |  |  |                         this.messageToggle('error', '拖盘码为8位随机数字!!') | 
 |  |  |                         return | 
 |  |  |                     }  | 
 |  |  |                 }, 500) | 
 |  |  | 				 | 
 |  |  |                 this.getMatnrBybarcode() | 
 |  |  |                     that.getMatnrBybarcode() | 
 |  |  |                 }, 800) | 
 |  |  |             },
 | 
 |  |  |  | 
 |  |  |             /** | 
 |  |  |              * 根据拖盘码拉取已组拖数据 | 
 |  |  |              */ | 
 |  |  |             getMatnrBybarcode() { | 
 |  |  |                 if (this.barcode.length < 1) { | 
 |  |  |                     return | 
 |  |  |                 } | 
 |  |  |                 if (this.barcode.length != 8) { | 
 |  |  |                     this.messageToggle('error', '拖盘码为8位随机数字!!') | 
 |  |  |                     return | 
 |  |  |                 }  | 
 |  |  |                 let that = this | 
 |  |  |                 uni.request({ | 
 |  |  |                     url: that.baseUrl + '/pda/barcode/matnr/' + that.barcode, | 
 |  |  | 
 |  |  |                         if (result.code === 200) { | 
 |  |  |                             that.dataList = result.data | 
 |  |  |                         } | 
 |  |  |                         console.log(result) | 
 |  |  |                     }     | 
 |  |  |                 }) | 
 |  |  |             }, | 
 |  |  | 
 |  |  |             
 | 
 |  |  |             comb() {
 | 
 |  |  |                 uni.vibrateShort();
 | 
 |  |  |                 let that = this;
 | 
 |  |  |                 let that = this; | 
 |  |  |                 this.$toast.loading('加载中...')
 | 
 |  |  |                 uni.request({
 | 
 |  |  |                     url: that.baseUrl + '/pda/matnr/in/barcode',
 | 
 |  |  |                     data: JSON.stringify({
 | 
 |  |  | 
 |  |  |                     header: {
 | 
 |  |  |                         'token': uni.getStorageSync('token')
 | 
 |  |  |                     },
 | 
 |  |  |                     success(result) {
 | 
 |  |  |                     success(result) { | 
 |  |  |                         that.$toast.hideLoading()
 | 
 |  |  |                         var res = result.data
 | 
 |  |  |                         if (res.code === 200) {
 | 
 |  |  |                             that.resst(); | 
 |  |  |                         if (res.code === 200) { | 
 |  |  |                             that.messageToggle('success', '上架成功!!')
 | 
 |  |  |                         } else if (res.code == 403) {
 | 
 |  |  |                             that.messageText = res.msg
 | 
 |  |  | 
 |  |  |                         } else {
 | 
 |  |  |                             that.messageText = res.msg
 | 
 |  |  |                             that.messageToggle('error')
 | 
 |  |  |                         }
 | 
 |  |  |                         } | 
 |  |  | 						 | 
 |  |  |                     }, | 
 |  |  |                     fail() { | 
 |  |  |                         that.$toast.hideLoading() | 
 |  |  |                     }, | 
 |  |  |                     complete() { | 
 |  |  |                         that.resst() | 
 |  |  |                     }
 | 
 |  |  |                 });
 | 
 |  |  |             },
 | 
 |  |  | 
 |  |  |             }, | 
 |  |  |              | 
 |  |  |             resst() { | 
 |  |  |                 this.dataList = [] | 
 |  |  |                 this.barcode = '' | 
 |  |  |                 this.locno = '' | 
 |  |  |             }, | 
 
 |  |  | 
 |  |  |     <view>
 | 
 |  |  |         <view class="view-bg"> | 
 |  |  |             <uni-section title="播种位" type="line" /> | 
 |  |  |             <uni-data-select v-model="value" :localdata="range" @change="change" style="padding: 20rpx; height: 100rpx;background-color: white;"> | 
 |  |  |             <uni-data-select v-model="siteNo" :localdata="range" @change="change" style="padding: 20rpx; height: 100rpx;background-color: white;"> | 
 |  |  |             </uni-data-select> | 
 |  |  |         </view> | 
 |  |  |         <view class="view-bg"> | 
 |  |  |             <uni-section title="订单" type="line" /> | 
 |  |  |             <input maxlength="10" placeholder="PDA扫描站点标签" v-model="orderNo"/> | 
 |  |  |             <input placeholder="PDA扫描站点标签" v-model="orderNo"/> | 
 |  |  |         </view> | 
 |  |  |         <view class="view-bg"> | 
 |  |  |             <uni-section title="容器" type="line" /> | 
 |  |  |             <input maxlength="10" placeholder="PDA扫描托盘/料箱标签" v-model="barcode"/> | 
 |  |  |             <input maxlength="8" placeholder="PDA扫描托盘/料箱标签" v-model="barcode"/> | 
 |  |  |         </view> | 
 |  |  |          | 
 |  |  |         <view class="button-sp-buttom"> | 
 |  |  |             <button class="btn-span" type="primary" @click="bindOrder">绑定</button> | 
 |  |  |             <button class="btn-span" type="primary" @click="bindOrder('bind')">绑定</button> | 
 |  |  |             <button class="btn-span" type="default">解绑</button> | 
 |  |  |         </view>
 | 
 |  |  |         </view> | 
 |  |  |         <template> | 
 |  |  |             <!-- 确认出库 --> | 
 |  |  |             <view> | 
 |  |  |                 <uni-popup ref="combConfirm" type="dialog"> | 
 |  |  |                     <uni-popup-dialog :type="msgType" cancelText="取消" confirmText="确认" :title="title" :content="content" | 
 |  |  |                         @confirm="confirm" @close="combClose"></uni-popup-dialog> | 
 |  |  |                 </uni-popup> | 
 |  |  |             </view> | 
 |  |  |             <view> | 
 |  |  |                 <!-- 提示信息弹窗 --> | 
 |  |  |                 <uni-popup ref="message" type="message"> | 
 |  |  |                     <uni-popup-message :type="msgType1" :message="messageText" :duration="2000"></uni-popup-message> | 
 |  |  |                 </uni-popup> | 
 |  |  |             </view> | 
 |  |  |         </template>
 | 
 |  |  |     </view>
 | 
 |  |  | </template>
 | 
 |  |  | 
 | 
 |  |  | 
 |  |  |     export default {
 | 
 |  |  |         data() {
 | 
 |  |  |             return {
 | 
 |  |  |                 value: 0,
 | 
 |  |  |                 range: [], | 
 |  |  |                 orderNo: '', | 
 |  |  |                 barcode: ''
 | 
 |  |  |                 barcode: '', | 
 |  |  |                 msgType1: '', | 
 |  |  |                 messageText: '', | 
 |  |  |                 msgType: '', | 
 |  |  |                 title: '', | 
 |  |  |                 content: '',
 | 
 |  |  |             }
 | 
 |  |  |         }, | 
 |  |  |          | 
 |  |  | 
 |  |  |         methods: { | 
 |  |  |             getSeedLocs() { | 
 |  |  |                 let that = this | 
 |  |  |                 toast.loading('加载中') | 
 |  |  |                 uni.request({ | 
 |  |  |                     url: this.baseUrl +  '/pda/pick/seed/locs', | 
 |  |  |                     header: { | 
 |  |  | 
 |  |  |                                 let array = result.data | 
 |  |  |                                 console.log(array) | 
 |  |  |                                 that.range = array.map((item, index) => { | 
 |  |  |                                     return {text: item.siteNo, value: item.id} | 
 |  |  |                                     return {text: item.siteNo, value: item.siteNo} | 
 |  |  |                                 }) | 
 |  |  |                                 console.log(that.range)     | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     }, | 
 |  |  |                     complete() { | 
 |  |  |                         toast.hideLoading() | 
 |  |  |                     } | 
 |  |  | 					 | 
 |  |  |                 }) | 
 |  |  |             }, | 
 |  |  |             
 | 
 |  |  | 
 |  |  |                 console.log("e:", e);
 | 
 |  |  |             }, | 
 |  |  |             //绑定订单至播种墙 | 
 |  |  |             bindOrder() { | 
 |  |  |             bindOrder(type) { | 
 |  |  |                 let that = this | 
 |  |  |                 if (this.barcode == undefined || this.barcode == '') { | 
 |  |  |                     this.messageToggle('error', '拖盘码不能为空!!') | 
 |  |  |                     return | 
 |  |  |                 } | 
 |  |  | 				 | 
 |  |  |                 if (this.orderNo == undefined || this.orderNo == '') { | 
 |  |  |                     this.messageToggle('error', '订单编码不能为空!!') | 
 |  |  |                     return | 
 |  |  |                 } | 
 |  |  | 				 | 
 |  |  |                 if (this.siteNo == undefined || this.siteNo == '') { | 
 |  |  |                     this.messageToggle('error', '播种站点不能为空!!') | 
 |  |  |                     return | 
 |  |  |                 } | 
 |  |  | 				 | 
 |  |  |                 if (type == undefined || type == null || type == null) { | 
 |  |  |                     type = 'bind' | 
 |  |  |                 } | 
 |  |  |                 toast.loading('绑定中..') | 
 |  |  |                 uni.request({ | 
 |  |  |                     url: that.baseUrl +  "/pda/pick/seed/bind", | 
 |  |  |                     data: {barcode: that.barcode, orderNo: that.orderNo, siteNo: '', type: 'bind'}, | 
 |  |  |                     data: {barcode: that.barcode, orderNo: that.orderNo, siteNo: that.siteNo, type: type}, | 
 |  |  |                     method: 'POST', | 
 |  |  |                     header: { | 
 |  |  |                         'token': uni.getStorageSync('token') | 
 |  |  |                     }, | 
 |  |  |                     success(res) { | 
 |  |  |                         let result = res.data; | 
 |  |  |                         if (result.code === 200) { | 
 |  |  | 							 | 
 |  |  |                             toast.hideLoading() | 
 |  |  |                             this.messageToggle('success', '绑定成功!') | 
 |  |  |                         } else { | 
 |  |  |                             toast.hideLoading() | 
 |  |  |                             this.messageToggle('error', result.msg) | 
 |  |  |                         } | 
 |  |  |                     }, | 
 |  |  |                     fail(res) { | 
 |  |  |                         toast.hideLoading() | 
 |  |  |                         this.messageToggle('error', '服务器错误') | 
 |  |  | 						 | 
 |  |  |                     }, | 
 |  |  |                     complete() { | 
 |  |  |                         that.barcode = '' | 
 |  |  |                         that.orderNo = '' | 
 |  |  |                         that.siteNo = '' | 
 |  |  |                     } | 
 |  |  |                 }) | 
 |  |  |             }, | 
 |  |  |             //解绑  | 
 |  |  |             unbindOrder() { | 
 |  |  |                 let that = this | 
 |  |  |                 uni.request({ | 
 |  |  |                     url: that.baseUrl +  "/pda/pick/seed/bind", | 
 |  |  |                     data: {barcode: that.barcode, orderNo: that.orderNo, siteNo: '', type: 'unbind'}, | 
 |  |  |                     header: { | 
 |  |  |                         'token': uni.getStorageSync('token') | 
 |  |  |                     }, | 
 |  |  |                     success(res) { | 
 |  |  |                         let result = res.data; | 
 |  |  |                         if (result.code === 200) { | 
 |  |  | 							 | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 }) | 
 |  |  |             }
 | 
 |  |  |                 this.bindOrder('unbind') | 
 |  |  |             }, | 
 |  |  |             //dialog弹框信息 | 
 |  |  |             dialogToggle(type,title, msg) { | 
 |  |  |                 this.msgType = type | 
 |  |  |                 this.title = title | 
 |  |  |                 this.content = msg | 
 |  |  |                 this.$refs.combConfirm.open() | 
 |  |  |             }, | 
 |  |  | 			 | 
 |  |  |             //消息弹框 | 
 |  |  |             messageToggle(type, msg) { | 
 |  |  |                 this.msgType1 = type | 
 |  |  |                 if (msg != undefined || msg != null) { | 
 |  |  |                     this.messageText = msg | 
 |  |  |                 }  | 
 |  |  |                 this.$refs.message.open() | 
 |  |  |             },
 | 
 |  |  |         }
 | 
 |  |  |     }
 | 
 |  |  | </script>
 |