Explorar o código

Merge branch 'master' of git.echepei.com:sailun/sailun-shop into master

qukaidi %!s(int64=4) %!d(string=hai) anos
pai
achega
142a763ef5
Modificáronse 2 ficheiros con 77 adicións e 80 borrados
  1. 68 69
      luntai/saomachuku.html
  2. 9 11
      luntai/saomaruku.html

+ 68 - 69
luntai/saomachuku.html

@@ -87,7 +87,7 @@
 <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() {
+	apiready = function () {
 		new Vue({
 			el: '#input',
 			data: {
@@ -100,12 +100,12 @@
 				codes: [],
 			},
 			methods: {
-				init: function() {
+				init: function () {
 					var _this = this;
 					this.userId = $api.getStorage('userid');
 					var winHeight = $(window).height();
 					//获取当前页面高度
-					$(window).resize(function() {
+					$(window).resize(function () {
 						var thisHeight = $(this).height();
 						if (winHeight - thisHeight > 50) {
 							//当软键盘弹出,在这里面操作
@@ -116,16 +116,16 @@
 					});
 					this.scanCode = api.require('FNScanner');
 					this.startScan();
-					this.addEvent('refushku', function() {
+					this.addEvent('refushku', function () {
 						_this.inputStore = new Array();
 					})
 				},
 				//  开始扫码
-				startScan: function() {
+				startScan: function () {
 					if (api.systemType != 'ios') {
 						api.require('audioStreamer').openPlayer({
 							path: 'widget://res/startscan.mp3',
-						}, function(ret) {
+						}, function (ret) {
 							if (ret.status) {
 								//api.alert({ msg: JSON.stringify(ret) });
 							}
@@ -133,43 +133,43 @@
 					}
 
 					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();
-						// 	}
-						// });
+					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() {
+				setQueryInputLoction: function () {
 					var _this = this;
 					this.showInput = 'show';
-					this.$nextTick(function() {
+					this.$nextTick(function () {
 						document.getElementById('inputCode_input').focus();
 					})
 				},
-				doneSearch2: function() {
+				doneSearch2: function () {
 					if (this.codes.indexOf(this.code) >= 0) {
 						if (api.systemType != 'ios') {
 							api.require('audioStreamer').openPlayer({
 								path: 'widget://res/rescan.mp3',
-							}, function(ret) {
+							}, function (ret) {
 								if (ret.status) {
 									//api.alert({ msg: JSON.stringify(ret) });
 								}
@@ -181,38 +181,37 @@
 						return;
 					}
 					var data = {
-							"tireNumber": this.code,
-							"id": this.userId,
-							"scanWay": 1,
-							"version":this.getVersion(),
-							"type": "body",
-							"url": "json"
-						},
+						"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) });
-								}
-							});
-						}
-
+					this.$post(url, data, function (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.message) {
+								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.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);
-							}
+									ret.Data[0].tireNumber = _this.code
+									ret.Data[0].scanWay = 1
+									_this.inputStore.push(ret.Data[0]);
+									_this.codes.push(_this.code);
+								}
 							} else {
 								api.toast({
 									msg: ret.message,
@@ -223,12 +222,12 @@
 					})
 				},
 				//  点击确定根据条形码获取商品
-				doneSearch: function() {
+				doneSearch: function () {
 					if (this.codes.indexOf(this.code) >= 0) {
 						if (api.systemType != 'ios') {
 							api.require('audioStreamer').openPlayer({
 								path: 'widget://res/rescan.mp3',
-							}, function(ret) {
+							}, function (ret) {
 								if (ret.status) {
 									//api.alert({ msg: JSON.stringify(ret) });
 								}
@@ -241,20 +240,20 @@
 						return;
 					}
 					var data = {
-							"tireNumber": this.code,
-							"id": this.userId,
-							"scanWay": 0,
-							"version":this.getVersion(),
-							"type": "body",
-							"url": "json"
-						},
+						"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) {
+					this.$post(url, data, function (ret) {
 						if (api.systemType != 'ios') {
 							api.require('audioStreamer').openPlayer({
 								path: 'widget://res/scansuccess.mp3',
-							}, function(ret) {
+							}, function (ret) {
 								if (ret.status) {
 									//api.alert({ msg: JSON.stringify(ret) });
 								}
@@ -276,7 +275,7 @@
 					})
 				},
 				//  扫码确认
-				doneScan: function() {
+				doneScan: function () {
 					if (this.code == '') {
 						api.toast({
 							msg: "胎号不能为空"
@@ -309,11 +308,11 @@
 					//					    })
 				}
 			},
-			mounted: function() {
+			mounted: function () {
 				this.init();
 			}
 		})
 	}
 </script>
 
-</html>
+</html>

+ 9 - 11
luntai/saomaruku.html

@@ -186,17 +186,6 @@
 						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({
@@ -205,6 +194,15 @@
 							// 	return;
 							// }
 							if (!ret.message) {
+								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.Data[0].maktx != null) {
 									ret.Data[0].tireNumber = _this.code
 									ret.Data[0].scanWay = 1