作者 lihan

最终完善+充值卡支付

@@ -2,12 +2,14 @@ @@ -2,12 +2,14 @@
2 <html> 2 <html>
3 <head> 3 <head>
4 <meta charset="UTF-8"> 4 <meta charset="UTF-8">
  5 + <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />
5 <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> 6 <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
6 <link rel="stylesheet" type="text/css" href="/themes/simplebootx/Portal/Template/css/swiper-3.4.2.min.css" /> 7 <link rel="stylesheet" type="text/css" href="/themes/simplebootx/Portal/Template/css/swiper-3.4.2.min.css" />
7 <link rel="stylesheet" type="text/css" href="/themes/simplebootx/Portal/Template/css/init.css" /> 8 <link rel="stylesheet" type="text/css" href="/themes/simplebootx/Portal/Template/css/init.css" />
8 <link rel="stylesheet" type="text/css" href="http://at.alicdn.com/t/font_647640_n3cow34ja3gzaor.css" /> 9 <link rel="stylesheet" type="text/css" href="http://at.alicdn.com/t/font_647640_n3cow34ja3gzaor.css" />
9 <link rel="stylesheet" type="text/css" href="/themes/simplebootx/Portal/Template/css/PersonCenter/topus.css" /> 10 <link rel="stylesheet" type="text/css" href="/themes/simplebootx/Portal/Template/css/PersonCenter/topus.css" />
10 <script src="/themes/simplebootx/Portal/Template/js/base.js" type="text/javascript" charset="utf-8"></script> 11 <script src="/themes/simplebootx/Portal/Template/js/base.js" type="text/javascript" charset="utf-8"></script>
  12 + <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
