fix: hide countdown for manual dispatch
This commit is contained in:
@@ -51,8 +51,8 @@
|
|||||||
<img class="orbit" :src="mobileAssets.claimSpinner" alt="" />
|
<img class="orbit" :src="mobileAssets.claimSpinner" alt="" />
|
||||||
<img class="gift" :src="mobileAssets.claimMatchingGift" alt="" />
|
<img class="gift" :src="mobileAssets.claimMatchingGift" alt="" />
|
||||||
</div>
|
</div>
|
||||||
<div class="m-match-progress"><i :style="{ width: `${matchProgress}%` }"></i></div>
|
<div v-if="isAutoMatching" class="m-match-progress"><i :style="{ width: `${matchProgress}%` }"></i></div>
|
||||||
<strong class="m-match-percent">{{ matchProgress }}%</strong>
|
<strong v-if="isAutoMatching" class="m-match-percent">{{ matchProgress }}%</strong>
|
||||||
<ol class="m-match-steps">
|
<ol class="m-match-steps">
|
||||||
<li v-for="(step, index) in matchSteps" :key="step" :class="{ active: index <= matchStep }">
|
<li v-for="(step, index) in matchSteps" :key="step" :class="{ active: index <= matchStep }">
|
||||||
<span>✓</span>{{ step }}
|
<span>✓</span>{{ step }}
|
||||||
@@ -141,6 +141,7 @@
|
|||||||
});
|
});
|
||||||
const matchStep = computed(() => (matchProgress.value < 35 ? 0 : matchProgress.value < 60 ? 1 : matchProgress.value < 85 ? 2 : 3));
|
const matchStep = computed(() => (matchProgress.value < 35 ? 0 : matchProgress.value < 60 ? 1 : matchProgress.value < 85 ? 2 : 3));
|
||||||
const matchSteps = ['正在匹配任务', '获取商品信息', '确认任务内容', '发放任务结果'];
|
const matchSteps = ['正在匹配任务', '获取商品信息', '确认任务内容', '发放任务结果'];
|
||||||
|
const isAutoMatching = computed(() => order.value?.dispatch_mode !== 'manual');
|
||||||
const matchingHint = computed(() => {
|
const matchingHint = computed(() => {
|
||||||
if (order.value?.dispatch_mode === 'manual') return '订单已领取,正在等待后台匹配...';
|
if (order.value?.dispatch_mode === 'manual') return '订单已领取,正在等待后台匹配...';
|
||||||
if (matchRemainingSeconds.value > 0) return `系统正在派单... ${formatCountdown(matchRemainingSeconds.value)}`;
|
if (matchRemainingSeconds.value > 0) return `系统正在派单... ${formatCountdown(matchRemainingSeconds.value)}`;
|
||||||
@@ -256,7 +257,15 @@
|
|||||||
function handleOrder(value: any) {
|
function handleOrder(value: any) {
|
||||||
order.value = value;
|
order.value = value;
|
||||||
if (value?.status === 'matching') {
|
if (value?.status === 'matching') {
|
||||||
startCountdown(value);
|
if (value?.dispatch_mode === 'manual') {
|
||||||
|
if (countdownTimer) window.clearInterval(countdownTimer);
|
||||||
|
countdownTimer = undefined;
|
||||||
|
matchRemainingSeconds.value = 0;
|
||||||
|
matchTotalSeconds.value = 0;
|
||||||
|
matchProgress.value = 18;
|
||||||
|
} else {
|
||||||
|
startCountdown(value);
|
||||||
|
}
|
||||||
schedulePoll();
|
schedulePoll();
|
||||||
} else if (['pending', 'processing', 'completed'].includes(value?.status)) {
|
} else if (['pending', 'processing', 'completed'].includes(value?.status)) {
|
||||||
matchProgress.value = 100;
|
matchProgress.value = 100;
|
||||||
@@ -300,6 +309,7 @@
|
|||||||
|
|
||||||
function startCountdown(value: any) {
|
function startCountdown(value: any) {
|
||||||
if (countdownTimer) window.clearInterval(countdownTimer);
|
if (countdownTimer) window.clearInterval(countdownTimer);
|
||||||
|
if (value?.dispatch_mode === 'manual') return;
|
||||||
const scheduledAt = Date.parse(String(value?.scheduled_match_at || ''));
|
const scheduledAt = Date.parse(String(value?.scheduled_match_at || ''));
|
||||||
if (!Number.isFinite(scheduledAt)) return;
|
if (!Number.isFinite(scheduledAt)) return;
|
||||||
matchTotalSeconds.value = Math.max(1, Number(value?.dispatch_delay_seconds || 0));
|
matchTotalSeconds.value = Math.max(1, Number(value?.dispatch_delay_seconds || 0));
|
||||||
|
|||||||
Reference in New Issue
Block a user