Forráskód Böngészése

我的订单支付方式选择

wangkaiyue 6 éve
szülő
commit
ed27a17243

+ 9 - 0
src/jfw/front/dataExport.go

@@ -1,6 +1,7 @@
 package front
 
 import (
+	"encoding/base64"
 	"encoding/json"
 	"errors"
 	"fmt"
@@ -14,6 +15,7 @@ import (
 	"strings"
 	"time"
 
+	"github.com/SKatiyar/qr"
 	"github.com/go-xweb/xweb"
 )
 
@@ -214,6 +216,13 @@ func (d *DataExport) QueryOrder() error {
 			}
 		}
 	}
+	for _, v := range *list {
+		if v["pay_way"] == "微信" && util.IntAll(v["order_status"]) == 0 {
+			r, _ := qr.Encode(util.ObjToString(v["code_url"]), qr.M)
+			pngdat := r.PNG()
+			v["code_url"] = base64.StdEncoding.EncodeToString(pngdat)
+		}
+	}
 	d.ServeJson(map[string]interface{}{
 		"list":     list,
 		"count":    count,

+ 82 - 0
src/jfw/pay/dataExportPay.go

@@ -19,6 +19,7 @@ type DataExportPayAction struct {
 	sacnPay_WaitPay     xweb.Mapper `xweb:"/dataExport/sacnPay/waitPay"`     //生成支付二维码
 	sacnPay_CreateOrder xweb.Mapper `xweb:"/dataExport/sacnPay/createOrder"` //创建订单
 	isPaySuccess        xweb.Mapper `xweb:"/dataExport/pay/isPaySuccess"`    //是否支付成功
+	getOrderPayMsg      xweb.Mapper `xweb:"/dataexport/getOrderPayMsg"`      //我的订单页面获取支付二维码
 }
 
 func init() {
@@ -365,3 +366,84 @@ func (p *DataExportPayAction) IsPaySuccess() {
 		"status": status,
 	})
 }
+
+func (p *DataExportPayAction) GetOrderPayMsg() {
+	openid := util.ObjToString(p.GetSession("s_m_openid"))
+	code := p.GetString("orderCode")
+	pay_way := p.GetString("payway")
+	prepay_time := p.GetString("prepaytime")
+	payUrl, errMsg, ok := func() (string, string, bool) {
+		if openid == "" {
+			return "", "用户异常", false
+		}
+		if code == "" || pay_way == "" {
+			return "", "参数异常", false
+		}
+		queryOrder := public.Mysql.FindOne("dataexport_order", map[string]interface{}{
+			"user_openid": openid,
+			"order_code":  code,
+		}, "id,order_status,order_money", "")
+
+		if queryOrder == nil {
+			return "", "订单异常", false
+		}
+		if util.IntAll((*queryOrder)["order_status"]) != 0 {
+			return "", "订单状态异常", false
+		}
+		//修改支付方式
+		orderid := util.Int64All((*queryOrder)["id"])
+		orderMoney := util.IntAll((*queryOrder)["order_money"])
+		codeUrl := ""
+		now := time.Now()
+		prepay_time = util.FormatDate(&now, util.Date_Full_Layout)
+		if pay_way == "微信" {
+			tradeno, ret := public.WxStruct.CreatePrepayOrder(config.Sysconfig["weixinrpc"].(string), "b", p.IP(), openid, "", orderMoney)
+			if ret != nil {
+				if public.Mysql.Update("dataexport_order", map[string]interface{}{
+					"id": orderid,
+				}, map[string]interface{}{
+					"prepay_time":  prepay_time,
+					"prepay_id":    (*ret)["prepayid"],
+					"code_url":     (*ret)["codeurl"],
+					"out_trade_no": tradeno,
+					"pay_way":      pay_way,
+				}) {
+					r, _ := qr.Encode(util.ObjToString((*ret)["codeurl"]), qr.M)
+					pngdat := r.PNG()
+					codeUrl = base64.StdEncoding.EncodeToString(pngdat)
+				} else {
+					return "", "创建微信订单出错", false
+				}
+			}
+		} else if pay_way == "支付宝" {
+			payOutTime := now.Add(time.Hour * 2)
+			if qr_url, tradeno, err := Alipay.GetPayUrl(util.Float64All(orderMoney), util.FormatDate(&payOutTime, util.Date_Full_Layout)); err == nil {
+				if public.Mysql.Update("dataexport_order", map[string]interface{}{
+					"id": orderid,
+				}, map[string]interface{}{
+					"prepay_time":  prepay_time,
+					"prepay_id":    "",
+					"code_url":     qr_url,
+					"out_trade_no": tradeno,
+					"pay_way":      pay_way,
+				}) {
+					//surplus_second = 7200
+				}
+				codeUrl = qr_url
+			} else {
+				return "", "创建支付宝订单出错", false
+			}
+		}
+		return codeUrl, "", true
+	}()
+	if errMsg != "" {
+		log.Printf("用户%s 订单号%s 出错%s", openid, code, errMsg)
+	}
+	p.ServeJson(map[string]interface{}{
+		"success":     ok,
+		"payUrl":      payUrl,
+		"errMsg":      errMsg,
+		"prepay_time": prepay_time,
+	})
+
+}

+ 180 - 1
src/web/staticres/dataExport/css/drder_details.css

@@ -78,4 +78,183 @@
 
 #drder .list ul li .iner ul li:nth-of-type(6) .wcxq:hover { color: #2CB7CA; }
 
-/*# sourceMappingURL=drder_details.css.map */
+/*# sourceMappingURL=drder_details.css.map */
+
+/* 微信支付样式 */
+.clearfix:after {
+  content: '.';
+  visibility: hidden;
+  display: block;
+  height: 0;
+  clear: both;
+}
+.ks-clear, .clear {
+  *zoom: 1;
+}
+.modal:after{
+	content:"";
+	overflow:hidden;
+	display:block;
+	visibility:hidden;
+	height:0;
+	clear:both;
+}
+.modal{
+    width: 440px;
+    height: 520px;
+    background: #ffffff;
+    left: 50% !important;
+    margin-left:-220px;
+    margin-top:-260px;
+    top:50% !important;
+    padding-right: 0px !important;
+    border-radius: 10px;
+}
+.modal .nav{
+    width: 100%;
+    height: 72px;
+}
+.modal .nav .list{
+    width: 100%;
+    height: 100%;
+    border-bottom: 1px solid #E0E0E0;
+    display: flex;
+}
+.modal .nav .list li{
+    width: 220px;
+    height: 100%;
+}
+.modal .nav .list li a{
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    width: 100%;
+    height: 100%;
+    color: #999;
+    font-size: 16px;
+}
+.modal .nav .list .underline{
+    border-bottom: 4px solid #2CB7CA;
+    font-size: 20px;
+    font-weight: bold;
+    color: #1D1D1D
+}
+.modal .nav .pay{
+    width: 100%;
+    height: 448px;
+    overflow: hidden;
+    position: relative;
+}
+.modal .nav .pay .price{
+    width: 100%;
+    height: 42px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    margin-top: 16px;
+    font-size: 32px;
+    color: #FF3A20;
+}
+.modal .nav .qr_code{
+    width: 100%;
+    height: 240px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    margin-top: 16px;
+}
+.modal .nav .qr_code img{
+    width: 240px;
+    height: 240px;
+    border: 1px solid #707070;
+}
+.modal .nav .scanning{
+    width: 100%;
+    height: 26px;
+    margin-top: 18px;
+    display: flex;
+}
+.modal .nav .scanning img{
+    width: 30px;
+    height: 26px;
+    margin-left: 96px;
+}
+.modal .nav .scanning .scan_text{
+    width: 225px;
+    height: 21px;
+    margin-left: 10px;
+    font-size: 16px;
+    line-height: 26px;
+    color: #1D1D1D;
+}
+.modal .nav .footer{
+    width: 100%;
+    height: 60px;
+    background: #2CB7CA;
+    margin-top: 30px;
+    border-radius: 0 0 6px 6px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+}
+.modal .nav .footer .tips{
+    font-size: 14px;
+    color: #ffffff;
+}
+.modal .nav .footer .tips .times{
+    font-size: 16px;
+    color: #ffffff;
+}
+/* 支付宝支付样式 */
+.modal .nav .pay .Alipay{
+    width: 100%;
+    height: 42px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    margin-top: 16px;
+    font-size: 32px;
+    color: #FF3A20;
+}
+.modal .nav .pay .alipay_scan{
+    width: 100%;
+    height: 26px;
+    margin-top: 18px;
+    display: flex;
+}
+.modal .nav .pay .alipay_scan img{
+    width: 30px;
+    height: 26px;
+    margin-left: 96px;
+}
+.modal .nav .pay .alipay_scan .alipay_text{
+    width: 225px;
+    height: 21px;
+    margin-left: 10px;
+    font-size: 16px;
+    color: #1D1D1D;
+}
+.modal .nav .pay .alipay_footer{
+    width: 100%;
+    height: 60px;
+    background: #2CB7CA;
+    margin-top: 30px;
+    border-radius: 0 0 6px 6px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+}
+.modal .nav .pay .alipay_footer .alipay_tips{
+    font-size: 14px;
+    color: #ffffff;
+}
+.modal .nav .pay .alipay_footer .alipay_tips .times{
+    font-size: 16px;
+    color: #ffffff;
+}
+.modal .nav .close{
+    position: fixed;
+    left: 50%;
+    bottom: 15%;
+    margin-left: -20px;
+}

BIN
src/web/staticres/dataExport/image/close.png


+ 602 - 439
src/web/templates/pc/myOrder.html

@@ -1,159 +1,174 @@
 <!doctype html>
 <html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <meta name="viewport"
-          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
-    <meta http-equiv="X-UA-Compatible" content="ie=edge">
-    <link rel="stylesheet" href="{{Msg "seo" "cdn"}}/dataExport/css/font_624651_bjdvktmum68.css?v={{Msg "seo" "version"}}">
-    <link rel="stylesheet" href="{{Msg "seo" "cdn"}}/dataExport/css/reset_pc.css?v={{Msg "seo" "version"}}">
-    <link rel="stylesheet" href="{{Msg "seo" "cdn"}}/dataExport/css/drder_details.css?v={{Msg "seo" "version"}}">
-
-    {{include "/common/pnc.html"}}
-    <link href="{{Msg "seo" "cdn"}}/css/pc.css?v={{Msg "seo" "version"}}" rel="stylesheet">
-    <link href="{{Msg "seo" "cdn"}}/css/dev2/reset_pc.css?v={{Msg "seo" "version"}}" rel="stylesheet">
-    <link rel="stylesheet" type="text/css" href="{{Msg "seo" "cdn"}}/pccss/public-nav-1200.css?v={{Msg "seo" "version"}}"/>
-    <script type="text/javascript" src="{{Msg "seo" "cdn"}}/js/public-nav.js?v={{Msg "seo" "version"}}"></script>
-
-    <link href="//cdn.bootcss.com/jquery-confirm/3.1.0/jquery-confirm.min.css" rel="stylesheet">
-    <script src="//cdn.bootcss.com/jquery-confirm/3.1.0/jquery-confirm.min.js"></script>
-
-    <title>我的订单</title>
-    <style type="text/css">
-        a{
-            text-decoration:none !important;
-        }
-        .glyphicon-question-sign:before {
-             content: "";
-         }
-
-        .inner > .err-box{
-            box-sizing: border-box;
-            padding: 67px 0 97px 0;
-            font-size: 16px;
-        }
-        .inner > .err-box > img{
-            width: 211px;
-            height: 169px;
-            display: block;
-            margin: 0 auto;
-        }
-        .inner > .err-box > span{
-            display: block;
-            text-align: center;
-            margin-top: 30px;
-        }
-	.pagination a {
-	    float: left;
-	    padding: 10px 9px;
-	    border: 1px solid #EBEBEB;
-	    margin-left: 0;
-	    text-decoration: none;
-	    /* border-bottom-left-radius: 4px; */
-	    border-radius: 4px;
-	}
-	.pagination span {
-	    float: left;
-	    width: 36px;
-	    height: 36px;
-	    line-height: 36px;
-	    text-align: center;
-	    color: #ffffff;
-	    background-color: #2cb7ca;
-	    margin: 0 10px;
-	    border-radius: 4px;
-	}
-	.disabled {
-	    cursor: not-allowed;
-	    color: #aea79f !important;
-	}
-	.nbprev i{
-		margin-right: 5px;
-	}
-	.nbnext i{
-		margin-left: 5px;
-	}
-	/**/
-	.pagination-box{
-		float: right;
-    	margin-top: 20px;
-        user-select: none;
-    }
-    .pagination-box button {
-        padding: 0 4px;
-        vertical-align: top;
-        display: inline-block;
-        font-size: 14px;
-        height: 36px;
-        line-height: 36px;
-        cursor: pointer;
-        box-sizing: border-box;
-        text-align: center;
-        margin: 0 5px;
-        background-color: #fff;
-        color: #606266;
-        min-width: 36px;
-        border-radius: 4px;
-        border:none;
-        outline: none;    
-		border: 1px solid #EBEBEB;
-    }
-    .pagination-box button.now {
-        background-color: #2cb7ca;
-        color: #fff;
-		border: 1px solid #2cb7ca !important;
-    }
-    .pagination-box button.stop {
-        background-color: #fff;
-        color: #aea79f;
-        cursor: not-allowed;
-    }
-	.pagination-box #prev{
-		    width: 78px;
-    		border: 1px solid #EBEBEB;
-	}
-	.pagination-box #prev i{
-		margin-right: 8px;
-	}
-	.pagination-box #next{
-		    width: 78px;
-    		border: 1px solid #EBEBEB;
-	}
-	.pagination-box #next i{
-		margin-left: 8px;
-	}
-</style>
-</head>
-<body style="background-color: #fff !important;">
-{{include "/common/pchead.html"}}
-<section id="drder" class="w">
-    <div class="tab-bar">
-        <ul class="tab clearfix">
-            <li class="active">全部</li>
-            <li>待付款</li>
-            <li>已完成</li>
-        </ul>
-    </div>
-    <div class="title-bar">
-        <ul class="clearfix">
-            <li>日期</li>
-            <li>关键词</li>
-            <li>数据量</li>
-            <li>数据规格</li>
-            <li>金额</li>
-            <li>状态</li>
-        </ul>
-    </div>
-    <div class="list">
-        <ul class="item clearfix">
-        </ul>
-        <ul class="item clearfix">
-        </ul>
-        <ul class="item clearfix">
-        </ul>
-    </div>
-	
-<!--分页
+	<head>
+		<meta charset="UTF-8">
+		<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+		<meta http-equiv="X-UA-Compatible" content="ie=edge">
+		<link rel="stylesheet" href="{{Msg "seo" "cdn"}}/dataExport/css/font_624651_bjdvktmum68.css?v={{Msg "seo" "version"}}">
+		<link rel="stylesheet" href="{{Msg "seo" "cdn"}}/dataExport/css/reset_pc.css?v={{Msg "seo" "version"}}">
+		<link rel="stylesheet" href="{{Msg "seo" "cdn"}}/dataExport/css/drder_details.css?v={{Msg "seo" "version"}}">
+
+		{{include "/common/pnc.html"}}
+		<link href="{{Msg "seo" "cdn"}}/css/pc.css?v={{Msg "seo" "version"}}" rel="stylesheet">
+		<link href="{{Msg "seo" "cdn"}}/css/dev2/reset_pc.css?v={{Msg "seo" "version"}}" rel="stylesheet">
+		<link rel="stylesheet" type="text/css" href="{{Msg "seo" "cdn"}}/pccss/public-nav-1200.css?v={{Msg "seo" "version"}}" />
+		<script type="text/javascript" src="{{Msg "seo" "cdn"}}/js/public-nav.js?v={{Msg "seo" "version"}}"></script>
+
+		<link href="//cdn.bootcss.com/jquery-confirm/3.1.0/jquery-confirm.min.css" rel="stylesheet">
+		<script src="//cdn.bootcss.com/jquery-confirm/3.1.0/jquery-confirm.min.js"></script>
+
+		<title>我的订单</title>
+		<style type="text/css">
+			a {
+				text-decoration: none !important;
+			}
+
+			.glyphicon-question-sign:before {
+				content: "";
+			}
+
+			.inner>.err-box {
+				box-sizing: border-box;
+				padding: 67px 0 97px 0;
+				font-size: 16px;
+			}
+
+			.inner>.err-box>img {
+				width: 211px;
+				height: 169px;
+				display: block;
+				margin: 0 auto;
+			}
+
+			.inner>.err-box>span {
+				display: block;
+				text-align: center;
+				margin-top: 30px;
+			}
+
+			.pagination a {
+				float: left;
+				padding: 10px 9px;
+				border: 1px solid #EBEBEB;
+				margin-left: 0;
+				text-decoration: none;
+				/* border-bottom-left-radius: 4px; */
+				border-radius: 4px;
+			}
+
+			.pagination span {
+				float: left;
+				width: 36px;
+				height: 36px;
+				line-height: 36px;
+				text-align: center;
+				color: #ffffff;
+				background-color: #2cb7ca;
+				margin: 0 10px;
+				border-radius: 4px;
+			}
+
+			.disabled {
+				cursor: not-allowed;
+				color: #aea79f !important;
+			}
+
+			.nbprev i {
+				margin-right: 5px;
+			}
+
+			.nbnext i {
+				margin-left: 5px;
+			}
+
+			/**/
+			.pagination-box {
+				float: right;
+				margin-top: 20px;
+				user-select: none;
+			}
+
+			.pagination-box button {
+				padding: 0 4px;
+				vertical-align: top;
+				display: inline-block;
+				font-size: 14px;
+				height: 36px;
+				line-height: 36px;
+				cursor: pointer;
+				box-sizing: border-box;
+				text-align: center;
+				margin: 0 5px;
+				background-color: #fff;
+				color: #606266;
+				min-width: 36px;
+				border-radius: 4px;
+				border: none;
+				outline: none;
+				border: 1px solid #EBEBEB;
+			}
+
+			.pagination-box button.now {
+				background-color: #2cb7ca;
+				color: #fff;
+				border: 1px solid #2cb7ca !important;
+			}
+
+			.pagination-box button.stop {
+				background-color: #fff;
+				color: #aea79f;
+				cursor: not-allowed;
+			}
+
+			.pagination-box #prev {
+				width: 78px;
+				border: 1px solid #EBEBEB;
+			}
+
+			.pagination-box #prev i {
+				margin-right: 8px;
+			}
+
+			.pagination-box #next {
+				width: 78px;
+				border: 1px solid #EBEBEB;
+			}
+
+			.pagination-box #next i {
+				margin-left: 8px;
+			}
+		</style>
+	</head>
+	<body style="background-color: #fff !important;">
+		{{include "/common/pchead.html"}}
+		<section id="drder" class="w">
+			<div class="tab-bar">
+				<ul class="tab clearfix">
+					<li class="active">全部</li>
+					<li>待付款</li>
+					<li>已完成</li>
+				</ul>
+			</div>
+			<div class="title-bar">
+				<ul class="clearfix">
+					<li>日期</li>
+					<li>关键词</li>
+					<li>数据量</li>
+					<li>数据规格</li>
+					<li>金额</li>
+					<li>状态</li>
+				</ul>
+			</div>
+			<div class="list">
+				<ul class="item clearfix">
+				</ul>
+				<ul class="item clearfix">
+				</ul>
+				<ul class="item clearfix">
+				</ul>
+			</div>
+
+			<!--分页
 	<div class="pagination clearfix w">
 		<div class="pagination-inner fr" style="margin-right:3px;">
 			<a class="nbprev disabled"  id="previousPage"><i><</i>上一页</a>
