f8d6a901 by unknown

add alipay

1 parent c4caec3a
...@@ -696,7 +696,7 @@ body, button, input, select, textarea { ...@@ -696,7 +696,7 @@ body, button, input, select, textarea {
696 border-bottom: 1px solid #eee; 696 border-bottom: 1px solid #eee;
697 } 697 }
698 698
699 .residual,.wechatPay{ 699 .residual,.wechatPay,.aliPay{
700 width:16px; 700 width:16px;
701 height:13px; 701 height:13px;
702 display: inline-block; 702 display: inline-block;
...@@ -712,6 +712,10 @@ body, button, input, select, textarea { ...@@ -712,6 +712,10 @@ body, button, input, select, textarea {
712 background: url(../images/wechat.png) no-repeat; 712 background: url(../images/wechat.png) no-repeat;
713 background-size: 100%; 713 background-size: 100%;
714 } 714 }
715 .aliPay{
716 background: url(../images/alipay.png) no-repeat;
717 background-size: 100%;
718 }
715 .checkboxS{ 719 .checkboxS{
716 width:20px; 720 width:20px;
717 height:20px; 721 height:20px;
......
...@@ -19,13 +19,23 @@ ...@@ -19,13 +19,23 @@
19 </div> 19 </div>
20 <ul> 20 <ul>
21 <!--<li> 21 <!--<li>
22
22 <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> 23 <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>
23 </li>--> 24 </li>-->
25 <!--ng-class="{true: 'checkboxTrue', false: 'checkboxFalse'}[isActive]"-->
26 <li>
27 <span class="leftText aliPay"></span><span class="leftText "> 支付宝</span> <span
28 class="rightText checkboxS"
29 ng-class="{'checkboxTrue': payType === 100, 'checkboxFalse': payType !== 100}"
30 ng-click="choosePay(100)"></span>
31 </li>
24 <li> 32 <li>
25 <span class="leftText wechatPay"></span><span class="leftText "> 微信支付</span> <span 33 <span class="leftText wechatPay"></span><span class="leftText "> 微信支付</span> <span
26 class="rightText checkboxS" ng-class="{true: 'checkboxTrue', false: 'checkboxFalse'}[isActive]" 34 class="rightText checkboxS"
27 ng-click="choosePay(1)"></span> 35 ng-class="{'checkboxTrue': payType === 101, 'checkboxFalse': payType !== 101}"
36 ng-click="choosePay(101)"></span>
28 </li> 37 </li>
38
29 </ul> 39 </ul>
30 </div> 40 </div>
31 41
......
...@@ -28,23 +28,23 @@ angular.module('myApp') ...@@ -28,23 +28,23 @@ angular.module('myApp')
28 * */ 28 * */
29 var ispay = false; 29 var ispay = false;
30 $scope.isActive = true; // 这个是个关键 TODO 要更改的 30 $scope.isActive = true; // 这个是个关键 TODO 要更改的
31 $scope.payType = 1; 31 $scope.payType = 100;
32 $scope.choosePay = function (index) { 32 $scope.choosePay = function (index) {
33 if ($($('.checkboxS')[index]).hasClass('checkboxTrue')) { 33 // if ($($('.checkboxS')[index]).hasClass('checkboxTrue')) {
34 // 如果要选择的项已经选中,不处理 34 // // 如果要选择的项已经选中,不处理
35 return 35 // return
36 } else { 36 // } else {
37 $scope.isActive = !$scope.isActive; 37 // $scope.isActive = !$scope.isActive;
38 } 38 // }
39 39
40 $scope.payType = index; 40 $scope.payType = index;
41 } 41 }
42 $scope.goPay = function () { 42 $scope.goPay = function () {
43 if (ispay) return; 43 if (ispay) return;
44 if ($scope.payType == 1) { //微信支付 44 if ($scope.payType == 100 || $scope.payType == 101) { //手机支付
45 45
46 ispay = true; 46 ispay = true;
47 wechatPayment.callRentPay($scope.tripDetail.id, $scope.tripDetail.total_fee) 47 wechatPayment.callRentTypePay($scope.tripDetail.id, $scope.tripDetail.total_fee, $scope.payType)
48 .then(function (result) { 48 .then(function (result) {
49 ispay = false; 49 ispay = false;
50 //支付成功 50 //支付成功
......
1 angular.module('myApp.services') 1 angular.module('myApp.services')
2 .service('wechatPayment',['$http', '$q', '$rootScope','$location',function($http, $q, $rootScope,$location) { 2 .service('wechatPayment',['$http', '$q', '$rootScope','$location',function($http, $q, $rootScope,$location) {
3 3
4 var host = 'http://finance.api.dingdachuxing.com/service'; 4 // var host = 'http://finance.api.dingdachuxing.com/service';
5 // var host = 'http://finance.dy.dingdatech.com/service'; 5 // var host = 'http://finance.dy.dingdatech.com/service';
6 6
7 var payhost = 'http://lsz1.28ms.com/service' 7 var host = 'http://lsz1.28ms.com/service'
8 8
9 var h5wxhost = 'http://h5api.dy.dingdachuxing.com/service/balance/'; 9 var h5wxhost = 'http://h5api.dy.dingdachuxing.com/service/balance/';
10 10
...@@ -93,6 +93,39 @@ angular.module('myApp.services') ...@@ -93,6 +93,39 @@ angular.module('myApp.services')
93 return callUnifiedOrderApi(host + '/bill/wx/' + orderId, param); 93 return callUnifiedOrderApi(host + '/bill/wx/' + orderId, param);
94 }, 94 },
95 /** 95 /**
96 * 租车付款
97 */
98 callRentTypePay: function (orderId, amount, type) {
99
100 switch (type) {
101 case 100:
102 var html = ' <form action="'+ host + '/bill/alipay/h5/'+ orderId
103 +'" method="post">' +
104 ' <input type="text" name="amount" value="'+amount+'" />' +
105 ' <input type="text" name="body" value="租车租金"/>' +
106 ' <input type="text" name="type" value="100" />' +
107 ' <input type="submit" id="ok">' +
108 ' </input>' +
109 ' </form>'
110 var form = document.createElement('div')
111 form.innerHTML = html
112 // form.querySelector('#ok').click()
113 document.body.appendChild(form)
114 document.querySelector('#ok').click()
115
116 case 101:
117 var param = Object.assign($location.search(),{
118 amount : amount,
119 body : "租车租金",
120 type : 101
121 });
122 return callUnifiedOrderApi(host + "/bill/wx/h5/" + orderId, param);
123
124 default:
125 return null
126 }
127 },
128 /**
96 * 保证金充值 129 * 保证金充值
97 * @param amount 130 * @param amount
98 */ 131 */
...@@ -108,12 +141,36 @@ angular.module('myApp.services') ...@@ -108,12 +141,36 @@ angular.module('myApp.services')
108 * @param amount 141 * @param amount
109 */ 142 */
110 callDepositTypePay : function(amount, type){ 143 callDepositTypePay : function(amount, type){
111 var param = Object.assign($location.search(),{ 144 switch (type) {
112 amount : amount, 145 case 100:
113 body : "保证金充值", 146 var html = ' <form action="'+ host + '/balance/alipay/h5'
114 type : type 147 +'" method="post">' +
115 }); 148 ' <input type="text" name="amount" value="'+amount+'" />' +
116 return callUnifiedOrderApi(payhost + "/balance/" + (type === 100?'alipay': 'wx') +"/h5", param); 149 ' <input type="text" name="body" value="保证金充值"/>' +
150 ' <input type="text" name="type" value="100" />' +
151
152 ' <input type="submit" id="ok">\n' +
153 ' 余额充值\n' +
154 ' </input>\n' +
155 ' </form>'
156 var form = document.createElement('div')
157 form.innerHTML = html
158 // form.querySelector('#ok').click()
159 document.body.appendChild(form)
160 document.querySelector('#ok').click()
161
162 case 101:
163 var param = Object.assign($location.search(),{
164 amount : amount,
165 body : "保证金充值",
166 type : type
167 });
168 return callUnifiedOrderApi(payhost + "/balance/wx/h5", param);
169
170 default:
171 return null
172 }
173
117 }, 174 },
118 /** 175 /**
119 * 钱包充值 176 * 钱包充值
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!