11 <title>充值</title> 13 <title>充值</title>
12 <style> 14 <style>
13 .wrapper{ 15 .wrapper{
@@ -73,26 +75,7 @@ @@ -73,26 +75,7 @@
73 <p class="explain">充值卡使用说明</p> 75 <p class="explain">充值卡使用说明</p>
74 </div> 76 </div>
75 <div class="text"> 77 <div class="text">
76 - 美食美食美食美食美食美食美食美食  
77 - 美食美食美食美食美食美食美食美食  
78 - 美食美食美食美食  
79 - 美食美食美食美食  
80 - 美食美食美食美食  
81 - 美食美食美食美食美食美食美食美食  
82 - 美食美食美食美食美食美食美食美食  
83 - 美食美食美食美食  
84 - 美食美食美食美食  
85 - 美食美食美食美食  
86 - 美食美食美食美食美食美食美食美食  
87 - 美食美食美食美食美食美食美食美食  
88 - 美食美食美食美食  
89 - 美食美食美食美食  
90 - 美食美食美食美食  
91 - 美食美食美食美食美食美食美食美食  
92 - 美食美食美食美食美食美食美食美食  
93 - 美食美食美食美食  
94 - 美食美食美食美食  
95 - 美食美食美食美食 78 + 充值说明
96 </div> 79 </div>
97 <button class="certain">确定</button> 80 <button class="certain">确定</button>
98 </div> 81 </div>
@@ -101,18 +84,46 @@ @@ -101,18 +84,46 @@
101 <div class="header"> 84 <div class="header">
102 <i class="iconfont icon-my_icon"></i><p>充值卡使用说明</p> 85 <i class="iconfont icon-my_icon"></i><p>充值卡使用说明</p>
103 </div> 86 </div>
104 - <div class="top_us_card" v-for="item in cardindex" :id="item.id"> 87 + <div class="top_us_card" v-for="item in cardindex">
105 <p class="top_us_num">充值面额</p> 88 <p class="top_us_num">充值面额</p>
106 <div class="top_us_num_wrap"> 89 <div class="top_us_num_wrap">
107 <p class="forever">有效期:永久</p> 90 <p class="forever">有效期:永久</p>
108 <p class="give_num">赠送{{item.bonus}}元</p> 91 <p class="give_num">赠送{{item.bonus}}元</p>
109 - <span class="btn" @click="recharge(item)">立即充值</span> 92 + <span class="btn" onclick="recharge(this.id)" :id="item.id">立即充值</span>
110 </div> 93 </div>
111 <div class="money"> 94 <div class="money">
112 <p class="icon">¥</p><p class="money_num">{{item.denomination}}</p> 95 <p class="icon">¥</p><p class="money_num">{{item.denomination}}</p>
113 </div> 96 </div>
114 </div> 97 </div>
115 </div> 98 </div>
  99 + <script>
  100 + function recharge(id) {
  101 + $.ajax({
  102 + url:"{:U('Portal/Card/recharge_s')}",
  103 + data:{
  104 + id:id,
  105 + from:2,
  106 + unique_id: localStorage.getItem('unique_id')
  107 + },
  108 + type:"POST",
  109 + dataType:"JSON",
  110 +
  111 + success: function (data) {
  112 + console.log(data);
  113 + wx.chooseWXPay({
  114 + timestamp: data.data.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
  115 + nonceStr: data.data.nonceStr, // 支付签名随机串,不长于 32 位
  116 + package: data.data.package, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
  117 + signType: data.data.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
  118 + paySign: data.data.paySign, // 支付签名
  119 + success: function (res) {
  120 +// 支付成功后的回调函数
  121 + }
  122 + });
  123 + }
  124 + })
  125 + }
  126 + </script>
116 <script src="/themes/simplebootx/Portal/Template/js/vue.min.js" type="text/javascript" charset="utf-8"></script> 127 <script src="/themes/simplebootx/Portal/Template/js/vue.min.js" type="text/javascript" charset="utf-8"></script>
117 <script src="/themes/simplebootx/Portal/Template/js/jquery.min.js" type="text/javascript" charset="utf-8"></script> 128 <script src="/themes/simplebootx/Portal/Template/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
118 <script src="/themes/simplebootx/Portal/Template/js/cookie.js" type="text/javascript" charset="utf-8"></script> 129 <script src="/themes/simplebootx/Portal/Template/js/cookie.js" type="text/javascript" charset="utf-8"></script>
@@ -130,9 +141,20 @@ @@ -130,9 +141,20 @@
130 // alert(111) 141 // alert(111)
131 $(".wrapper").css("display","block") 142 $(".wrapper").css("display","block")
132 }); 143 });
133 -  
134 -  
135 </script> 144 </script>
136 - 145 +
  146 + <script>
  147 + wx.config({
  148 + debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  149 + appId: '{$sdk.appId}', // 必填,公众号的唯一标识
  150 + timestamp: '{$sdk.timestamp}', // 必填,生成签名的时间戳
  151 + nonceStr: '{$sdk.nonceStr}', // 必填,生成签名的随机串
  152 + signature: '{$sdk.signature}',// 必填,签名
  153 + jsApiList: [
  154 + 'chooseWXPay'
  155 + ] // 必填,需要使用的JS接口列表
  156 + });
  157 + </script>
  158 +
