feat: 支持采购任务追溯并安全重新创建 (#186)

This commit is contained in:
chengma
2026-08-12 16:26:22 +08:00
parent 836aad5c26
commit 69bcf6116a
13 changed files with 298 additions and 57 deletions
+5 -3
View File
@@ -215,7 +215,8 @@
<h2 id="purchase-modal-title">确认创建采购任务</h2>
<button type="button" class="modal-x" data-modal-close aria-label="关闭">×</button>
</div>
<form method="post" action="/syb/create-task" data-purchase-form>
<form method="post" action="/syb/create-task" data-purchase-form
data-auto-open-purchase-id="{{.OpenPurchaseSybID}}">
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
<input type="hidden" name="order_no" value="{{.Keyword}}">
<input type="hidden" name="shop" value="{{.ShopFilter}}">
@@ -231,7 +232,7 @@
{{if eq .PurchaseClientCount 0}}<small class="missing">当前账号没有可见的客户端,请先联系管理员绑定客户端。</small>{{else}}<small>所有当前账号可见的客户端均可指派;未就绪或离线客户端会等待其就绪后领取。</small>{{end}}
</div>
<p class="hint">单价上限默认取已映射 PDD 规格的人民币采集价;订单总价上限按单价乘以顺运宝数量自动计算,不使用顺运宝的台币售价。</p>
{{range .Rows}}
{{range .PurchaseRows}}
<div class="purchase-confirm-row" data-purchase-row="{{.SybID}}" data-purchase-quantity="{{.Quantity}}" hidden>
<input type="hidden" name="ids" value="{{.SybID}}" disabled>
<input type="hidden" name="mapping_option_key" value="{{.MappingOptionKey}}" disabled>
@@ -283,7 +284,8 @@
</div>
</div>
<div class="modal-backdrop" id="detail-modal" data-detail-url="{{.DetailURL}}" hidden>
<div class="modal-backdrop" id="detail-modal" data-detail-url="{{.DetailURL}}"
data-auto-open-detail-id="{{.OpenSybID}}" hidden>
<div class="modal modal-wide" role="dialog" aria-modal="true" data-detail-slot>
<div class="modal-body">正在加载…</div>
</div>
+19 -2
View File
@@ -2,8 +2,8 @@
{{/* 双击一行时弹出的内容。
这是一个**片段**,不是整页——外面的弹窗壳子在 task/list.html 里。
`[必须]` 只读:本工单不做改派、重试、取消,弹窗里不放对应的表单和按钮,
见 #19。采购专有字段(目标规格/数量/订单总价上限)在采集任务这里
`[必须]` 字段只读:弹窗不直接改派、重试、取消或复制旧任务;失败/取消采购
只允许导航回原顺运宝明细重新确认,见 #186。采购专有字段在采集任务这里
**整段隐藏**,不显示空行。 */}}
{{with .D}}
<div class="modal-head">
@@ -23,6 +23,16 @@
<dt>完成时间</dt><dd>{{.FinishedAt}}</dd>
</dl>
{{if .IsPurchase}}
<h3>来源信息</h3>
<dl class="detail">
<dt>蝦皮订单号</dt><dd>{{.ShopeeOrderNo}}</dd>
<dt>顺运宝明细 ID</dt><dd>{{.SybID}}</dd>
<dt>蝦皮商品 ID</dt><dd>{{.ShopeeGoodsID}}</dd>
<dt>PDD 商品 ID</dt><dd>{{.PddGoodsID}}</dd>
</dl>
{{end}}
<h3>执行参数</h3>
<dl class="detail">
<dt>PDD 链接</dt>
@@ -70,6 +80,13 @@
</div>
<div class="modal-foot">
{{if .HasSybSource}}
<span class="grow"></span>
<a class="button-link" href="{{.ViewSybURL}}">查看原货运单</a>
{{if .CanRecreatePurchase}}
<a class="button-link primary" href="{{.RecreatePurchaseURL}}">重新创建采购任务</a>
{{end}}
{{end}}
<button type="button" data-modal-close>关闭</button>
</div>
{{end}}