# -*- coding: utf-8 -*-
# 支付类


class PaymentService:

    # 返回支付失败html内容
    @staticmethod
    def get_pay_error_content():
        return '''
<!DOCTYPE html>
<html>
<head>
	<!--浏览器不缓存-->
	<meta http-equiv="Pragma" content="no-cache">
	<meta http-equiv="Cache-Control" content="no-cache">
	<meta http-equiv="Expires" content="0">
	<!--utf-8-->
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <!-- viewport的<meta>标签，这个标签可以修改在大部分的移动设备上面的显示，为了确保适当的绘制和触屏缩放。-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="https://test.zositechc.cn/web/images/favicon.ico" type="image/x-icon"  charset="utf-8"/>
    <title>Trading particulars</title>
    <style>
    	.title_head{
    		height: 50px;
    		border-radius: 5px;
    		background-color: #c3c6c7;
    		text-align: center;
    		line-height: 50px;
    	}
    	.content{
    		text-align: center;
    		margin-top: 50px;
    		font-size: 20px;
    		color : #ec7648
    	}
    	.content_img{
    		width: 60px;
    		height: 60px;
    	}
    	.bottom{
    		 margin-bottom: 10px;
    		 margin-top: 250px;
    		 color : #ec7648
    	}
    	.bottom_div{
    		border: 1px solid #ec7648;
    		line-height: 38px;
    		text-align: center;
    		width: 100px;
    		height: 38px;
    		border-radius: 5px;
    	}

    	.bottom_div:hover{
    		background-color: #dde4e2;
    	}
    </style>
</head>
<body>
	<div class="title_head">Trading particulars</div>
    <div class="content">
    	<p >
    		<img src="https://test.zositechc.cn/web/images/failed.jpg" class="content_img">
    		<br />
    		Payment failure
    	</p>
    </div>
    <center class="bottom">
    	<div class="bottom_div" onclick="payOKButton()">
    	 Finish
    	</div>
    </center>
    <script> 	    // 点击付款成功按钮
    function payOKButton() {
        // 复杂数据
        console.log('success')
        window.location.href="https://www.baidu.com?page=closePage";
    }
	</script>
</body>
</html>
                '''

    # 返回支付成功html内容
    @staticmethod
    def get_pay_ok_content(lang, pay_type):
        title = "支付成功"
        complete = '完成'
        if lang == 'cn':
            if pay_type == "10":
                title = "体验成功"
            if pay_type == "11":
                title = "兑换成功"
        else:
            title = "Payment successful"
            complete = 'complete'
            if pay_type == "10":
                title = "Successful experience"
            if pay_type == "11":
                title = "Successful exchange"

        return '''
        <html>
        <head>
                <!--浏览器不缓存-->
                <meta http-equiv="Pragma" content="no-cache">
                <meta http-equiv="Cache-Control" content="no-cache">
                <meta http-equiv="Expires" content="0">
                <!--utf-8-->
            <meta http-equiv="content-type" content="text/html;charset=utf-8">
            <!-- viewport的<meta>标签，这个标签可以修改在大部分的移动设备上面的显示，为了确保适当的绘制和触屏缩放。-->
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <link rel="shortcut icon" href="https://test.zositechc.cn/web/images/favicon.ico" type="image/x-icon" charset="utf-8">
            <title>''' + title + '''</title>
            <style>
                    .title_head{
                            height: 50px;
                            border-radius: 5px;
                            background-color: #c3c6c7;
                            text-align: center;
                            line-height: 50px;
                    }
                    .content{
                            text-align: center;
                            margin-top: 50px;
                            font-size: 15px;
                            color:#0000008A;

                    }
                    .content_img{
        					margin-bottom:15px;
                            width: 60px;
                            height: 60px;
                    }
                    .bottom{
                             margin-bottom: 10px;
                             margin-top: 250px;
                             color : white;
                    }
                    .bottom_div{
                            border: 1px solid #68c9c5;
                            line-height: 38px;
                            text-align: center;
                            width: 100px;
                            height: 38px;
                            border-radius: 30px;
        					background-color:#68c9c5;
                    }

                    .bottom_div:hover{
                            background-color: #dde4e2;
                    }
            </style>
        </head>
        <body style="" rlt="1" inmaintabuse="true">

            <div class="content">
                    <p>
        					<img src="https://test.zositechc.cn/web/images/success.png" class="content_img">
                            <br>
                            ''' + title + '''
                    </p>
            </div>
            <center class="bottom">
                    <div class="bottom_div" onclick="payOKButton()">
                     ''' + complete + '''
                    </div>
            </center>
            <script src="//hm.baidu.com/hm.js?eaa57ca47dacb4ad4f5a257001a3457c"></script><script>             // 点击付款成功按钮
            function payOKButton() {
                // 复杂数据
                console.log('success')
                window.location.href="https://www.baidu.com?page=closePage"
            }
                </script>


                <div id="qds" style="display:none;"></div></body></html>
                '''
