carpay.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <?
  2. include("../config/conn.php");
  3. include("../config/function.php");
  4. sesCheck();
  5. $sqluser="select * from yjcode_user where uid='".$_SESSION[SHOPUSER]."'";mysql_query("SET NAMES 'GBK'");$resuser=mysql_query($sqluser);
  6. if(!$rowuser=mysql_fetch_array($resuser)){php_toheader("../reg/");}
  7. $sj=date("Y-m-d H:i:s");
  8. include("buycheck.php");
  9. //B
  10. if(sqlzhuru($_POST[jvs])=="carpay" && sqlzhuru($_POST[R1])=="alipay"){
  11. if($needmoney<=$usermoney){Audit_alert("您的可用余额充足,请用余额直接支付。","carpay.php?carid=".$carid);}
  12. zwzr();
  13. $bh=time();
  14. $uip=$_SERVER["REMOTE_ADDR"];
  15. $ddbh=time()."|".$rowuser[id];
  16. $money1=sprintf("%.2f",$needmoney-$usermoney);
  17. intotable("yjcode_dingdang","bh,ddbh,userid,sj,uip,money1,ddzt,alipayzt,bz,ifok,carid,sxf","'".$bh."','".$ddbh."',".$rowuser[id].",'".$sj."','".$uip."',".$money1.",'等待买家付款','','',0,'".$caridarr."',".$sxf."");
  18. require_once("alipay.config.php");
  19. $payment_type = "1";
  20. $notify_url = weburl."user/notify_carpay.php"; //服务器异步通知页面路径
  21. $return_url = weburl."user/ordertz.php";//页面跳转同步通知页面路径
  22. $seller_email = $rowcontrol[seller_email];//卖家支付宝帐户
  23. $out_trade_no = $ddbh;//商户订单号
  24. $subject = "【".webname."】 ".$zfbordertit;//订单名称
  25. $body = webname."收银台结算";
  26. $show_url = weburl;//商品展示地址
  27. //开始即时到帐
  28. if(0==$rowcontrol[zftype]){
  29. $alipay_config['cacert'] = getcwd().'\\cacert.pem';
  30. require_once("lib/alipay_submit.class.php");
  31. $total_fee = $money1;//付款金额
  32. $anti_phishing_key = "";//防钓鱼时间戳
  33. $exter_invoke_ip = "";//客户端的IP地址
  34. $parameter = array(
  35. "service" => "create_direct_pay_by_user",
  36. "partner" => trim($alipay_config['partner']),
  37. "payment_type" => $payment_type,
  38. "notify_url" => $notify_url,
  39. "return_url" => $return_url,
  40. "seller_email" => $seller_email,
  41. "out_trade_no" => $out_trade_no,
  42. "subject" => $subject,
  43. "total_fee" => $total_fee,
  44. "body" => $body,
  45. "show_url" => $show_url,
  46. "anti_phishing_key" => $anti_phishing_key,
  47. "exter_invoke_ip" => $exter_invoke_ip,
  48. "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
  49. //结束即时到帐
  50. }
  51. //建立请求
  52. $alipaySubmit = new AlipaySubmit($alipay_config);
  53. $html_text = $alipaySubmit->buildRequestForm($parameter,"get", "正在跳转,请稍候");
  54. echo $html_text;exit;
  55. }elseif(sqlzhuru($_POST[jvs])=="carmypay"){//余额支付
  56. if($needmoney>$usermoney){Audit_alert("您的可用余额不足,返回重试。","carpay.php?carid=".$carid);}
  57. zwzr();
  58. include("buy.php");
  59. php_toheader("ordertz.php");
  60. }
  61. //E
  62. ?>
  63. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  64. <html xmlns="http://www.w3.org/1999/xhtml">
  65. <head>
  66. <meta http-equiv="x-ua-compatible" content="ie=7" />
  67. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  68. <title>用户管理面板 - <?=webname?></title>
  69. <? include("cssjs.html");?>
  70. <link href="css/pay.css" rel="stylesheet" type="text/css" />
  71. <script language="javascript">
  72. function xz(x){
  73. document.getElementById(x).checked=true;
  74. }
  75. function carpaytj(x){
  76. r=document.getElementsByName("R1");
  77. rv="";
  78. for(i=0;i<r.length;i++){
  79. if(r[i].checked==true){rv=r[i].value;}
  80. }
  81. <? if($usermoney<$needmoney){?>if(rv==""){alert("请选择支付方式");return false;}<? }?>
  82. tjwait();
  83. if(rv=="alipay" || rv==""){fu="carpay.php?carid="+x;}
  84. else if(rv=="wxpay"){f1.action="wxpay/buy_index.php?carid="+x;}
  85. else if(rv=="aliewm"){f1.action="alipay_ewm.php?money1=<?=$needmoney?>";}
  86. else if(rv=="wxewm"){f1.action="wxpay_ewm.php?money1=<?=$needmoney?>";}
  87. else if(rv=="otherpay"){f1.action="otherpay/buy_otherpay.php?carid="+x;}
  88. f1.action=fu;
  89. tangopen();
  90. }
  91. function tangopen(){
  92. layer.open({
  93. type:1,
  94. title: false,
  95. closeBtn: 0,
  96. area: '331px',
  97. skin: 'layui-layer-nobg', //没有背景色
  98. shadeClose: false,
  99. content: $('#tang')
  100. });
  101. }
  102. </script>
  103. </head>
  104. <body>
  105. <? include("../tem/top.html");?>
  106. <? include("top.php");?>
  107. <div class="yjcode">
  108. <? include("left.php");?>
  109. <!--RB-->
  110. <div class="userright">
  111. <? include("rcap11.php");?>
  112. <script language="javascript">
  113. document.getElementById("rcap1").className="l1 l2";
  114. </script>
  115. <!--白B-->
  116. <div class="rkuang">
  117. <div class="carpay">
  118. <form name="f1" method="post"<? if($usermoney<$needmoney){?> target="_blank"<? }?> onSubmit="return carpaytj('<?=$carid?>')">
  119. <div class="pay">
  120. <ul class="pu1">
  121. <li class="l1">结算费用 <strong><?=sprintf("%.2f",$needmoney)?></strong> 元<? if(!empty($sxf)){?>(含<?=$sxf?>元手续费)<? }?></li>
  122. <li class="l2">您的可用余额:<strong><?=sprintf("%.2f",$usermoney)?></strong> 元</li>
  123. </ul>
  124. <? if($usermoney<$needmoney){?>
  125. <ul class="pay1">
  126. <li class="l1">第三方支付平台:</li>
  127. <? if(!empty($rowcontrol[partner]) && !empty($rowcontrol[security_code]) && !empty($rowcontrol[seller_email]) && 3!=$rowcontrol[zftype]){?>
  128. <li class="l2"><input name="R1" id="alipay" checked="checked" type="radio" value="alipay" /><img onClick="xz('alipay')" src="img/pay/alipay.gif" /></li>
  129. <? }elseif(3==$rowcontrol[zftype]){?>
  130. <li class="l2">
  131. <input name="R1" id="aliewm" type="radio" value="aliewm" /><img onClick="xz('aliewm')" src="img/pay/alipay.gif" />
  132. </li>
  133. <? }?>
  134. <? if(!empty($rowcontrol[wxpay]) && $rowcontrol[wxpay]!=",,," && $rowcontrol[wxpayfs]!=1){?>
  135. <li class="l2">
  136. <input name="R1" id="wxpay" type="radio" value="wxpay" /><img src="img/pay/wxpay.gif" onClick="xz('wxpay')" />
  137. </li>
  138. <? }elseif($rowcontrol[wxpayfs]==1){?>
  139. <li class="l2">
  140. <input name="R1" id="wxewm" type="radio" value="wxewm" /><img src="img/pay/wxpay.gif" onClick="xz('wxewm')" />
  141. </li>
  142. <? }?>
  143. <? if(!empty($rowcontrol[otherpay])){$a=preg_split("/,/",$rowcontrol[otherpay]);?>
  144. <li class="l2">
  145. <input name="R1" id="otherpay" type="radio" value="otherpay" /><img src="img/pay/otherpay.jpg" width="150" height="50" onClick="xz('otherpay')" />
  146. </li>
  147. <? }?>
  148. </ul>
  149. <? }?>
  150. <div id="tang" style="display:none;">
  151. <ul class="pay4">
  152. <li class="l1">请在支付页面完成付款!</li>
  153. <li class="l2">付款完成前请不要关闭此窗口。付款完成后请根据情况点击以下按钮。</li>
  154. <li class="l3">
  155. <a href="ordertz.php" class="a1">完成付款</a>
  156. <a href="javascript:void(0);" class="a2" onClick="javascript:alert('付款遇到问题?请联系客服');location.href='carpay.php?carid=<?=$carid?>';return false;">付款遇到问题</a>
  157. </li>
  158. </ul>
  159. </div>
  160. <div class="carbtn">
  161. <div id="tjbtn"><input type="submit" value="确认付款" /></div>
  162. <div class="tjing" id="tjing" style="display:none;">
  163. <img style="margin:0 0 6px 0;" src="../img/ajax_loader.gif" width="208" height="13" /><br />正在处理数据,请不要刷新页面,也不要关闭页面 ^_^
  164. </div>
  165. </div>
  166. <input type="hidden" value="<? if($usermoney<$needmoney){echo "carpay";}else{echo "carmypay";}?>" name="jvs" />
  167. </div>
  168. </form>
  169. </div>
  170. </div>
  171. <!--白E-->
  172. </div>
  173. <!--RE-->
  174. </div>
  175. <div class="clear clear15"></div>
  176. <? include("../tem/bottom.html");?>
  177. </body>
  178. </html>