764ef11a by unknown

get ercode

1 parent 44a749ef
......@@ -98,6 +98,7 @@
<link href="css/app.css" rel="stylesheet"/>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="js/JSBridge.js"></script>
<script type="text/javascript" src="js/angularjs/angular.min.js"></script>
<script type="text/javascript" src="js/angularjs/angular-local-storage.js"></script>
<script type="text/javascript" src="js/angularjs/angular-ui-router.js"></script>
......
function AppClient(appObj, isAndroid) {
this.appObj = appObj;
this.isAndroid = isAndroid;
};
AppClient.prototype.closePage = function() {
if (this.isAndroid) {
this.appObj.closePageAction();
} else {
this.appObj.callHandler("closePageAction");
}
}
function isJson(str) {
try {
JSON.parse(str);
} catch (e) {
return false;
}
return true;
}
// window.invokeJsPassCompanyCodeAndName = function(_params) {
// companyCode = _params.companyCode;
// companyName = _params.companyName;
// var jsonStr = "";
// getSign(jsonStr);
// }
AppClient.prototype.getERCode = function (callbackName, callback, jsonStr) {
var dataParams = "";
if(isJson(jsonStr)){
dataParams = JSON.parse(jsonStr);
}
var iOSData = {
from: 'H5',
params: dataParams
};
if (this.isAndroid) {
this.appObj.getERCode('H5', jsonStr);
} else {
this.appObj.callHandler("getERCode", iOSData, callback);
}
};
if(window.android) {
appClient = new AppClient(window.android, true);
// 此处可以调用一些init的方法
} else {
function setupWebViewJavascriptBridge(callback) {
if (window.WebViewJavascriptBridge) { return callback(WebViewJavascriptBridge); }
if (window.WVJBCallbacks) { return window.WVJBCallbacks.push(callback); }
window.WVJBCallbacks = [callback];
var WVJBIframe = document.createElement('iframe');
WVJBIframe.style.display = 'none';
WVJBIframe.src = 'https://__bridge_loaded__';
document.documentElement.appendChild(WVJBIframe);
setTimeout(function() { document.documentElement.removeChild(WVJBIframe) }, 0)
}
setupWebViewJavascriptBridge(function(bridge) {
appClient = new AppClient(bridge, false);
// 此处可以调用一些init的方法
});
}
window.getIOSERCode = function (_params) {
alert(JSON.parse(_params))
}
......@@ -4,7 +4,6 @@ angular.module('myApp')
$rootScope.isRendBike = false;
$rootScope.isLoadFinish = false;
$scope.unfinishOrder = {};
var init = function() {
// globalService.init();
$scope.userinfo = globalService.getData("user");
......@@ -105,56 +104,60 @@ angular.module('myApp')
$rootScope.openRing = false;
$rootScope.$watch("openScan",function(newVal, oldVal){
if(newVal !== oldVal && newVal) {
if(!$scope.checkLogin()) {
return;
}
if($scope.unfinishOrder.status == 200) {
$state.go('tripDetail' , { orderId : $scope.unfinishOrder.id});
return;
}
// if(!$scope.checkLogin()) {
// return;
// }
// if($scope.unfinishOrder.status == 200) {
// $state.go('tripDetail' , { orderId : $scope.unfinishOrder.id});
// return;
// }
$rootScope.openScan = false;
wx.scanQRCode({
needResult: 1, // 默认为1,扫描结果由微信处理,1则直接返回扫描结果,
scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码,默认二者都有
success: function (res) {
var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
// alert(result);
dingdaService.verifyScanCode(result).success(function(data , status){
// alert(JSON.stringify(data))
if(data.meta.code == 200) {
if(data.data.orderDetail.id) {
layer.open({
content: "租车成功,订单号为:" + data.data.orderDetail.id,
time:2
});
// alert("租车成功,订单号为:" + data.data.orderDetail.id);
$rootScope.isRendBike = true;
$state.go('rentDetail', {}, {reload: true});
}
} else if(data.meta.code == 202) {
layer.open({
content: data.meta.message,
time:2
});
$state.go('bond', {longitude: $rootScope.currentPoint.longitude , latitude: $rootScope.currentPoint.latitude });
} else {
layer.open({
content: data.meta.message,
time:2
});
}
}).error(function(data , status){
layer.open({
content: "租车失败" + JSON.stringify(data),
time:2
});
});
}
});
console.log(appClient)
appClient.getERCode('getIOSERCode', function (res) {
alert(JSON.parse(res))
}, '')
// wx.scanQRCode({
// needResult: 1, // 默认为1,扫描结果由微信处理,1则直接返回扫描结果,
// scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码,默认二者都有
// success: function (res) {
// var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
// // alert(result);
// dingdaService.verifyScanCode(result).success(function(data , status){
// // alert(JSON.stringify(data))
// if(data.meta.code == 200) {
// if(data.data.orderDetail.id) {
//
// layer.open({
// content: "租车成功,订单号为:" + data.data.orderDetail.id,
// time:2
// });
// // alert("租车成功,订单号为:" + data.data.orderDetail.id);
// $rootScope.isRendBike = true;
//
// $state.go('rentDetail', {}, {reload: true});
//
// }
// } else if(data.meta.code == 202) {
// layer.open({
// content: data.meta.message,
// time:2
// });
// $state.go('bond', {longitude: $rootScope.currentPoint.longitude , latitude: $rootScope.currentPoint.latitude });
// } else {
// layer.open({
// content: data.meta.message,
// time:2
// });
// }
// }).error(function(data , status){
// layer.open({
// content: "租车失败" + JSON.stringify(data),
// time:2
// });
// });
// }
// });
}
})
$rootScope.$watch("openDetail",function(newVal, oldVal){
......
......@@ -9,7 +9,6 @@ angular.module('myApp')
var map;
var endPosition;
var polyline;
$rootScope.currentPoint = {};
var rendBike = function() {
......@@ -154,7 +153,6 @@ angular.module('myApp')
img.src = "images/scancode.png";
scanControlContent.innerHTML = img.outerHTML + " 扫码租车";
scanControlContainer.onclick = function() {
$scope.$apply(function() {
$rootScope.openScan = true;
......
......@@ -116,7 +116,7 @@ angular.module('myApp.services')
case 101:
var param = Object.assign($location.search(),{
amount : amount,
body : "租车租金",
body : "租车租git金",
type : 101
});
return callUnifiedOrderApi(host + "/bill/wx/h5/" + orderId, param);
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!