@@ -161,70 +176,97 @@
 			<a class="nbnext"  id="nextPage">下一页<i>></i></a>
 		</div>
 	</div>-->
-	<div class="pagination clearfix w">
-		<div class="pagination-box">
-		    
+			<div class="pagination clearfix w">
+				<div class="pagination-box">
+
+				</div>
+			</div>
+		</section>
+		<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
+			<div class="nav">
+				<ul class="list">
+					<li><a class="active wx" href="javascript:;">微信支付</a></li>
+					<li><a class="active ali" href="javascript:;">支付宝</a></li>
+				</ul>
+				<div class="pay">
+					<div class="price">
+						¥1208
+					</div>
+					<div class="qr_code">
+						<img src="/dataExport/image/code.png" alt="">
+					</div>
+					<div class="scanning">
+						<img src="/dataExport/image/wx_cm.jpg" alt="">
+						<p class="scan_text" id="paywaytip">使用手机微信扫描二维码支付</p>
+					</div>
+					<div class="footer">
+						<div class="tips">二维码过期倒计时:<span class="times">00:00:00 </span> | 如过期,请刷新页面重试</div>
+					</div>
+				</div>
+				<div class="close">
+					<img src="/dataExport/image/close.png" alt="">
+				</div>
+			</div>
 		</div>
