893 lines
26 KiB
Plaintext
893 lines
26 KiB
Plaintext
<%@ page contentType="text/html; charset=UTF-8"
|
||
pageEncoding="UTF-8"%>
|
||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
|
||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
|
||
<c:set var="ctx" value="${pageContext.request.contextPath}" scope="request"/>
|
||
<c:set var="resourcePath" value="${ctx}/resources" scope="request"/>
|
||
<!DOCTYPE html>
|
||
<html>
|
||
<link rel="stylesheet" href="${resourcePath}/css/weui.css">
|
||
<link rel="stylesheet" href="${resourcePath}/css/weuix.css">
|
||
<%--<script type="text/javascript" src="${resourcePath}/js/zepto.min.js"></script>--%>
|
||
<%--<script type="text/javascript" src="${resourcePath}/js/zepto.weui.js"></script>--%>
|
||
<script type="text/javascript" src="${resourcePath}/js/swiper.min.js"></script>
|
||
<script type="text/javascript" src="${resourcePath}/js/utils/StringUtil.js"></script>
|
||
<%--<script type="text/javascript" src="${resourcePath}/js/utils/DateUtil.js"></script>--%>
|
||
<%--<script type="text/javascript" src="${resourcePath}/js/global.js"></script>--%>
|
||
<%--<link href="https://www.shouyinbei.net/resources/wap/css/weui.min.css" type="text/css" rel="stylesheet" />--%>
|
||
<script src="https://www.shouyinbei.net/resources/js/alipayjsapi.min3.1.1.js"></script>
|
||
<script src="${resourcePath}/js/third-party/jquery/jquery-1.11.0.min.js"></script>
|
||
<%--<script src="https://cdn.bootcss.com/vConsole/3.3.4/vconsole.min.js"></script>--%>
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
<meta name="viewport"
|
||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||
<title>向商家付款</title>
|
||
|
||
<style type="text/css">
|
||
.logo {
|
||
margin: 2vw !important;
|
||
line-height: 1;
|
||
height: 10vw;
|
||
position: relative;
|
||
}
|
||
|
||
.logo img {
|
||
margin: 0;
|
||
height: 10vw;
|
||
border-radius: 50%;
|
||
}
|
||
|
||
.logo div.title {
|
||
position: absolute;
|
||
margin-left: 2vw;
|
||
display:inline-block;
|
||
height: 100%;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
text-align: left;
|
||
line-height: 10vw;
|
||
font-size: 5vw;
|
||
right: 64px;
|
||
left: 36px;
|
||
}
|
||
|
||
.logo div.right {
|
||
right: 0;
|
||
font-size: 4vw;
|
||
display: inline-block;
|
||
color: #df6051;
|
||
line-height: 10vw;
|
||
position: relative;
|
||
}
|
||
|
||
.item {
|
||
height: 80px;
|
||
padding: 5px 20px;
|
||
}
|
||
|
||
.shangLogo {
|
||
width: 30%;
|
||
height: 100%;
|
||
position: relative;
|
||
float: left;
|
||
}
|
||
|
||
.bs {
|
||
padding: 0 10px;
|
||
border-bottom: none;
|
||
}
|
||
|
||
.shouyin {
|
||
text-align: center;
|
||
left: 50%;
|
||
padding: 7px;
|
||
background-color: #f8f8f8;
|
||
color: #000;
|
||
font-size: 12px;
|
||
border-bottom: white solid 1px;
|
||
}
|
||
|
||
.gongsi p {
|
||
width: 100%;
|
||
height: 120px;
|
||
line-height: 120px;
|
||
text-align: center;
|
||
}
|
||
|
||
.mt40 {
|
||
margin-top: 40px;
|
||
}
|
||
|
||
.moneyPay {
|
||
padding-left: 30px;
|
||
background: url(../resources/images/bankcard.png) no-repeat left
|
||
}
|
||
|
||
.weui-cell {
|
||
justify-content: space-between;
|
||
}
|
||
|
||
.weui-cell:before {
|
||
border-top: 0;
|
||
}
|
||
|
||
.weui-cells:after {
|
||
border-bottom: 0;
|
||
}
|
||
|
||
.weui-cells:before {
|
||
border-top: 0;
|
||
}
|
||
.vm {
|
||
vertical-align: center;
|
||
padding: 10px 0;
|
||
}
|
||
|
||
.submit, .del {
|
||
padding: 0 !important;
|
||
|
||
}
|
||
.weui-footer_fixed-bottom {
|
||
bottom: 0;
|
||
-webkit-user-select: none;
|
||
-moz-user-select: none;
|
||
}
|
||
|
||
.showKeyBoard {
|
||
animation: showKeyBoard 200ms;
|
||
-moz-animation: showKeyBoard 200ms;
|
||
-webkit-animation: showKeyBoard 200ms;
|
||
-o-animation: showKeyBoard 200ms;
|
||
|
||
-webkit-animation-fill-mode: forwards;
|
||
-moz-animation-fill-mode: forwards;
|
||
-o-animation-fill-mode: forwards;
|
||
animation-fill-mode: forwards;
|
||
}
|
||
|
||
.hiddenKeyBoard {
|
||
animation: hiddenKeyBoard 200ms;
|
||
-moz-animation: hiddenKeyBoard 200ms;
|
||
-webkit-animation: hiddenKeyBoard 200ms;
|
||
-o-animation: hiddenKeyBoard 200ms;
|
||
|
||
-webkit-animation-fill-mode: forwards;
|
||
-moz-animation-fill-mode: forwards;
|
||
-o-animation-fill-mode: forwards;
|
||
animation-fill-mode: forwards;
|
||
}
|
||
|
||
.weui-btn+.weui-btn {
|
||
margin: 0;
|
||
}
|
||
|
||
.weui-btn+.weui-cell {
|
||
padding: 15px;
|
||
}
|
||
|
||
.weui-btn {
|
||
border-radius: 0 !important;
|
||
border: 0 !important;
|
||
font-size: 22px;
|
||
}
|
||
|
||
.weui-btn:after {
|
||
border-radius: 0 !important;
|
||
border: 1px solid white;
|
||
}
|
||
.f-submit{
|
||
line-height: 50px;
|
||
}
|
||
|
||
/*input::-webkit-input-placeholder { !* WebKit browsers 适配谷歌 *!*/
|
||
/* color: #000;*/
|
||
/*}*/
|
||
/*input:-moz-placeholder { !* Mozilla Firefox 4 to 18 适配火狐 *!*/
|
||
/* color: #000;*/
|
||
/*}*/
|
||
/*input::-moz-placeholder { !* Mozilla Firefox 19+ 适配火狐 *!*/
|
||
/* color: #000;*/
|
||
/*}*/
|
||
/*input:-ms-input-placeholder { !* Internet Explorer 10+ 适配ie*!*/
|
||
/* color: #000;*/
|
||
/*}*/
|
||
|
||
img {
|
||
pointer-events:none;/* 禁止长按图片保存 */
|
||
}
|
||
|
||
/* 隐藏键盘动画 */
|
||
@keyframes hiddenKeyBoard
|
||
{
|
||
from {bottom: 0;}
|
||
to {bottom: -224px;}
|
||
}
|
||
|
||
@-moz-keyframes hiddenKeyBoard /* Firefox */
|
||
{
|
||
from {bottom: 0;}
|
||
to {bottom: -224px;}
|
||
}
|
||
|
||
@-webkit-keyframes hiddenKeyBoard /* Safari and Chrome */
|
||
{
|
||
from {bottom: 0;}
|
||
to {bottom: -224px;}
|
||
}
|
||
|
||
@-o-keyframes hiddenKeyBoard /* Opera */
|
||
{
|
||
from {bottom: 0;}
|
||
to {bottom: -224px;}
|
||
}
|
||
|
||
/* 弹出键盘动画 */
|
||
@keyframes showKeyBoard
|
||
{
|
||
from {bottom: -224px;}
|
||
to {bottom: 0;}
|
||
}
|
||
|
||
@-moz-keyframes showKeyBoard /* Firefox */
|
||
{
|
||
from {bottom: -224px;}
|
||
to {bottom: 0;}
|
||
}
|
||
|
||
@-webkit-keyframes showKeyBoard /* Safari and Chrome */
|
||
{
|
||
from {bottom: -224px;}
|
||
to {bottom: 0;}
|
||
}
|
||
|
||
@-o-keyframes showKeyBoard /* Opera */
|
||
{
|
||
from {bottom: -224px;}
|
||
to {bottom: 0;}
|
||
}
|
||
.backdrop {
|
||
position: fixed;
|
||
z-index: 998;
|
||
top: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
background-color: rgba(0,0,0,.1);
|
||
}
|
||
</style>
|
||
</head>
|
||
<body style="background: #fff;">
|
||
<div id='loading' class="backdrop" style="display: none; padding-top: 70%; text-align: center;">
|
||
<div>
|
||
<img src="${resourcePath}/images/loading-2.gif" alt="loading" />
|
||
</div>
|
||
<div style="font-family:'Microsoft YaHei';color:#000000;font-size: 1rem;">支付中...</div>
|
||
<!--自己放loding图片-->
|
||
</div>
|
||
<!-- <div class="page-title tcenter h40 bluebg white">
|
||
<span>收银呗</span>
|
||
</div> -->
|
||
<div class="logo" style="margin: 10px;">
|
||
<img src="https://www.shouyinbei.net/resources/images/syblogo.png" />
|
||
<div class="title" style="color:black;">${storeName}</div>
|
||
<div class="right" onclick="showRemarkDialog()">
|
||
添加备注
|
||
</div>
|
||
</div>
|
||
<%-- <div class="tcenter">--%>
|
||
<%-- <img src="https://www.shouyinbei.net/resources/images/merchant.png"--%>
|
||
<%-- style="height: 30px; width: 30px" class="vm">--%>
|
||
<%-- </div>--%>
|
||
<div class="weui-cells weui-cells_form bs" style="margin-top: 30px">
|
||
<div class="weui-cell weui-cell_warn bdbe" style="background-color: #f8f8f8; border-radius: 5px;">
|
||
<div class="weui-cell__hd">
|
||
<label class="weui-label f-black f26">金额</label>
|
||
</div>
|
||
<div class="weui-cell__bd">
|
||
<input class="weui-input f26 tright" name="comsumeMoney"
|
||
id="comsumeMoney" value="" placeholder="¥0.00"
|
||
style="color: #000;">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="weui-cells weui-cells_form" style="margin-top: 10px;">
|
||
<c:if test="${payType eq 'wx'}">
|
||
<div class="weui-cell weui-cell_warn">
|
||
<div class="weui-cell__hd">
|
||
<span class="icon icon-14 f26 vm f-green"></span>
|
||
<span class="f-black f18 ml10">微信支付</span>
|
||
</div>
|
||
<div class="weui-cells_checkbox">
|
||
<label class="weui-check__label" style="padding: 0;">
|
||
<div class="weui-cell__hd">
|
||
<input type="radio" class="weui-check" name="radio1"
|
||
value="weixinPay" checked="checked"> <i
|
||
class="weui-icon-checked"></i>
|
||
</div>
|
||
</label>
|
||
</div>
|
||
</div>
|
||
<%-- <c:if test="${isMember eq '1'}">--%>
|
||
<%-- <div class="weui-cell weui-cell_warn">--%>
|
||
<%-- <div class="weui-cell__hd">--%>
|
||
<%-- <span class="icon icon-42 f26 vm "></span>--%>
|
||
<%-- <span class="f-black f18 ml10">会员卡支付</span>--%>
|
||
<%-- <span class="weui-cell__hd f16" style="color: #ccc;">--%>
|
||
<%-- <c:forEach items="${activityRechargeList }" var="activityRecharge">--%>
|
||
<%-- 充${activityRecharge.rechargeMoney }送${activityRecharge.giveMoney}--%>
|
||
<%-- </c:forEach>--%>
|
||
<%-- </span>--%>
|
||
<%-- </div>--%>
|
||
|
||
<%-- <div class="weui-cells_checkbox">--%>
|
||
<%-- <label class="weui-check__label" style="padding: 0;">--%>
|
||
<%-- <div class="weui-cell__hd">--%>
|
||
<%-- <input type="radio" class="weui-check" name="radio1"--%>
|
||
<%-- value="memberPay"> <i class="weui-icon-checked"></i>--%>
|
||
<%-- </div>--%>
|
||
<%-- </label>--%>
|
||
<%-- </div>--%>
|
||
<%-- </div>--%>
|
||
<%-- <div class="weui-cell weui-cell_warn">--%>
|
||
<%-- <div class="weui-cell__hd">--%>
|
||
<%-- <span class="f18 ml10" style="color:#bbb;">会员卡余额:<fmt:formatNumber type="number" value="${balance}" pattern="0.00" maxFractionDigits="2"/></span>--%>
|
||
<%-- </div>--%>
|
||
|
||
<%-- <div class="weui-cell__hd">--%>
|
||
<%-- <a href="javascript:void(0)" onclick="goMemberPay()" style="color:#FF586A;" class="f16 mr10">充值</a>--%>
|
||
<%-- </div>--%>
|
||
<%-- </div>--%>
|
||
<%-- </c:if>--%>
|
||
<%-- <c:if test="${isMember ne '1'}">--%>
|
||
<%-- <div class="weui-cell weui-cell_warn">--%>
|
||
<%-- <div class="weui-cell__hd">--%>
|
||
<%-- <span class="icon icon-42 f26 vm "></span>--%>
|
||
<%-- <span class="f-black f18 ml10">会员卡支付</span>--%>
|
||
<%-- <span class="weui-cell__hd f16" style="color: #ccc;">--%>
|
||
<%-- <c:forEach items="${activityRechargeList }" var="activityRecharge">--%>
|
||
<%-- 充${activityRecharge.rechargeMoney }送${activityRecharge.giveMoney}--%>
|
||
<%-- </c:forEach>--%>
|
||
<%-- </span>--%>
|
||
<%-- </div>--%>
|
||
|
||
<%-- <div class="weui-cell__hd">--%>
|
||
<%-- <a href="javascript:void(0)" onclick="openVIPCard()" style="color:#FF586A;" class="f16 mr10">开通</a>--%>
|
||
<%-- </div>--%>
|
||
<%-- </div>--%>
|
||
<%-- </c:if>--%>
|
||
</c:if>
|
||
</div>
|
||
</div>
|
||
<input type="hidden" id="code" value="${code }">
|
||
<input type="hidden" id="nickName" value="${nickName }">
|
||
<input type="hidden" id="userImg" value="${userImg }">
|
||
<input type="hidden" id="auth_code" value="${auth_code}">
|
||
<input type="hidden" id="openid" value="${openid }">
|
||
<input type="hidden" id="userid" value="${userid }">
|
||
<input type="hidden" id="userAppId" value="${userAppId }">
|
||
<input type="hidden" id="merchantCode" value="${merchantCode }">
|
||
<input type="hidden" id="storeId" value="${storeId }">
|
||
<input type="hidden" id="aisleSwitch" value="${aisleSwitch }">
|
||
<input type="hidden" id="leshuaMchId" value="${leshuaMchId }">
|
||
<input type="hidden" id="isMember" value="${isMember }">
|
||
<input type="hidden" id="unionId" value="${unionId }">
|
||
<input type="hidden" id="qrNo" value="${qrNo}">
|
||
<%-- <div class="btn mt40 ml20 mr20">--%>
|
||
<%-- <a href="javascript:void(0);onclick=paySuccessOrFail()"--%>
|
||
<%-- class="weui-btn weui-btn_primary radius10 f14 pt5 pb5">确 认 支 付</a>--%>
|
||
<%-- </div>--%>
|
||
<%-- <div class="gongsi">--%>
|
||
<%-- <p>@2019 武汉融商创银科技有限公司</p>--%>
|
||
<%-- </div>--%>
|
||
|
||
<div class="weui-mask" style="opacity: 1;"></div>
|
||
<div class="weui-dialog" style="opacity: 1;">
|
||
<div class="weui-dialog__hd">
|
||
<strong class="weui-dialog__title">备注信息</strong>
|
||
</div>
|
||
<div class="weui-dialog__bd">
|
||
<input type="text" class="weui-input weui-prompt-input" placeholder="请输入备注" id="remark" name="remark" value="">
|
||
</div>
|
||
<div class="weui-dialog__ft">
|
||
<a href="javascript:;" class="weui-dialog__btn default" onclick="hiddenRemarkDialog()">取消</a>
|
||
<a href="javascript:;" class="weui-dialog__btn primary" onclick="enterRemark()">确定</a>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="weui-footer_fixed-bottom">
|
||
<div class="shouyin">
|
||
<p>收 银 就 用 收 银 呗</p>
|
||
</div>
|
||
<div class="weui-flex tcenter f26 f-black" style="padding: 0;">
|
||
<div class="weui-flex__item">
|
||
<div class="weui-btn weui-btn_default" onclick="onNumberDown(1)">
|
||
<div class="swiper-container">1</div>
|
||
</div>
|
||
<div class="weui-btn weui-btn_default" onclick="onNumberDown(4)">
|
||
<div class="swiper-container">4</div>
|
||
</div>
|
||
<div class="weui-btn weui-btn_default" onclick="onNumberDown(7)">
|
||
<div class="swiper-container">7</div>
|
||
</div>
|
||
<div class="weui-btn weui-btn_default" onclick="onNumberDown('.')">
|
||
<div class="swiper-container">.</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="weui-flex__item">
|
||
<div class="weui-btn weui-btn_default" onclick="onNumberDown(2)">
|
||
<div class="swiper-container">2</div>
|
||
</div>
|
||
<div class="weui-btn weui-btn_default" onclick="onNumberDown(5)">
|
||
<div class="swiper-container">5</div>
|
||
</div>
|
||
<div class="weui-btn weui-btn_default" onclick="onNumberDown(8)">
|
||
<div class="swiper-container">8</div>
|
||
</div>
|
||
<div class="weui-btn weui-btn_default" onclick="onNumberDown(0)">
|
||
<div class="swiper-container">0</div>
|
||
</div>
|
||
</div>
|
||
<div class="weui-flex__item">
|
||
<div class="weui-btn weui-btn_default" onclick="onNumberDown(3)">
|
||
<div class="swiper-container">3</div>
|
||
</div>
|
||
<div class="weui-btn weui-btn_default" onclick="onNumberDown(6)">
|
||
<div class="swiper-container">6</div>
|
||
</div>
|
||
<div class="weui-btn weui-btn_default" onclick="onNumberDown(9)">
|
||
<div class="swiper-container">9</div>
|
||
</div>
|
||
<div class="weui-cell weui-btn weui-btn_default" onclick="hiddenKeyBoard()">
|
||
<img class="swiper-container" src="<%=request.getAttribute("resourcePath")%>/images/keyboard.png" width="26px" height="26px" />
|
||
</div>
|
||
</div>
|
||
<div class="weui-flex__item">
|
||
<div class="weui-cell weui-btn weui-btn_default del" onclick="backSpace()">
|
||
<img class="swiper-container" src="<%=request.getAttribute("resourcePath")%>/images/del.png" width="26px" height="26px" />
|
||
</div>
|
||
<div class="weui-cell weui-btn_default weui-swiped-btn_warn f-white submit" onclick="paySuccessOrFail()">
|
||
<div class="swiper-container f22 f-submit">
|
||
<p>支</p><p>付</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</body>
|
||
<script type="text/javascript">
|
||
|
||
// // 初始化
|
||
// var vConsole = new VConsole();
|
||
// console.log('VConsole is cool');
|
||
|
||
var isKeyBoardVisible = false;
|
||
/** 是否需要打开自己写的键盘 */
|
||
var showDiyKeyBoardFlag = false;
|
||
/** 自定义键盘是否可见 */
|
||
var isDiyKeyBoardVisible = true;
|
||
/** 网页初始高度 */
|
||
var winHeight;
|
||
/** 网页实时高度 */
|
||
var thisHeight;
|
||
/** 备注 */
|
||
var remark;
|
||
|
||
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
|
||
// 通过下面这个API隐藏右上角按钮
|
||
WeixinJSBridge.call('hideOptionMenu');
|
||
});
|
||
|
||
|
||
$(function (){
|
||
winHeight = window.innerHeight;
|
||
|
||
window.onresize = function(){
|
||
thisHeight = window.innerHeight;
|
||
// confirm("winHeight : " + winHeight);
|
||
// confirm("thisHeight : " + thisHeight);
|
||
if(winHeight - thisHeight > 50){
|
||
// confirm("当前系统键盘可见");
|
||
isKeyBoardVisible = true;
|
||
//当软键盘弹出,在这里面操作
|
||
if (showDiyKeyBoardFlag) {
|
||
hiddenKeyBoardImmediately();
|
||
}
|
||
}else{
|
||
isKeyBoardVisible = false;
|
||
//当软键盘收起,在此处操作
|
||
if (showDiyKeyBoardFlag) {
|
||
showDiyKeyBoard();
|
||
}
|
||
}
|
||
}
|
||
|
||
let del = $(".del");
|
||
let submit = $(".submit");
|
||
let parent = $(".del").parent();
|
||
console.log("total height: " + parent.parent().height());
|
||
parent.height(parent.parent().height());
|
||
console.log("del height: " + (parent.height() / 4));
|
||
del.height(parent.height() / 4);
|
||
console.log("submit height: " + (parent.height() * 3 / 4));
|
||
submit.height(parent.height() * 3 / 4);
|
||
|
||
$("#comsumeMoney").focus(function() {
|
||
showKeyBoard();
|
||
document.activeElement.blur();
|
||
});
|
||
|
||
$("#remark").focus(function () {
|
||
showDiyKeyBoardFlag = false;
|
||
|
||
hiddenKeyBoardImmediately()
|
||
console.log("remark winHeight : " + winHeight);
|
||
$(window).height(winHeight * 0.8);
|
||
console.log("remark winHeight : " + $(window).height());
|
||
|
||
});
|
||
|
||
$(".shouyin").click(function() {
|
||
showKeyBoard();
|
||
});
|
||
});
|
||
|
||
function isWeiXin() {
|
||
var ua = window.navigator.userAgent.toLowerCase();
|
||
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
function isAlipay() {
|
||
var ua = window.navigator.userAgent.toLowerCase();
|
||
if(ua.match(/Alipay/i) == "alipay"){
|
||
return true;
|
||
}else{
|
||
return false;
|
||
}
|
||
}
|
||
|
||
function paySuccessOrFail() {
|
||
var comsumeMoney = $("#comsumeMoney").val();//消费金额
|
||
var aisleSwitch = $("#aisleSwitch").val();//通道
|
||
var leshuaMchId = $("#leshuaMchId").val();//乐刷商户id
|
||
var userImg = $("#userImg").val();//支付用户头像
|
||
var nickName = $("#nickName").val();//昵称
|
||
var pattern = /^(?!0+(?:\.0+)?$)(?:[1-9]\d*|0)(?:\.\d{1,2})?$/;
|
||
if (!pattern.test(comsumeMoney)) {
|
||
alert('请输入正确的金额(保留两位有效数字)');
|
||
return;
|
||
}
|
||
if (StringUtil.isNotBlank(comsumeMoney)) {
|
||
if (comsumeMoney < 0.01) {
|
||
alert('充值金额必须大于0.01');
|
||
return;
|
||
}
|
||
}
|
||
if (aisleSwitch == '0') {//1乐刷通道 0官方通道
|
||
if (isWeiXin()) {
|
||
wechatPay(comsumeMoney, userImg, nickName);// 微信支付
|
||
} else {
|
||
aliPay(comsumeMoney, userImg, nickName);
|
||
}
|
||
} else{
|
||
tradePay(comsumeMoney, leshuaMchId, userImg, nickName);
|
||
}
|
||
|
||
}
|
||
|
||
// 微信支付
|
||
function wechatPay(comsumeMoney, userImg, nickName) {
|
||
var openid = $('#openid').val();
|
||
var code = $("#code").val();
|
||
var userAppId = $("#userAppId").val();
|
||
var storeId = $("#storeId").val();
|
||
var merchantCode = $("#merchantCode").val();
|
||
var remark = $("#remark").val();
|
||
$.ajax({
|
||
url : '${ctx}/merchant/wechatPay',
|
||
data : {
|
||
"openid" : openid,
|
||
"merchantCode" : merchantCode,
|
||
"comsumeMoney" : comsumeMoney,
|
||
"userAppId" : userAppId,
|
||
"storeId" : storeId,
|
||
"userImg" : userImg,
|
||
"nickName" : nickName,
|
||
"remark" : remark
|
||
},
|
||
dataType : "json",
|
||
type : "post",
|
||
success : function(result) {
|
||
var rdata = result.data;
|
||
WeixinJSBridge.invoke('getBrandWCPayRequest', {
|
||
// 商品名称
|
||
"appId" : rdata.appId,
|
||
"timeStamp" : rdata.timeStamp,
|
||
"nonceStr" : rdata.nonceStr,
|
||
"package" : rdata.packageMsg,
|
||
"signType" : rdata.signType,
|
||
"paySign" : rdata.paySgin,
|
||
}, function(res) {
|
||
if (res.err_msg == "get_brand_wcpay_request:ok") {
|
||
//成功之后跳转地址
|
||
window.location = '${ctx}/merchant/paySuccess';
|
||
} else {
|
||
alert("支付失败");
|
||
}
|
||
})
|
||
},
|
||
error : function(data) {
|
||
alert('系统错误请稍后再试')
|
||
}
|
||
})
|
||
}
|
||
|
||
// 支付宝支付
|
||
function aliPay(comsumeMoney, userImg, nickName) {
|
||
var auth_code = $("#auth_code").val();
|
||
var userid = $("#userid").val();
|
||
var userAppId = $("#userAppId").val();
|
||
var storeId = $("#storeId").val();
|
||
var merchantCode = $("#merchantCode").val();
|
||
var remark = $("#remark").val();
|
||
$.ajax({
|
||
url : '${ctx}/merchant/aliPay',
|
||
dataType : 'json',
|
||
"type" : "post",
|
||
data : {
|
||
'comsumeMoney' : comsumeMoney,
|
||
"merchantCode" : merchantCode,
|
||
"storeId" : storeId,
|
||
'userid' : userid,
|
||
"userAppId" : userAppId,
|
||
"userImg" : userImg,
|
||
"nickName" : nickName,
|
||
"remark" : remark,
|
||
},
|
||
success : function(data) {
|
||
if ("1" == data.code) {
|
||
ap.tradePay({
|
||
tradeNO : data.transNo
|
||
}, function(res) {
|
||
if (res.resultCode == '9000') {
|
||
window.location = '${ctx}/merchant/paySuccess'; //订单支付成功
|
||
} else if (res.resultCode == '8000') {
|
||
} else if (res.resultCode == '4000') {
|
||
ap.alert("订单支付失败");
|
||
} else if (res.resultCode == '6001') {
|
||
} else if (res.resultCode == '6002') {
|
||
ap.alert("网络连接出错");
|
||
}
|
||
});
|
||
} else {
|
||
alert(data.resultMsg);
|
||
}
|
||
},
|
||
error : function(data) {
|
||
alert('系统错误请稍后再试')
|
||
}
|
||
});
|
||
}
|
||
|
||
//统一支付入口
|
||
function tradePay(comsumeMoney, leshuaMchId, userImg, nickName) {
|
||
var radioPay = $("input[name='radio1']:checked").val();//是会员选择的
|
||
var storeId = $("#storeId").val();
|
||
var openid = $("#openid").val();
|
||
var merchantCode = $("#merchantCode").val();
|
||
var remark = $("#remark").val();
|
||
var isMember = $("#isMember").val();
|
||
var userId = $("#userid").val();
|
||
var unionId = $("#unionId").val();
|
||
var qrNo = $("#qrNo").val();
|
||
var payWay = "";
|
||
if (isWeiXin()) {
|
||
payWay = "WXZF";
|
||
} else if(isAlipay()){
|
||
payWay = "ZFBZF";
|
||
}else{
|
||
payWay = "UNIONPAY";
|
||
}
|
||
//var index = layer.msg('支付中...', {icon: 16,time:0,shade : [0.3 , '#000' , false]});
|
||
$('#loading').css('display','block');
|
||
$.ajax({
|
||
url : '${ctx}/merchant/tradePay',
|
||
data : {
|
||
"comsumeMoney" : comsumeMoney,
|
||
"leshuaMchId" : leshuaMchId,
|
||
"merchantCode" : merchantCode,
|
||
"storeId" : storeId,
|
||
"payWay" : payWay,
|
||
"userImg" : userImg,
|
||
"nickName" : nickName,
|
||
"remark" : remark,
|
||
"openid" : openid,
|
||
"isMember" : isMember,
|
||
"radioPay" : radioPay,
|
||
"userId" : userId,
|
||
"unionId" : unionId,
|
||
"snNo" : qrNo,
|
||
},
|
||
dataType : "json",
|
||
type : "post",
|
||
success : function(res) {
|
||
$('#loading').css('display','none');
|
||
if (res.isMember == '1') {
|
||
window.location = '${ctx}/merchant/paySuccess';
|
||
} else if (res.isMember == '0') {
|
||
window.location = '${ctx}/wap/merchant/payFail';
|
||
} else {
|
||
if (res.code == 200) {
|
||
//乐刷
|
||
var rdata = res.data;
|
||
if("WXZF" == payWay){
|
||
WeixinJSBridge.invoke('getBrandWCPayRequest', {
|
||
// 商品名称
|
||
"appId" : rdata.payAppId,
|
||
"timeStamp" : rdata.payTimeStamp,
|
||
"nonceStr" : rdata.paynonceStr,
|
||
"package" : rdata.payPackage,
|
||
"signType" : rdata.paySignType,
|
||
"paySign" : rdata.paySign,
|
||
}, function(res) {
|
||
if (res.err_msg == "get_brand_wcpay_request:ok" || res.err_msg == "stopMonitoringBeacons:ok") {
|
||
//成功之后跳转地址
|
||
window.location = '${ctx}/merchant/jumpUrl?orderNumber='+rdata.orderNumber;
|
||
} else {
|
||
cancelPay(rdata.orderNumber);
|
||
alert("支付失败");
|
||
}
|
||
})
|
||
}else if("ZFBZF" == payWay){
|
||
var reg=/^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+).)+([A-Za-z0-9-~\/])+$/;
|
||
if(reg.test(rdata.source)){
|
||
window.location = rdata.source;
|
||
}else{
|
||
ap.tradePay({
|
||
tradeNO : rdata.source
|
||
}, function(res) {
|
||
if (res.resultCode == '9000') {
|
||
window.location = '${ctx}/merchant/jumpUrl?orderNumber='+rdata.orderNumber;//订单支付成功
|
||
} else if (res.resultCode == '8000') {
|
||
} else if (res.resultCode == '4000') {
|
||
cancelPay(rdata.orderNumber);
|
||
ap.alert("订单支付失败");
|
||
} else if (res.resultCode == '6001' || res.resultCode == '99') {
|
||
cancelPay(rdata.orderNumber);
|
||
} else if (res.resultCode == '6002') {
|
||
cancelPay(rdata.orderNumber);
|
||
ap.alert("网络连接出错");
|
||
}
|
||
});
|
||
}
|
||
}else{
|
||
window.location = rdata.redirectUrl;
|
||
}
|
||
} else {
|
||
alert(res.message);
|
||
}
|
||
}
|
||
}
|
||
})
|
||
}
|
||
|
||
function cancelPay(m) {
|
||
var url = "${ctx}/merchant/cancelPay/"+m;
|
||
$.get(url, (res)=>{
|
||
console.log(res);
|
||
})
|
||
}
|
||
|
||
<%--function goMemberPay(){--%>
|
||
<%-- /*var storeId=$("#storeId").val();--%>
|
||
<%-- var merchantCode=$("#merchantCode").val();--%>
|
||
<%-- var openid=$("#openid").val();*/--%>
|
||
<%-- var openid = $("#openid").val();--%>
|
||
<%-- window.location = '${ctx}/vip/goPay?cardNo=${cardNo}';--%>
|
||
<%--}--%>
|
||
|
||
<%--function openVIPCard() {--%>
|
||
<%-- var storeId=$("#storeId").val();--%>
|
||
<%-- var merchantCode=$("#merchantCode").val();--%>
|
||
<%-- var openid=$("#openid").val();--%>
|
||
<%-- window.location= '${ctx}/vip/vipOpenCard?storeId='+storeId+'&merchantCode='+merchantCode+'&openid='+openid;--%>
|
||
<%--}--%>
|
||
|
||
function showDiyKeyBoard() {
|
||
isDiyKeyBoardVisible = true;
|
||
$(".weui-footer_fixed-bottom").removeClass("hiddenKeyBoard");
|
||
$(".weui-footer_fixed-bottom").addClass("showKeyBoard");
|
||
}
|
||
|
||
function hiddenDiyKeyBoard() {
|
||
isDiyKeyBoardVisible = false;
|
||
$(".weui-footer_fixed-bottom").removeClass("showKeyBoard");
|
||
$(".weui-footer_fixed-bottom").addClass("hiddenKeyBoard");
|
||
}
|
||
|
||
function hiddenKeyBoard() {
|
||
showDiyKeyBoardFlag = false;
|
||
if (isDiyKeyBoardVisible) {
|
||
hiddenDiyKeyBoard()
|
||
}
|
||
}
|
||
|
||
function showKeyBoard() {
|
||
showDiyKeyBoardFlag = true;
|
||
// 两种键盘都不可见,则调用动画
|
||
if (!isDiyKeyBoardVisible && !isKeyBoardVisible) {
|
||
// confirm("当前自定义键盘不可见;系统键盘不可见");
|
||
showDiyKeyBoard();
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 立即收起自定义键盘
|
||
*/
|
||
function hiddenKeyBoardImmediately() {
|
||
showDiyKeyBoardFlag = false;
|
||
isDiyKeyBoardVisible = false;
|
||
$(".weui-footer_fixed-bottom").removeClass("showKeyBoard");
|
||
$(".weui-footer_fixed-bottom").removeClass("hiddenKeyBoard");
|
||
$(".weui-footer_fixed-bottom").css("bottom", "-224px");
|
||
}
|
||
|
||
function onNumberDown(num) {
|
||
let number = $('#comsumeMoney').val();
|
||
|
||
if (number === "" || number === "undefined" || number === undefined || number === null) {
|
||
number = "0";
|
||
}
|
||
|
||
let dotPosition = number.indexOf(".");
|
||
if (dotPosition !== -1 && num === ".") {
|
||
return;
|
||
}
|
||
|
||
if (dotPosition !== -1 && (dotPosition + 3) === number.length) {
|
||
return;
|
||
}
|
||
|
||
if (number === "0" && num !== ".") {
|
||
number = num;
|
||
} else {
|
||
number += num;
|
||
}
|
||
|
||
$('#comsumeMoney').val(number);
|
||
}
|
||
|
||
function backSpace() {
|
||
let number = $('#comsumeMoney').val();
|
||
$('#comsumeMoney').val(number.substr(0, number.length - 1));
|
||
}
|
||
|
||
/** 打开备注弹窗 */
|
||
function showRemarkDialog() {
|
||
hiddenKeyBoardImmediately()
|
||
$("#remark").val(remark);
|
||
$(".weui-mask").addClass("weui-mask--visible");
|
||
$(".weui-dialog").addClass("weui-dialog--visible");
|
||
}
|
||
|
||
/** 收起备注弹窗 */
|
||
function hiddenRemarkDialog() {
|
||
$(".weui-mask").removeClass("weui-mask--visible");
|
||
$(".weui-dialog").removeClass("weui-dialog--visible");
|
||
showDiyKeyBoard();
|
||
}
|
||
|
||
function enterRemark() {
|
||
remark = $("#remark").val();
|
||
$(".weui-mask").removeClass("weui-mask--visible");
|
||
$(".weui-dialog").removeClass("weui-dialog--visible");
|
||
showDiyKeyBoard();
|
||
}
|
||
</script>
|
||
</html> |