<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Proud Kids 在线固定外教小班课</title> <meta name="keywords" content="" /> <meta name="description" content="" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <link type="text/css" rel="stylesheet" href="swiper/swiper.min.css" /> <link type="text/css" rel="stylesheet" href="css/index.css" /> <link type="text/css" rel="stylesheet" href="css/detail.css" /> <link rel="stylesheet" href="css/flexible.css"> <script src="./js/jquery-1.8.3.min.js"></script> <script src="js/flexible.js"></script> </head> <body> <div class="container"> <div class="myInfo"> <div class="img-box"><img src="" alt=""></div> <ul class="userInfo font-30"> <li> <span>中文名字:</span> <span id="chName"></span> </li> <li> <span>英文名字:</span> <span id="EnName"></span> </li> <li> <span>学习阶段:</span> <span>LEVEL <b id="grade" style="color:#ff6b6a;font-weight: normal"></b></span> </li> <li> <span>注册的手机号:</span> <span id="phone"></span> </li> <li> <span>已经报名课程:</span> <span id="goodsName"></span> </li> </ul> </div> <div class="linkMan-box"> <div class="linkManMa"> <img src="./images/erweima.png" alt=""> <p class="font-30"><span style="color:#ff6b6a">长按</span>咨询课程</p> </div> <!-- <a href="" class="font-24">退费政策</a> --> </div> <div class="fixed-box1"> <div class="person"> <p class="font-32">剩余:<b class="hundred">0</b><b class="ten">0</b><b class="unit">0</b> <span class="font-18" style="color:#a9a9a9">人</span></p> <p class="font-20" style="color:#a9a9a9">总报名人数:<span class="totalNum">500</span>人</p> </div> <div class="money font-36 payMoney"> 支付<span id="newPrice" style="margin-left:0"></span>元购买<span class="font-24">(原价<span id="oldPrice" style="margin-left:0;text-decoration:line-through"></span>元)</span> </div> </div> </div> </body> <script src="https://pv.sohu.com/cityjson"></script> <script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script> <script> var openId; //var baseUrl = 'http://192.168.1.80:9527'; var baseUrl = 'https://ce.proudkids.cn'; var ruserId; var goodsId = 1; var token = ''; var fee; //原价 var amount = 1; var wxConfig; var cid = localStorage.getItem('cid'); var pid = localStorage.getItem('pid'); //微信分享 $(document).ready(function() { $.ajax({ type: 'get', url: 'https://wechat.proudkids.cn/winShareController.do?shareView&route=' + encodeURIComponent(window.location.href.split("#")[0]), async: false, cache: false, dataType: 'json', success: function(res) { console.log(res); wxConfig = res.obj console.log(wxConfig) wx.config({ debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 appId: 'wxff0504465ffbaacd', // 必填,公众号的唯一标识 timestamp: wxConfig.timestamp, // 必填,生成签名的时间戳 nonceStr: wxConfig.nonceStr, // 必填,生成签名的随机串 signature: wxConfig.signature, // 必填,签名 jsApiList: ['chooseWXPay', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone' ] // 必填,需要使用的JS接口列表 }); } }) }); wx.ready(function() { wx.checkJsApi({ jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone' ], // 需要检测的JS接口列表,所有JS接口列表见附录2, success: function(res) { // 以键值对的形式返回,可用的api值true,不可用为false // 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"} return { "checkResult": { "onMenuShareTimeline": true }, "errMsg": "checkJsApi:ok" }; } }); // 获取“分享到朋友圈”按钮点击状态及自定义分享内容接口 wx.onMenuShareTimeline({ title: 'Proud Kids 在线固定外教小班课', // 分享标题 desc: "千聊官方推荐,粉丝福利,固定外教小班课选:Proud Kids", // 分享描述 link: "https://wechat.proudkids.cn/purchase/index.html?cid=" + cid + '&pid=' + pid, imgUrl: "https://files.proudkids.cn/default/dalibao.png", // 分享图标 success: function() { alert("分享成功!"); }, cancel: function() { alert("取消分享!"); } }); // 获取“分享给朋友”按钮点击状态及自定义分享内容接口 wx.onMenuShareAppMessage({ title: 'Proud Kids 在线固定外教小班课', // 分享标题 desc: "千聊官方推荐,粉丝福利,固定外教小班课选:Proud Kids", // 分享描述 link: "https://wechat.proudkids.cn/purchase/index.html?cid=" + cid + '&pid=' + pid, imgUrl: "https://files.proudkids.cn/default/dalibao.png", // 分享图标 success: function() { alert("分享成功!"); }, cancel: function() { alert("取消分享!"); } }); //获取“分享到QQ”按钮点击状态及自定义分享内容接口 wx.onMenuShareQQ({ title: 'Proud Kids 在线固定外教小班课', // 分享标题 desc: "千聊官方推荐,粉丝福利,固定外教小班课选:Proud Kids", // 分享描述 link: "https://wechat.proudkids.cn/purchase/index.html?cid=" + cid + '&pid=' + pid, imgUrl: "https://files.proudkids.cn/default/dalibao.png", // 分享图标 success: function() { alert("分享成功!"); }, cancel: function() { alert("取消分享!"); } }); //获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口 // wx.onMenuShareWeibo({ // title: '阅读打卡14天 实体绘本免费送', // 分享标题 // desc: '14天Raz绘本阅读训练营', // 分享描述 // link: "https://wechat.proudkids.cn/picBooksController.do?myIndex&invitedOpenId=" + // wxConfig.openId, // imgUrl: "https://wechat.proudkids.cn/webpage/winter/images/wechat.jpg", // 分享图标 // success: function() { // alert("分享成功!"); // }, // cancel: function() { // alert("取消分享!"); // } // }); //获取“分享到QQ空间”按钮点击状态及自定义分享内容接口 wx.onMenuShareQZone({ title: 'Proud Kids 在线固定外教小班课', // 分享标题 desc: "千聊官方推荐,粉丝福利,固定外教小班课选:Proud Kids", // 分享描述 link: "https://wechat.proudkids.cn/purchase/index.html?cid=" + cid + '&pid=' + pid, imgUrl: "https://files.proudkids.cn/default/dalibao.png", // 分享图标 success: function() { alert("分享成功!"); }, cancel: function() { alert("取消分享!"); } }); }); function getCookie(name) { var arr = document.cookie.split("; "); for (var i = 0; i < arr.length; i++) { var arr2 = arr[i].split("="); if (arr2[0] === name) { return decodeURIComponent(arr2[1]); } } return ""; }; $(document).ready(function() { var winHeight = $(window).height(); var boxHeight var myInfoHeight = $('.myInfo').height(); var fixedHeight = $('.fixed-box1').height(); openId = localStorage.getItem('openId'); ruserId = localStorage.getItem('ruserId'); console.log(openId + ruserId); token = getCookie('token'); boxHeight = winHeight - myInfoHeight - fixedHeight $('.linkMan-box').height(boxHeight); $('.img-box img').attr('src', localStorage.getItem('headimgurl')) $.ajax({ url: baseUrl + '/pay/v1/payGoods/1', type: 'get', async: false, cache: false, dataType: 'json', success: function(res) { console.log(res) var data = res.data var residueNum = data.qty - data.signUpNumber goodsId = data.id fee = data.favour console.log(residueNum); $('.totalNum').text(data.qty); $('#oldPrice').text(data.fee); $('#newPrice').text(data.favour); if (residueNum >= 100) { $('.hundred').text(residueNum.toString().substring(0, 1)) } else { $('.hundred').text(0); } if (residueNum >= 10) { $('.ten').text(residueNum.toString().substring(1, 2)) } else { $('.ten').text(0); } $('.unit').text(residueNum.toString().substring(2, 3)); }, error: function() { console.log('获取失败') } }); getstuInfo(); getList(); ccInfo(); }) function getstuInfo() { $.ajax({ url: baseUrl + '/ruser/v1/ruser/ruser-info/' + ruserId, type: 'get', async: false, cache: false, dataType: 'json', headers: { 'Authorization': 'Bearer ' + token }, //contentType: "application/json", success: function(res) { console.log(res) $('#chName').text(res.name); if (res.enName) { $('#EnName').text(res.enName); } else { $('#EnName').text('----'); } $('#phone').text(res.phone); if (res.grade == 0) { $('#grade').text('k'); } else { $('#grade').text(res.grade); } }, error: function(res) { console.log(res) } }) } function getList() { $.ajax({ url: baseUrl + '/pay/v1/payOrders/ruser/' + ruserId + '/goods/' + goodsId, type: 'get', async: false, cache: false, dataType: 'json', headers: { 'Authorization': 'Bearer ' + token }, //contentType: "application/json", success: function(res) { if (res.length == 0) { $('#goodsName').text('暂无课程') } else { $('#goodsName').text(res[0].goodsName); $('.payMoney').text('课程顾问会在24小时内与您取得联系'); $('.payMoney').css('background', '#b7b7b7'); $('.payMoney').addClass('font-26'); } }, error: function(res) { console.log(res) } }); } //获取CC二维码 function ccInfo() { console.log() $.ajax({ url: baseUrl + '/sales/v1/bills/ccQrcode/' + ruserId, type: 'get', async: false, cache: false, // dataType: 'json', headers: { 'Authorization': 'Bearer ' + token }, success: function(res) { console.log(res) $('.linkManMa img').attr('src', res) }, error: function(res) { console.log(res) } }); }; //支付 $(function() { var orderId = null; var subjectName = '1111'; var channelId = 1; var clientIp = returnCitySN["cip"]; var appId; var sign; var timeStamp; var nonceStr; var packageStr; var signType; token = getCookie('token'); $('.payMoney').click(function() { if (token) { if ($('.payMoney').text() == '课程顾问会在24小时内与您取得联系') { return } else { addOrder(); } } clientIp = returnCitySN["cip"]; }) function addOrder() { //添加订单 $.ajax({ url: baseUrl + '/pay/v1/payOrders', type: 'post', async: false, cache: false, dataType: 'json', headers: { 'Authorization': 'Bearer ' + token }, contentType: "application/json", data: JSON.stringify({ 'amount': amount, 'fee': fee, 'goodsId': goodsId, 'ruserId': ruserId, }), success: function(res) { console.log(res); orderId = res.data.id; goodsId = res.data.goodsId; fee = res.data.fee; payOrders(); }, error: function(res) { console.log(res) } }); } function payOrders() { $.ajax({ url: baseUrl + '/pay/payCenter/toPay', type: 'get', async: false, cache: false, dataType: 'json', headers: { 'Authorization': 'Bearer ' + token }, //contentType: "application/json", data: { 'openId': openId, 'fee': fee, 'goodsId': goodsId, 'orderId': orderId, 'subjectName': subjectName, 'clientIp': clientIp, 'channelId': channelId, }, success: function(res) { var data = res.data console.log(res) appId = data.appId; nonceStr = data.nonceStr; packageStr = data.packageStr; signType = data.signType; timeStamp = data.timeStamp; sign = data.paySign; WxPay(); }, error: function(res) { console.log(res) } }); }; function WxPay() { WeixinJSBridge.invoke('getBrandWCPayRequest', { "appId": appId, //公众号名称,由商户传入 "paySign": sign, //微信签名 "timeStamp": timeStamp, //时间戳,自1970年以来的秒数 "nonceStr": nonceStr, //随机串 "package": packageStr, //预支付交易会话标识 "signType": signType //微信签名方式 }, function(res) { if (res.err_msg == "get_brand_wcpay_request:ok") { //alert("支付成功"); //this.$router.push({path:'Invite'}) location.href = "https://wechat.proudkids.cn/purchase/index.html"; //你的业务逻辑 } else { alert("支付失败") //alert(JSON.stringify(res.err_msg)) } }); }; }) </script> </html>