| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312 | 
							- <!DOCTYPE html>
 
- <html>
 
- <!--STATUS OK-->
 
- <head>
 
- 	<meta name="referrer" content="always" />
 
- 	<meta charset='utf-8' />
 
- 	<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
 
- 	<meta http-equiv="x-dns-prefetch-control" content="on">
 
- 	<meta name="description" content="">
 
- 	<meta name="format-detection" content="telephone=no" />
 
- 	<link rel="stylesheet" type="text/css" href="css/vant-ui.css" />
 
- 	<link rel="stylesheet" type="text/css" href="css/iconfont.css">
 
- 	<link rel="stylesheet" type="text/css" href="css/main.css" />
 
- 	<script src="js/vue.js"></script>
 
- 	<script src="js/vant-ui.js"></script>
 
- 	<script src="js/main.js"></script>
 
- 	<title></title>
 
- </head>
 
- <style>
 
- 	.QRcode {
 
- 		color: #fff;
 
- 		font-size: .5rem;
 
- 		text-align: center;
 
- 		padding-top: 1.5rem;
 
- 	}
 
- 	.inputCode {
 
- 		width: 85%;
 
- 		background-color: #E2E2E2;
 
- 		border: none;
 
- 		border-radius: 5px;
 
- 		padding: .15rem .1rem;
 
- 		margin-left: 5px;
 
- 	}
 
- 	.inputBtn {
 
- 		margin: 7px;
 
- 	}
 
- 	.initInput {
 
- 		background-color: #fff;
 
- 		padding: .1rem;
 
- 		justify-content: flex-start !important;
 
- 		position: absolute;
 
- 		width: 100%;
 
- 		left: 0;
 
- 		right: 0;
 
- 		bottom: -10px;
 
- 	}
 
- </style>
 
- <body>
 
- 	<div class="shaomachuku" id="input" v-cloak>
 
- 		<div class="QRcode" v-on:click="startScan">
 
- 			点击扫码
 
- 		</div>
 
- 		<div class="addCount flex a-center j-center" v-on:click="setQueryInputLoction">
 
- 			<i></i> 手工录入
 
- 		</div>
 
- 		<div class="addCount a-center j-center initInput" id="inputCode" v-show="showInput == 'show'">
 
- 			<input class="inputCode" id="inputCode_input" type="number" placeholder="请输入条形码号" v-model="code" />
 
- 			<div class="inputBtn" style="float: right" v-on:click="doneSearch">
 
- 				确定
 
- 			</div>
 
- 		</div>
 
- 		<table>
 
- 			<tr>
 
- 				<td>胎号</td>
 
- 				<td>物料</td>
 
- 			</tr>
 
- 			<tr v-for="store in inputStore">
 
- 				<td>{{ store.tirenumber }}</td>
 
- 				<td>{{ store.maktx }}</td>
 
- 			</tr>
 
- 		</table>
 
- 		<!--			<div class="QRsend flex a-center j-center">
 
- 			扫码<br/>完成
 
- 			</div>-->
 
- 		<div class="paisheBtn flex a-center j-center" v-on:click="doneScan" v-if="showInput == 'hide'">
 
- 			扫码确认
 
- 		</div>
 
- 	</div>
 
- </body>
 
- <script type="text/javascript" src="../script/jquery-1.11.0.min.js"></script>
 
- <script type="text/javascript" src="../script/api.js"></script>
 
- <script type="text/javascript" src="../script/httpRequest.js"></script>
 
- <script type="text/javascript" src="../script/vue_plugins.js"></script>
 
- <script type="text/javascript">
 
