数量加减:同城/跨城/现场取货确认页加减号不再置灰;点减到低于起购时 toast,数量仍可降到 1(不能到 0)。
支付后返回:支付成功进详情带 from=pay;返回一律 switchTab 首页(失败则 reLaunch),避免栈只有一页时 navigateBack 退出小程序。订单列表返回同样加固。
This commit is contained in:
@@ -75,11 +75,12 @@ export default function OrderConfirmPickupPage() {
|
|||||||
const canSubmit = !!preview && quantityOk && !loading && !previewLoading;
|
const canSubmit = !!preview && quantityOk && !loading && !previewLoading;
|
||||||
|
|
||||||
function updateQuantity(next: number) {
|
function updateQuantity(next: number) {
|
||||||
if (next < 1) return;
|
|
||||||
if (next < minQty) {
|
if (next < minQty) {
|
||||||
const tip = `现场提货至少购买 ${minQty} 瓶`;
|
const tip = `现场提货至少购买 ${minQty} 瓶`;
|
||||||
toast(tip);
|
toast(tip);
|
||||||
setMsg(tip);
|
setMsg(tip);
|
||||||
|
if (next < 1) return;
|
||||||
|
setQuantity(next);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setQuantity(next);
|
setQuantity(next);
|
||||||
@@ -101,8 +102,12 @@ export default function OrderConfirmPickupPage() {
|
|||||||
|
|
||||||
async function submit() {
|
async function submit() {
|
||||||
if (!canSubmit) {
|
if (!canSubmit) {
|
||||||
if (!quantityOk) setMsg(`现场提货至少购买 ${minQty} 瓶`);
|
if (!quantityOk) {
|
||||||
return;
|
const tip = `现场提货至少购买 ${minQty} 瓶`;
|
||||||
|
setMsg(tip);
|
||||||
|
toast(tip);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const returnPath = `/pages/order-confirm-pickup/index?productId=${productId}&qty=${quantity}`;
|
const returnPath = `/pages/order-confirm-pickup/index?productId=${productId}&qty=${quantity}`;
|
||||||
@@ -191,8 +196,8 @@ export default function OrderConfirmPickupPage() {
|
|||||||
<Text>购买数量</Text>
|
<Text>购买数量</Text>
|
||||||
<View className="order-qty-controls">
|
<View className="order-qty-controls">
|
||||||
<View
|
<View
|
||||||
className={`order-qty-btn${quantity <= minQty ? ' order-qty-btn--disabled' : ''}`}
|
className="order-qty-btn"
|
||||||
onClick={() => updateQuantity(Math.max(minQty, quantity - 1))}
|
onClick={() => updateQuantity(quantity - 1)}
|
||||||
>
|
>
|
||||||
<Text>−</Text>
|
<Text>−</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -167,14 +167,14 @@ export default function OrderConfirmPage() {
|
|||||||
: '';
|
: '';
|
||||||
|
|
||||||
function updateQuantity(next: number) {
|
function updateQuantity(next: number) {
|
||||||
if (next < 1) return;
|
|
||||||
if (next < minQty) {
|
if (next < minQty) {
|
||||||
const tip = isCross
|
const tip = isCross
|
||||||
? `跨城配送至少购买 ${minQty} 瓶(1箱)`
|
? `跨城配送至少购买 ${minQty} 瓶(1箱)`
|
||||||
: `同城配送至少购买 ${minQty} 瓶`;
|
: `同城配送至少购买 ${minQty} 瓶`;
|
||||||
toast(tip);
|
toast(tip);
|
||||||
setMsg(tip);
|
setMsg(tip);
|
||||||
setQuantity(Math.max(1, next));
|
if (next < 1) return;
|
||||||
|
setQuantity(next);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setQuantity(next);
|
setQuantity(next);
|
||||||
@@ -352,7 +352,7 @@ export default function OrderConfirmPage() {
|
|||||||
<Text>购买数量</Text>
|
<Text>购买数量</Text>
|
||||||
<View className="order-qty-controls">
|
<View className="order-qty-controls">
|
||||||
<View
|
<View
|
||||||
className={`order-qty-btn${quantity <= 1 ? ' order-qty-btn--disabled' : ''}`}
|
className="order-qty-btn"
|
||||||
onClick={() => updateQuantity(quantity - 1)}
|
onClick={() => updateQuantity(quantity - 1)}
|
||||||
>
|
>
|
||||||
<Text>−</Text>
|
<Text>−</Text>
|
||||||
|
|||||||
@@ -181,12 +181,15 @@ export default function OrderDetailPage() {
|
|||||||
<SubPageHeader
|
<SubPageHeader
|
||||||
title="订单详情"
|
title="订单详情"
|
||||||
onBack={() => {
|
onBack={() => {
|
||||||
const pages = Taro.getCurrentPages();
|
// 支付完成后 reLaunch 进详情:栈仅一页时 navigateBack 会退出小程序,统一回首页
|
||||||
if (pages.length > 1) {
|
const fromPay = String(router.params.from || '') === 'pay';
|
||||||
Taro.navigateBack();
|
if (fromPay || Taro.getCurrentPages().length <= 1) {
|
||||||
|
Taro.switchTab({ url: '/pages/home/index' }).catch(() => {
|
||||||
|
Taro.reLaunch({ url: '/pages/home/index' });
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Taro.switchTab({ url: '/pages/home/index' });
|
Taro.navigateBack();
|
||||||
}}
|
}}
|
||||||
right={<ShareNavButton payload={sharePayload} />}
|
right={<ShareNavButton payload={sharePayload} />}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -95,7 +95,11 @@ export default function OrdersPage() {
|
|||||||
<PageShell variant="sub" className="orders-page">
|
<PageShell variant="sub" className="orders-page">
|
||||||
<SubPageHeader
|
<SubPageHeader
|
||||||
title="我的订单"
|
title="我的订单"
|
||||||
onBack={() => Taro.switchTab({ url: '/pages/home/index' })}
|
onBack={() => {
|
||||||
|
Taro.switchTab({ url: '/pages/home/index' }).catch(() => {
|
||||||
|
Taro.reLaunch({ url: '/pages/home/index' });
|
||||||
|
});
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<View className="order-tabs">
|
<View className="order-tabs">
|
||||||
{TABS.map((t) => (
|
{TABS.map((t) => (
|
||||||
|
|||||||
@@ -144,10 +144,10 @@ export default function PayPage() {
|
|||||||
toast('支付成功', 'success');
|
toast('支付成功', 'success');
|
||||||
}
|
}
|
||||||
if (deliveryType === 'ON_SITE_PICKUP') {
|
if (deliveryType === 'ON_SITE_PICKUP') {
|
||||||
// 现场提货支付即完成 → 订单详情(已完成);reLaunch 清掉商品详情栈
|
// 现场提货支付即完成 → 订单详情;from=pay 返回强制回首页,避免 navigateBack 退出小程序
|
||||||
Taro.reLaunch({ url: `/pages/order-detail/index?id=${orderId}` });
|
Taro.reLaunch({ url: `/pages/order-detail/index?id=${orderId}&from=pay` });
|
||||||
} else {
|
} else {
|
||||||
Taro.reLaunch({ url: '/pages/orders/index?tab=paid' });
|
Taro.reLaunch({ url: '/pages/orders/index?tab=paid&from=pay' });
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (isWechatAuthRequiredError(e)) {
|
if (isWechatAuthRequiredError(e)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user