feat: 支持人工修改蝦皮规格 (#215)

This commit is contained in:
chengma
2026-08-13 12:14:02 +08:00
parent 5b7d92289e
commit 4752fef54f
16 changed files with 403 additions and 34 deletions
+34 -3
View File
@@ -60,16 +60,47 @@
{{end}}
<h3>规格({{len .SKUs}} 个{{if gt .PendingCount 0}},{{.PendingCount}} 个待人工补{{end}})</h3>
{{$product := .}}
{{if not .SKUs}}
<p class="missing">这个商品在报表里没有任何 SKU。</p>
{{else}}
<div class="table-wrap">
<table>
<thead><tr><th>规格ID</th><th>颜色</th><th>尺码</th><th>建議</th><th>状态</th></tr></thead>
<thead><tr><th>蝦皮 SKU ID</th><th>规格原文</th><th>颜色</th><th>尺码</th><th>建议说明</th><th>状态</th><th>操作</th></tr></thead>
<tbody>
{{range .SKUs}}
<tr{{if .Pending}} class="row-warn"{{end}}><td>{{.SKUID}}</td><td>{{.Color}}</td><td>{{.Size}}</td><td>{{.Advice}}</td><td>{{.StatusText}}</td></tr>
{{if .Pending}}<tr class="row-warn"><td colspan="5"><small>原文:{{.SpecRaw}}</small></td></tr>{{end}}
<tr{{if .Pending}} class="row-warn"{{end}}>
<td>{{if .SKUID}}{{.SKUID}}{{else}}—{{end}}</td>
<td class="truncate" title="{{.SpecRaw}}">{{if .SpecRaw}}{{.SpecRaw}}{{else}}—{{end}}</td>
<td>{{if .Color}}{{.Color}}{{else}}—{{end}}</td>
<td>{{if .Size}}{{.Size}}{{else}}—{{end}}</td>
<td>{{if .Advice}}{{.Advice}}{{else}}—{{end}}</td>
<td>{{.StatusText}}</td>
<td>
<details class="sku-editor">
<summary>编辑</summary>
<form method="post" action="/shopee/spec/save" class="sku-edit-form">
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
<input type="hidden" name="shopee_goods_id" value="{{$product.GoodsID}}">
<input type="hidden" name="sku_record_id" value="{{.RecordID}}">
<input type="hidden" name="open_id" value="{{$product.GoodsID}}">
<input type="hidden" name="q" value="{{$.Keyword}}">
<input type="hidden" name="search_field" value="{{$.SearchField}}">
<input type="hidden" name="status" value="{{$.StatusFilter}}">
<input type="hidden" name="deleted" value="{{if $.DeletedFilter}}1{{end}}">
<input type="hidden" name="unlinked" value="{{if $.UnlinkedFilter}}1{{end}}">
<input type="hidden" name="page" value="{{$.CurrentPage}}">
<div class="sku-edit-grid">
<label class="sku-edit-field"><span>颜色</span><input type="text" name="color" value="{{.Color}}" maxlength="500" required></label>
<label class="sku-edit-field"><span>尺码</span><input type="text" name="size" value="{{.Size}}" maxlength="500" required></label>
<label class="sku-edit-field sku-edit-advice"><span>建议说明</span><input type="text" name="advice" value="{{.Advice}}" maxlength="500"></label>
</div>
<small>规格原文和 SKU 身份不会修改;保存后这三个字段按人工值保护。</small>
<div><button type="submit" class="primary">保存规格</button></div>
</form>
</details>
</td>
</tr>
{{end}}
</tbody>
</table>
+1 -1
View File
@@ -158,7 +158,7 @@
app.js 不需要改,见工单 #41。
弹窗同时提供当前 PDD 关联和单商品采集入口。 */}}
<div class="modal-backdrop" id="detail-modal" data-detail-url="{{.DetailURL}}" hidden>
<div class="modal-backdrop" id="detail-modal" data-detail-url="{{.DetailURL}}"{{if .AutoOpenDetailID}} data-auto-open-detail-id="{{.AutoOpenDetailID}}"{{end}} hidden>
<div class="modal" role="dialog" aria-modal="true" data-detail-slot>
<div class="modal-body">正在加载…</div>
</div>