forked from php-danfu.shenzhenbenwo.com

lefengyang
2025-09-10 9753a88eceb52a0f2e3084cf72f3474d2d7d7f1b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<!DOCTYPE html>
<html lang="en">
 
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="referrer" content="origin">
    <meta name="viewport"
        content="width=device-width, viewport-fit=cover, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <title>支付完成</title>
    <script type="text/javascript" charset="UTF-8" src="https://wx.gtimg.com/pay_h5/goldplan/js/jgoldplan-1.0.0.js">
    </script>
    <script type="text/javascript" src="https://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
 
    <style>
        body {
            font-family: PingFang SC, "Helvetica Neue", Arial, sans-serif;
        }
 
        .order_box {
            text-align: center;
        }
 
        .order_box .bussiness_avt img {
            width: 68px;
            height: 68px;
            border-radius: 100%;
            border: 1px solid #E0E0E0;
        }
 
        .b_name {
            font-size: 14px;
            font-weight: 500;
            color: #333333;
            margin-top: 6px;
        }
 
        .col_box {
            margin-top: 35px;
        }
 
        .col_box .col {
            display: -webkit-box;
            display: -ms-flexbox;
            display: -webkit-flex;
            display: flex;
            -webkit-box-align: center;
            -ms-flex-align: center;
            -webkit-align-items: center;
            align-items: center;
            -webkit-box-pack: justify;
            -ms-flex-pack: justify;
            -webkit-justify-content: space-between;
            justify-content: space-between;
            font-size: 14px;
            color: #333;
            margin-bottom: 14px;
        }
 
        .col .ct.price {
            color: #E61515
        }
 
        .btns {
            display: -webkit-box;
            display: -ms-flexbox;
            display: -webkit-flex;
            display: flex;
            -webkit-box-pack: justify;
            -ms-flex-pack: justify;
            -webkit-justify-content: space-between;
            justify-content: space-between;
            margin-top: 31px;
        }
 
        .btns .btn {
            width: 100%;
            height: 35px;
            line-height: 35px;
            font-size: 14px;
            border-radius: 39px;
            border: 1px solid #CD2314;
            box-sizing: border-box;
            color: #CD2314;
        }
 
        .btns .btn.detail {
 
            background: linear-gradient(270deg, #D51010 0%, #EF4D2D 100%);
            color: #fff;
        }
    </style>
</head>
 
<body>
    <div class="order_box">
        <div class="bussiness_avt">
            <img id="b_avt" src="" alt="">
        </div>
        <div class="b_name" id="b_name">
 
        </div>
        <div class="col_box">
            <div class="col">
                <div class="lab">产品名称</div>
                <div id="p_name" class="ct">产品名称</div>
            </div>
            <div class="col">
                <div class="lab">实付金额</div>
                <div id="price" class="ct price">¥</div>
            </div>
        </div>
        <div class="btns">
            <!-- <div id="backHome" class="btn home">返回首页</div> -->
            <div id="toOrder" class="btn detail">查看详情</div>
        </div>
    </div>
 
    <script>
        //获取返回页面参数
        function getQueryString(name) {
            var query = window.location.search.substring(1);
            var vars = query.split("&");
            for (var i = 0; i < vars.length; i++) {
                var pair = vars[i].split("=");
                if (pair[0] == name) {
                    return pair[1];
                }
            }
            return null;
        };
        //获取参数
        var sub_mch_id = getQueryString("sub_mch_id"); //特约商户号
        console.log("sub_mch_id is " + sub_mch_id)
        var out_trade_no = getQueryString("out_trade_no"); //商户订单号
        console.log("out_trade_no is " + out_trade_no)
        var check_code = getQueryString("check_code"); //md5 校验码
        console.log("check_code is " + check_code)
 
 
 
        $.ajax({
            type: "GET",
            url: window.location.protocol + "//" + window.location.host + "/api/service_pay_result",
            data: {
                sub_mch_id: sub_mch_id,
                out_trade_no: out_trade_no
            },
            dataType: "json",
            success: function (data) {
                console.log(data)
                if (data.msg == "success") {
                    var info = data.data;
                    const img = document.getElementById('b_avt');
                    img.src = info.site_logo
                    $("#b_name").html(info.site_name)
                    $("#p_name").html(info.goods_name)
                    $("#price").html(info.pay_price)
                    //初始化小票
                    var initData = {
                        action: 'onIframeReady',
                        displayStyle: 'SHOW_CUSTOM_PAGE'
                    }
                    var initPostData = JSON.stringify(initData)
                    parent.postMessage(initPostData, 'https://payapp.weixin.qq.com')
 
                    //注册点击事件(去详情)
                    document.getElementById("toOrder").onclick = () => {
                        var mchData = {
                            action: 'jumpOut',
                            jumpOutUrl: info.jump_url //跳转的页面
                        }
                        var postData = JSON.stringify(mchData)
                        parent.postMessage(postData, 'https://payapp.weixin.qq.com')
                    }
                }
 
            }
        });
    </script>
</body>
 
</html>