123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533 |
- <!DOCTYPE html>
- <html>
- <head>
- @include('home.soft.common.head')
- <style>
- /* 会员中心 */
- .vip-model {
- display: flex;
- flex-wrap: nowrap;
- justify-content: flex-start;
- }
- .v-left {
- width: 160px;
- border-right: 1px solid #ddd;
- text-align: center;
- }
- .v-left .v-name {
- font-size: 16px;
- font-weight: 600;
- margin-bottom: 10px;
- }
- .v-left .v-logo {
- width: 100px;
- height: 100px;
- border-radius: 100px;
- border: 1px solid #ddd;
- }
- .v-left .vip-interest {
- margin: 20px 0;
- line-height: 2.8;
- }
- .v-left .vip-title {
- font-size: 24px;
- font-weight: 600;
- color: #ed4014;
- }
- .v-right {
- flex: 1;
- padding-left: 16px;
- }
- .vip-list {
- display: flex;
- flex-wrap: nowrap;
- justify-content: space-between;
- }
- .vip-list .vip-item {
- width: 130px;
- border: 1px solid #ddd;
- border-radius: 10px;
- text-align: center;
- padding-bottom: 10px;
- cursor: pointer;
- margin-bottom: 12px;
- }
- .vip-list .active {
- border: 1px solid #e12424;
- }
- .vip-list .vip-name {
- font-size: 18px;
- line-height: 50px;
- background-color: #eee;
- border-top-left-radius: 10px;
- border-top-right-radius: 10px;
- border-bottom: 1px solid #ddd;
- }
- .vip-list .vip-price {
- font-size: 14px;
- color: #666;
- }
- .vip-list .vip-market-price {
- margin-left: 10px;
- text-decoration: line-through;
- }
- .vip-list .price-value {
- color: #e12424;
- font-size: 22px;
- font-weight: 600;
- margin-left: 3px;
- }
- .vip-list .vip-desc {
- color: #999;
- font-size: 12px;
- }
- .vip-list .vip-red {
- color: #e12424;
- font-weight: 600;
- }
- .vip-tips {
- color: #999;
- font-size: 12px;
- margin-bottom: 12px;
- }
- .pay-line, .pay-type {
- display: flex;
- flex-wrap: nowrap;
- justify-content: flex-start;
- line-height: 35px;
- }
- .pay-item {
- border: 1px solid #ddd;
- padding: 0 15px;
- border-radius: 5px;
- cursor: pointer;
- height: 35px;
- margin-right: 15px;
- }
- .pay-type .active {
- border: 1px solid #e12424;
- color: #e12424;
- }
- .pay-item .iconfont {
- margin-right: 5px;
- }
- .pay-item .icon-zhifubaozhifu {
- color: #027AFF;
- }
- .pay-item .icon-weixinzhifu {
- color: #62b900;
- }
- .pay-cont {
- padding: 10px 0;
- display: flex;
- flex-wrap: nowrap;
- justify-content: flex-start;
- }
- .pay-cont .pay-img {
- width: 200px;
- height: 200px;
- background-color: #eee;
- position: relative;
- }
- .pay-cont .pay-desc {
- padding: 20px;
- line-height: 3;
- font-size: 16px;
- }
- .pay-cont .iconfont {
- vertical-align: middle;
- font-size: 16px;
- margin: 0 5px 0 10px;
- }
- .iconfont {
- vertical-align: middle;
- }
- .dis-agreement {
- text-align: center;
- height: 240px;
- line-height: 240px;
- font-size: 18px;
- font-weight: 600;
- color: #ed4014;
- }
- .pay-agreement span {
- font-size: 12px;
- color: #999;
- margin: 0 !important;
- }
- .agreement-txt {
- cursor: pointer;
- }
- .agreement-txt:hover {
- color: #ed4014;
- }
- .money-color {
- color: #ed4014;
- font-size: 18px;
- font-weight: 600;
- }
- .vip-banner {
- background-color: #eee;
- height: 60px;
- width: 100%;
- margin-bottom: 15px;
- }
- </style>
- </head>
- <body>
- <div class="vip-model">
- <div class="v-left">
- <img src="{{ $userInfo->avatar ?: "/static/logo/logo_small.png"}}" class="v-logo"/>
- <p class="v-name">{{ $userInfo->username }}</p>
- @if($billInfo['validity_type'] == 2)
- <p>会员: 永久有效</p>
- @elseif($billInfo['validity_type'] == 1)
- <p>会员有效期</p>
- <p>
- {{ $billInfo['validity_end_time'] }}
- </p>
- @else
- <p>会员: 无</p>
- @endif
- <div class="vip-interest">
- <p class="vip-title">会员专享</p>
- <p>1、会员特权</p>
- <p>2、批量转换</p>
- <p>3、专属客服</p>
- <p>4、次数不限</p>
- </div>
- </div>
- <div class="v-right">
- @if(isset($ad) && $ad->logo)
- <div class="vip-banner">
- <img src="{{$ad->logo}}" style="width: 100%; height: 100%;"/>
- </div>
- @endif
- <div class="vip-list">
- @if($productInfo && $productInfo->price4)
- <div id="vip_item4" class="vip-item active" onclick="selectTerm(4,{{ $productInfo->price4 }})">
- <div class="vip-name">永久</div>
- <div>
- <p class="vip-price">
- ¥<span class="price-value">{{ $productInfo->price4 }}</span>
- @if($productInfo->market_price4)
- <span class="vip-market-price">{{ $productInfo->market_price4 }}</span>
- @endif
- </p>
- <p class="vip-desc vip-red">
- {{ $productInfo->desc_price4 ?: "超划算,热销中" }}
- </p>
- </div>
- </div>
- @endif
- @if($productInfo->price1)
- <div id="vip_item1" class="vip-item" onclick="selectTerm(1,{{ $productInfo->price1 }})">
- <div class="vip-name">一个月</div>
- <div>
- <p class="vip-price">
- ¥<span class="price-value">{{ $productInfo->price1 }}</span>
- @if($productInfo->market_price1)
- <span class="vip-market-price">¥{{ $productInfo->market_price1 }}</span>
- @endif
- </p>
- <p class="vip-desc vip-red">
- {{ $productInfo->desc_price1 ?: "有效期一个月" }}
- </p>
- </div>
- </div>
- @endif
- @if($productInfo->price2)
- <div id="vip_item2" class="vip-item" onclick="selectTerm(2,{{ $productInfo->price2 }})">
- <div class="vip-name">半年</div>
- <div>
- <p class="vip-price">
- ¥<span class="price-value">{{ $productInfo->price2 }}</span>
- @if($productInfo->market_price2)
- <span class="vip-market-price">¥{{ $productInfo->market_price2 }}</span>
- @endif
- </p>
- <p class="vip-desc">
- {{ $productInfo->desc_price2 ?: "有效期半年" }}
- </p>
- </div>
- </div>
- @endif
- @if($productInfo->price3)
- <div id="vip_item3" class="vip-item" onclick="selectTerm(3,{{ $productInfo->price3 }})">
- <div class="vip-name">一年</div>
- <div>
- <p class="vip-price">
- ¥<span class="price-value">{{ $productInfo->price3 }}</span>
- @if($productInfo->market_price3)
- <span class="vip-market-price">¥{{ $productInfo->market_price3 }}</span>
- @endif
- </p>
- <p class="vip-desc">
- {{ $productInfo->desc_price3 ?: "有效期一年" }}
- </p>
- </div>
- </div>
- @endif
- </div>
- <p class="vip-tips">温馨提示:VIP会员到期后将直接转为非VIP会员</p>
- <p class="pay-line">
- 支付金额:<span id="payMoney" class="money-color">0</span>元
- </p>
- <div class="pay-line">
- <p>支付方式:</p>
- <div class="pay-type">
- <div id="payWechat" class="pay-item active" onclick="selectPaytype('wechat')">
- <span class="iconfont icon-weixinzhifu"></span>微信支付
- </div>
- <div id="payAlipay" class="pay-item" onclick="selectPaytype('alipay')">
- <span class="iconfont icon-zhifubaozhifu"></span>支付宝支付
- </div>
- </div>
- <div class="pay-agreement">
- <label>
- <input disabled type="checkbox" checked/>
- </label>
- <span>同意并接受</span>
- <span class="agreement-txt" onclick="agreementModel = true">《软件会员增值服务协议》</span>
- </div>
- </div>
- <div class="pay-cont">
- <div class="spinner-border m-5" role="status" id="spinnerShow">
- <span class="visually-hidden">Loading...</span>
- </div>
- <div id="qrcode" class="pay-img" style="display: none"></div>
- <div class="pay-desc">
- <div>
- 1、<span class="iconfont icon-saoma1"></span> 请打开微信扫一扫
- </div>
- <div>
- 2、<span class="iconfont icon-erweima1"></span> 扫描左侧二维码
- </div>
- <div>
- 3、<span class="iconfont icon-wancheng1"></span> 请完成支付
- </div>
- </div>
- </div>
- <template>
- <div class="dis-agreement">请同意服务协议后方可购买产品</div>
- </template>
- </div>
- </div>
- <script>
- let buyContext;
- let target = '{{ $target }}';
- let agentMid = '{{$agentMid}}';
- let token = '{{$token}}';
- let pay_type = "wechat";
- let sku_type = 4;
- let pmid = "{{ $productInfo->mid }}";
- // 设置允许跨域
- axios.defaults.withCredentials = false;
- // 初始化
- function init() {
- if (typeof qt != 'undefined') {
- new QWebChannel(qt.webChannelTransport, function (channel) {
- buyContext = channel.objects.buyChannel;
- // 显示图片
- buyContext.sendQrcodeStrSignal.connect(function (base64Str) {
- document.getElementById('qrcode').innerHTML = '<img src="data:image/jpg;base64,' + base64Str + '" style="width:100%;height:100%" alt=""/>'
- })
- }
- );
- } else {
- // alert("qt对象获取失败!");
- }
- }
- init();
- // 默认金额
- document.getElementById("payMoney").innerText = "{{ $productInfo->price4 }}"
- function selectTerm(type, price) {
- sku_type = type;
- document.getElementById("payMoney").innerText = price
- // 其他的去除
- let vipItem1 = document.getElementById("vip_item1").getAttribute("class").replace("active", " ");
- document.getElementById("vip_item1").setAttribute("class", vipItem1);
- let vipItem2 = document.getElementById("vip_item2").getAttribute("class").replace("active", " ");
- document.getElementById("vip_item2").setAttribute("class", vipItem2);
- let vipItem3 = document.getElementById("vip_item3").getAttribute("class").replace("active", " ");
- document.getElementById("vip_item3").setAttribute("class", vipItem3);
- let vipItem4 = document.getElementById("vip_item4").getAttribute("class").replace("active", " ");
- document.getElementById("vip_item4").setAttribute("class", vipItem4);
- let classVal = document.getElementById("vip_item" + type).getAttribute("class");
- document.getElementById("vip_item" + type).setAttribute("class", classVal.concat(" active"))
- //创建支付二维码
- createPayCode();
- }
- // 创建支付二维码
- createPayCode();
- function createPayCode() {
- document.getElementById('spinnerShow').style.display = ""
- document.getElementById("qrcode").innerHTML = ""
- document.getElementById('qrcode').style.display = "none"
- let data = {
- agent_mid: agentMid,
- type: sku_type,
- pay_type: pay_type
- }
- axios.post(target + '/api/pay/getPayCode/' + pmid, data, {headers: {Authorization: token}}).then(function (response) {
- if (!response.data.error) {
- let code = response.data.result;
- createQrcode(code);
- }
- }).catch(function (error) {
- console.log(error);
- });
- }
- // 设置支付类型
- function selectPaytype(type) {
- pay_type = type
- if (type === 'wechat') {
- let str = document.getElementById("payAlipay").getAttribute("class").replace("active", " ")
- document.getElementById("payAlipay").setAttribute("class", str);
- let classVal = document.getElementById("payWechat").getAttribute("class");
- document.getElementById("payWechat").setAttribute("class", classVal.concat(" active"))
- } else {
- let str = document.getElementById("payWechat").getAttribute("class").replace("active", " ");
- document.getElementById("payWechat").setAttribute("class", str);
- let classVal = document.getElementById("payAlipay").getAttribute("class");
- document.getElementById("payAlipay").setAttribute("class", classVal.concat(" active"))
- }
- //创建支付二维码
- createPayCode();
- }
- // 创建二维码
- function createQrcode(code) {
- if (typeof buyContext == 'undefined') {
- // alert("context对象获取失败!");
- } else {
- buyContext.getQrcode("https://www.qasimblog.com/soft/pay/" + code);
- }
- document.getElementById('qrcode').style.display = ""
- document.getElementById('spinnerShow').style.display = "none"
- // 开始检测支付扫描
- startScan(code);
- }
- let payScanInterval;
- let payEndInterval;
- function startScan(code) {
- if (payScanInterval) {
- clearInterval(payScanInterval);
- }
- if (payEndInterval) {
- clearInterval(payEndInterval);
- }
- payScanInterval = setInterval(() => {
- axios.post(target + '/api/pay/checkPayScan/' + code, {}, {headers: {Authorization: token}}).then((response) => {
- if (!response.data.error) {
- // 提示消息,扫描成功
- // 开始检测支付
- clearInterval(payScanInterval);
- startCheckPayEnd(code);
- }
- }).catch(function (error) {
- console.log(error);
- });
- }, 1000);
- }
- // 开始检测支付
- function startCheckPayEnd(code) {
- if (payEndInterval) {
- clearInterval(payEndInterval);
- }
- payEndInterval = setInterval(() => {
- axios.post(target + '/api/pay/checkPayEnd/' + code, {product_type: 1}, {headers: {Authorization: token}}).then((response) => {
- if (!response.data.code === 0 || !response.data.error) {
- // 关闭定时器
- clearInterval(payEndInterval);
- // 支付完成
- if (typeof buyContext == 'undefined') {
- // alert("context对象获取失败!");
- } else {
- buyContext.setPaySuccess();
- }
- }
- }).catch(function (error) {
- console.log(error);
- });
- }, 1000);
- }
- </script>
- </body>
- </html>
|