Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
杨建斌
/
dy-wx2
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
a313492b
authored
2019-01-19 23:44:07 +0800
by
ex
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
回调判断支付状态
1 parent
affec4af
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
16 deletions
html/wxPayReturn.html
js/app.js
js/controller/bondPayController.js
js/controller/wxPayReturn.js
js/service/wechatPaymentService.js
html/wxPayReturn.html
0 → 100644
View file @
a313492
<div
ng-controller=
"wxPayReturnController"
ng-init=
"init()"
>
</div>
\ No newline at end of file
js/app.js
View file @
a313492
...
...
@@ -67,6 +67,11 @@ var app = angular.module('myApp', [ "ui.router",'myApp.services', 'myApp.direct
url
:
"/rechargeList"
,
templateUrl
:
"html/rechargeList.html"
})
.
state
(
'wxPayReturn'
,{
url
:
"/wxPayReturn/:type"
,
templateUrl
:
"html/wxPayReturn.html"
,
controller
:
'wxPayReturnController'
})
...
...
js/controller/bondPayController.js
View file @
a313492
...
...
@@ -5,9 +5,6 @@ angular.module('myApp')
if
(
!
$rootScope
.
toPaid
){
$state
.
go
(
'bond'
);
}
if
(
$rootScope
.
data
.
user
.
userName
===
17097826207
)
{
$rootScope
.
toPaid
=
0.01
}
// 支付保证金
var
ispay
=
false
;
$scope
.
goPay
=
function
(){
...
...
@@ -15,17 +12,16 @@ angular.module('myApp')
ispay
=
true
;
var
IswechatPayment
=
window
.
localStorage
.
getItem
(
"IswechatPayment"
);
if
(
IswechatPayment
==
undefined
||
IswechatPayment
==
"no"
)
{
wechatPayment
.
callDepositTypePay
(
$rootScope
.
toPaid
,
$scope
.
payType
)
.
then
(
function
(
result
)
{
ispay
=
false
;
//支付成功
// alert(window.localStorage.getItem("IswechatPayment"));
window
.
localStorage
.
setItem
(
"IswechatPayment"
,
"yes"
)
$state
.
go
(
'bondSuccess'
);
//
window.localStorage.setItem("IswechatPayment", "yes")
//
$state.go('bondSuccess');
},
function
(
errMsg
)
{
ispay
=
false
;
window
.
localStorage
.
setItem
(
"IswechatPayment"
,
"no"
)
//
window.localStorage.setItem("IswechatPayment", "no")
//支付失败
})
}
...
...
js/controller/wxPayReturn.js
0 → 100644
View file @
a313492
angular
.
module
(
'myApp'
)
.
controller
(
'wxPayReturnController'
,[
'$scope'
,
'$rootScope'
,
'dingdaService'
,
'$state'
,
'globalService'
,
function
(
$scope
,
$rootScope
,
dingdaService
,
$state
,
globalService
,
$stateParams
){
var
type
=
$stateParams
.
type
var
init
=
function
()
{
switch
(
type
){
case
'order'
:
dingdaService
.
getUnfinishedOrder
().
success
(
function
(
data
,
status
){
if
(
data
.
meta
.
code
==
200
)
{
if
(
!
data
.
data
.
unfinishedOrder
.
id
)
{
layer
.
open
({
content
:
'支付成功'
,
time
:
2
});
$state
.
go
(
'main'
)
return
}
else
{
$scope
.
unfinishOrder
=
data
.
data
.
unfinishedOrder
;
$state
.
go
(
'tripDetail'
,
{
orderId
:
$scope
.
unfinishOrder
.
id
});
return
}
$state
.
go
(
'main'
)
}
}).
error
(
function
(
data
,
status
)
{
console
.
log
(
JSON
.
stringify
(
data
))
})
break
case
'bond'
:
var
longitude
=
$rootScope
.
currentPoint
.
longitude
;
var
latitude
=
$rootScope
.
currentPoint
.
latitude
;
dingdaService
.
getBond
(
longitude
,
latitude
)
.
success
(
function
(
data
){
if
(
data
.
meta
.
code
==
200
){
if
(
data
.
data
.
isActive
){
$rootScope
.
toPaid
=
data
.
data
.
toPaid
;
$state
.
go
(
'bondSuccess'
);
return
}
}
$state
.
go
(
'bond'
)
}).
error
(
function
(
data
){
})
break
default
:
}
}
init
()
}]);
\ No newline at end of file
js/service/wechatPaymentService.js
View file @
a313492
...
...
@@ -62,20 +62,20 @@ angular.module('myApp.services')
// $state.go('bond');
var
redirect_url
=
''
if
(
isiOS
){
redirect_url
=
"&redirect_url=dcxing.com://"
+
window
.
location
.
origin
+
window
.
location
.
pathname
redirect_url
=
"&redirect_url=dcxing.com://"
+
window
.
location
.
origin
+
window
.
location
.
pathname
+
'#/wxPayReturn/'
+
q
}
window
.
location
.
href
=
sign
.
mwebUrl
+
redirect_url
;
}
var
call
UnifiedOrderApi
=
function
(
url
,
data
){
var
call
OrderApi
=
function
(
url
,
data
,
type
){
var
q
=
$q
.
defer
();
$http
.
post
(
url
,
data
)
.
success
(
function
(
data
)
{
if
(
data
.
meta
.
code
==
200
)
{
// alert('支付签名返回:' + JSON.stringify(data));
wxh5ApiCall
(
data
.
data
.
wechatDto
,
q
);
wxh5ApiCall
(
data
.
data
.
wechatDto
,
type
);
}
else
{
layer
.
open
({
content
:
'支付失败:code '
+
data
.
meta
.
code
+
","
+
data
.
meta
.
message
,
...
...
@@ -130,14 +130,14 @@ angular.module('myApp.services')
// form.querySelector('#ok').click()
document
.
body
.
appendChild
(
form
)
document
.
querySelector
(
'#ok'
).
click
()
return
callUnifiedOrderApiAliPay
(
'支付'
)
//
return callUnifiedOrderApiAliPay('支付')
case
101
:
var
param
=
Object
.
assign
(
$location
.
search
(),{
amount
:
amount
,
body
:
"租车租git金"
,
type
:
101
});
return
call
UnifiedOrderApi
(
host
+
"/bill/wx/h5/"
+
orderId
,
param
);
return
call
OrderApi
(
host
+
"/bill/wx/h5/"
+
orderId
,
param
,
'order'
);
default
:
return
null
...
...
@@ -153,7 +153,7 @@ angular.module('myApp.services')
body
:
"保证金充值"
,
type
:
101
});
return
call
Unified
OrderApi
(
host
+
"/bail/wx"
,
param
);
return
callOrderApi
(
host
+
"/bail/wx"
,
param
);
},
/**
* 保证金充值
* @param amount
...
...
@@ -187,14 +187,14 @@ angular.module('myApp.services')
// form.querySelector('#ok').click()
document
.
body
.
appendChild
(
form
)
document
.
querySelector
(
'#ok'
).
click
()
return
callUnifiedOrderApiAliPay
(
'支付'
)
//
return callUnifiedOrderApiAliPay('支付')
case
101
:
var
param
=
Object
.
assign
(
$location
.
search
(),{
amount
:
amount
,
body
:
"保证金充值"
,
type
:
type
});
return
call
UnifiedOrderApi
(
host
+
"/balance/wx/h5"
,
param
);
return
call
OrderApi
(
host
+
"/balance/wx/h5"
,
param
,
'bond'
);
default
:
return
null
...
...
@@ -212,7 +212,7 @@ angular.module('myApp.services')
body
:
"钱包充值"
,
type
:
parseInt
(
way
)
});
return
call
Unified
OrderApi
(
host
,
param
);
return
callOrderApi
(
host
,
param
);
}
}
}]);
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment