fix(after-sale): 售后工单已完结仍可再次申请,改由订单是否已退款决定
上一个提交把「工单 completed」当成了不能再申请售后的判据,方向搞反了: 能否再售后应该看订单有没有被标「已退款」,而不是看工单状态。订单已退款时 status_group 变成 refunded、enabled 直接为 false,那道闸门本来就够用;用工单 状态再判一次,反而把「工单已完结但订单没退款」的用户堵死,售后详细弹窗底部 也只剩下一个「我知道了」死胡同。 - reapplyable_statuses 补上 STATUS_COMPLETED:rejected / cancelled / completed 一律放行再次申请,售后详细弹窗底部按钮对已完成订单渲染「再次申请售后」 - can_apply 还原为只看有没有进行中的工单(!open),不再二次校验工单状态 - create() 的重复申请闸门还原为 find_active():只挡仍在流转的工单, completed 不挡;订单已退款由上面的 STATUS_PAID 校验先挡掉 - 点「再次申请售后」后清 has_application 落回申请表单,提交走 create() 新建工单,链路本来就通,无需改动 harness 场景名改为 settled_ticket_still_allows_reapply,断言 completed / rejected / cancelled 三种已终结状态都能新建工单;待审核工单同因幂等、换因 挡住的场景保留。 验证:tests/widget-system/ 462 项、tests/admin/ 76 项通过;after-sale-log-harness 7/7。未做浏览器视觉验收。
This commit is contained in:
@@ -233,12 +233,13 @@ test('order view model exposes the after-sale button matrix', () => {
|
||||
assert.match(userOrders, /'expired'\s*=> \(bool\) \$expired,/)
|
||||
assert.match(userOrders, /'has_application' => \$has_application,/)
|
||||
assert.match(userOrders, /'open'\s*=> \$open,/)
|
||||
// completed 的工单已终结,订单没另标「已退款」也不能再申请
|
||||
assert.match(userOrders, /'can_apply'\s*=> \$enabled && !\$expired && !\$open && \$reapplyable,/)
|
||||
assert.match(userOrders, /\$reapplyable = !\$has_application \|\| in_array\(\$latest_status, \$reapplyable_statuses, true\);/)
|
||||
// 可再次申请售后按工单状态推理:rejected(被拒绝)/ cancelled(已取消)允许再次申请;
|
||||
// pending / processing / approved(流转中)与 completed(已完结)不允许
|
||||
assert.match(userOrders, /\$reapplyable_statuses = \[AfterSaleService::STATUS_REJECTED, AfterSaleService::STATUS_CANCELLED\];/)
|
||||
// can_apply 只问「有没有进行中的工单」:completed 不挡,能否再售后由订单是否已退款决定
|
||||
assert.match(userOrders, /'can_apply'\s*=> \$enabled && !\$expired && !\$open,/)
|
||||
// 可再次申请售后按工单状态推理:rejected / cancelled / completed 都允许再次申请;
|
||||
// pending / processing / approved(流转中)不允许。订单已退款时 enabled 直接为 false,
|
||||
// 上面那条自然挡死,不需要工单状态再判一次。
|
||||
assert.match(userOrders, /\$reapplyable_statuses = \[\s*AfterSaleService::STATUS_REJECTED,\s*AfterSaleService::STATUS_CANCELLED,\s*AfterSaleService::STATUS_COMPLETED,\s*\];/)
|
||||
assert.ok(!userOrders.includes('$reapplyable ='), 'can_apply must not re-check the ticket status')
|
||||
assert.match(userOrders, /'can_reapply'\s*=> \$enabled && !\$expired && \$has_application && in_array\(\$latest_status, \$reapplyable_statuses, true\),/)
|
||||
assert.match(userOrders, /'latest'\s*=> \$has_application \? \[/)
|
||||
assert.match(userOrders, /'apply_form'\s*=> is_array\(\$latest\['apply_form'\] \?\? null\) \? \$latest\['apply_form'\] : null,/)
|
||||
@@ -505,7 +506,7 @@ test('handling-log behaviour is covered against the real service', () => {
|
||||
'cancel_appends_user_entry',
|
||||
'log_is_capped_at_50',
|
||||
'normalize_drops_malformed_entries',
|
||||
'completed_ticket_blocks_reapply',
|
||||
'settled_ticket_still_allows_reapply',
|
||||
'open_ticket_blocks_duplicate_apply',
|
||||
]) {
|
||||
assert.ok(names.includes(name), `missing handling-log scenario: ${name}`)
|
||||
|
||||
Reference in New Issue
Block a user