进行了一些小优化
This commit is contained in:
@@ -22,11 +22,9 @@ export const orderSchema = {
|
|||||||
payment_show_pay_time: true,
|
payment_show_pay_time: true,
|
||||||
payment_order_status_pending: '待支付',
|
payment_order_status_pending: '待支付',
|
||||||
payment_order_status_paid: '已支付',
|
payment_order_status_paid: '已支付',
|
||||||
payment_order_status_completed: '已完成',
|
|
||||||
payment_order_status_cancelled: '已取消',
|
|
||||||
payment_order_status_refunded: '已退款',
|
|
||||||
payment_order_status_refunding: '退款中',
|
payment_order_status_refunding: '退款中',
|
||||||
payment_order_status_processing: '处理中',
|
payment_order_status_refunded: '已退款',
|
||||||
|
payment_order_status_closed: '已关闭',
|
||||||
pay_service: '',
|
pay_service: '',
|
||||||
pay_service_icon: '',
|
pay_service_icon: '',
|
||||||
pay_service_value: '',
|
pay_service_value: '',
|
||||||
@@ -71,11 +69,9 @@ export const orderSchema = {
|
|||||||
fields: [
|
fields: [
|
||||||
{ key: 'payment_order_status_pending', label: '待支付状态文案', type: 'input', default: '待支付' },
|
{ key: 'payment_order_status_pending', label: '待支付状态文案', type: 'input', default: '待支付' },
|
||||||
{ key: 'payment_order_status_paid', label: '已支付状态文案', type: 'input', default: '已支付' },
|
{ key: 'payment_order_status_paid', label: '已支付状态文案', type: 'input', default: '已支付' },
|
||||||
{ key: 'payment_order_status_completed', label: '已完成状态文案', type: 'input', default: '已完成' },
|
|
||||||
{ key: 'payment_order_status_cancelled', label: '已取消状态文案', type: 'input', default: '已取消' },
|
|
||||||
{ key: 'payment_order_status_refunded', label: '已退款状态文案', type: 'input', default: '已退款' },
|
|
||||||
{ key: 'payment_order_status_refunding', label: '退款中状态文案', type: 'input', default: '退款中' },
|
{ key: 'payment_order_status_refunding', label: '退款中状态文案', type: 'input', default: '退款中' },
|
||||||
{ key: 'payment_order_status_processing', label: '处理中状态文案', type: 'input', default: '处理中' },
|
{ key: 'payment_order_status_refunded', label: '已退款状态文案', type: 'input', default: '已退款' },
|
||||||
|
{ key: 'payment_order_status_closed', label: '已关闭状态文案', type: 'input', default: '已关闭' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,18 +55,14 @@
|
|||||||
|
|
||||||
.aksrt-orders-page__filter-panel { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -2px 0 14px; padding: 12px; border-radius: 10px; background: var(--surface-2, #f4f6f9); }
|
.aksrt-orders-page__filter-panel { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -2px 0 14px; padding: 12px; border-radius: 10px; background: var(--surface-2, #f4f6f9); }
|
||||||
.aksrt-orders-page__filter-panel[hidden] { display: none !important; }
|
.aksrt-orders-page__filter-panel[hidden] { display: none !important; }
|
||||||
.aksrt-orders-page__filter-label { color: var(--orders-muted); font-size: 12px; font-weight: 650; }
|
.aksrt-orders-page__filter-group { display: flex; flex: 1 1 100%; gap: 10px; align-items: center; }
|
||||||
.aksrt-orders-page__type-filters { display: flex; flex-wrap: wrap; gap: 6px; }
|
.aksrt-orders-page__filter-label { flex: 0 0 58px; color: var(--orders-muted); font-size: 12px; font-weight: 650; }
|
||||||
.aksrt-orders-page__filter-chip { padding: 5px 9px; border: 1px solid var(--orders-line); border-radius: 999px; background: var(--surface-1, #fff); color: var(--orders-muted); font-size: 12px; text-decoration: none; }
|
.aksrt-orders-page__status-filters, .aksrt-orders-page__type-filters { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||||
|
.aksrt-orders-page__filter-chip { display: inline-flex; gap: 5px; align-items: center; padding: 5px 9px; border: 1px solid var(--orders-line); border-radius: 999px; background: var(--surface-1, #fff); color: var(--orders-muted); font-size: 12px; text-decoration: none; }
|
||||||
.aksrt-orders-page__filter-chip.is-active { border-color: var(--color-primary, #3b82f6); background: color-mix(in srgb, var(--color-primary, #3b82f6) 10%, var(--surface-1, #fff)); color: var(--color-primary, #3b82f6); font-weight: 700; }
|
.aksrt-orders-page__filter-chip.is-active { border-color: var(--color-primary, #3b82f6); background: color-mix(in srgb, var(--color-primary, #3b82f6) 10%, var(--surface-1, #fff)); color: var(--color-primary, #3b82f6); font-weight: 700; }
|
||||||
|
.aksrt-orders-page__filter-count { display: inline-grid; min-width: 17px; height: 17px; padding: 0 4px; place-items: center; border-radius: 999px; background: var(--color-warning, #c87819); color: #fff; font-size: 10px; line-height: 1; }
|
||||||
.aksrt-orders-page__clear { margin-left: auto; color: var(--color-primary, #3b82f6); font-size: 12px; text-decoration: none; }
|
.aksrt-orders-page__clear { margin-left: auto; color: var(--color-primary, #3b82f6); font-size: 12px; text-decoration: none; }
|
||||||
|
|
||||||
.aksrt-orders-page__tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 4px 0 14px; border-bottom: 1px solid var(--orders-line); }
|
|
||||||
.aksrt-orders-page__tab { position: relative; padding: 11px 8px; color: var(--orders-muted); text-align: center; font-size: 13px; font-weight: 650; text-decoration: none; }
|
|
||||||
.aksrt-orders-page__tab.is-active { color: var(--orders-ink); }
|
|
||||||
.aksrt-orders-page__tab.is-active::after { position: absolute; right: 28%; bottom: -1px; left: 28%; height: 2px; border-radius: 2px; background: var(--color-primary, #3b82f6); content: ""; }
|
|
||||||
.aksrt-orders-page__tab-badge { display: inline-grid; min-width: 17px; height: 17px; place-items: center; border-radius: 50%; background: var(--color-warning, #c87819); color: #fff; font-size: 10px; }
|
|
||||||
|
|
||||||
.aksrt-orders-page__list { display: grid; gap: 10px; }
|
.aksrt-orders-page__list { display: grid; gap: 10px; }
|
||||||
.aksrt-orders-page__card { overflow: hidden; border: 1px solid var(--orders-line); border-radius: 13px; background: var(--surface-1, #fff); transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
|
.aksrt-orders-page__card { overflow: hidden; border: 1px solid var(--orders-line); border-radius: 13px; background: var(--surface-1, #fff); transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
|
||||||
.aksrt-orders-page__card:hover { border-color: color-mix(in srgb, var(--color-primary, #3b82f6) 36%, var(--orders-line)); box-shadow: 0 8px 22px rgba(30, 48, 79, .07); transform: translateY(-1px); }
|
.aksrt-orders-page__card:hover { border-color: color-mix(in srgb, var(--color-primary, #3b82f6) 36%, var(--orders-line)); box-shadow: 0 8px 22px rgba(30, 48, 79, .07); transform: translateY(-1px); }
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ if ($user_id <= 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$raw_query = [
|
$raw_query = [
|
||||||
'status' => $_GET['order_status'] ?? '',
|
'status' => $_GET['order_status'] ?? 'all',
|
||||||
'type' => $_GET['order_type'] ?? '',
|
'type' => $_GET['order_type'] ?? '',
|
||||||
'order_number' => $_GET['order_number'] ?? '',
|
'order_number' => $_GET['order_number'] ?? '',
|
||||||
'page' => $_GET['order_page'] ?? 1,
|
'page' => $_GET['order_page'] ?? 1,
|
||||||
@@ -52,7 +52,7 @@ $orders_url = static function (array $override = []) use ($status, $type, $order
|
|||||||
return add_query_arg($values, remove_query_arg(['order_tab', 'otab', 'section'], $base));
|
return add_query_arg($values, remove_query_arg(['order_tab', 'otab', 'section'], $base));
|
||||||
};
|
};
|
||||||
|
|
||||||
$tabs = [
|
$status_options = [
|
||||||
'all' => __('全部', 'aksrt'),
|
'all' => __('全部', 'aksrt'),
|
||||||
'pending' => __('待支付', 'aksrt'),
|
'pending' => __('待支付', 'aksrt'),
|
||||||
'paid' => __('已支付', 'aksrt'),
|
'paid' => __('已支付', 'aksrt'),
|
||||||
@@ -90,24 +90,28 @@ $tabs = [
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div id="aksrt-orders-filter-panel" class="aksrt-orders-page__filter-panel" data-aksrt-orders-filter-panel hidden>
|
<div id="aksrt-orders-filter-panel" class="aksrt-orders-page__filter-panel" data-aksrt-orders-filter-panel hidden>
|
||||||
<span class="aksrt-orders-page__filter-label"><?php esc_html_e('订单类型', 'aksrt'); ?></span>
|
<div class="aksrt-orders-page__filter-group">
|
||||||
<div class="aksrt-orders-page__type-filters">
|
<span class="aksrt-orders-page__filter-label"><?php esc_html_e('订单状态', 'aksrt'); ?></span>
|
||||||
<?php foreach ($type_options as $key => $label) : ?>
|
<nav class="aksrt-orders-page__status-filters" aria-label="<?php esc_attr_e('订单状态', 'aksrt'); ?>">
|
||||||
<a class="aksrt-orders-page__filter-chip<?php echo (string) $key === $type ? ' is-active' : ''; ?>" href="<?php echo esc_url($orders_url(['order_type' => $key, 'order_page' => null])); ?>"><?php echo esc_html((string) $label); ?></a>
|
<?php foreach ($status_options as $key => $label) : ?>
|
||||||
<?php endforeach; ?>
|
<a class="aksrt-orders-page__filter-chip<?php echo $status === $key ? ' is-active' : ''; ?>" href="<?php echo esc_url($orders_url(['order_status' => $key, 'order_page' => null])); ?>">
|
||||||
|
<?php echo esc_html($label); ?>
|
||||||
|
<?php if ($key === 'pending' && !empty($stats['pending'])) : ?><span class="aksrt-orders-page__filter-count"><?php echo esc_html((string) $stats['pending']); ?></span><?php endif; ?>
|
||||||
|
</a>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
<div class="aksrt-orders-page__filter-group">
|
||||||
|
<span class="aksrt-orders-page__filter-label"><?php esc_html_e('订单类型', 'aksrt'); ?></span>
|
||||||
|
<div class="aksrt-orders-page__type-filters">
|
||||||
|
<?php foreach ($type_options as $key => $label) : ?>
|
||||||
|
<a class="aksrt-orders-page__filter-chip<?php echo (string) $key === $type ? ' is-active' : ''; ?>" href="<?php echo esc_url($orders_url(['order_type' => $key, 'order_page' => null])); ?>"><?php echo esc_html((string) $label); ?></a>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a class="aksrt-orders-page__clear" href="<?php echo esc_url($orders_url(['order_status' => null, 'order_type' => null, 'order_number' => null, 'order_page' => null])); ?>"><?php esc_html_e('清除条件', 'aksrt'); ?></a>
|
<a class="aksrt-orders-page__clear" href="<?php echo esc_url($orders_url(['order_status' => null, 'order_type' => null, 'order_number' => null, 'order_page' => null])); ?>"><?php esc_html_e('清除条件', 'aksrt'); ?></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<nav class="aksrt-orders-page__tabs" aria-label="<?php esc_attr_e('订单状态', 'aksrt'); ?>">
|
|
||||||
<?php foreach ($tabs as $key => $label) : ?>
|
|
||||||
<a class="aksrt-orders-page__tab<?php echo $status === $key ? ' is-active' : ''; ?>" href="<?php echo esc_url($orders_url(['order_status' => $key, 'order_page' => null])); ?>">
|
|
||||||
<?php echo esc_html($label); ?>
|
|
||||||
<?php if ($key === 'pending' && !empty($stats['pending'])) : ?><span class="aksrt-orders-page__tab-badge"><?php echo esc_html((string) $stats['pending']); ?></span><?php endif; ?>
|
|
||||||
</a>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<?php if ($orders !== []) : ?>
|
<?php if ($orders !== []) : ?>
|
||||||
<div class="aksrt-orders-page__list" data-aksrt-order-list>
|
<div class="aksrt-orders-page__list" data-aksrt-order-list>
|
||||||
<?php foreach ($orders as $order) :
|
<?php foreach ($orders as $order) :
|
||||||
|
|||||||
@@ -260,11 +260,9 @@ class SchemaPayment {
|
|||||||
['key' => 'status', 'title' => '状态设置', 'fields' => [
|
['key' => 'status', 'title' => '状态设置', 'fields' => [
|
||||||
['key' => 'payment_order_status_pending', 'label' => '待支付状态文案', 'type' => 'input', 'default' => '待支付'],
|
['key' => 'payment_order_status_pending', 'label' => '待支付状态文案', 'type' => 'input', 'default' => '待支付'],
|
||||||
['key' => 'payment_order_status_paid', 'label' => '已支付状态文案', 'type' => 'input', 'default' => '已支付'],
|
['key' => 'payment_order_status_paid', 'label' => '已支付状态文案', 'type' => 'input', 'default' => '已支付'],
|
||||||
['key' => 'payment_order_status_completed', 'label' => '已完成状态文案', 'type' => 'input', 'default' => '已完成'],
|
|
||||||
['key' => 'payment_order_status_cancelled', 'label' => '已取消状态文案', 'type' => 'input', 'default' => '已取消'],
|
|
||||||
['key' => 'payment_order_status_refunded', 'label' => '已退款状态文案', 'type' => 'input', 'default' => '已退款'],
|
|
||||||
['key' => 'payment_order_status_refunding', 'label' => '退款中状态文案', 'type' => 'input', 'default' => '退款中'],
|
['key' => 'payment_order_status_refunding', 'label' => '退款中状态文案', 'type' => 'input', 'default' => '退款中'],
|
||||||
['key' => 'payment_order_status_processing', 'label' => '处理中状态文案', 'type' => 'input', 'default' => '处理中'],
|
['key' => 'payment_order_status_refunded', 'label' => '已退款状态文案', 'type' => 'input', 'default' => '已退款'],
|
||||||
|
['key' => 'payment_order_status_closed', 'label' => '已关闭状态文案', 'type' => 'input', 'default' => '已关闭'],
|
||||||
]],
|
]],
|
||||||
['key' => 'service', 'title' => '服务设置', 'fields' => [
|
['key' => 'service', 'title' => '服务设置', 'fields' => [
|
||||||
['key' => 'pay_service', 'label' => '客服设置', 'type' => 'textarea', 'default' => ''],
|
['key' => 'pay_service', 'label' => '客服设置', 'type' => 'textarea', 'default' => ''],
|
||||||
|
|||||||
@@ -359,8 +359,8 @@ class PaymentRuntime {
|
|||||||
$box_position = 'top';
|
$box_position = 'top';
|
||||||
}
|
}
|
||||||
|
|
||||||
$status_keys = ['pending', 'paid', 'completed', 'cancelled', 'refunded', 'refunding', 'processing'];
|
$status_keys = ['pending', 'paid', 'refunding', 'refunded', 'closed'];
|
||||||
$status_defaults = ['待支付', '已支付', '已完成', '已取消', '已退款', '退款中', '处理中'];
|
$status_defaults = ['待支付', '已支付', '退款中', '已退款', '已关闭'];
|
||||||
$status_texts = [];
|
$status_texts = [];
|
||||||
foreach ($status_keys as $i => $key) {
|
foreach ($status_keys as $i => $key) {
|
||||||
$val = trim((string) ($s["payment_order_status_{$key}"] ?? ''));
|
$val = trim((string) ($s["payment_order_status_{$key}"] ?? ''));
|
||||||
|
|||||||
@@ -177,6 +177,8 @@ test('asset purchases share the order center and refresh every wallet surface',
|
|||||||
const repository = fs.readFileSync(path.join(root, 'src', 'Payment', 'OrderRepositoryCore.php'), 'utf8')
|
const repository = fs.readFileSync(path.join(root, 'src', 'Payment', 'OrderRepositoryCore.php'), 'utf8')
|
||||||
const adminRepository = fs.readFileSync(path.join(root, 'src', 'Payment', 'OrderRepositoryAdmin.php'), 'utf8')
|
const adminRepository = fs.readFileSync(path.join(root, 'src', 'Payment', 'OrderRepositoryAdmin.php'), 'utf8')
|
||||||
const payOrders = fs.readFileSync(path.join(root, 'src', 'Admin', 'Native', 'PayOrders.php'), 'utf8')
|
const payOrders = fs.readFileSync(path.join(root, 'src', 'Admin', 'Native', 'PayOrders.php'), 'utf8')
|
||||||
|
const paymentRuntime = fs.readFileSync(path.join(root, 'src', 'Settings', 'PaymentRuntime.php'), 'utf8')
|
||||||
|
const paymentSchema = fs.readFileSync(path.join(root, 'assets', 'admin', 'src', 'schema', 'sections', 'payment', 'order.js'), 'utf8')
|
||||||
const balanceRest = fs.readFileSync(path.join(root, 'src', 'Credits', 'BalanceServiceRest.php'), 'utf8')
|
const balanceRest = fs.readFileSync(path.join(root, 'src', 'Credits', 'BalanceServiceRest.php'), 'utf8')
|
||||||
const chargeCard = fs.readFileSync(path.join(root, 'src', 'Payment', 'ChargeCard.php'), 'utf8')
|
const chargeCard = fs.readFileSync(path.join(root, 'src', 'Payment', 'ChargeCard.php'), 'utf8')
|
||||||
const creditsJs = fs.readFileSync(path.join(root, 'assets', 'js', 'credits.js'), 'utf8')
|
const creditsJs = fs.readFileSync(path.join(root, 'assets', 'js', 'credits.js'), 'utf8')
|
||||||
@@ -223,6 +225,11 @@ test('asset purchases share the order center and refresh every wallet surface',
|
|||||||
assert.match(adminRepository, /\$valid_statuses = array_keys\(\\AKSRT\\Core\\DomainModel::order_status_labels\(\)\)/)
|
assert.match(adminRepository, /\$valid_statuses = array_keys\(\\AKSRT\\Core\\DomainModel::order_status_labels\(\)\)/)
|
||||||
assert.doesNotMatch(payOrders, /<select name="new_status">/)
|
assert.doesNotMatch(payOrders, /<select name="new_status">/)
|
||||||
assert.doesNotMatch(`${order}\n${repository}\n${userOrders}\n${payOrders}`, /['"]force['"]\s*=>\s*true/)
|
assert.doesNotMatch(`${order}\n${repository}\n${userOrders}\n${payOrders}`, /['"]force['"]\s*=>\s*true/)
|
||||||
|
assert.match(paymentRuntime, /\$status_keys = \['pending', 'paid', 'refunding', 'refunded', 'closed'\]/)
|
||||||
|
for (const status of ['pending', 'paid', 'refunding', 'refunded', 'closed']) {
|
||||||
|
assert.match(paymentSchema, new RegExp(`payment_order_status_${status}`))
|
||||||
|
}
|
||||||
|
assert.doesNotMatch(paymentSchema, /payment_order_status_(?:completed|cancelled|processing)/)
|
||||||
|
|
||||||
assert.match(balanceRest, /register_rest_route\('aksrt\/v1', '\/pay\/assets'/)
|
assert.match(balanceRest, /register_rest_route\('aksrt\/v1', '\/pay\/assets'/)
|
||||||
assert.match(balanceRest, /'product_type'\s*=>\s*\\AKSRT\\Core\\DomainModel::ORDER_PRODUCT_POINTS/)
|
assert.match(balanceRest, /'product_type'\s*=>\s*\\AKSRT\\Core\\DomainModel::ORDER_PRODUCT_POINTS/)
|
||||||
|
|||||||
@@ -364,7 +364,12 @@ test('profile routes load versioned leaf styles and keep dialogs hidden initiall
|
|||||||
assert.match(profileModalsCss, /\.modal-field input\[type="tel"\]/);
|
assert.match(profileModalsCss, /\.modal-field input\[type="tel"\]/);
|
||||||
assert.doesNotMatch(profileCredits, /credits-signin\.php|data-aksrt-signin-calendar/);
|
assert.doesNotMatch(profileCredits, /credits-signin\.php|data-aksrt-signin-calendar/);
|
||||||
assert.match(profileOrders, /data-aksrt-orders-filter-panel hidden/);
|
assert.match(profileOrders, /data-aksrt-orders-filter-panel hidden/);
|
||||||
|
assert.match(profileOrders, /'status'\s*=>\s*\$_GET\['order_status'\]\s*\?\?\s*'all'/);
|
||||||
|
assert.match(profileOrders, /data-aksrt-orders-filter-panel hidden[\s\S]*?aksrt-orders-page__status-filters[\s\S]*?aksrt-orders-page__type-filters/);
|
||||||
|
assert.doesNotMatch(profileOrders, /aksrt-orders-page__tabs|aksrt-orders-page__tab(?:\s|<|"|')/);
|
||||||
assert.match(ordersCss, /\.aksrt-orders-page__filter-panel\[hidden\]\s*\{\s*display:\s*none\s*!important;/);
|
assert.match(ordersCss, /\.aksrt-orders-page__filter-panel\[hidden\]\s*\{\s*display:\s*none\s*!important;/);
|
||||||
|
assert.match(ordersCss, /\.aksrt-orders-page__status-filters, \.aksrt-orders-page__type-filters/);
|
||||||
|
assert.doesNotMatch(ordersCss, /\.aksrt-orders-page__tabs|\.aksrt-orders-page__tab(?:\s|\.|:|\{)/);
|
||||||
assert.match(orderCenterJs, /if \(panel\) panel\.hidden = expanded;/);
|
assert.match(orderCenterJs, /if \(panel\) panel\.hidden = expanded;/);
|
||||||
assert.match(userCenterJs, /name === 'follow' \|\| name === 'orders'/);
|
assert.match(userCenterJs, /name === 'follow' \|\| name === 'orders'/);
|
||||||
assert.match(userCenterJs, /\['order_status', 'order_type', 'order_number', 'order_page'\]/);
|
assert.match(userCenterJs, /\['order_status', 'order_type', 'order_number', 'order_page'\]/);
|
||||||
|
|||||||
Reference in New Issue
Block a user