886 lines
46 KiB
Smarty
Executable File
886 lines
46 KiB
Smarty
Executable File
{include file='user/header.tpl'}
|
||
|
||
<style>
|
||
.banner {
|
||
border-radius: 10px;
|
||
background-color: #007bff; /* 设置背景色 */
|
||
padding: 1rem; /* 增加填充空间 */
|
||
margin-bottom: 1rem; /* 设置底部间距 */
|
||
cursor: pointer; /* 鼠标悬停时显示指针 */
|
||
display: flex; /* 使用flex布局 */
|
||
justify-content: center; /* 水平居中 */
|
||
align-items: center; /* 垂直居中 */
|
||
text-align: center; /* 文字居中对齐 */
|
||
}
|
||
|
||
.banner-text {
|
||
color: #FFFFFF; /* 设置文字颜色 */
|
||
font-weight: 600; /* 加粗 */
|
||
margin: 1rem 0; /* 设置上下间距 */
|
||
font-size: 1.5rem; /* 设置字体大小 */
|
||
}
|
||
|
||
.footer {
|
||
margin-left: 10px !important;
|
||
}
|
||
</style>
|
||
|
||
<link rel="stylesheet" type="text/css" href="/theme/cool/assets/css/theme/page/shop.css">
|
||
|
||
<!-- BEGIN: Content-->
|
||
<div class="app-content content">
|
||
<div class="content-overlay"></div>
|
||
<div class="header-navbar-shadow"></div>
|
||
<div class="content-wrapper">
|
||
<div class="content-header row">
|
||
<div class="content-header-left col-md-8 col-12 mb-2">
|
||
<div class="row breadcrumbs-top">
|
||
<div class="col-12">
|
||
<h2 class="content-header-title float-left mb-0">套餐商店</h2>
|
||
<div class="breadcrumb-wrapper col-12">
|
||
<ol class="breadcrumb shop-navigate">
|
||
<li class="breadcrumb-item"><a href="/user">Home</a>
|
||
</li>
|
||
<li class="breadcrumb-item"><a href="/user/shop">Store</a>
|
||
</li>
|
||
</ol>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="row">
|
||
|
||
<div class="col-12">
|
||
<div class="card offer-box">
|
||
<div class="card-body p-0 bg-primary" style="border-radius:10px">
|
||
<div class="offer-slider">
|
||
<div class="carousel slide">
|
||
<div class="selling-slide row" onclick="if (!window.__cfRLUnblockHandlers) return false; window.open('/user/invite','_self')" data-cf-modified-c4d86746314722ec8753695f-="">
|
||
<div class="col-xl-4 col-md-6">
|
||
<div class="d-flex">
|
||
<div class="left-content" style="margin-left:1rem">
|
||
<p>邀请好友注册返现</p>
|
||
<h2 class="f-w-600" style="color:#FFFFFF;margin:1rem 0 1rem 0">获得TA的充值 <b>{$env['invite_rate']}%</b> 的返利</h2>
|
||
<span class="badge badge-white rounded-pill">满{$env['aff_draw_need']}元</span>
|
||
<span class="badge badge-dotted rounded-pill ms-2 ">可提现 💰</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="col-xl-4 col-md-12 shop_img">
|
||
<div class="center-img tada animated"><img class="img-fluid" src="/theme/cool/assets/images/pages/rocket.png"></div>
|
||
</div>
|
||
<div class="col-xl-4 col-md-6">
|
||
<div class="d-flex">
|
||
<div class="right-content">
|
||
<p>发送邀请链接给好友🏃</p>
|
||
<h2 class="f-w-600" style="color:#FFFFFF;margin:10px 0 10px 0">您将一次性获得 <b>{$env['aff_reward_gb']}GB</b> 奖励</h2>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
<!--
|
||
<div class="banner" onclick="window.open('/user/code', '_self')">
|
||
<div class="banner-content">
|
||
<h2 class="banner-text">>>> 加密货币购买 享受 5% 折扣 <<<</h2>
|
||
</div>
|
||
</div>
|
||
-->
|
||
</div>
|
||
|
||
<div class="col-xl-12">
|
||
<div class="card">
|
||
<div class="card-body">
|
||
<ul class="nav nav-tabs border-tab shop_tab" role="tablist" style="border-bottom: 1px solid #dee2e6;">
|
||
{assign var="isFirst" value=true}
|
||
{foreach $products as $k => $v}
|
||
<li class="nav-item">
|
||
<a class="nav-link {if $isFirst}active{/if}" id="top-home-tab" data-toggle="tab" href="#top-home-{$k}" aria-controls="home" role="tab" aria-selected="true">
|
||
{if $v['is_huodong'] == true}
|
||
<i class="fa">🎉</i>
|
||
{else}
|
||
<i class="fa fa-ravelry"></i>
|
||
{/if}
|
||
<span style="word-break: keep-all">{$k}</span>
|
||
</a>
|
||
</li>
|
||
{assign var="isFirst" value=false}
|
||
{/foreach}
|
||
</ul>
|
||
|
||
|
||
<div class="tab-content" id="top-tabContent">
|
||
|
||
{assign var="isFirst" value=true}
|
||
{foreach $products as $productGroupKey => $productGroupValue}
|
||
|
||
<div class="tab-pane fade {if $isFirst}active show{/if}" id="top-home-{$productGroupKey}" role="tabpanel" aria-labelledby="top-home-tab">
|
||
<div class="row" style="padding: 1.5rem">
|
||
<div class="col-sm-12">
|
||
<div class="tab-content" id="top-tabContent">
|
||
<div class="row">
|
||
{foreach $productGroupValue['data'] as $row}
|
||
<div class="col-md-4 pb-1">
|
||
<div class="pricing-card p-30 b-primary shadow shadow-showcase">
|
||
<span class="badge badge-primary" id="product-name">
|
||
{if isset($row['name_sub']) && $row['name_sub']}
|
||
{$row['name_sub']}
|
||
<input id="product-name-{$row['id']}" hidden value="{$row['name']} - {$row['name_sub']}">
|
||
{else}
|
||
{$row['name']}
|
||
<input id="product-name-{$row['id']}" hidden value="{$row['name']}">
|
||
{/if}
|
||
</span>
|
||
{if $row['is_huodong']}
|
||
<div style="position:absolute;top: -5px;right: 10px;">
|
||
<div class="corner-text">活动</div>
|
||
<img src="/theme/cool/assets/images/HOT.png" width="60">
|
||
</div>
|
||
<br>
|
||
{/if}
|
||
<div class="price-value txt-primary" style="position: relative;">
|
||
<span class="currency">¥</span>
|
||
<span class="amount" id="product-price-{$row['id']}">{$row['price']}</span>
|
||
<span class="duration">{$row['class_time']}天</span>
|
||
<input id="product-time-{$row['id']}" hidden value="{$row['class_time']}">
|
||
<span class="badge badge-primary classify">{$row['time_group_str']}</span>
|
||
</div>
|
||
|
||
{if $row['have_endtime'] == false && $row['have_stock'] == false}
|
||
<div class="d-flex flex-column w-100">
|
||
<span class="font-size-sm text-muted font-weight-bold pb-1">
|
||
此商品无限制购买
|
||
</span>
|
||
<div class="progress progress-md w-100">
|
||
<div class="progress-bar progress-bar-striped bg-primary" role="progressbar" style="width: 0%;" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
{else}
|
||
<div class="d-flex flex-column w-100">
|
||
<span class="font-size-sm text-muted font-weight-bold pb-1">
|
||
{if $row['stock'] != -1}
|
||
<span class="text-primary">
|
||
此商品限购剩余 {$row['shengyu']} 份
|
||
</span>
|
||
{else}
|
||
此商品不限购
|
||
{/if}
|
||
</span>
|
||
<div class="progress progress-md w-100">
|
||
<div class="progress-bar progress-bar-striped bg-primary" role="progressbar" style="width: {$row['shengyu_rate']}%;" aria-valuenow="{$row['shengyu_rate']}" aria-valuemin="0" aria-valuemax="100">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="d-flex flex-column w-100">
|
||
<span class="font-size-sm text-muted font-weight-bold pb-1">
|
||
{if (isset($row['shengyu_day']) && $row['shengyu_day'] > 0) || $row['end_time'] != 0}
|
||
<span class="text-primary">
|
||
此商品将在 {$row['shengyu_day']} 天后下架
|
||
</span>
|
||
{else}
|
||
此商品不限期
|
||
{/if}
|
||
</span>
|
||
<div class="progress progress-md w-100">
|
||
<div class="progress-bar progress-bar-striped bg-primary" role="progressbar" style="width: {$row['shengyu_day_rate']}%;" aria-valuenow="{$row['shengyu_day_rate']}" aria-valuemin="0" aria-valuemax="100">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
{/if}
|
||
|
||
<ul class="pricing-content">
|
||
<li>套餐流量: <b>{$row['content']['bandwidth']} GB</b></li>
|
||
<li>套餐时长: <b>{$row['class_time']} 天</b></li>
|
||
<li>在线设备:
|
||
<b>
|
||
{if {$row['content']['ip_limit']} == 0}
|
||
无限制
|
||
{else}
|
||
{$row['content']['ip_limit']}
|
||
{/if}
|
||
</b>
|
||
</li>
|
||
<li>端口速率:
|
||
<b>
|
||
{if {$row['content']['speed_limit']} == 0}
|
||
无限制
|
||
{else}
|
||
{$row['content']['speed_limit']}Mbps
|
||
{/if}
|
||
</b>
|
||
</li>
|
||
<li>重置周期: <b>到期清零</b></li>
|
||
{if isset($row['huodong_up_str']) && $row['huodong_up_str']}
|
||
<li class="no-before text-primary" style="padding-left:0px;">
|
||
<span style="display: inline-block; margin-right: 6px;">🌟</span>
|
||
{$row['huodong_up_str']}
|
||
</li>
|
||
{/if}
|
||
</ul>
|
||
<div class="text-center mt-3">
|
||
|
||
<button class="btn btn-primary" type="button" onclick="if (!window.__cfRLUnblockHandlers) return false; buy({$row['id']}, {$row['coupon_disable']});" data-cf-modified-c4d86746314722ec8753695f-="">
|
||
{if $user->class >= $env['user_payClass']}
|
||
提前续订
|
||
{else}
|
||
购买
|
||
{/if}
|
||
</button>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
{/foreach}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
{assign var="isFirst" value=false}
|
||
{/foreach}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<!--coupon modal-->
|
||
<div class="modal fade" id="coupon_modal" tabindex="-1" role="dialog" aria-labelledby="couponModalLabel" aria-hidden="true">
|
||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h4 id="couponModalLabel" class="ls-2">你有优惠码吗?</h4>
|
||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||
<span aria-hidden="true">×</span>
|
||
</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div id="dailymail-modal-body-content">
|
||
<p>如果没有优惠码,请直接点击确定。</p>
|
||
<p>新用户专属优惠码:<span class="text-primary">福云.com</span></p>
|
||
<div class="form-group">
|
||
<label class="form-control-label">输入你的优惠码 : </label>
|
||
<input id="coupon" class="form-control" type="text">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-primary js-modal_keep" onclick="if (!window.__cfRLUnblockHandlers) return false; coupon_modal_ok();" data-cf-modified-c4d86746314722ec8753695f-="">确认提交</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!--buy modal-->
|
||
<div class="modal fade" id="order_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||
<div class="modal-content shadow-lg">
|
||
<div class="modal-header">
|
||
<h4 class="modal-title kt-font-primary" id="exampleModalLongTitle"><strong>订单确认</strong></h4>
|
||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||
<span aria-hidden="true">×</span>
|
||
</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<!-- <p><font color="red">如您是更换套餐,那剩余流量和有效期将会重置。</font></p> -->
|
||
<label class="row col-12 col-form-label" id="shop_name"></label>
|
||
<label class="row col-12 col-form-label" id="shop_time"></label>
|
||
<label class="row col-12 col-form-label" id="shop_total" style="display:none;"></label>
|
||
<label class="row col-12 col-form-label" id="shop_payTotal"></label>
|
||
<label class="row col-12 col-form-label" id="shop_stneed" style="display:none;"></label>
|
||
<label class="row col-12 col-form-label">
|
||
<fieldset class="checkbox" id="disableo">
|
||
<div class="vs-checkbox-con vs-checkbox-primary">
|
||
<span>自动续订:</span>
|
||
<input type="checkbox" id="autorenew">
|
||
<span class="vs-checkbox">
|
||
<span class="vs-checkbox--check">
|
||
<i class="vs-icon feather icon-check"></i>
|
||
</span>
|
||
</span>
|
||
( 从本地钱包扣费,不从微信支付宝 )
|
||
</div>
|
||
</fieldset>
|
||
</label>
|
||
|
||
<!--pay system-->
|
||
<div class="form-group row form-group-marginless" style="display: none" id="shop_payment">
|
||
<label class="col-lg-12 col-form-label">在线支付:</label>
|
||
<div class="col-lg-12">
|
||
|
||
<ul class="nav nav-pills row" role="tablist" id="pay_the">
|
||
<li class="nav-alipay nav-item d-flex col-md-4 mb-3 mb-lg-0 cursor_onclick"">
|
||
<a class="nav-link border py-10 d-flex flex-grow-1 rounded flex-column align-items-center active tom-hand" data-toggle="pill" data-name="wxpay">
|
||
<span class="nav-icon py-1 w-auto">
|
||
<i class="fab fa-wechat icon-2x"></i>
|
||
</span>
|
||
<span class="nav-text font-size-lg py-2 font-weight-bold text-center">微信</span>
|
||
</a>
|
||
</li>
|
||
<li class="nav-alipay nav-item d-flex col-md-4 mb-3 mb-lg-0 cursor_onclick"">
|
||
<a class="nav-link border py-10 d-flex flex-grow-1 rounded flex-column align-items-center tom-hand" data-toggle="pill" data-name="alipay">
|
||
<span class="nav-icon py-1 w-auto">
|
||
<i class="fab fa-alipay icon-2x"></i>
|
||
</span>
|
||
<span class="nav-text font-size-lg py-2 font-weight-bold text-center">支付宝</span>
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-primary js-modal_keep" data-dismiss="modal" id="pay-confirm">确定</button>
|
||
<button type="button" class="btn btn-secondary js-modal_unkeep" data-dismiss="modal">取消</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<!-- autorenew check modal -->
|
||
<div style="z-index:1050;" class="modal fade" id="autorenew_modal" tabindex="-1" role="dialog" aria-labelledby="autorenewModalLabel" aria-hidden="true">
|
||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h4 id="autorenewModalLabel" class="ls-2">自动续订 - 开启</h4>
|
||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||
<span aria-hidden="true">×</span>
|
||
</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div id="autorenew-modal-body-content">
|
||
<label class="row col-12 col-form-label">当前套餐时间到期,或流量用尽时,将会自动续费。</label>
|
||
<label class="row col-12 col-form-label">自动续费完全沿用当前的套餐配置及打折优惠。</label>
|
||
<label class="row col-12 col-form-label">请确保钱包余额充足,以免自动续费失败。</label>
|
||
<label class="row col-12 col-form-label">钱包余额:{$user->money} 元。</label>
|
||
<label class="row col-12 col-form-label"><a href="/user/code" class="btn btn-sm btn-info mr-4 waves-effect waves-float waves-light">钱包充值</a></label>
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-primary js-modal_keep" onclick="if (!window.__cfRLUnblockHandlers) return false; autorenew_ok(1);" data-cf-modified-c4d86746314722ec8753695f-="" data-dismiss="modal">确定</button>
|
||
<button type="button" class="btn btn-secondary js-modal_keep" data-dismiss="modal" onclick="if (!window.__cfRLUnblockHandlers) return false;">取消</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- autorenew uncheck modal -->
|
||
<div style="z-index:1050;" class="modal fade" id="autorenewUn_modal" tabindex="-1" role="dialog" aria-labelledby="autorenewUnModalLabel" aria-hidden="true">
|
||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h4 id="autorenewUnModalLabel" class="ls-2">自动续订 - 关闭</h4>
|
||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||
<span aria-hidden="true">×</span>
|
||
</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div id="autorenewUn-modal-body-content">
|
||
<label class="row col-12 col-form-label">自动续订将设为关闭。</label>
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-primary js-modal_keep" onclick="if (!window.__cfRLUnblockHandlers) return false; autorenew_ok(0);" data-cf-modified-c4d86746314722ec8753695f-="" data-dismiss="modal">确定</button>
|
||
<button type="button" class="btn btn-secondary js-modal_keep" data-dismiss="modal" onclick="if (!window.__cfRLUnblockHandlers) return false;">取消</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 提前续订 modal -->
|
||
<div style="z-index:1050;" class="modal fade" id="tiqianxuding_modal" tabindex="-1" role="dialog" aria-labelledby="tiqianxudingModalLabel" aria-hidden="true">
|
||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h4 id="tiqianxudingModalLabel" class="ls-2">提前续订</h4>
|
||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||
<span aria-hidden="true">×</span>
|
||
</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div id="autorenew-modal-body-content">
|
||
<label class="row col-12 col-form-label">套餐时间到期,或流量用尽时,套餐视为过期。</label>
|
||
<label class="row col-12 col-form-label">当前套餐过期后,将会激活提前续订的套餐。</label>
|
||
<label class="row col-12 col-form-label">优先于自动续订。</label>
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-primary js-modal_keep" onclick="if (!window.__cfRLUnblockHandlers) return false; tiqianxuding_ok();" data-cf-modified-c4d86746314722ec8753695f-="" data-dismiss="modal">确定</button>
|
||
<button type="button" class="btn btn-secondary js-modal_unkeep" data-dismiss="modal" onclick="if (!window.__cfRLUnblockHandlers) return false;">取消</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 支付确认跳转 -->
|
||
<div class="modal fade" id="coolpay-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h4 class="modal-title">支付</h4>
|
||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||
<span aria-hidden="true">×</span>
|
||
</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="text-center">
|
||
点击“继续支付”打开支付页面支付<br>
|
||
支付完成后,套餐将在5分钟之内激活
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<a id="to-coolpay" href="shop.html##" class="btn btn-primary">继续支付</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<!-- 按量付费 modal -->
|
||
<div class="modal fade" id="Byvolume-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||
<div class="modal-content shadow-lg">
|
||
<div class="modal-header">
|
||
<h4 class="modal-title"><strong>启用按量付费</strong></h4>
|
||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||
<span aria-hidden="true">×</span>
|
||
</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<p>启用按量付费后,您可获得<code>Level 1</code>等级权限,按量付费价格为<code>0.5RMB/1G</code>,速度限制为<code>100Mbps</code>,限制<code>2个</code>设备同时在线,系统自动按您使用的流量在余额中扣费,请确保您有足够的余额。</p>
|
||
<p>
|
||
<div style="display:inline">为了保障稳定性,按量付费需您购买过正常套餐(不包括试用套餐)后才可启用。按量付费启用后</div>
|
||
<div style="color:red; display:inline">您的当前套餐将会失效且流量将会被重置,且启用期间您的账户签到将不能获得流量</div>
|
||
<div style="display:inline">,请您留意。</div>
|
||
</p>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-info waves-effect buyTrafficPackage" onclick="if (!window.__cfRLUnblockHandlers) return false; payasyougo()" data-cf-modified-c4d86746314722ec8753695f-="">确认启用</button>
|
||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<!-- END: Content-->
|
||
|
||
{include file='user/footer.tpl'}
|
||
|
||
<script src="/theme/cool/assets/js/scripts/jquery.bootstrap-touchspin.js" type="c4d86746314722ec8753695f-text/javascript"></script>
|
||
<script src="/theme/cool/assets/js/scripts/number-input.js" type="c4d86746314722ec8753695f-text/javascript"></script>
|
||
|
||
<script type="c4d86746314722ec8753695f-text/javascript">
|
||
|
||
// 原本的变量,最好不动
|
||
var userMoney = {$user->money};
|
||
var paymentSystem = "cool";
|
||
var payment = $('.cursor_onclick .active').attr('data-name');
|
||
var shop;
|
||
var credit = 0;
|
||
|
||
// 用户变量
|
||
var user_class = {$user->class};
|
||
var user_vipInfo = {
|
||
rate: "{$user->vipInfo->rate}",
|
||
name: "{$user->vipInfo->name}",
|
||
}
|
||
|
||
// 环境变量
|
||
var coupon_value;
|
||
var bodyPaddingRight;
|
||
var couponDisable = 0;
|
||
var bodyPaddingRight = 0;
|
||
var modalKeep = false;
|
||
//var autorenewToCheck = false;
|
||
var tiqianxuding_modal_isok = false;
|
||
var payclass = {$env['user_payClass']};
|
||
var buy_tiqianxuding_have = user_class >= payclass;
|
||
var remainingAmount = 0;
|
||
var autorenewValue = {$user->autorenew};
|
||
var payRedir = "{$baseUrl}" + "/user";
|
||
|
||
//// modal绑定系列 ////
|
||
|
||
$('.modal').on('hidden.bs.modal', function () {
|
||
if (modalKeep) {
|
||
$('body').addClass('modal-open');
|
||
$('body').css('padding-right', bodyPaddingRight);
|
||
} else {
|
||
$('body').removeClass('modal-open');
|
||
}
|
||
});
|
||
|
||
$('.modal').on('shown.bs.modal', function () {
|
||
bodyPaddingRight = $('body').css('padding-right');
|
||
});
|
||
|
||
$('.js-modal_keep').click(function(){
|
||
modalKeep = true;
|
||
});
|
||
|
||
$('.js-modal_unkeep').click(function(){
|
||
modalKeep = false;
|
||
});
|
||
|
||
$('.close').click(function(){
|
||
modalKeep = false;
|
||
});
|
||
|
||
$('#order_modal').on('hidden.bs.modal', function () {
|
||
// autorenewToCheck = false;
|
||
// autorenewToggle();
|
||
});
|
||
|
||
$('#order_modal').on('shown.bs.modal', function () {
|
||
if (autorenewValue == 1) {
|
||
$('#autorenew').prop('checked', true);
|
||
} else {
|
||
$('#autorenew').prop('checked', false);
|
||
}
|
||
});
|
||
|
||
$('#order_modal').on('shown.bs.modal', function () {
|
||
// autorenewToggle();
|
||
});
|
||
|
||
$('#autorenew_modal').on('hidden.bs.modal', function () {
|
||
// autorenewToggle();
|
||
$("#order_modal").modal("show");
|
||
});
|
||
|
||
$('#autorenewUn_modal').on('hidden.bs.modal', function () {
|
||
$("#order_modal").modal("show");
|
||
});
|
||
|
||
//// modal绑定 end ////
|
||
|
||
//// 通用function系列 ////
|
||
|
||
function showAlert(type, title, message = "") {
|
||
const alertOptions = {
|
||
type: type,
|
||
title: title
|
||
};
|
||
if (message) {
|
||
alertOptions.html = message;
|
||
}
|
||
Swal.fire(alertOptions);
|
||
}
|
||
|
||
/*
|
||
function autorenewToggle() {
|
||
if (autorenewToCheck == true) {
|
||
$('#autorenew').prop('checked', true);
|
||
} else {
|
||
$('#autorenew').prop('checked', false);
|
||
}
|
||
}
|
||
*/
|
||
|
||
//// 通用function end ////
|
||
|
||
//// 按钮functin系列 ////
|
||
|
||
// 点击购买,所有购买按钮都先走这里
|
||
function buy(id, isHuodong)
|
||
{
|
||
shop = id;
|
||
couponDisable = isHuodong;
|
||
tiqianxuding_modal_isok = false;
|
||
|
||
_buy();
|
||
}
|
||
|
||
function autorenew_ok(value)
|
||
{
|
||
$.ajax({
|
||
type: "GET",
|
||
url: "/user/autorenew",
|
||
dataType: "json",
|
||
success: function (e) {
|
||
if (e.ret) {
|
||
|
||
autorenewValue = e.value;
|
||
|
||
} else {
|
||
|
||
}
|
||
},
|
||
error: function (e) {
|
||
|
||
}
|
||
})
|
||
//autorenewToCheck = true;
|
||
|
||
//$("#order_modal").modal("show");
|
||
|
||
}
|
||
|
||
function autorenew_cancel() {
|
||
//autorenewToCheck = false;
|
||
//$("#order_modal").modal("show");
|
||
}
|
||
|
||
function tiqianxuding_ok()
|
||
{
|
||
tiqianxuding_modal_isok = true;
|
||
_buy();
|
||
}
|
||
|
||
function coupon_modal_ok(id) {
|
||
$.ajax({
|
||
type: "POST",
|
||
url: "/user/coupon",
|
||
dataType: "json",
|
||
data: {
|
||
coupon: $("#coupon").val(),
|
||
product_id: shop
|
||
},
|
||
success: function (response) {
|
||
if (response.ret) {
|
||
/*
|
||
const coupon = {
|
||
code: $("#coupon-code").val(),
|
||
shop: response.name,
|
||
credit: response.credit,
|
||
total: response.total
|
||
};
|
||
*/
|
||
|
||
//credit = response.credit;
|
||
coupon_value = response.coupon_value;
|
||
|
||
$("#coupon_modal").modal("hide");
|
||
|
||
buyForm();
|
||
|
||
} else {
|
||
showAlert("error", response.msg);
|
||
}
|
||
},
|
||
error: function (error) {
|
||
showAlert("error", "发生错误", error.msg);
|
||
}
|
||
});
|
||
}
|
||
|
||
//// 按钮function end ////
|
||
|
||
//// 元素绑定系列 ////
|
||
$("#autorenew").click(function() {
|
||
if ($(this).is(':checked')) {
|
||
$("#autorenew_modal").modal("show");
|
||
//$("#order_modal").modal("hide");
|
||
} else {
|
||
$("#autorenewUn_modal").modal("show");
|
||
//$("#order_modal").modal("hide");
|
||
}
|
||
|
||
$("#order_modal").modal("hide");
|
||
|
||
return false;
|
||
});
|
||
|
||
//// 元素绑定 end ////
|
||
|
||
//// 业务关联系列 ////
|
||
|
||
function couponForm()
|
||
{
|
||
$("#coupon_modal").modal();
|
||
}
|
||
|
||
function buyForm()
|
||
{
|
||
|
||
let name = $("#product-name-"+shop).val();
|
||
let priceShop = $("#product-price-"+shop).html();
|
||
let time = $("#product-time-"+shop).val();
|
||
let str = '';
|
||
let suandazheStr = '';
|
||
let pricePay = priceShop;
|
||
|
||
$("#shop_name").text("套餐名称:" + name);
|
||
$("#shop_time").text("套餐时长:" + time + " 天");
|
||
$("#shop_total").text("套餐金额:" + priceShop + " 元");
|
||
|
||
// test
|
||
//user_vipInfo['rate'] = 12.445231241424;
|
||
//coupon_value = 0;
|
||
|
||
let suandazheArr = [];
|
||
|
||
if (user_vipInfo['rate'] > 0) {
|
||
str = user_vipInfo['name'] + ":-" + user_vipInfo['rate'] + '%';
|
||
suandazheArr.push(str);
|
||
|
||
pricePay = pricePay * ((100 - user_vipInfo['rate']) / 100);
|
||
|
||
}
|
||
|
||
if (coupon_value > 0) {
|
||
str = "优惠码:-" + coupon_value + '%';
|
||
suandazheArr.push(str);
|
||
|
||
pricePay = pricePay * ((100 - coupon_value) / 100);
|
||
|
||
}
|
||
pricePay = parseFloat(pricePay)
|
||
pricePay = parseFloat(pricePay.toFixed(2));
|
||
|
||
suandazheStr = suandazheArr.join(',');
|
||
if (suandazheStr.trim().length !== 0) {
|
||
suandazheStr = "<span class='text-primary'> 【 " + suandazheStr + " 】</span>";
|
||
$("#shop_total").show();
|
||
} else {
|
||
$("#shop_total").hide();
|
||
}
|
||
|
||
$("#shop_payTotal").html("支付金额:" + pricePay + " 元" + suandazheStr);
|
||
|
||
remainingAmount = pricePay - userMoney;
|
||
|
||
if (remainingAmount > 0) { // 实际支付 - 钱包支付 有仍需支付
|
||
$("#pay-confirm").text("在线支付"); // 订单modal > 确认按钮
|
||
$("#shop_payment").show(); // 微信支付宝组合框
|
||
if (userMoney > 0) {
|
||
$("#shop_stneed").text("余额支付:" + userMoney + " 元,还需支付 " + parseFloat(remainingAmount.toFixed(2)) + " 元"); // 余额抵扣
|
||
$("#shop_stneed").show();
|
||
}
|
||
} else {
|
||
$("#shop_payment").hide();
|
||
$("#pay-confirm").text("本地钱包支付【 余额 " + userMoney + " 元 】");
|
||
}
|
||
|
||
$("#order_modal").modal("show");
|
||
}
|
||
|
||
|
||
|
||
// 给程序用的购买触发
|
||
function _buy()
|
||
{
|
||
if (buy_tiqianxuding_have == true && tiqianxuding_modal_isok == false) {
|
||
|
||
$("#tiqianxuding_modal").modal("show");
|
||
return false;
|
||
}
|
||
|
||
if (couponDisable == 1) {
|
||
buyForm();
|
||
} else {
|
||
couponForm();
|
||
}
|
||
}
|
||
|
||
// 最后点击支付时
|
||
$("#pay-confirm").click(function () {
|
||
|
||
// 检查仍需支付金额是否小于或等于零
|
||
if (remainingAmount <= 0) {
|
||
// 如果没有剩余金额,进行购买确认
|
||
buyConfirm(shop);
|
||
} else {
|
||
let selectedPaymentMethod = $(".cursor_onclick .active").attr("data-name");
|
||
// 如果还有剩余金额,进行充值
|
||
topUp(remainingAmount, selectedPaymentMethod, shop);
|
||
}
|
||
|
||
})
|
||
|
||
// 本地钱包购买按钮
|
||
function buyConfirm(e) {
|
||
$.ajax({
|
||
type: "POST",
|
||
url: "/user/payment/purchase/balance",
|
||
dataType: "json",
|
||
data: {
|
||
coupon: $("#coupon").val(),
|
||
shopid: e,
|
||
redir: payRedir
|
||
//autorenew: _autorenewValue()
|
||
},
|
||
success: function (e) {
|
||
if (e.ret) {
|
||
var t = {
|
||
type: "success"
|
||
};
|
||
t.title = e.msg,
|
||
Swal.fire(t),
|
||
window.setTimeout("location.href='/user'", 1500)
|
||
} else {
|
||
showAlert("error", e.msg);
|
||
}
|
||
},
|
||
error: function (e) {
|
||
var t = {
|
||
type: "error"
|
||
};
|
||
t.title = data.msg,
|
||
Swal.fire(t)
|
||
}
|
||
})
|
||
}
|
||
|
||
function coolpay(e, t, o = 0) {
|
||
$.ajax({
|
||
url: "/user/payment/purchase/epay",
|
||
data: {
|
||
//price: t,
|
||
type: e, // 微信支付宝
|
||
shopid: o,
|
||
coupon: $("#coupon").val(),
|
||
redir: payRedir
|
||
//autorenew: _autorenewValue()
|
||
},
|
||
dataType: "json",
|
||
type: "POST",
|
||
success: function (o) {
|
||
if (o.ret) {
|
||
var r = (i = document.location.toString().split("#")[0].split("?")[0]).split("//")[1].split("/")[2];
|
||
|
||
if ("url" == o.type)
|
||
"code" == r ? window.location.href = o.url : ($("#coolpay-modal").modal("show"),
|
||
$("#to-coolpay").attr("href", o.url));
|
||
else if ("qrcode" == o.type) { // 不会触发
|
||
var i = encodeURIComponent(o.url)
|
||
, a = "/user/qrcode?type=" + e + "&qrcode=" + i + "&tradeno=" + o.tradeno + "&price=" + t;
|
||
"code" == r ? window.location.href = a : ($("#coolpay-modal").modal("show"),
|
||
$("#to-coolpay").attr("href", a))
|
||
}
|
||
} else {
|
||
//Swal.fire("发生错误", o.msg, "error")
|
||
showAlert("error", o.msg);
|
||
}
|
||
}
|
||
})
|
||
}
|
||
|
||
//// 业务接待 end ////
|
||
|
||
</script>
|
||
|
||
<script type="c4d86746314722ec8753695f-text/javascript">
|
||
/*
|
||
function nobuy() {
|
||
Swal.fire({ type: "error",title: '请注意',html: '按量付费不允许购买套餐' });
|
||
}
|
||
*/
|
||
</script>
|
||
|
||
<script src="/cdn-cgi/scripts/7d0fa10a/cloudflare-static/rocket-loader.min.js" data-cf-settings="c4d86746314722ec8753695f-|49" defer></script></body>
|
||
</html>
|