@@ -190,17 +190,28 @@ function stationRow(s) {
190190 // 固定成本渠道:不访问接口,只展示摊销信息
191191 if ( s . type === "fixed" ) {
192192 const daily = s . fixedCostCny > 0 && s . fixedDays > 0 ? s . fixedCostCny / s . fixedDays : 0 ;
193+ const pieces = [ `<span>日均摊销 ${ cny ( daily ) } </span>` , `<span>每次 ${ cny ( s . fixedCostCny || 0 ) } 管 ${ s . fixedDays || 0 } 天</span>` ] ;
194+ let expired = false ;
195+ if ( s . fixedStartDate && s . fixedDays > 0 ) {
196+ const start = new Date ( s . fixedStartDate + "T00:00:00" ) ;
197+ const end = start . getTime ( ) + s . fixedDays * 86400000 ;
198+ const remain = Math . ceil ( ( end - Date . now ( ) ) / 86400000 ) ;
199+ expired = remain <= 0 ;
200+ pieces . push ( expired
201+ ? `<span class="danger">已于 ${ fmtClock ( end ) . split ( " " ) [ 0 ] } 到期,续费请更新日期</span>`
202+ : `<span${ remain <= 3 ? ' class="warn"' : "" } >${ esc ( s . fixedStartDate ) } 起 · 剩 ${ remain } 天</span>` ) ;
203+ }
193204 return `
194205 <div class="st-row" data-id="${ s . id } ">
195206 <div class="st-plate">¥</div>
196207 <div class="st-main" style="cursor:default">
197208 <div class="st-name">${ esc ( s . name ) } <span class="demo-tag">固定成本</span></div>
198209 <div class="st-meta">${ s . baseUrl ? esc ( s . baseUrl ) + " · " : "" } 不访问接口 · 仅计入利润成本</div>
199- <div class="st-predict"><span>日均摊销 ${ cny ( daily ) } </ span><span> ·</span><span>每次 ${ cny ( s . fixedCostCny || 0 ) } 管 ${ s . fixedDays || 0 } 天</span> </div>
210+ <div class="st-predict">${ pieces . join ( "< span>·</span>" ) } </div>
200211 </div>
201212 <div class="st-balance">
202- <div class="amt" >${ cny ( daily ) } </div>
203- <div class="sub">每天 </div>
213+ <div class="amt${ expired ? " danger" : "" } " >${ cny ( expired ? 0 : daily ) } </div>
214+ <div class="sub">${ expired ? "已到期" : "每天" } </div>
204215 </div>
205216 <div class="st-actions">
206217 <button class="icon-btn" data-act="edit" title="编辑"><svg viewBox="0 0 24 24"><path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z"/></svg></button>
@@ -989,7 +1000,9 @@ function profitSection(p) {
9891000 const costRows = p . costs . map ( ( c ) => `
9901001 <div class="st-row profit-row">
9911002 <div class="st-main" style="cursor:default">
992- <div class="st-name">${ esc ( c . name ) } <span class="demo-tag">${ MODE_LABEL [ c . mode ] || c . mode } </span></div>
1003+ <div class="st-name">${ esc ( c . name ) } <span class="demo-tag">${ MODE_LABEL [ c . mode ] || c . mode } </span>${
1004+ c . note ? ` <span class="demo-tag${ c . note === "已到期" ? " tag-warn" : "" } ">${ esc ( c . note ) } </span>` : ""
1005+ } </div>
9931006 <div class="st-meta">渠道:${ esc ( c . channels . join ( "、" ) ) } </div>
9941007 </div>
9951008 <div class="st-balance"><div class="amt">${ cny ( c . cny ) } </div><div class="sub">期内成本</div></div>
@@ -1230,6 +1243,8 @@ function openModal(station) {
12301243 $ ( "#f-cnyRate" ) . value = station ?. cnyPerUsd ?? "" ;
12311244 $ ( "#f-fixedCost" ) . value = station ?. fixedCostCny ?? "" ;
12321245 $ ( "#f-fixedDays" ) . value = station ?. fixedDays ?? "" ;
1246+ // 新建默认今天;编辑回显已存日期(本地时区的 YYYY-MM-DD)
1247+ $ ( "#f-fixedStart" ) . value = station ? ( station . fixedStartDate || "" ) : new Date ( ) . toLocaleDateString ( "en-CA" ) ;
12331248 $ ( "#f-own" ) . checked = ! ! station ?. isOwn ;
12341249 if ( station ) {
12351250 $ ( "#f-accessToken" ) . placeholder = station . hasAccessToken ? "已配置,留空保持不变" : "令牌 / JWT" ;
@@ -1281,6 +1296,7 @@ $("#modalSave").onclick = async () => {
12811296 cnyPerUsd : $ ( "#f-cnyRate" ) . value . trim ( ) ,
12821297 fixedCostCny : $ ( "#f-fixedCost" ) . value . trim ( ) ,
12831298 fixedDays : $ ( "#f-fixedDays" ) . value . trim ( ) ,
1299+ fixedStartDate : $ ( "#f-fixedStart" ) . value ,
12841300 isOwn : $ ( "#f-type" ) . value === "newapi" && $ ( "#f-own" ) . checked ,
12851301 } ;
12861302 const at = $ ( "#f-accessToken" ) . value . trim ( ) ;
0 commit comments