You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
590 lines
27 KiB
590 lines
27 KiB
<?php
|
|
header("Content-type: text/html; charset=utf-8");
|
|
ini_set('date.timezone','Asia/Shanghai');
|
|
//error_reporting(E_ERROR);
|
|
require_once "../lib/WxPay.Api.php";
|
|
require_once "WxPay.JsApiPay.php";
|
|
require_once 'log.php';
|
|
|
|
//初始化日志
|
|
$logHandler= new CLogFileHandler("../logs/".date('Y-m-d').'.log');
|
|
$log = Log::Init($logHandler, 15);
|
|
|
|
//打印输出数组信息
|
|
function printf_info($data)
|
|
{
|
|
foreach($data as $key=>$value){
|
|
echo "<font color='#00ff55;'>$key</font> : $value <br/>";
|
|
}
|
|
}
|
|
function NumToStr($num){
|
|
if (stripos($num,'e')===false) return $num;
|
|
$num = trim(preg_replace('/[=\'"]/','',$num,1),'"');//出现科学计数法,还原成字符串
|
|
$result = "";
|
|
while ($num > 0){
|
|
$v = $num - floor($num / 10)*10;
|
|
$num = floor($num / 10);
|
|
$result = $v . $result;
|
|
}
|
|
return $result;
|
|
}
|
|
//①、获取用户openid
|
|
$tools = new JsApiPay();
|
|
// exit();
|
|
$openId = $tools->GetOpenid();
|
|
session_start();
|
|
|
|
//获取金额
|
|
$pFee = $_SESSION['premoney'];
|
|
// echo "<span>".$pFee."</span>";
|
|
$pBody = $_SESSION['body'];
|
|
$pCardNo = $_SESSION['cardno'];
|
|
$pRegID = $_SESSION['regId'];
|
|
$pRepeiceNo = $_SESSION['repeiceNo'];
|
|
$pOrder = $_SESSION['order'];
|
|
$pPatientID = $_SESSION['patientid'];
|
|
$pName = $_SESSION['name'];
|
|
$pPatientNO = $_SESSION['patientno'];
|
|
// echo "<span>".$pCardNo."</span>";
|
|
|
|
|
|
switch($pBody) {
|
|
case 'zyyj': $pBody = '住院押金';break;
|
|
case 'mzjf': $pBody = '门诊缴费';break;
|
|
}
|
|
// var_dump($f);
|
|
//②、统一下单
|
|
|
|
$input = new WxPayUnifiedOrder();
|
|
$tradeNo = NumToStr(WxPayConfig::MCHID.date("YmdHis"));
|
|
$input->SetBody($pBody);
|
|
$input->SetAttach("test");
|
|
// $tradeNo = $input->SetOut_trade_no(WxPayConfig::MCHID.date("YmdHis"));
|
|
$input->SetOut_trade_no($tradeNo);
|
|
$input->SetTotal_fee($pFee);
|
|
$input->SetTime_start(date("YmdHis"));
|
|
$input->SetTime_expire(date("YmdHis", time() + 600));
|
|
$input->SetGoods_tag("test");
|
|
$input->SetNotify_url("http://lyl.medical.91paiyipai.com/wxpay/example/notify.php");
|
|
$input->SetTrade_type("JSAPI");
|
|
$input->SetOpenid($openId);
|
|
$order = WxPayApi::unifiedOrder($input);
|
|
// echo '<font color="#f00"><b>统一下单支付单信息</b></font><br/>';
|
|
// printf_info($orde);
|
|
// print_r($input);
|
|
$jsApiParameters = $tools->GetJsApiParameters($order);
|
|
|
|
// $jsSdkParameters = $tools->GetJsSDKParameters($order);
|
|
|
|
//获取共享收货地址js函数参数
|
|
$editAddress = $tools->GetEditAddressParameters();
|
|
|
|
//③、在支持成功回调通知中处理成功之后的事宜,见 notify.php
|
|
/**
|
|
* 注意:
|
|
* 1、当你的回调地址不可访问的时候,回调通知会失败,可以通过查询订单来确认支付是否成功
|
|
* 2、jsapi支付时需要填入用户openid,WxPay.JsApiPay.php中有获取openid流程 (文档可以参考微信公众平台“网页授权接口”,
|
|
* 参考http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html)
|
|
*/
|
|
?>
|
|
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
<meta name="format-detection" content="telephone=no">
|
|
|
|
<link rel="stylesheet" href="../../medical_wx/lib/assets/css/bootstrap.min.css">
|
|
<link rel="stylesheet" href="../../medical_wx/lib/assets/css/home_two.css">
|
|
<link rel="stylesheet" href="../../medical_wx/lib/assets/css/loaders.css">
|
|
|
|
<script src="../../medical_wx/lib/assets/js/jquery.min.js"></script>
|
|
<script src="../../medical_wx/lib/assets/js/bootstrap.min.js"></script>
|
|
<script src="../../medical_wx/lib/assets/js/home.js"></script>
|
|
<script src="../../medical_wx/js/base.js"></script>
|
|
|
|
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
|
|
|
|
<title>确认支付</title>
|
|
<style>
|
|
.wx_company{font-size: 14px;color: #000000;}
|
|
.wx_money{font-size: 30px;color: #000000;margin-top: 10px;}
|
|
.wx_tab2{border-top: 1px solid #f0eded;;background-color: #ffffff;border-bottom: 1px solid #f0eded;;padding: 10px 15px;}
|
|
.wx_btn{background-color: #7cc53e;color: #ffffff;font-size: 14px;text-align: center;line-height: 40px;border-radius: 4px;cursor: pointer;}
|
|
body{margin: 0;padding: 0;background-color: #f7f7f7;}
|
|
.wx_tab3{padding: 30px 15px;}
|
|
.wx_tab1{text-align: center;padding: 20px 0 20px 0;}
|
|
.wx_tab2 label{font-size: 12px;color: #ccc;}
|
|
.wx_tab2 span{font-size: 13px;color: #000000;float: right;}
|
|
.wx_footer{font-size: 12px;color: #ccc;margin: 0 auto;position: absolute;bottom: 30%;left: 0;width: 100%;text-align: center;}
|
|
</style>
|
|
<script type="text/javascript">
|
|
// var t_uid = GetQuery('uid');
|
|
var uid = localStorage.getItem('uid', uid);
|
|
|
|
//调用微信JS api 支付
|
|
function jsApiCall()
|
|
{
|
|
|
|
// alert(JSON.stringify( eval('(<?php echo $jsApiParameters; ?>)')));
|
|
// return;
|
|
WeixinJSBridge.invoke(
|
|
'getBrandWCPayRequest',
|
|
<?php echo $jsApiParameters; ?>,
|
|
function(res){
|
|
WeixinJSBridge.log(res.err_msg);
|
|
// alert(res.err_code+res.err_desc+res.err_msg);
|
|
if(res.err_msg == 'get_brand_wcpay_request:ok') {
|
|
// alert('支付成功');
|
|
var order = "<?php echo $pOrder;?>"
|
|
var cardno = "<?php echo $pCardNo;?>"
|
|
var repeiceno = "<?php echo $pRepeiceNo;?>"
|
|
var type = 2;//1.未支付、2.已支付(未更新)、3.已支付(已更新)、4.退费
|
|
// alert(order);
|
|
if(order == '1'){//门诊缴费
|
|
wxorder("<?php echo $pName; ?>", "<?php echo $pFee/100; ?>", uid, "<?php echo $tradeNo; ?>", 1, 1, "<?php echo $pPatientNO; ?>", "<?php echo $pRegID; ?>", '2');
|
|
payAdm(cardno, "<?php echo $pRegID; ?>", "<?php echo $pRepeiceNo; ?>", "<?php echo $pFee/100; ?>", "<?php echo $pName; ?>", "<?php echo $tradeNo; ?>", "<?php echo $pPatientNO; ?>");
|
|
//wxorder("<?php echo $pName;?>", "<?php echo $pFee;?>", uid, "<?php echo $tradeNo?>", 1, "<?php echo $pPatientID;?>");
|
|
}
|
|
if(order == '2'){//住院押金缴费
|
|
wxorder("<?php echo $pName; ?>", "<?php echo $pFee/100; ?>", uid, "<?php echo $tradeNo; ?>", 2, "<?php echo $pPatientID; ?>", "<?php echo $pPatientNO; ?>", '0', '2');
|
|
recharge("<?php echo $pPatientID; ?>", "<?php echo $pFee/100; ?>", "<?php echo $pName; ?>", "<?php echo $tradeNo; ?>");
|
|
//wxorder("<?php echo $pName;?>", "<?php echo $pFee;?>", uid, "<?php echo $tradeNo?>", 2, 1);
|
|
}
|
|
}else{
|
|
alert('支付失败');
|
|
// var order = "<?php echo $pOrder;?>"
|
|
// var cardno = "<?php echo $pCardNo;?>"
|
|
// // var repeiceno = "<?php echo $pRepeiceNo;?>"
|
|
// // var type = 2;//1.未支付、2.已支付(未更新)、3.已支付(已更新)、4.退费
|
|
// alert(order);
|
|
// if(order == '1'){//门诊缴费
|
|
// wxorder("<?php echo $pName; ?>", "<?php echo $pFee/100; ?>", uid, "<?php echo $tradeNo; ?>", 1, 1, "<?php echo $pPatientNO; ?>", "<?php echo $pRegID; ?>", '2');
|
|
// // payAdms(cardno, "<?php echo $pRegID; ?>", "<?php echo $pRepeiceNo; ?>", "<?php echo $pFee/100; ?>", "<?php echo $pName; ?>", "<?php echo $tradeNo; ?>", "<?php echo $pPatientNO; ?>");
|
|
// // //wxorder("<?php echo $pName;?>", "<?php echo $pFee;?>", uid, "<?php echo $tradeNo?>", 1, "<?php echo $pPatientID;?>");
|
|
// }
|
|
}
|
|
|
|
|
|
}
|
|
);
|
|
}
|
|
// callpay();
|
|
function callpay()
|
|
{
|
|
// alert("callpay");
|
|
// alert(typeof (WeixinJSBridge));
|
|
|
|
if (typeof (WeixinJSBridge) == "undefined"){
|
|
if( document.addEventListener ){
|
|
document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
|
|
}else if (document.attachEvent){
|
|
document.attachEvent('WeixinJSBridgeReady', jsApiCall);
|
|
document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
|
|
}
|
|
}else{
|
|
jsApiCall();
|
|
}
|
|
}
|
|
//提交门诊缴费
|
|
function payAdm(data1, data2, data3, data4, data5, data6, data7) {
|
|
|
|
var url = domain2+':4419/apiv1_outpayment/payadm?jsoncallback=callback';
|
|
var xhr = $.ajax({
|
|
type: 'post',
|
|
async: false,
|
|
url: url,
|
|
dataType: 'jsonp',
|
|
data: {cardno:data1, regid:data2, repeiceno:data3, total_fee:data4},
|
|
jsonp: 'jsoncallback',
|
|
timeout: 1000,
|
|
beforeSend: function() {
|
|
startLoading();
|
|
},
|
|
success: function(obj) {
|
|
stopLoading();
|
|
if(obj.repstatus == 1) {
|
|
|
|
if(obj.repmsg.Header.ResultCode == '0') {
|
|
//缴费记录入库
|
|
wxorder(data5, data4, uid, data6, 1, '1', data7, data2, '3', data1);
|
|
//location.href = 'http://lyl.medical.91paiyipai.com/wxpay/example/reload.php?remoney='+(fee*100)+'&order=1&body=mzjf&name='+name;
|
|
}else{
|
|
$('.tip_mess').css('display', 'block');
|
|
$('.tip_mess').html('支付失败,原因:'+obj.repmsg.Header.ResultMsg+';您的该笔费用将会退回到您的微信账户');
|
|
time = self.setInterval('clearTime()', 1500);
|
|
//发起微信退款
|
|
var refund_fee = data4 * 100;
|
|
refund(data6, refund_fee);
|
|
}
|
|
} else {
|
|
$('.tip_mess').css('display', 'block');
|
|
$('.tip_mess').html(obj.repmsg.Header.ResultMsg);
|
|
time = self.setInterval('clearTime()', 1500);
|
|
}
|
|
},
|
|
error: function(xhr, textStatus) {
|
|
// alert(textStatus);
|
|
if(textStatus == 'timeout') {
|
|
setTimeout(function(){
|
|
stopLoading();
|
|
$('.tip_mess').css('display', 'block');
|
|
$('.tip_mess').html('连接超时请刷新再试!');
|
|
time = self.setInterval('clearTime()', 1000);
|
|
},2000);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
//提交门诊缴费 测试代码
|
|
// function payAdms(data1=null, data2=null, data3=null, data4=null, data5=null, data6=null, data7=null) {
|
|
|
|
// var url = domain2+':4419/apiv1_outpayment/payadm?jsoncallback=callback';
|
|
// var xhr = $.ajax({
|
|
// type: 'post',
|
|
// async: true,
|
|
// url: url,
|
|
// dataType: 'jsonp',
|
|
// data: {cardno:data1, regid:data2, repeiceno:data3, total_fee:data4},
|
|
// jsonp: 'jsoncallback',
|
|
// timeout: 1000,
|
|
// beforeSend: function() {
|
|
// startLoading();
|
|
// },
|
|
// success: function(obj) {
|
|
// stopLoading();
|
|
// if(obj.repstatus == 1) {
|
|
|
|
// if(obj.repmsg.Header.ResultCode == '0') {
|
|
// //缴费记录入库
|
|
// wxorder(data5, data4, uid, data6, 1, '1', data7, data2, '3');
|
|
// //location.href = 'http://lyl.medical.91paiyipai.com/wxpay/example/reload.php?remoney='+(fee*100)+'&order=1&body=mzjf&name='+name;
|
|
// }else{
|
|
// $('.tip_mess').css('display', 'block');
|
|
// $('.tip_mess').html('支付失败,原因:'+obj.repmsg.Header.ResultMsg+';您的该笔费用将会退回到您的微信账户');
|
|
// time = self.setInterval('clearTime()', 1500);
|
|
// //发起微信退款
|
|
// var refund_fee = data4 * 100;
|
|
// refund(data6, refund_fee);
|
|
// }
|
|
// } else {
|
|
// $('.tip_mess').css('display', 'block');
|
|
// $('.tip_mess').html(obj.repmsg.Header.ResultMsg);
|
|
// time = self.setInterval('clearTime()', 1500);
|
|
// }
|
|
// },
|
|
// error: function(xhr, textStatus) {
|
|
// // alert(textStatus);
|
|
// if(textStatus == 'timeout') {
|
|
// setTimeout(function(){
|
|
// stopLoading();
|
|
// $('.tip_mess').css('display', 'block');
|
|
// $('.tip_mess').html('连接超时请刷新再试!');
|
|
// time = self.setInterval('clearTime()', 1000);
|
|
// },2000);
|
|
// }
|
|
// }
|
|
// });
|
|
// }
|
|
//住院押金缴费
|
|
function recharge(data1, data2, data3, data4) {
|
|
var url = domain2+':4419/apiv1_inpdeposit/recharge?jsoncallback=callback';
|
|
var xhr = $.ajax({
|
|
type: 'post',
|
|
async: true,
|
|
url: url,
|
|
dataType: 'jsonp',
|
|
data: {patientid:data1, paymt:data2},
|
|
jsonp: 'jsoncallback',
|
|
timeout: 1000,
|
|
beforeSend: function() {
|
|
startLoading();
|
|
},
|
|
success: function(obj) {
|
|
if(obj.repstatus == 1) {
|
|
if(obj.repmsg.Header.ResultCode == '0') {
|
|
//缴费记录入库
|
|
wxorder(data3, data2, uid, data4, 2, data1, '0', '0', '3', '0');
|
|
//location.href='http://lyl.medical.91paiyipai.com/wxpay/example/reload.php?premoney='+(fee*100)+'&order=2'+'&body=zyyj'+'&name='+name+'&patientid='+patient_id;
|
|
}else {
|
|
$('.tip_mess').css('display', 'block');
|
|
$('.tip_mess').html('支付失败,原因:'+obj.repmsg.Header.ResultMsg+';您的该笔费用将会退回到您的微信账户');
|
|
time = self.setInterval('clearTime()', 1500);
|
|
//发起微信退款
|
|
var refund_fee = data2 * 100;
|
|
refund(data4, refund_fee);
|
|
// alert('error');
|
|
}
|
|
|
|
} else {
|
|
$('.tip_mess').css('display', 'block');
|
|
$('.tip_mess').html(obj.repmsg.Header.ResultMsg);
|
|
time = self.setInterval('clearTime()', 1500);
|
|
}
|
|
},
|
|
error: function(xhr, textStatus) {
|
|
if(textStatus == 'timeout') {
|
|
setTimeout(function(){
|
|
stopLoading();
|
|
$('.tip_mess').css('display', 'block');
|
|
$('.tip_mess').html('连接超时请刷新再试!');
|
|
time = self.setInterval('clearTime()', 1000);
|
|
},2000);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
//缴费记录入库
|
|
function wxorder(data1, data2, data3, data4, data5, data6, data7, data8, data9, data10) {
|
|
var url = domain1+'/apiv1_wxorder/';
|
|
var xhr = $.ajax({
|
|
type: 'post',
|
|
async: false,
|
|
url: url,
|
|
// dataType: 'jsonp',
|
|
data: {name:data1, total_fee:data2, uid:data3, out_trade_no:data4, prepay_id:data5, patientid:data6, patientno:data7, regid:data8, cardno:data10},
|
|
// jsonp: 'jsoncallback',
|
|
timeout: 1000,
|
|
beforeSend: function() {
|
|
startLoading();
|
|
},
|
|
success: function(obj) {
|
|
stopLoading();
|
|
// alert(obj.status);
|
|
if(obj.status == '1') {
|
|
if(data9 == '3'){
|
|
location.href='http://lyl.medical.91paiyipai.com/medical_wx/h5/jfjl.html?title=缴费记录&type=jfjl&uid='+data3;
|
|
}else{
|
|
return false;
|
|
}
|
|
} else {
|
|
// alert('sb');
|
|
$('.tip_mess').css('display', 'block');
|
|
$('.tip_mess').html(obj.msg+';您的该笔费用将会退回到您的微信账户');
|
|
time = self.setInterval('clearTime()', 1500);
|
|
//发起微信退款
|
|
var refund_fee = data2 * 100;
|
|
refund(data4, refund_fee);
|
|
}
|
|
},
|
|
error: function(xhr, textStatus) {
|
|
if(textStatus == 'timeout') {
|
|
setTimeout(function(){
|
|
stopLoading();
|
|
$('.tip_mess').css('display', 'block');
|
|
$('.tip_mess').html('连接超时请刷新再试!');
|
|
time = self.setInterval('clearTime()', 1000);
|
|
},2000);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
//微信退款发起
|
|
function refund(out_trade_no, total_fee){
|
|
var url = domain+'/wxpay/example/refund.php';
|
|
var xhr = $.ajax({
|
|
type: 'get',
|
|
async: true,
|
|
url: url,
|
|
data: {out_trade_no:out_trade_no, total_fee:total_fee, refund_fee:total_fee},
|
|
timeout: 1000,
|
|
beforeSend: function(){
|
|
startLoading();
|
|
},
|
|
success: function(obj) {
|
|
stopLoading();
|
|
if(obj.status == 1){
|
|
var data = obj.data;
|
|
if(data.result_code == 'SUCCESS'){//退款成功
|
|
//微信退费数据入库
|
|
refundupdate(out_trade_no, "<?php echo $pName;?>", total_fee, uid, "<?php echo $pOrder;?>", data.refund_id);
|
|
// $('.tip_mess').css('display', 'block');
|
|
// $('.tip_mess').html('您的该笔费用已经成功退款');
|
|
// time = self.setInterval('clearTime()', 1500);
|
|
// location.href=domain+'medical_wx/h5/sy_mzjf.html?title=门诊缴费';
|
|
}else{
|
|
$('.tip_mess').css('display', 'block');
|
|
$('.tip_mess').html('微信退款失败,原因:'+data.err_code_des);
|
|
}
|
|
}else{
|
|
$('.tip_mess').css('display', 'block');
|
|
$('.tip_mess').html('微信退款异常');
|
|
}
|
|
},
|
|
error: function(xhr, textStatus){
|
|
if(textStatus == 'timeout'){
|
|
setTimeout(function(){
|
|
stopLoading();
|
|
$('.tip_mess').css('display', 'block');
|
|
$('.tip_mess').html('连接超时请刷新再试!');
|
|
time = self.setInterval('clearTime()', 1000);
|
|
}, 2000);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
//微信退费数据入库
|
|
function refundupdate(out_trade_no, name, total_fee, uid, prepay_id, refund_id){
|
|
var url = domain1+'/apiv1_wxorder/refund';
|
|
|
|
var xhr = $.ajax({
|
|
type: 'post',
|
|
async: false,
|
|
url: url,
|
|
data:{out_trade_no:out_trade_no, name:name, total_fee:total_fee, uid:uid, prepay_id:prepay_id, refund_id:refund_id},
|
|
timeout: 1000,
|
|
success: function(obj) {
|
|
if(obj.status == 1) {
|
|
$('.tip_mess').css('display', 'block');
|
|
$('.tip_mess').html('您的该笔费用已经成功退款');
|
|
time = self.setInterval('clearTime()', 1500);
|
|
location.href=domain+'medical_wx/h5/sy_mzjf.html?title=门诊缴费';
|
|
}else{
|
|
$('.tip_mess').css('display', 'block');
|
|
$('.tip_mess').html(obj.msg);
|
|
time = self.setInterval('clearTime()', 1000);
|
|
}
|
|
},
|
|
error: function(xhr, textStatus) {
|
|
if(textStatus == 'timeout') {
|
|
setTimeout(function(){
|
|
$('.tip_mess').css('display', 'block');
|
|
$('.tip_mess').html('连接超时请刷新再试!');
|
|
time = self.setInterval('clearTime()', 1000);
|
|
}, 2000);
|
|
}
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
$(document).ready(function(){
|
|
$(".wx_btn").click(function(){
|
|
// callpay(); //v2
|
|
pay(); //v3
|
|
});
|
|
|
|
//jssdk初始化配置
|
|
(function () {
|
|
var url = location.href.split('#')[0]; //当前页面URL
|
|
$.ajax({
|
|
type: 'post',
|
|
async: true,
|
|
url: domain1+'/apiv1_jssdk/',
|
|
data:{url:decodeURI(url)},
|
|
// beforeSend: function() {
|
|
// $.showLoading();
|
|
// },
|
|
success: function(obj) {
|
|
console.log(obj);
|
|
// $.hideLoading();
|
|
if(obj.status == 1) {
|
|
var data = obj.data;
|
|
var timestamp = data.timestamp;
|
|
var nonceStr = data.nonceStr;
|
|
var signature = data.signature;
|
|
wx.config({
|
|
beta: true,
|
|
debug: false,//调试模式
|
|
appId: data.appId,
|
|
timestamp: data.timestamp,
|
|
nonceStr: data.nonceStr,
|
|
signature: data.signature,
|
|
jsApiList: [
|
|
// "selectEnterpriseContact",
|
|
// "checkJsApi",
|
|
// "chooseImage",
|
|
// "previewImage",
|
|
// "uploadImage",
|
|
// "downloadImage",
|
|
// "openEnterpriseChat",
|
|
// "openLocation",
|
|
// "getLocation",
|
|
"chooseWXPay"
|
|
]
|
|
})
|
|
}else{
|
|
$.toptip(obj.msg,'error');return;
|
|
}
|
|
},
|
|
error: function() {
|
|
$.hideLoading();
|
|
$.toptip('网络繁忙请稍后再试!');return;
|
|
}
|
|
})
|
|
})();
|
|
|
|
});
|
|
|
|
function pay(){
|
|
var params = eval('(<?php echo $jsApiParameters;?>)');
|
|
console.log(JSON.stringify(params));
|
|
wx.chooseWXPay({
|
|
timestamp: params.timeStamp,
|
|
nonceStr: params.nonceStr,
|
|
package: params.package,
|
|
paySign: params.paySign,
|
|
signType: params.signType,
|
|
success: function(res) {
|
|
// 支付成功后的回调函数
|
|
if (res.errMsg == "chooseWXPay:ok") {
|
|
// alert('支付成功');
|
|
var order = "<?php echo $pOrder;?>"
|
|
var cardno = "<?php echo $pCardNo;?>"
|
|
var repeiceno = "<?php echo $pRepeiceNo;?>"
|
|
var type = 2;//1.未支付、2.已支付(未更新)、3.已支付(已更新)、4.退费
|
|
// alert(order);
|
|
if(order == '1'){//门诊缴费
|
|
wxorder("<?php echo $pName; ?>", "<?php echo $pFee/100; ?>", uid, "<?php echo $tradeNo; ?>", 1, 1, "<?php echo $pPatientNO; ?>", "<?php echo $pRegID; ?>", '2', "<?php echo $pCardNo; ?>");
|
|
payAdm(cardno, "<?php echo $pRegID; ?>", "<?php echo $pRepeiceNo; ?>", "<?php echo $pFee/100; ?>", "<?php echo $pName; ?>", "<?php echo $tradeNo; ?>", "<?php echo $pPatientNO; ?>");
|
|
//wxorder("<?php echo $pName;?>", "<?php echo $pFee;?>", uid, "<?php echo $tradeNo?>", 1, "<?php echo $pPatientID;?>");
|
|
}
|
|
if(order == '2'){//住院押金缴费
|
|
wxorder("<?php echo $pName; ?>", "<?php echo $pFee/100; ?>", uid, "<?php echo $tradeNo; ?>", 2, "<?php echo $pPatientID; ?>", "<?php echo $pPatientNO; ?>", '0', '2');
|
|
recharge("<?php echo $pPatientID; ?>", "<?php echo $pFee/100; ?>", "<?php echo $pName; ?>", "<?php echo $tradeNo; ?>");
|
|
//wxorder("<?php echo $pName;?>", "<?php echo $pFee;?>", uid, "<?php echo $tradeNo?>", 2, 1);
|
|
}
|
|
} else {
|
|
alert(res.errMsg);
|
|
}
|
|
},
|
|
cancel: function(res) {
|
|
//支付取消
|
|
alert('支付取消');
|
|
}});
|
|
}
|
|
|
|
</script>
|
|
</head><!--
|
|
<body>
|
|
<br/>
|
|
<font color="#9ACD32"><b>该笔订单支付金额为<span style="color:#f00;font-size:50px">1分</span>钱</b></font><br/><br/>
|
|
<div align="center">
|
|
<button style="width:210px; height:50px; border-radius: 15px;background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer; color:white; font-size:16px;" type="button" onclick="callpay()" >立即支付<?php echo $pOrder;?></button>
|
|
</div>
|
|
<div class="tip_mess"></div>
|
|
|
|
</body> -->
|
|
<body class="background">
|
|
<div class="main">
|
|
<div class="wx_tab1">
|
|
<span class="wx_company">郴州市中医医院</span>
|
|
<div class="wx_money">¥<?php echo $pFee/100;?></div>
|
|
</div>
|
|
<div class="wx_tab2">
|
|
<label>收款方</label><span>郴州市中医医院</span>
|
|
<br>
|
|
<label>商 品</label><span><?php echo $pBody;?></span>
|
|
</div>
|
|
<div class="wx_tab3">
|
|
<!-- <div class="wx_btn" onclick="callpay()">立即支付</div> -->
|
|
<button type="button" class="wx_btn" id="wxBtn" style="border: none; width:100%;">立即支付</button>
|
|
</div>
|
|
<!-- <div class="wx_footer">支付宝安全由中国人民财产保险股份有限公司承包</> -->
|
|
</div>
|
|
<div class="tip_mess"></div>
|
|
</body>
|
|
</html>
|
|
|