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
f8d6a901
authored
2018-08-14 00:38:26 +0800
by
unknown
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add alipay
1 parent
c4caec3a
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
86 additions
and
15 deletions
.idea/workspace.xml
css/app.css
html/tripDetail.html
js/controller/tripDetailController.js
js/service/wechatPaymentService.js
.idea/workspace.xml
View file @
f8d6a90
This diff is collapsed.
Click to expand it.
css/app.css
View file @
f8d6a90
...
...
@@ -696,7 +696,7 @@ body, button, input, select, textarea {
border-bottom
:
1px
solid
#eee
;
}
.residual
,
.wechatPay
{
.residual
,
.wechatPay
,
.aliPay
{
width
:
16px
;
height
:
13px
;
display
:
inline-block
;
...
...
@@ -712,6 +712,10 @@ body, button, input, select, textarea {
background
:
url(../images/wechat.png)
no-repeat
;
background-size
:
100%
;
}
.aliPay
{
background
:
url(../images/alipay.png)
no-repeat
;
background-size
:
100%
;
}
.checkboxS
{
width
:
20px
;
height
:
20px
;
...
...
html/tripDetail.html
View file @
f8d6a90
...
...
@@ -19,13 +19,23 @@
</div>
<ul>
<!--<li>
<span class="leftText residual"></span> <span class="leftText"> 余额支付(¥{{balance}})</span> <span class="rightText checkboxS" ng-class="{true: 'checkboxTrue', false: 'checkboxFalse'}[!isActive]" ng-click="choosePay(0)"> </span>
</li>-->
<!--ng-class="{true: 'checkboxTrue', false: 'checkboxFalse'}[isActive]"-->
<li>
<span
class=
"leftText aliPay"
></span><span
class=
"leftText "
>
支付宝
</span>
<span
class=
"rightText checkboxS"
ng-class=
"{'checkboxTrue': payType === 100, 'checkboxFalse': payType !== 100}"
ng-click=
"choosePay(100)"
></span>
</li>
<li>
<span
class=
"leftText wechatPay"
></span><span
class=
"leftText "
>
微信支付
</span>
<span
class=
"rightText checkboxS"
ng-class=
"{true: 'checkboxTrue', false: 'checkboxFalse'}[isActive]"
ng-click=
"choosePay(1)"
></span>
class=
"rightText checkboxS"
ng-class=
"{'checkboxTrue': payType === 101, 'checkboxFalse': payType !== 101}"
ng-click=
"choosePay(101)"
></span>
</li>
</ul>
</div>
...
...
js/controller/tripDetailController.js
View file @
f8d6a90
...
...
@@ -28,23 +28,23 @@ angular.module('myApp')
* */
var
ispay
=
false
;
$scope
.
isActive
=
true
;
// 这个是个关键 TODO 要更改的
$scope
.
payType
=
1
;
$scope
.
payType
=
1
00
;
$scope
.
choosePay
=
function
(
index
)
{
if
(
$
(
$
(
'.checkboxS'
)[
index
]).
hasClass
(
'checkboxTrue'
))
{
// 如果要选择的项已经选中,不处理
return
}
else
{
$scope
.
isActive
=
!
$scope
.
isActive
;
}
//
if ($($('.checkboxS')[index]).hasClass('checkboxTrue')) {
//
// 如果要选择的项已经选中,不处理
//
return
//
} else {
//
$scope.isActive = !$scope.isActive;
//
}
$scope
.
payType
=
index
;
}
$scope
.
goPay
=
function
()
{
if
(
ispay
)
return
;
if
(
$scope
.
payType
==
1
)
{
//微信
支付
if
(
$scope
.
payType
==
1
00
||
$scope
.
payType
==
101
)
{
//手机
支付
ispay
=
true
;
wechatPayment
.
callRent
Pay
(
$scope
.
tripDetail
.
id
,
$scope
.
tripDetail
.
total_fe
e
)
wechatPayment
.
callRent
TypePay
(
$scope
.
tripDetail
.
id
,
$scope
.
tripDetail
.
total_fee
,
$scope
.
payTyp
e
)
.
then
(
function
(
result
)
{
ispay
=
false
;
//支付成功
...
...
js/service/wechatPaymentService.js
View file @
f8d6a90
angular
.
module
(
'myApp.services'
)
.
service
(
'wechatPayment'
,[
'$http'
,
'$q'
,
'$rootScope'
,
'$location'
,
function
(
$http
,
$q
,
$rootScope
,
$location
)
{
var
host
=
'http://finance.api.dingdachuxing.com/service'
;
//
var host = 'http://finance.api.dingdachuxing.com/service';
// var host = 'http://finance.dy.dingdatech.com/service';
var
pay
host
=
'http://lsz1.28ms.com/service'
var
host
=
'http://lsz1.28ms.com/service'
var
h5wxhost
=
'http://h5api.dy.dingdachuxing.com/service/balance/'
;
...
...
@@ -93,6 +93,39 @@ angular.module('myApp.services')
return
callUnifiedOrderApi
(
host
+
'/bill/wx/'
+
orderId
,
param
);
},
/**
* 租车付款
*/
callRentTypePay
:
function
(
orderId
,
amount
,
type
)
{
switch
(
type
)
{
case
100
:
var
html
=
' <form action="'
+
host
+
'/bill/alipay/h5/'
+
orderId
+
'" method="post">'
+
' <input type="text" name="amount" value="'
+
amount
+
'" />'
+
' <input type="text" name="body" value="租车租金"/>'
+
' <input type="text" name="type" value="100" />'
+
' <input type="submit" id="ok">'
+
' </input>'
+
' </form>'
var
form
=
document
.
createElement
(
'div'
)
form
.
innerHTML
=
html
// form.querySelector('#ok').click()
document
.
body
.
appendChild
(
form
)
document
.
querySelector
(
'#ok'
).
click
()
case
101
:
var
param
=
Object
.
assign
(
$location
.
search
(),{
amount
:
amount
,
body
:
"租车租金"
,
type
:
101
});
return
callUnifiedOrderApi
(
host
+
"/bill/wx/h5/"
+
orderId
,
param
);
default
:
return
null
}
},
/**
* 保证金充值
* @param amount
*/
...
...
@@ -108,12 +141,36 @@ angular.module('myApp.services')
* @param amount
*/
callDepositTypePay
:
function
(
amount
,
type
){
switch
(
type
)
{
case
100
:
var
html
=
' <form action="'
+
host
+
'/balance/alipay/h5'
+
'" method="post">'
+
' <input type="text" name="amount" value="'
+
amount
+
'" />'
+
' <input type="text" name="body" value="保证金充值"/>'
+
' <input type="text" name="type" value="100" />'
+
' <input type="submit" id="ok">\n'
+
' 余额充值\n'
+
' </input>\n'
+
' </form>'
var
form
=
document
.
createElement
(
'div'
)
form
.
innerHTML
=
html
// form.querySelector('#ok').click()
document
.
body
.
appendChild
(
form
)
document
.
querySelector
(
'#ok'
).
click
()
case
101
:
var
param
=
Object
.
assign
(
$location
.
search
(),{
amount
:
amount
,
body
:
"保证金充值"
,
type
:
type
});
return
callUnifiedOrderApi
(
payhost
+
"/balance/"
+
(
type
===
100
?
'alipay'
:
'wx'
)
+
"/h5"
,
param
);
return
callUnifiedOrderApi
(
payhost
+
"/balance/wx/h5"
,
param
);
default
:
return
null
}
},
/**
* 钱包充值
...
...
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