subscription/templates/emails/subscription-renewal.php

304 lines
9.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* 订阅续费邮件模板
*
* @package Yoone_Subscriptions
* @version 1.0.0
*/
if (!defined('ABSPATH')) {
exit; // 防止直接访问
}
// 获取传递的变量
$subscription = isset($subscription) ? $subscription : null;
$order = isset($order) ? $order : null;
$user = isset($user) ? $user : null;
if (!$subscription || !$order || !$user) {
return;
}
// 获取产品信息
$product = wc_get_product($subscription->product_id);
$product_name = $product ? $product->get_name() : __('未知产品', 'yoone-subscriptions');
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo('charset'); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php _e('订阅续费成功', 'yoone-subscriptions'); ?></title>
<style type="text/css">
/* 邮件样式 */
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
font-size: 14px;
line-height: 1.6;
color: #333333;
background-color: #f4f4f4;
}
.email-container {
max-width: 600px;
margin: 0 auto;
background-color: #ffffff;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.email-header {
background-color: #46b450;
color: #ffffff;
padding: 30px 20px;
text-align: center;
}
.email-header h1 {
margin: 0;
font-size: 24px;
font-weight: bold;
}
.email-body {
padding: 30px 20px;
}
.greeting {
font-size: 16px;
margin-bottom: 20px;
}
.subscription-info {
background-color: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 5px;
padding: 20px;
margin: 20px 0;
}
.subscription-info h3 {
margin: 0 0 15px 0;
color: #333;
font-size: 18px;
}
.info-table {
width: 100%;
border-collapse: collapse;
}
.info-table th,
.info-table td {
padding: 8px 0;
text-align: left;
border-bottom: 1px solid #e9ecef;
}
.info-table th {
font-weight: bold;
color: #555;
width: 40%;
}
.info-table td {
color: #333;
}
.info-table tr:last-child th,
.info-table tr:last-child td {
border-bottom: none;
}
.amount {
font-size: 18px;
font-weight: bold;
color: #46b450;
}
.next-payment {
background-color: #fff3cd;
border: 1px solid #ffeaa7;
border-radius: 5px;
padding: 15px;
margin: 20px 0;
}
.next-payment h4 {
margin: 0 0 10px 0;
color: #856404;
}
.action-buttons {
text-align: center;
margin: 30px 0;
}
.button {
display: inline-block;
padding: 12px 24px;
background-color: #46b450;
color: #ffffff;
text-decoration: none;
border-radius: 5px;
font-weight: bold;
margin: 0 10px;
}
.button:hover {
background-color: #3a9b3f;
}
.button.secondary {
background-color: #6c757d;
}
.button.secondary:hover {
background-color: #5a6268;
}
.email-footer {
background-color: #f8f9fa;
padding: 20px;
text-align: center;
color: #6c757d;
font-size: 12px;
}
.email-footer p {
margin: 5px 0;
}
.email-footer a {
color: #46b450;
text-decoration: none;
}
@media only screen and (max-width: 600px) {
.email-container {
margin: 0;
border-radius: 0;
}
.email-header,
.email-body,
.email-footer {
padding: 20px 15px;
}
.info-table th,
.info-table td {
display: block;
width: 100%;
padding: 5px 0;
}
.info-table th {
font-weight: bold;
margin-top: 10px;
}
.action-buttons .button {
display: block;
margin: 10px 0;
}
}
</style>
</head>
<body>
<div class="email-container">
<!-- 邮件头部 -->
<div class="email-header">
<h1><?php _e('订阅续费成功', 'yoone-subscriptions'); ?></h1>
</div>
<!-- 邮件正文 -->
<div class="email-body">
<div class="greeting">
<?php printf(__('亲爱的 %s', 'yoone-subscriptions'), esc_html($user->display_name)); ?>
</div>
<p><?php _e('您的订阅已成功续费!以下是本次续费的详细信息:', 'yoone-subscriptions'); ?></p>
<!-- 订阅信息 -->
<div class="subscription-info">
<h3><?php _e('订阅信息', 'yoone-subscriptions'); ?></h3>
<table class="info-table">
<tr>
<th><?php _e('订阅编号:', 'yoone-subscriptions'); ?></th>
<td>#<?php echo esc_html($subscription->id); ?></td>
</tr>
<tr>
<th><?php _e('产品名称:', 'yoone-subscriptions'); ?></th>
<td><?php echo esc_html($product_name); ?></td>
</tr>
<tr>
<th><?php _e('续费金额:', 'yoone-subscriptions'); ?></th>
<td class="amount"><?php echo Yoone_Helper::format_price($subscription->subscription_price); ?></td>
</tr>
<tr>
<th><?php _e('续费日期:', 'yoone-subscriptions'); ?></th>
<td><?php echo Yoone_Helper::format_date($order->post_date, get_option('date_format') . ' ' . get_option('time_format')); ?></td>
</tr>
<tr>
<th><?php _e('订单编号:', 'yoone-subscriptions'); ?></th>
<td>#<?php echo esc_html($order->ID); ?></td>
</tr>
<tr>
<th><?php _e('计费周期:', 'yoone-subscriptions'); ?></th>
<td><?php echo Yoone_Helper::format_billing_period($subscription->billing_period, $subscription->billing_interval); ?></td>
</tr>
</table>
</div>
<!-- 下次付款信息 -->
<?php if ($subscription->next_payment_date && $subscription->status === 'active'): ?>
<div class="next-payment">
<h4><?php _e('下次付款信息', 'yoone-subscriptions'); ?></h4>
<p>
<?php printf(
__('您的下次付款将在 %s 自动处理,金额为 %s。', 'yoone-subscriptions'),
'<strong>' . Yoone_Helper::format_date($subscription->next_payment_date, get_option('date_format')) . '</strong>',
'<strong>' . Yoone_Helper::format_price($subscription->subscription_price) . '</strong>'
); ?>
</p>
</div>
<?php endif; ?>
<p><?php _e('感谢您继续使用我们的服务!如果您有任何问题或需要帮助,请随时联系我们。', 'yoone-subscriptions'); ?></p>
<!-- 操作按钮 -->
<div class="action-buttons">
<a href="<?php echo esc_url(wc_get_account_endpoint_url('yoone-subscriptions') . '/' . $subscription->id); ?>" class="button">
<?php _e('查看订阅详情', 'yoone-subscriptions'); ?>
</a>
<a href="<?php echo esc_url(wc_get_account_endpoint_url('view-order', $order->ID)); ?>" class="button secondary">
<?php _e('查看订单详情', 'yoone-subscriptions'); ?>
</a>
</div>
</div>
<!-- 邮件底部 -->
<div class="email-footer">
<p><?php printf(__('此邮件由 %s 自动发送', 'yoone-subscriptions'), get_bloginfo('name')); ?></p>
<p>
<a href="<?php echo esc_url(home_url()); ?>"><?php echo esc_html(get_bloginfo('name')); ?></a> |
<a href="<?php echo esc_url(wc_get_account_endpoint_url('yoone-subscriptions')); ?>"><?php _e('管理订阅', 'yoone-subscriptions'); ?></a>
</p>
<?php if ($subscription->status === 'active'): ?>
<p style="margin-top: 15px; font-size: 11px; color: #999;">
<?php _e('如果您不希望继续接收此订阅,可以随时在账户页面中取消订阅。', 'yoone-subscriptions'); ?>
</p>
<?php endif; ?>
</div>
</div>
</body>
</html>