f8d6a901 by unknown

add alipay

1 parent c4caec3a
......@@ -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;
......
......@@ -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>
......
......@@ -28,23 +28,23 @@ angular.module('myApp')
* */
var ispay = false;
$scope.isActive = true; // 这个是个关键 TODO 要更改的
$scope.payType = 1;
$scope.payType = 100;
$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 == 100 || $scope.payType == 101) { //手机支付
ispay = true;
wechatPayment.callRentPay($scope.tripDetail.id, $scope.tripDetail.total_fee)
wechatPayment.callRentTypePay($scope.tripDetail.id, $scope.tripDetail.total_fee, $scope.payType)
.then(function (result) {
ispay = false;
//支付成功
......
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 payhost = '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
}
},
/**
* 钱包充值
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!