137 </body> 159 </body>
138 </html> 160 </html>
@@ -282,7 +282,7 @@ new Vue({ @@ -282,7 +282,7 @@ new Vue({
282 var cartid=obj.cart_id; 282 var cartid=obj.cart_id;
283 cartdid.push(cartid); 283 cartdid.push(cartid);
284 console.log(cartdid); 284 console.log(cartdid);
285 - window.location.href=linkPath+'/order.html?id='+cartdid 285 + window.location.href="/index.php?g=&m=template&a=order&id="+cartdid;
286 } 286 }
287 287
288 //else if(that.checklist.length==0){ 288 //else if(that.checklist.length==0){
@@ -20,18 +20,15 @@ new Vue({ @@ -20,18 +20,15 @@ new Vue({
20 console.log(res); 20 console.log(res);
21 var data=res.data; 21 var data=res.data;
22 that.cardindex=data; 22 that.cardindex=data;
23 - console.log(that.cardindex)  
24 -  
25 -  
26 - 23 + console.log(that.cardindex)
27 }) 24 })
28 }, 25 },
29 //充值卡充值 26 //充值卡充值
30 recharge:function(obj){ 27 recharge:function(obj){
31 var that = this; 28 var that = this;
32 var id=obj.id; 29 var id=obj.id;
33 -  
34 - var url = '/Card/recharge' 30 +
  31 + var url = '/Card/recharges'
35 var params = { 32 var params = {
36 unique_id: localStorage.getItem('unique_id'), 33 unique_id: localStorage.getItem('unique_id'),
37 id:id, 34 id:id,
@@ -40,18 +37,9 @@ new Vue({ @@ -40,18 +37,9 @@ new Vue({
40 ajaxsend(url, params, function(res) { 37 ajaxsend(url, params, function(res) {
41 /*console.log(JSON.stringify(res))*/ 38 /*console.log(JSON.stringify(res))*/
42 console.log(res); 39 console.log(res);
43 -// var data=res.data;  
44 -// that.cardindex=data;  
45 -// console.log(that.cardindex)  
46 -  
47 -  
48 -  
49 }) 40 })
50 41
51 }, 42 },
52 -  
53 -  
54 -  
55 }, 43 },
56 44
57 45
@@ -4,22 +4,22 @@ @@ -4,22 +4,22 @@
4 <head> 4 <head>
5 <meta charset="UTF-8"> 5 <meta charset="UTF-8">
6 <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> 6 <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
7 - <link rel="stylesheet" type="text/css" href="css/swiper-3.4.2.min.css" />  
8 - 7 + <link rel="stylesheet" type="text/css" href="/themes/simplebootx/Portal/Template/css/swiper-3.4.2.min.css" />
  8 + <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />
9 <link rel="stylesheet" type="text/css" href="http://at.alicdn.com/t/font_647640_rgou3w6dip.css" /> 9 <link rel="stylesheet" type="text/css" href="http://at.alicdn.com/t/font_647640_rgou3w6dip.css" />
10 - <link rel="stylesheet" type="text/css" href="css/order.css" />  
11 - <script src="js/base.js" type="text/javascript" charset="utf-8"></script> 10 + <link rel="stylesheet" type="text/css" href="/themes/simplebootx/Portal/Template/css/order.css" />
  11 + <script src="/themes/simplebootx/Portal/Template/js/base.js" type="text/javascript" charset="utf-8"></script>
12 12
13 <!--jquery weui--> 13 <!--jquery weui-->
14 - <link rel="stylesheet" href="css/weui.min.css">  
15 - <link rel="stylesheet" href="css/jquery-weui.css">  
16 - <link rel="stylesheet" href="css/demos.css"> 14 + <link rel="stylesheet" href="/themes/simplebootx/Portal/Template/css/weui.min.css">
  15 + <link rel="stylesheet" href="/themes/simplebootx/Portal/Template/css/jquery-weui.css">
  16 + <link rel="stylesheet" href="/themes/simplebootx/Portal/Template/css/demos.css">
17 <!--时间插件--> 17 <!--时间插件-->
18 - <link rel="stylesheet" href="datecss/mobiscroll.css" />  
19 - <link rel="stylesheet" href="datecss/mobiscroll_003.css" />  
20 - <link rel="stylesheet" href="datecss/mobiscroll_002.css" /> 18 + <link rel="stylesheet" href="/themes/simplebootx/Portal/Template/datecss/mobiscroll.css" />
  19 + <link rel="stylesheet" href="/themes/simplebootx/Portal/Template/datecss/mobiscroll_003.css" />
  20 + <link rel="stylesheet" href="/themes/simplebootx/Portal/Template/datecss/mobiscroll_002.css" />
21 <!--<link rel="stylesheet" type="text/css" href="css/index.css" />--> 21 <!--<link rel="stylesheet" type="text/css" href="css/index.css" />-->
22 - <link rel="stylesheet" type="text/css" href="css/init.css" /> 22 + <link rel="stylesheet" type="text/css" href="/themes/simplebootx/Portal/Template/css/init.css" />
23 <title>提交订单</title> 23 <title>提交订单</title>
24 <style> 24 <style>
25 .state { 25 .state {
@@ -581,25 +581,25 @@ @@ -581,25 +581,25 @@
581 </div> 581 </div>
582 582
583 </div> 583 </div>
584 - <script src="js/vue.js" type="text/javascript" charset="utf-8"></script>  
585 - <script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script>  
586 - <script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>  
587 - <script src="js/cookie.js" type="text/javascript" charset="utf-8"></script>  
588 - <script src="js/swiper-3.4.2.jquery.min.js" type="text/javascript" charset="utf-8"></script>  
589 - <script src="js/order.js" type="text/javascript" charset="utf-8"></script>  
590 - <script src="datejs/jquery-1.js" type="text/javascript" charset="utf-8"></script>  
591 - <script src="datejs/jquery.1.7.2.min.js" type="text/javascript" charset="utf-8"></script> 584 + <script src="/themes/simplebootx/Portal/Template/js/vue.js" type="text/javascript" charset="utf-8"></script>
  585 + <script src="/themes/simplebootx/Portal/Template/js/vue.min.js" type="text/javascript" charset="utf-8"></script>
  586 + <script src="/themes/simplebootx/Portal/Template/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
  587 + <script src="/themes/simplebootx/Portal/Template/js/cookie.js" type="text/javascript" charset="utf-8"></script>
  588 + <script src="/themes/simplebootx/Portal/Template/js/swiper-3.4.2.jquery.min.js" type="text/javascript" charset="utf-8"></script>
  589 + <script src="/themes/simplebootx/Portal/Template/js/order.js" type="text/javascript" charset="utf-8"></script>
  590 + <script src="/themes/simplebootx/Portal/Template/datejs/jquery-1.js" type="text/javascript" charset="utf-8"></script>
  591 + <script src="/themes/simplebootx/Portal/Template/datejs/jquery.1.7.2.min.js" type="text/javascript" charset="utf-8"></script>
592 <!--jquery weui--> 592 <!--jquery weui-->
593 - <script src="js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>  
594 - <script src="js/fastclick.js" type="text/javascript" charset="utf-8"></script>  
595 - <script src="js/jquery-weui.js" type="text/javascript" charset="utf-8"></script> 593 + <script src="/themes/simplebootx/Portal/Template/js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
  594 + <script src="/themes/simplebootx/Portal/Template/js/fastclick.js" type="text/javascript" charset="utf-8"></script>
  595 + <script src="/themes/simplebootx/Portal/Template/js/jquery-weui.js" type="text/javascript" charset="utf-8"></script>
596 <!--jQuery weui--> 596 <!--jQuery weui-->
597 597
598 - <script src="datejs/mobiscroll_002.js" type="text/javascript" charset="utf-8"></script>  
599 - <script src="datejs/mobiscroll.js" type="text/javascript" charset="utf-8"></script>  
600 - <script src="datejs/mobiscroll_004.js" type="text/javascript" charset="utf-8"></script>  
601 - <script src="datejs/mobiscroll_003.js" type="text/javascript" charset="utf-8"></script>  
602 - <script src="datejs/mobiscroll_005.js" type="text/javascript" charset="utf-8"></script> 598 + <script src="/themes/simplebootx/Portal/Template/datejs/mobiscroll_002.js" type="text/javascript" charset="utf-8"></script>
  599 + <script src="/themes/simplebootx/Portal/Template/datejs/mobiscroll.js" type="text/javascript" charset="utf-8"></script>
  600 + <script src="/themes/simplebootx/Portal/Template/datejs/mobiscroll_004.js" type="text/javascript" charset="utf-8"></script>
  601 + <script src="/themes/simplebootx/Portal/Template/datejs/mobiscroll_003.js" type="text/javascript" charset="utf-8"></script>
  602 + <script src="/themes/simplebootx/Portal/Template/datejs/mobiscroll_005.js" type="text/javascript" charset="utf-8"></script>
603 <script type="text/javascript"> 603 <script type="text/javascript">
604 var hope_address = document.getElementsByClassName('hope_address')[0]; 604 var hope_address = document.getElementsByClassName('hope_address')[0];
605 var wrap = document.getElementsByClassName('wrap')[0]; 605 var wrap = document.getElementsByClassName('wrap')[0];