-	</div>
-</section>
-<script type="text/javascript" src="{{Msg "seo" "cdn"}}/dataExport/js/pageination.ie.js?v={{Msg "seo" "version"}}"></script>
-{{include "/common/pcbottom.html"}}
-{{include "/common/baiducc.html"}}
-<script>
-	var totalPage = 1;
-	var pageNum =1;
-	/*
-	* el Dom节点
-	* show 索引数量
-	* total 数据总数
-	* size 每页条数
-	* now 当前索引
-	* click 点击事件
-	* */
-	var pageHtml = "<button name=\"back\" id=\"prev\"><i><</i>上一页</button><button name=\"min\">1</button><button name=\"prev\">...</button><button name=\"next\">...</button><button name=\"max\">100</button><button name=\"cont\" id=\"next\">下一页<i>></i></button>";
-	var show = 5;
-	var total = 20;
-	var size = 2;
-	var clickF = function clickF(number, type) {
-		var $Index = $(".tab-bar .tab li.active").index();
-		var $list = $(".list .item");
-        queryOrder($Index,$list,number);
-	};
-	var pageFlag = true;
-	var p = null; 
-    $(function () {
-        selcetIndexNav(4);
-        haslogin({{.T.logid}});
-
-        $("body").css("line-height","1");
-        $(".logo img").attr("src", "/images/swordfish/sf_01_new.png");
-        $(".public-nav").css("border-bottom", "1px solid #e0e0e0");
-        $("section[id='drder']").css("padding-top","107px");
-
-        /*设置关键词css*/
-        var $gjccss =  $(".list .gjc");
-        $gjccss.each(function (v,i) {
-            var $l = i.children.length;
-            var $h = 66;
-            i.style.height = ($h/$l)+'px';
-            i.style.lineHeight = ($h/$l)+'px';
-        });
-        //获取全部订单
-        queryOrder(0,$(".list .item").eq(0),pageNum);
-
-        $(".tab-bar .tab li").on("click",function () {
-            var $Index = $(this).index();
-            $(this).addClass("active").siblings().removeClass("active");
-            var $list = $(".list .item");
-            $list.eq($Index).show().siblings().hide();
-			pageNum = 1;
-			pageFlag= true;
-			p = null; 
-			$("#previousPage").addClass("disabled");
-			$("#nextPage").removeClass("disabled");
-            queryOrder($Index,$list,pageNum);
-        });
-		/*
+		<script type="text/javascript" src="{{Msg "seo" "cdn"}}/dataExport/js/pageination.ie.js?v={{Msg "seo" "version"}}"></script>
+		{{include "/common/pcbottom.html"}}
+		{{include "/common/baiducc.html"}}
+		<script>
+			var totalPage = 1;
+			var pageNum = 1;
+			/*
+			 * el Dom节点
+			 * show 索引数量
+			 * total 数据总数
+			 * size 每页条数
+			 * now 当前索引
+			 * click 点击事件
+			 * */
+			var pageHtml =
+				"<button name=\"back\" id=\"prev\"><i><</i>上一页</button><button name=\"min\">1</button><button name=\"prev\">...</button><button name=\"next\">...</button><button name=\"max\">100</button><button name=\"cont\" id=\"next\">下一页<i>></i></button>";
+			var show = 5;
+			var total = 20;
+			var size = 2;
+			var clickF = function clickF(number, type) {
+				var $Index = $(".tab-bar .tab li.active").index();
+				var $list = $(".list .item");
+				queryOrder($Index, $list, number);
+			};
+			var pageFlag = true;
+			var p = null;
+			$(function() {
+				selcetIndexNav(4);
+				haslogin({{.T.logid}});
+
+				$("body").css("line-height", "1");
+				$(".logo img").attr("src", "/images/swordfish/sf_01_new.png");
+				$(".public-nav").css("border-bottom", "1px solid #e0e0e0");
+				$("section[id='drder']").css("padding-top", "107px");
+
+				/*设置关键词css*/
+				var $gjccss = $(".list .gjc");
+				$gjccss.each(function(v, i) {
+					var $l = i.children.length;
+					var $h = 66;
+					i.style.height = ($h / $l) + 'px';
+					i.style.lineHeight = ($h / $l) + 'px';
+				});
+				//获取全部订单
+				queryOrder(0, $(".list .item").eq(0), pageNum);
+
+				$(".tab-bar .tab li").on("click", function() {
+					var $Index = $(this).index();
+					$(this).addClass("active").siblings().removeClass("active");
+					var $list = $(".list .item");
+					$list.eq($Index).show().siblings().hide();
+					pageNum = 1;
+					pageFlag = true;
+					p = null;
+					$("#previousPage").addClass("disabled");
+					$("#nextPage").removeClass("disabled");
+					queryOrder($Index, $list, pageNum);
+				});
+				/*
 		//点击上下页
 		$("#previousPage").on("click",function () {
 			if($(this).hasClass("disabled")){
@@ -259,227 +301,348 @@
         });
 		*/
 
-    })
-
-    var noDataHtml =
-                    "<div class=\"inner\">" +
-                    "<div class=\"err-box\">" +
-                    "<img src=\"/images/pc_12.png\" alt=\"暂无数据\">" +
-                    "<span>暂无数据</span>" +
-                    "</div>" +
-                    "</div>";
-
-    //ind 0-全部 1-待支付 2-已支付
-    function queryOrder(ind,objD,pageNum) {
-        $.ajax({
-            type: "post",
-            url: "/front/dataExport/queryOrder",
-            data: {"type":ind,
-				   "pageNum":pageNum
-			},
-            dataType: 'json',
-            success: function(data){
-                var temp = "";
-                if (data.list && data.list.length>0){
-					if (pageFlag){
-						$(".pagination-box").html(pageHtml);
-					 	p = new Page({
-						  	show: show,
-						  	total: data.count,
-						  	size: data.pageSize,
-						  	click: clickF
-						});
-						p.init();
-						pageFlag= false;
+			})
+
+			var noDataHtml =
+				"<div class=\"inner\">" +
+				"<div class=\"err-box\">" +
+				"<img src=\"/images/pc_12.png\" alt=\"暂无数据\">" +
+				"<span>暂无数据</span>" +
+				"</div>" +
+				"</div>";
+
+			//ind 0-全部 1-待支付 2-已支付
+			function queryOrder(ind, objD, pageNum) {
+				$.ajax({
+					type: "post",
+					url: "/front/dataExport/queryOrder",
+					data: {
+						"type": ind,
+						"pageNum": pageNum
+					},
+					dataType: 'json',
+					success: function(data) {
+						var temp = "";
+						if (data.list && data.list.length > 0) {
+							if (pageFlag) {
+								$(".pagination-box").html(pageHtml);
+								p = new Page({
+									show: show,
+									total: data.count,
+									size: data.pageSize,
+									click: clickF
+								});
+								p.init();
+								pageFlag = false;
+							}
+							$(".backTop").click();
+							for (var i = 0; i < data.list.length; i++) {
+								var obj = data.list[i];
+								var id = obj.id;
+								var orderCode = obj.order_code;
+								var publishTime = obj.filter_publishtime;
+								var spec = obj.data_spec;
+								var orderStatus = obj.order_status;
+								var orderMoney = obj.order_money;
+								var token = obj.token;
+								var payway = obj.pay_way;
+								var code = obj.code_url;
+								var publishTimeHtml = "";
+								var orderStatusHtml = "";
+								var cla = "";
+								var deleteOrderHtml = "";
+								var keysHtml = "";
+								var prepaytime = obj.prepay_time;
+								if (!publishTime) {
+									publishTime = "全部";
+									publishTimeHtml = "<span style=\"margin-left: 118px;\">" + publishTime + "</span>";
+								} else {
+									publishTimeHtml = "<span>" + publishTime + "</span>";
+								}
+								if (!orderMoney) {
+									orderMoney = 0;
+								}
+								if (!spec) {
+									spec = "";
+								}
+								if (orderStatus == 0) {
+									orderStatusHtml +=
+										"<p>待付款</p>" +
+										"<a class=\"xq\" onclick=\"toDetail('" + orderCode + "');\" target=\"_blank\">查看详情</a>" +
+										"<a class=\"pay\" orderCode='" + orderCode + "' money='" + orderMoney + "' payway='" + payway + "' code='" +
+										code + "' time='" + prepaytime + "' onclick=toPay(this)>去支付</a>";
+									cla = "nopay";
+									deleteOrderHtml = "<a class=\"fr iconfont  icon-shanchu\" title=\"删除订单\" onclick=\"deleteOrder(" + id +
+										",this)\"></a>";
+								} else if (orderStatus == 1) {
+									orderStatusHtml +=
+										"<p class=\"wc\">已完成</p>" +
+										"<a class=\"wcxq\" onclick=\"toDetail('" + orderCode + "');\" target=\"_blank\">查看详情</a>";
+									cla = "pay";
+									deleteOrderHtml = "<a class=\"fr iconfont  icon-shanchu\" title=\"删除订单\" onclick=\"deleteOrder(" + id +
+										",this)\"></a>";
+
+								}
+								if (obj.filter_keys && obj.filter_keys.split(",").length > 0) {
+									var height = 66;
+									var keysArr = obj.filter_keys.split(",");
+									var keysLen = keysArr.length;
+
+									if (keysLen > 2) {
+										keysLen = 2;
+										height = height / 3;
+									} else {
+										height = height / keysLen;
+									}
+									keysHtml += "<li class=\"gjc\" style=\"height: " + height + "px; line-height: " + height + "px;\">";
+									for (var j = 0; j < keysLen; j++) {
+										keysHtml += "<span>" + keysArr[j] + "</span>";
+									}
+									if (keysArr.length > 2) {
+										keysHtml += "<span>......</span>";
+									}
+									keysHtml += "</li>";
+								} else {
+									keysHtml += "<li class=\"gjc\" style=\"height: 66px; line-height: 66px;\">";
+									keysHtml += "</li>";
+								}
+
+								temp += "<li>" +
+									"<div class=\"info " + cla + "\">" +
+									"<span>" + obj.create_time + "</span>" +
+									"<span>订单号:" + orderCode + "</span>" +
+									"" + deleteOrderHtml + "" +
+									"</div>" +
+									"<div class=\"iner\">" +
+									"<ul class=\"clearfix\">" +
+									"<li class=\"clearfix\">" +
+									"<img src=\"/dataExport/image/historical_data.png\" alt=\"\">" +
+									"" + publishTimeHtml + "" +
+									"</li>" +
+									"" + keysHtml + "" +
+									"<li>" + obj.data_count + "条</li>" +
+									"<li>" + spec + "</li>" +
+									"<li>¥" + FormatNum(orderMoney) + "</li>" +
+									"<li>" + orderStatusHtml + "</li>" +
+									"</ul>" +
+									"</div>" +
+									"</li>";
+							}
+						} else {
+							temp = noDataHtml;
+						}
+						objD.eq(ind).html(temp);
+					},
+					error: function(xhr, type) {
+						console.log("query err");
 					}
-					$(".backTop").click();
-                    for (var i=0;i<data.list.length;i++){
-                        var obj = data.list[i];
-                        var id = obj.id;
-                        var orderCode = obj.order_code;
-                        var publishTime = obj.filter_publishtime;
-                        var spec = obj.data_spec;
-                        var orderStatus = obj.order_status;
-                        var orderMoney = obj.order_money;
-                        var token = obj.token;
-                        var publishTimeHtml = "";
-                        var orderStatusHtml =  "";
-                        var cla = "";
-                        var deleteOrderHtml = "";
-                        var keysHtml = "";
-
-                        if(!publishTime){
-                            publishTime = "全部";
-                            publishTimeHtml = "<span style=\"margin-left: 118px;\">" + publishTime + "</span>";
-                        }else{
-                            publishTimeHtml = "<span>" + publishTime + "</span>";
-                        }
-                        if(!orderMoney){
-                            orderMoney = 0;
-                        }
-                        if(!spec){
-                            spec = "";
-                        }
-                        if(orderStatus==0){
-                            orderStatusHtml +=
-                                    "<p>待付款</p>" +
-                                    "<a class=\"xq\" onclick=\"toDetail('" + orderCode + "');\" target=\"_blank\">查看详情</a>" +
-                                    "<a class=\"pay\" onclick=\"toPay('" + orderCode + "','" + token + "');\">去支付</a>";
-                            cla = "nopay";
-                            deleteOrderHtml = "<a class=\"fr iconfont  icon-shanchu\" title=\"删除订单\" onclick=\"deleteOrder(" + id + ",this)\"></a>";
-                        }else if(orderStatus==1){
-                            orderStatusHtml +=
-                                    "<p class=\"wc\">已完成</p>" +
-                                    "<a class=\"wcxq\" onclick=\"toDetail('" + orderCode + "');\" target=\"_blank\">查看详情</a>";
-                            cla = "pay";
-							deleteOrderHtml = "<a class=\"fr iconfont  icon-shanchu\" title=\"删除订单\" onclick=\"deleteOrder(" + id + ",this)\"></a>";
-
-                        }
-                        if(obj.filter_keys && obj.filter_keys.split(",").length>0){
-                            var height = 66;
-                            var keysArr = obj.filter_keys.split(",");
-                            var keysLen = keysArr.length;
-
-                            if (keysLen>2){
-                                keysLen = 2;
-                                height = height/3;
-                            }else{
-                                height = height/keysLen;
-                            }
-                            keysHtml += "<li class=\"gjc\" style=\"height: " + height + "px; line-height: " + height + "px;\">";
-                            for(var j=0;j<keysLen;j++){
-                                keysHtml += "<span>" + keysArr[j] + "</span>";
-                            }
-                            if(keysArr.length>2){
-                                keysHtml += "<span>......</span>";
-                            }
-                            keysHtml += "</li>";
-                        }else{
-                            keysHtml += "<li class=\"gjc\" style=\"height: 66px; line-height: 66px;\">";
-                            keysHtml += "</li>";
-                        }
-
-                        temp += "<li>" +
-                                "<div class=\"info " + cla + "\">" +
-                                "<span>" + obj.create_time + "</span>" +
-                                "<span>订单号:" + orderCode + "</span>" +
-                                "" + deleteOrderHtml + "" +
-                                "</div>" +
-                                "<div class=\"iner\">" +
-                                "<ul class=\"clearfix\">" +
-                                "<li class=\"clearfix\">" +
-                                "<img src=\"/dataExport/image/historical_data.png\" alt=\"\">" +
-                                "" + publishTimeHtml + "" +
-                                "</li>" +
-                                "" + keysHtml + "" +
-                                "<li>" + obj.data_count + "条</li>" +
-                                "<li>" + spec + "</li>" +
-                                "<li>¥" + FormatNum(orderMoney) + "</li>" +
-                                "<li>" + orderStatusHtml + "</li>" +
-                                "</ul>" +
-                                "</div>" +
-                                "</li>";
-                    }
-                }else{
-                      temp = noDataHtml;
-                }
-                objD.eq(ind).html(temp);
-            },
-            error: function(xhr, type){
-                console.log("query err");
-            }
-        });
-    }
-
-    function deleteOrder(id,obj) {
-        $.confirm({
-            title: '订单删除',
-            content: '您确定要删除该订单吗?',
-            buttons: {
-                ok: {
-                    text: '确认',
-                    btnClass: 'btn-primary-0',
-                    action: function() {
-                        $.ajax({
-                            type: "post",
-                            url: "/front/dataExport/deleteOrder",
-                            data: {"id":id},
-                            dataType: 'json',
-                            success: function(data){
-                                if(data && data["success"]){
-                                    var self = $(obj).parent().parent();
-                                    var parent = self.parent();
-                                    self.remove();
-                                    $.alert({
-                                        title:"",
-                                        content:"删除成功!",
-                                        buttons: {
-                                            ok: {
-                                                text: '确认',
-                                                btnClass: 'btn-primary-0',
-                                                action: function() {
-                                                    if(parent.children("li").length==0){
-                                                        parent.html(noDataHtml);
-                                                    }
-                                                }
-                                            }
-                                        }
-                                    });
-                                }else{
-                                    alertS("删除失败,请联系管理员!");
-                                }
-                            },
-                            error: function(xhr, type){
-                                console.log("delete err");
-                            }
-                        });
-                    }
-                },
-                cancel: {
-                    text: '取消',
-                    btnClass: 'btn-primary-0'
-                }
-            }
-        });
-    }
-
-    function alertS(content) {
-        $.alert({
-            title:"",
-            content:content,
-            buttons: {
-                ok: {
-                    text: '确认',
-                    btnClass: 'btn-primary-0'
-                }
-            }
-        });
-    }
-
-    function toDetail(orderCode) {
-        window.open("/front/dataExport/toOrderDetail/"+orderCode);
-    }
-
-    function toPay(orderCode,token) {
-        window.location.href = "/dataExport/sacnPay/waitPay?code="+orderCode+"&token="+token;
-    }
-
-    function FormatNum(n){
-        var isF = /^-?\d*\.\d+$/.test(n);
-        var n2 = "";
-        if(isF){
-            var t = n+"";
-            n2 = t.substr(t.indexOf("."));
-            n = parseInt(n);
-        }
-        if(n>=1000){
-            n = Math.floor(n/1000)+","+("0000"+n%1000).slice(-3);
+				});
+			}
+
+			function deleteOrder(id, obj) {
+				$.confirm({
+					title: '订单删除',
+					content: '您确定要删除该订单吗?',
+					buttons: {
+						ok: {
+							text: '确认',
+							btnClass: 'btn-primary-0',
+							action: function() {
+								$.ajax({
+									type: "post",
+									url: "/front/dataExport/deleteOrder",
+									data: {
+										"id": id
+									},
+									dataType: 'json',
+									success: function(data) {
+										if (data && data["success"]) {
+											var self = $(obj).parent().parent();
+											var parent = self.parent();
+											self.remove();
+											$.alert({
+												title: "",
+												content: "删除成功!",
+												buttons: {
+													ok: {
+														text: '确认',
+														btnClass: 'btn-primary-0',
+														action: function() {
+															if (parent.children("li").length == 0) {
+																parent.html(noDataHtml);
+															}
+														}
+													}
+												}
+											});
+										} else {
+											alertS("删除失败,请联系管理员!");
+										}
+									},
+									error: function(xhr, type) {
+										console.log("delete err");
+									}
+								});
+							}
+						},
+						cancel: {
+							text: '取消',
+							btnClass: 'btn-primary-0'
+						}
+					}
+				});
+			}
+
+			function alertS(content) {
+				$.alert({
+					title: "",
+					content: content,
+					buttons: {
+						ok: {
+							text: '确认',
+							btnClass: 'btn-primary-0'
+						}
+					}
+				});
+			}
+
+			function toDetail(orderCode) {
+				window.open("/front/dataExport/toOrderDetail/" + orderCode);
+			}
+
+			function FormatNum(n) {
+				var isF = /^-?\d*\.\d+$/.test(n);
+				var n2 = "";
+				if (isF) {
+					var t = n + "";
+					n2 = t.substr(t.indexOf("."));
+					n = parseInt(n);
+				}
+				if (n >= 1000) {
+					n = Math.floor(n / 1000) + "," + ("0000" + n % 1000).slice(-3);
+				}
+				return n + n2;
+			}
+
+			function nextPage() {
+				queryOrder()
+			}
+			var listIndex;
+			var orderCode = "";
+			var price = "";
+			var payway = "";
+			var code = "";
+			var prepaytime = "";
+
+			var interval //计时
+			var interval_t = 0;
+
+			//获取支付二维码
+			function toPay(obj) {
+				orderCode = $(obj).attr("orderCode");
+				price = $(obj).attr("money");
+				payway = $(obj).attr("payway");
+				code = $(obj).attr("code");
+				prepaytime = $(obj).attr("time");
+				listIndex = $(obj).parents(".iner").parents("li").index()
+				if (!orderCode || !payway || !code || !price || !prepaytime) {
+					return
+				}
+				var t = new Date(prepaytime).getTime() + 2 * 60 * 60 * 1000 - new Date().getTime()
+				if (t < 0) { //二维码超时
+					$.post("/dataexport/getOrderPayMsg", {
+						payway: payway,
+						orderCode: orderCode,
+						prepaytime: prepaytime
+					}, function(r) {
+						if (r.success) {
+							showCode(payway, price, r.payUrl, r.prepay_time);
+							$(obj).attr("time", r.prepay_time);
+						}
+					})
+				}else{
+  				showCode(payway, price, code, prepaytime)
         }
-        return n+n2;
-    }
-	function nextPage(){
-		queryOrder()
-	}
-</script>
-</body>
-</html>
+			}
+
+			//支付方式切换
+			$("#myModal .active").on("click", function() {
+				if ($(this).hasClass("underline")) {
+					return
+				}
+				clearInterval(interval);
+				$(this).addClass("underline").parent('li').siblings().children().removeClass("underline");
+				payway = "微信"
+				if ($(this).text() == "支付宝") {
+					payway = "支付宝"
+				}
+				$.post("/dataexport/getOrderPayMsg", {
+					payway: payway,
+					orderCode: orderCode,
+					prepaytime: prepaytime
+				}, function(r) {
+					if (r.success) {
+						showCode(payway, price, r.payUrl, r.prepay_time);
+						$(".item.clearfix>li:eq(" + listIndex + ")").find(".pay").attr("time", r.prepay_time).attr("payway", payway).attr(
+							"code", r.payUrl);
+					}
+				})
+			})
+
+			//展示支付码
+			function showCode(payway, price, code, prepaytime) {
+				var t = new Date(prepaytime).getTime() + 2 * 60 * 60 * 1000 - new Date().getTime()
+				$("#myModal .price").text("¥" + price);
+				interval_t = parseInt(t / 1000);
+				if (payway == "微信") {
+					$("#myModal .active:eq(0)").addClass("underline").parent('li').siblings().children().removeClass("underline");
+					$("#myModal .qr_code").html("<img src='data:image/png;base64," + code + "'>");
+					$("#paywaytip").text("使用手机微信扫描二维码支付");
+				} else {
+					$("#myModal .active:eq(1)").addClass("underline").parent('li').siblings().children().removeClass("underline");
+					$("#myModal .qr_code").html("<iframe id='alicode' src='" + code +
+						"' style='width: 300px;height:280px;border:none;padding-left: 34px;padding-top: 11px;'></iframe>");
+					$("#paywaytip").text("使用手机支付宝扫描二维码支付");
+				}
+				interval = setInterval(function() {
+					var h = Math.floor(interval_t / 60 / 60 % 24);
+					var m = Math.floor(interval_t / 60 % 60);
+					var s = Math.floor(interval_t % 60);
+					var text = "";
+					if (h > 0) {
+						text += PrefixInteger(h, 2) + ":";
+					}
+					if (m > 0) {
+						text += PrefixInteger(m, 2) + ":";
+					}
+					text += PrefixInteger(s, 2);
+					$("#myModal .times").text(text);
+					if (interval_t <= 0) {
+						clearInterval(interval);
+					}
+					interval_t--;
+					//查询支付知否完成
+					if (interval_t % 3 == 0) {
+						$.post("/dataExport/pay/isPaySuccess", {
+							code: orderCode
+						}, function(r) {
+							if (r.status == "y") {
+								window.location.href = "/front/dataExport/toOrderDetail/" + orderCode;
+							}
+						})
+					}
+				}, 1000);
+				$("#myModal").modal("show");
+			}
+
+			function PrefixInteger(num, length) {
+				return ("00" + num).substr(-length);
+			}
+
+			$("#myModal .close").on("click", function() {
+				$("#myModal").modal("hide");
+				clearInterval(interval);
+			});
+		</script>
+	</body>
+</html>