subscription/templates/emails/subscription-cancelled.php

326 lines
10 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;
$user = isset($user) ? $user : null;
$reason = isset($reason) ? $reason : '';
if (!$subscription || !$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: #dc3232;
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;
}
.status-cancelled {
color: #dc3232;
font-weight: bold;
}
.cancellation-notice {
background-color: #f8d7da;
border: 1px solid #f5c6cb;
border-radius: 5px;
padding: 15px;
margin: 20px 0;
color: #721c24;
}
.cancellation-notice h4 {
margin: 0 0 10px 0;
color: #721c24;
}
.feedback-section {
background-color: #e7f3ff;
border: 1px solid #b8daff;
border-radius: 5px;
padding: 20px;
margin: 20px 0;
}
.feedback-section h4 {
margin: 0 0 15px 0;
color: #004085;
}
.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="status-cancelled"><?php echo Yoone_Helper::get_subscription_status_label($subscription->status); ?></td>
</tr>
<tr>
<th><?php _e('开始日期:', 'yoone-subscriptions'); ?></th>
<td><?php echo Yoone_Helper::format_date($subscription->start_date, get_option('date_format')); ?></td>
</tr>
<tr>
<th><?php _e('取消日期:', 'yoone-subscriptions'); ?></th>
<td><?php echo Yoone_Helper::format_date($subscription->end_date, get_option('date_format') . ' ' . get_option('time_format')); ?></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>
<!-- 取消通知 -->
<div class="cancellation-notice">
<h4><?php _e('重要提醒', 'yoone-subscriptions'); ?></h4>
<ul style="margin: 0; padding-left: 20px;">
<li><?php _e('您将不会再收到此订阅的自动续费扣款', 'yoone-subscriptions'); ?></li>
<li><?php _e('您仍可以访问已付费期间的服务内容', 'yoone-subscriptions'); ?></li>
<li><?php _e('如需重新订阅,您可以随时在我们的网站上重新购买', 'yoone-subscriptions'); ?></li>
</ul>
</div>
<!-- 取消原因 -->
<?php if ($reason): ?>
<div class="feedback-section">
<h4><?php _e('取消原因', 'yoone-subscriptions'); ?></h4>
<p><?php echo esc_html($reason); ?></p>
</div>
<?php endif; ?>
<!-- 反馈邀请 -->
<div class="feedback-section">
<h4><?php _e('我们重视您的反馈', 'yoone-subscriptions'); ?></h4>
<p><?php _e('很遗憾看到您取消了订阅。如果您愿意分享取消的原因,这将帮助我们改进服务质量。', 'yoone-subscriptions'); ?></p>
<p><?php _e('如果您在使用过程中遇到了任何问题,我们的客服团队随时准备为您提供帮助。', 'yoone-subscriptions'); ?></p>
</div>
<p><?php _e('感谢您曾经选择我们的服务,希望未来有机会再次为您服务!', 'yoone-subscriptions'); ?></p>
<!-- 操作按钮 -->
<div class="action-buttons">
<a href="<?php echo esc_url(get_permalink($subscription->product_id)); ?>" class="button">
<?php _e('重新订阅', 'yoone-subscriptions'); ?>
</a>
<a href="<?php echo esc_url(wc_get_account_endpoint_url('yoone-subscriptions')); ?>" 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_page_permalink('contact')); ?>"><?php _e('联系我们', 'yoone-subscriptions'); ?></a>
</p>
<p style="margin-top: 15px; font-size: 11px; color: #999;">
<?php _e('如果您改变主意,随时欢迎您重新订阅我们的服务。', 'yoone-subscriptions'); ?>
</p>
</div>
</div>
</body>
</html>