fix: 共享单按骑行人设置,手动还车不续租,支持上游 A→B 切换
共享策略 - 预览:车主出卡,骑行人决定时长、轮次、提醒与保护卡策略 - 后端拦截共享车主的加轮、临时锁/开车与支付,普通订单不变 - 前端共享车主只保留还车按钮,不显示权限提示;骑行人沿用现有设置页 还车与续租 - auto_return_bike 默认 allow_renewal=False;仅 0 点定时器与过期巡检显式开启 - 页面按钮、邮件链接、共享还车均清理自动重试状态,剩余/临时加轮不再触发续租 - 官方小程序还车(上游订单消失)只做本地收尾,不重新开锁 - 续租拿不到原车位置时仍直接尝试下单开锁,失败再明确提示 上游 A→B - 网站开 A,官方小程序还 A 后又开 B:巡检保留 B,A 按已还车本地收尾 - 同一订单号不误关、不重复建单;无订单号记录保守跳过 测试:266 pytest + 45 node 全绿;tsc 与生产 bundle 检查通过
This commit is contained in:
+18
-1
@@ -707,6 +707,10 @@ let orderTempActionLoading: any = false;
|
||||
// static/js/map.js:2213-2260
|
||||
export async function tempLockCurrentOrder() {
|
||||
if (orderTempActionLoading || !isOrderActionEligible(S.currentOrder) || Number(S.currentOrder.status) !== 2) return;
|
||||
if (S.currentOrder.shared) {
|
||||
showToast("共享订单仅骑行人可临时锁车,车主只能还车");
|
||||
return;
|
||||
}
|
||||
// 先快照:等定位(最长 5 秒)期间 20 秒轮询可能把 currentOrder 置空,
|
||||
// 之后再读 currentOrder.order_id 会抛 TypeError 并被吞成「临时锁车失败」。
|
||||
const order = S.currentOrder;
|
||||
@@ -762,6 +766,10 @@ export async function tempLockCurrentOrder() {
|
||||
// static/js/map.js:2262-2300
|
||||
export async function tempUnlockCurrentOrder() {
|
||||
if (orderTempActionLoading || !isOrderActionEligible(S.currentOrder) || Number(S.currentOrder.status) !== 2) return;
|
||||
if (S.currentOrder.shared) {
|
||||
showToast("共享订单仅骑行人可临时开车,车主只能还车");
|
||||
return;
|
||||
}
|
||||
const button = document.getElementById("order-action-unlock");
|
||||
orderTempActionLoading = true;
|
||||
if (button) {
|
||||
@@ -1368,12 +1376,20 @@ export async function confirmAddRound() {
|
||||
// static/js/map.js:2946-2949
|
||||
export function addRoundForCurrent() {
|
||||
if (!S.activeRental || !S.authToken) { showToast("当前没有进行中的订单"); return; }
|
||||
if (S.currentOrder && S.currentOrder.shared) {
|
||||
showToast("共享订单仅骑行人可加轮,车主只能还车");
|
||||
return;
|
||||
}
|
||||
showAddRoundConfirm({ kind: "rental", value: S.activeRental.rental_id });
|
||||
}
|
||||
|
||||
// static/js/map.js:2950-2954
|
||||
export function addRoundFromBanner() {
|
||||
if (!S.currentOrder || !S.currentOrder.order_id) { showToast("当前没有进行中的订单"); return; }
|
||||
if (S.currentOrder.shared) {
|
||||
showToast("共享订单仅骑行人可加轮,车主只能还车");
|
||||
return;
|
||||
}
|
||||
showAddRoundConfirm({ kind: "order", value: S.currentOrder.order_id });
|
||||
}
|
||||
// 页面加载时检查订单状态和租车状态
|
||||
@@ -1853,7 +1869,8 @@ export function showRentalBar() {
|
||||
if (addBtn) {
|
||||
const realOrder = S.activeRental.source ? S.activeRental.source !== "reminder"
|
||||
: !!S.activeRental.order_id;
|
||||
addBtn.style.display = realOrder ? "inline-flex" : "none";
|
||||
const ownerShared = !!(S.currentOrder && S.currentOrder.shared);
|
||||
addBtn.style.display = (realOrder && !ownerShared) ? "inline-flex" : "none";
|
||||
}
|
||||
updateRentalFinalTime();
|
||||
updateRentalCountdown();
|
||||
|
||||
Reference in New Issue
Block a user