feat: 建立全局店铺跨渠道管理 (#208 #209 #210 #211)

This commit is contained in:
chengma
2026-08-13 11:15:54 +08:00
parent 901b37a8cb
commit 8f707722ba
28 changed files with 1160 additions and 500 deletions
+2 -2
View File
@@ -21,7 +21,7 @@
</form>
<button type="button" data-modal-open="sync-history-modal">同步记录</button>
{{if .CurrentUser.IsAdmin}}<a class="button-link" href="/syb/shops">同步店铺({{.EnabledSyncShopCount}})</a>{{end}}
{{if .CurrentUser.IsAdmin}}<a class="button-link" href="/shops">店铺管理(同步 {{.EnabledSyncShopCount}})</a>{{end}}
<form id="syb-collect-form" method="post" action="/syb/collect-pdd-batch" hidden></form>
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}" form="syb-collect-form">
@@ -67,7 +67,7 @@
{{if .RangeError}}<p class="missing sync-range-message" role="alert">{{.RangeError}}</p>{{end}}
{{if .RangeWarning}}<p class="hint sync-range-message">{{.RangeWarning}}</p>{{end}}
<p class="hint sync-range-message">
按顺运宝货运单创建日期(UTC+8)同步,开始日和结束日都包含,每次最多 31 天;当前启用 {{.EnabledSyncShopCount}} 个同步店铺。
按顺运宝货运单创建日期(UTC+8)同步,开始日和结束日都包含,每次最多 31 天;当前在店铺管理中启用 {{.EnabledSyncShopCount}} 个 SYB 同步店铺。
</p>
<div class="modal-backdrop" id="sync-history-modal" {{if not .NeedSyncHistory}}hidden{{end}}>
-54
View File
@@ -1,54 +0,0 @@
{{define "syb/shops"}}
{{template "header" .}}
<div class="toolbar">
<form class="inline grow" method="post" action="/syb/shops/create">
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
<label for="shop-name">店铺名称</label>
<input id="shop-name" type="text" name="shop_name" maxlength="500" required
placeholder="与顺运宝 shopName 完全一致">
<button type="submit" class="primary">新增并启用</button>
</form>
<a class="button-link" href="/syb">返回顺运宝数据</a>
</div>
{{if .Message}}<p class="hint" role="status">{{.Message}}</p>{{end}}
{{if .Error}}<p class="missing" role="alert">{{.Error}}</p>{{end}}
<p class="hint">同步只接受启用店铺;匹配时忽略名称首尾空白,但不做模糊匹配。没有启用店铺时同步会安全停止。</p>
<div class="table-wrap">
<table>
<thead><tr><th>店铺名称</th><th>状态</th><th>更新时间</th><th>操作</th></tr></thead>
<tbody>
{{range .Rows}}
<tr>
<td title="{{.ShopName}}">{{.ShopName}}</td>
<td>{{if .Enabled}}启用{{else}}停用{{end}}</td>
<td>{{.UpdatedAt}}</td>
<td>
<form class="inline" method="post" action="/syb/shops/status">
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
<input type="hidden" name="shop_id" value="{{.ShopID}}">
<input type="hidden" name="enabled" value="{{if .Enabled}}0{{else}}1{{end}}">
<button type="submit">{{if .Enabled}}停用{{else}}重新启用{{end}}</button>
</form>
{{if not .Enabled}}
<form class="inline" method="post" action="/syb/shops/delete"
data-confirm-submit="确定永久删除已停用店铺“{{.ShopName}}”吗?历史货运单和同步记录不会删除;如需恢复,必须重新新增该店铺。">
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
<input type="hidden" name="shop_id" value="{{.ShopID}}">
<button type="submit" class="danger">删除</button>
</form>
{{end}}
</td>
</tr>
{{else}}
<tr class="empty"><td colspan="4">还没有同步店铺。请先新增并启用至少一个店铺,才能开始同步。</td></tr>
{{end}}
</tbody>
</table>
</div>
<div class="statusbar"><span class="grow"></span><span>共 {{len .Rows}} 个店铺,启用 {{.EnabledCount}} 个</span></div>
{{template "footer" .}}
{{end}}