|
@@ -17,6 +17,91 @@
|
|
|
<body>
|
|
|
<script>
|
|
|
initShare({{.T.signature}},{{.T.openid}},2,"jy_wxmyorder",{{.T.nickname}},{{.T.avatar}});
|
|
|
+
|
|
|
+ var signature = {{.T.signature}};
|
|
|
+ var isConfigSuccess = true;
|
|
|
+ var id = {{.T._id}}
|
|
|
+ if(signature && signature.length == 4){
|
|
|
+ wx.config({
|
|
|
+ debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
|
|
+ appId: signature[0], // 必填,公众号的唯一标识
|
|
|
+ timestamp:signature[1], // 必填,生成签名的时间戳
|
|
|
+ nonceStr: signature[2], // 必填,生成签名的随机串
|
|
|
+ signature: signature[3],// 必填,签名,见附录1
|
|
|
+ jsApiList: ['chooseWXPay','hideAllNonBaseMenuItem'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
|
|
|
+ });
|
|
|
+ wx.ready(function () {
|
|
|
+ if(!isConfigSuccess){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ wx.hideAllNonBaseMenuItem();
|
|
|
+ });
|
|
|
+ wx.error(function(res){
|
|
|
+ //config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
|
|
|
+ isConfigSuccess = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //调用微信支付接口
|
|
|
+ function onBridgeReady(res){
|
|
|
+ WeixinJSBridge.invoke('getBrandWCPayRequest',{
|
|
|
+ "appId": res["appId"],
|
|
|
+ "timeStamp": res["timestamp"],
|
|
|
+ "nonceStr": res["nonceStr"],
|
|
|
+ "package": res["prepayId"],
|
|
|
+ "signType": res["signType"],
|
|
|
+ "paySign": res["sign"]
|
|
|
+ },
|
|
|
+ function(r){
|
|
|
+ if(r.err_msg == "get_brand_wcpay_request:ok"){
|
|
|
+ $(".bottomButton").attr("id","buytwo").text("再次购买");
|
|
|
+ }else if(r.err_msg == "get_brand_wcpay_request:cancel"){
|
|
|
+ //取消支付 可以再次支付
|
|
|
+ canpay=true;
|
|
|
+ isReqing = false;
|
|
|
+ }else{
|
|
|
+ EasyAlert.show("系统异常,请稍微再试","",3000);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //
|
|
|
+ var isReqing = false;
|
|
|
+ function goPay(){
|
|
|
+ var filterid = {{.T.o.filter_id}};
|
|
|
+ var token = {{.T.o.token}};
|
|
|
+ if(isReqing){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ isReqing = true;
|
|
|
+ $.post("/front/wx_dataExport/getPayParm",{"id":filterid,"token":token},function(res){
|
|
|
+ isReqing = false;
|
|
|
+ if(res.status == 1){
|
|
|
+ onBridgeReady(res);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //提示框
|
|
|
+ var EasyAlert = {
|
|
|
+ timeout: null,
|
|
|
+ waitTime: 1000,
|
|
|
+ show: function(text,css,waitTime){
|
|
|
+ if(this.timeout != null){
|
|
|
+ clearTimeout(this.timeout);
|
|
|
+ this.hide();
|
|
|
+ this.timeout = null;
|
|
|
+ }
|
|
|
+ var thisClass = this;
|
|
|
+ this.timeout = setTimeout(function(){
|
|
|
+ thisClass.hide();
|
|
|
+ thisClass.timeout = null;
|
|
|
+ },waitTime?waitTime:this.waitTime);
|
|
|
+ $("body").append('<div class="easyalert" id="easyAlert">'+text+'</div>');
|
|
|
+ $("#easyAlert").css({"left":"50%","margin-top":-($("#easyAlert").outerHeight()/2),"margin-left":-($("#easyAlert").outerWidth()/2)}).show();
|
|
|
+ },
|
|
|
+ hide: function(){
|
|
|
+ $("#easyAlert").remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //
|
|
|
$(function(){
|
|
|
var filter={{.T.o.filter}};
|
|
|
if (filter){
|
|
@@ -149,10 +234,6 @@
|
|
|
}else{
|
|
|
$(".person_").show();
|
|
|
}
|
|
|
-
|
|
|
- $("#buy").click(function(){
|
|
|
- window.location.href="/weixin/pay/dataexport?id={{.T.o.filter_id}}&source=d";
|
|
|
- })
|
|
|
});
|
|
|
|
|
|
|
|
@@ -312,9 +393,9 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
{{if .T.o.pay_time}}
|
|
|
- <div class="button align" id="buytwo">再次购买</div>
|
|
|
+ <div class="button align bottomButton" id="buytwo">再次购买</div>
|
|
|
{{else}}
|
|
|
- <div class="button align" id="buy">去支付</div>
|
|
|
+ <div class="button align bottomButton" id="buy" onclick="goPay()">去支付</div>
|
|
|
{{end}}
|
|
|
</div>
|
|
|
</main>
|