- 	apiready = function() {
 
- 		new Vue({
 
- 			el: '#input',
 
- 			data: {
 
- 				list: [],
 
- 				FNScanner: '', // 扫码插件
 
- 				code: '',
 
- 				UIinput: '', // 输入框
 
- 				showInput: 'hide',
 
- 				inputStore: [], // 扫码入库的商品
 
- 				codes: [],
 
- 			},
 
- 			methods: {
 
- 				init: function() {
 
- 					var _this = this;
 
- 					this.userId = $api.getStorage('userid');
 
- 					var winHeight = $(window).height();
 
- 					//获取当前页面高度
 
- 					$(window).resize(function() {
 
- 						var thisHeight = $(this).height();
 
- 						if (winHeight - thisHeight > 50) {
 
- 							//当软键盘弹出,在这里面操作
 
- 						} else {
 
- 							//当软键盘收起,在此处操作
 
- 							_this.showInput = 'hide';
 
- 						}
 
- 					});
 
- 					this.scanCode = api.require('FNScanner');
 
- 					this.startScan();
 
- 					this.addEvent('refushku', function() {
 
- 						_this.inputStore = new Array();
 
- 					})
 
- 				},
 
- 				//  开始扫码
 
- 				startScan: function() {
 
- 					if (api.systemType != 'ios') {
 
- 						api.require('audioStreamer').openPlayer({
 
- 							path: 'widget://res/startscan.mp3',
 
- 						}, function(ret) {
 
- 							if (ret.status) {
 
- 								//api.alert({ msg: JSON.stringify(ret) });
 
- 							}
 
- 						});
 
- 					}
 
- 					var _this = this;
 
- 					this.ifHasPrme('camera', function(ret) {
 
- 							if (ret == true) {
 
- 								_this.scan(_this.scanCode, function(res) {
 
- 										if (res) {
 
- 											_this.code = res;
 
- 											_this.doneSearch2();
 
- 										}
 
- 									})
 
- 									// _this.scanCode.scan(function(ret, err) {
 
- 									// 	if (ret.status) {
 
- 									// 		_this.code = ret.code;
 
- 									// 		_this.doneSearch();
 
- 									// 	}
 
- 									// });
 
- 							}
 
- 						})
 
- 						// this.scanCode.scan(function(ret, err) {
 
- 						// 	if (ret.status) {
 
- 						// 		_this.code = ret.code;
 
- 						// 		_this.doneSearch();
 
- 						// 	}
 
- 						// });
 
- 				},
 
- 				//  获取输入框的高度,然后调整input输入框的位置
 
- 				setQueryInputLoction: function() {
 
- 					var _this = this;
 
- 					this.showInput = 'show';
 
- 					this.$nextTick(function() {
 
- 						document.getElementById('inputCode_input').focus();
 
- 					})
 
- 				},
 
- 				doneSearch2: function() {
 
- 					if (this.codes.indexOf(this.code) >= 0) {
 
- 						if (api.systemType != 'ios') {
 
- 							api.require('audioStreamer').openPlayer({
 
- 								path: 'widget://res/rescan.mp3',
 
- 							}, function(ret) {
 
- 								if (ret.status) {
 
- 									//api.alert({ msg: JSON.stringify(ret) });
 
- 								}
 
- 							});
 
- 						}
 
- 						api.toast({
 
- 							msg: '请勿重复扫码'
 
- 						});
 
- 						return;
 
- 					}
 
- 					var data = {
 
- 							"tireNumber": this.code,
 
- 							"id": this.userId,
 
- 							"scanWay": 1,
 
- 							"version":this.getVersion(),
 
- 							"type": "body",
 
- 							"url": "json"
 
- 						},
 
- 						url = "getStoreByScan",
 
- 						_this = this;
 
- 					this.$post(url, data, function(ret) {
 
- 						if (api.systemType != 'ios') {
 
- 							api.require('audioStreamer').openPlayer({
 
- 								path: 'widget://res/scansuccess.mp3',
 
- 							}, function(ret) {
 
- 								if (ret.status) {
 
- 									//api.alert({ msg: JSON.stringify(ret) });
 
- 								}
 
- 							});
 
- 						}
 
- 						if (ret.code == 0 || ret.code == '0') {
 
- 							// if(ret.Data[0].isRegular == 1 || ret.Data[0].isRegular == '1'){
 
- 							//    api.toast({msg : "该物料是非正规渠道"});
 
- 							// 	 return;
 
- 							// }
 
- 							if (ret.Data[0].maktx != null) {
 
- 								ret.Data[0].tireNumber = _this.code
 
- 								ret.Data[0].scanWay = 1
 
- 								_this.inputStore.push(ret.Data[0]);
 
- 								_this.codes.push(_this.code);
 
- 							}
 
- 						}
 
- 					})
 
- 				},
 
- 				//  点击确定根据条形码获取商品
 
- 				doneSearch: function() {
 
- 					if (this.codes.indexOf(this.code) >= 0) {
 
- 						if (api.systemType != 'ios') {
 
- 							api.require('audioStreamer').openPlayer({
 
- 								path: 'widget://res/rescan.mp3',
 
- 							}, function(ret) {
 
- 								if (ret.status) {
 
- 									//api.alert({ msg: JSON.stringify(ret) });
 
- 								}
 
- 							});
 
- 						}
 
- 						api.toast({
 
- 							msg: '请勿重复扫码'
 
- 						});
 
- 						return;
 
- 					}
 
- 					var data = {
 
- 							"tireNumber": this.code,
 
- 							"id": this.userId,
 
- 							"scanWay": 0,
 
- 							"version":this.getVersion(),
 
- 							"type": "body",
 
- 							"url": "json"
 
- 						},
 
- 						url = "getStoreByScan",
 
- 						_this = this;
 
- 					this.$post(url, data, function(ret) {
 
- 						if (api.systemType != 'ios') {
 
- 							api.require('audioStreamer').openPlayer({
 
- 								path: 'widget://res/scansuccess.mp3',
 
- 							}, function(ret) {
 
- 								if (ret.status) {
 
- 									//api.alert({ msg: JSON.stringify(ret) });
 
- 								}
 
- 							});
 
- 						}
 
- 						if (ret.code == 0 || ret.code == '0') {
 
- 							// if(ret.Data[0].isRegular == 1 || ret.Data[0].isRegular == '1'){
 
- 							//    api.toast({msg : "该物料是非正规渠道"});
 
- 							// 	 return;
 
- 							// }
 
- 							if (ret.Data[0].maktx != null) {
 
- 								ret.Data[0].tireNumber = _this.code
 
- 								ret.Data[0].scanWay = 0
 
- 								_this.inputStore.push(ret.Data[0]);
 
- 								_this.codes.push(_this.code);
 
- 							}
 
- 						}
 
- 					})
 
- 				},
 
- 				//  扫码确认
 
- 				doneScan: function() {
 
- 					if (this.code == '') {
 
- 						api.toast({
 
- 							msg: "胎号不能为空"
 
- 						})
 
- 						return;
 
- 					}
 
- 					if (this.inputStore.length == 0) {
 
- 						api.toast({
 
- 							msg: "请完善扫码物料"
 
- 						})
 
- 						return;
 
- 					}
 
- 					var param = {
 
- 						store: JSON.stringify(this.inputStore),
 
- 						type: 2
 
- 					}
 
- 					this.goWin('chukutongji_win', 'chukutongji_win.html', param);
 
- 					//					    var data = {
 
- 					//					        "materialList" : this.inputStore,
 
- 					//					        "url" : 'json',
 
- 					//					        "type" : 'body'
 
- 					//					    },_this = this,url = "scanDoneU";
 
- 					//					    this.$post(url,data,function(ret){
 
- 					//					        if(ret.code == 0 || ret.code == '0'){
 
- 					//					           api.toast({
 
- 					//	                               msg:'预入库成功'
 
- 					//                             });
 
- 					//                             _this.goWin('rukutongji_win', 'rukutongji_win.html', '');
 
- 					//					        }
 
- 					//					    })
 
- 				}
 
- 			},
 
- 			mounted: function() {
 
- 				this.init();
 
- 			}
 
- 		})
 
- 	}
 
- </script>
 
- </html>
 
 
  |