You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
5.6 KiB
Smarty
30 lines
5.6 KiB
Smarty
{assign var=billing_columns value=['账单','用户','项目','金额','财务状态','履约状态','支付渠道','时间','详情']}
|
|
{if $billing_view == 'orders'}{assign var=billing_columns value=['任务','用户','套餐 / 宿主机','金额','财务状态','履约状态','实例 / 引擎任务','更新 / 异常','账单']}{/if}
|
|
{if $billing_view == 'payments'}{assign var=billing_columns value=['支付流水','用户','支付渠道','金额','支付状态','账单财务状态','用途','时间','账单']}{/if}
|
|
{function name=billing_badge value='' kind='financial' purpose=''}
|
|
{assign var=labels value=$billing_financial}
|
|
{if $kind == 'fulfillment'}{assign var=labels value=$billing_fulfillment}{elseif $kind == 'payment'}{assign var=labels value=$billing_payment}{/if}
|
|
{assign var=tone value='light text-dark'}
|
|
{if in_array($value,['paid','succeeded','paid_invoice','credited_balance'])}{assign var=tone value='success-subtle text-success-emphasis'}{elseif in_array($value,['failed','uncertain','overdue'])}{assign var=tone value='danger-subtle text-danger-emphasis'}{elseif in_array($value,['open','pending','queued','awaiting_payment'])}{assign var=tone value='warning-subtle text-warning-emphasis'}{elseif in_array($value,['refunded','running','creating'])}{assign var=tone value='info-subtle text-info-emphasis'}{/if}
|
|
<span class="badge rounded-pill fs-12 px-2 py-1 bg-{$tone|escape}">{if $kind == 'fulfillment' && $purpose == 'renewal' && $value == 'succeeded'}已续费{elseif !$value}不适用{else}{$labels[$value]|default:$value|escape}{/if}</span>
|
|
{/function}
|
|
<thead id="billing-table-head"><tr>{foreach $billing_columns as $column}<th scope="col">{$column|escape}</th>{/foreach}</tr></thead>
|
|
<tbody id="billing-table-body">
|
|
{foreach $billing_page.items|default:[] as $item}
|
|
{assign var=purpose_key value=$item.purpose|default:''}
|
|
{assign var=provider_key value=$item.provider|default:''}
|
|
{assign var=method_key value=$item.payment_method|default:''}
|
|
<tr>
|
|
<td data-label="{$billing_columns[0]|escape}"><span class="admin-checkout-user"><strong>#{$item.id|escape}</strong><span>{if $billing_view == 'invoices'}{$billing_purpose[$purpose_key]|default:$purpose_key|escape}{elseif $billing_view == 'orders'}{if $item.job_id}引擎 #{$item.job_id|escape} · {/if}尝试 {$item.attempts|escape}{else}账单 #{$item.invoice_id|escape}{/if}</span></span></td>
|
|
<td data-label="用户"><span class="admin-checkout-user"><strong>{$item.user_name|default:$item.user_email|default:'用户'|escape}</strong><span>{if $item.user_name && $item.user_email}{$item.user_email|escape} · {/if}ID {$item.user_id|escape}</span></span></td>
|
|
<td data-label="{$billing_columns[2]|escape}" class="admin-billing-secondary"><span class="admin-checkout-user"><strong>{if $billing_view == 'payments'}{$billing_providers[$provider_key]|default:$provider_key|escape}{else}{$item.subject_name|default:$item.plan_name|default:'套餐未记录'|escape}{/if}</strong>{if $billing_view == 'orders'}<span>宿主机 #{$item.host_id|escape}</span>{elseif $billing_view == 'invoices' && $item.plan_id}<span>套餐 #{$item.plan_id|escape}</span>{/if}</span></td>
|
|
<td data-label="金额"><span class="admin-mono">${$item.amount|string_format:'%.2f'|escape}</span></td>
|
|
<td data-label="{$billing_columns[4]|escape}">{if $billing_view == 'payments'}{billing_badge kind='payment' value=$item.payment_status}{else}{billing_badge value=$item.financial_status}{/if}</td>
|
|
<td data-label="{$billing_columns[5]|escape}">{if $billing_view == 'payments'}{billing_badge value=$item.invoice_financial_status}{else}{billing_badge kind='fulfillment' value=$item.fulfillment_status purpose=$item.purpose|default:'provision'}{/if}</td>
|
|
<td data-label="{$billing_columns[6]|escape}" class="admin-billing-secondary">{if $billing_view == 'invoices'}{if $method_key}{$billing_providers[$method_key]|default:$method_key|escape}{else}未记录{/if}{elseif $billing_view == 'orders'}<span class="admin-checkout-user"><strong>{if $item.instance_id}实例 #{$item.instance_id|escape}{else}实例 —{/if}</strong><span>{if $item.job_id}任务 #{$item.job_id|escape} · {$billing_fulfillment[$item.job_status]|default:$item.job_status|escape}{else}引擎任务 —{/if}</span></span>{else}{if $purpose_key}{$billing_purpose[$purpose_key]|default:$purpose_key|escape}{else}未分类{/if}{/if}</td>
|
|
<td data-label="{$billing_columns[7]|escape}" class="admin-billing-secondary"><span class="admin-checkout-user"><strong>{if $billing_view == 'orders' && $item.updated_at}{$item.updated_at|date_format:'%Y-%m-%d %H:%M:%S'|escape}{elseif $item.created_at}{$item.created_at|date_format:'%Y-%m-%d %H:%M:%S'|escape}{else}—{/if}</strong>{if $billing_view == 'orders' && $item.error}<span>{$item.error|escape}</span>{elseif $billing_view == 'invoices' && $item.due_at}<span>到期 {$item.due_at|date_format:'%Y-%m-%d %H:%M:%S'|escape}</span>{elseif $billing_view == 'payments' && $item.updated_at}<span>更新 {$item.updated_at|date_format:'%Y-%m-%d %H:%M:%S'|escape}</span>{/if}</span></td>
|
|
<td data-label="{$billing_columns[8]|escape}">{assign var=detail_id value=$item.invoice_id|default:''}{if $billing_view == 'invoices'}{assign var=detail_id value=$item.id}{/if}{if $detail_id}<button class="btn btn-primary btn-sm" type="button" data-invoice-id="{$detail_id|escape}" aria-label="查看账单 {$detail_id|escape} 详情">账单详情</button>{else}—{/if}</td>
|
|
</tr>
|
|
{foreachelse}<tr><td colspan="9" class="text-center text-muted py-4">{if $billing_error|default:''}账单数据暂不可用,请点击刷新重试。{else}暂无匹配记录,请调整筛选条件。{/if}</td></tr>{/foreach}
|
|
</tbody>
|