新增代发订单列表、扫码反查与拣货页,完善绑定/进度展示与 nginx/vite SPA 回退;同步 SKU 申报、价格发布跳过、字典与 H5 代发体验优化。 Co-authored-by: Cursor <cursoragent@cursor.com>
339 lines
7.4 KiB
Vue
339 lines
7.4 KiB
Vue
<template>
|
|
<section class="h5-journey h5-enter">
|
|
<button type="button" class="h5-journey__summary" @click="expanded = !expanded">
|
|
<div class="h5-journey__summary-text">
|
|
<h3>{{ t('h5.journey.title') }}</h3>
|
|
<p>{{ t('h5.journey.lead') }}</p>
|
|
</div>
|
|
<span class="h5-journey__toggle">
|
|
{{ expanded ? t('h5.journey.collapse') : t('h5.journey.expand') }}
|
|
<icon-down :class="{ 'is-open': expanded }" />
|
|
</span>
|
|
</button>
|
|
|
|
<ol v-show="expanded" class="h5-journey__flow">
|
|
<li
|
|
v-for="(step, index) in steps"
|
|
:key="step.key"
|
|
class="h5-journey__step"
|
|
>
|
|
<button type="button" class="h5-journey__main" @click="onStep(step)">
|
|
<span class="h5-journey__index">{{ index + 1 }}</span>
|
|
<span class="h5-journey__icon">
|
|
<component :is="step.icon" />
|
|
</span>
|
|
<span class="h5-journey__text">
|
|
<strong>{{ t(step.titleKey) }}</strong>
|
|
<em>{{ t(step.hintKey) }}</em>
|
|
</span>
|
|
<icon-right class="h5-journey__arrow" />
|
|
</button>
|
|
</li>
|
|
</ol>
|
|
|
|
<H5WarehouseAddressSheet
|
|
v-if="warehouseVisible"
|
|
v-model:visible="warehouseVisible"
|
|
/>
|
|
<H5ShipGuideSheet v-if="shipVisible" v-model:visible="shipVisible" />
|
|
<H5PlaceOrderSheet v-if="placeOrderVisible" v-model:visible="placeOrderVisible" />
|
|
<H5CompleteContactSheet
|
|
v-if="contactVisible"
|
|
v-model:visible="contactVisible"
|
|
:profile="contactProfile"
|
|
@success="onContactSuccess"
|
|
@cancel="onContactCancel"
|
|
/>
|
|
</section>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { defineAsyncComponent, ref, type Component } from 'vue';
|
|
import { useRouter } from 'vue-router';
|
|
import { useI18n } from 'vue-i18n';
|
|
import {
|
|
IconSearch,
|
|
IconHome,
|
|
IconSend,
|
|
IconPlus,
|
|
IconSafe,
|
|
IconCheckCircle,
|
|
IconRight,
|
|
IconDown,
|
|
} from '@arco-design/web-vue/es/icon';
|
|
import type { CustomerProfileCompleteness } from '@/api/customer';
|
|
import { h5Navigate } from '@/utils/device';
|
|
import { checkCustomerContactRequired } from '@/utils/customerContactGate';
|
|
|
|
defineOptions({ name: 'H5JourneyGuide' });
|
|
|
|
const H5WarehouseAddressSheet = defineAsyncComponent(
|
|
() => import('./H5WarehouseAddressSheet.vue'),
|
|
);
|
|
const H5ShipGuideSheet = defineAsyncComponent(() => import('./H5ShipGuideSheet.vue'));
|
|
const H5PlaceOrderSheet = defineAsyncComponent(() => import('./H5PlaceOrderSheet.vue'));
|
|
const H5CompleteContactSheet = defineAsyncComponent(
|
|
() => import('./H5CompleteContactSheet.vue'),
|
|
);
|
|
|
|
type StepKey = 'price' | 'warehouse' | 'ship' | 'order' | 'pay' | 'done';
|
|
|
|
type Step = {
|
|
key: StepKey;
|
|
titleKey: string;
|
|
hintKey: string;
|
|
icon: Component;
|
|
action: 'route' | 'warehouse' | 'ship' | 'placeOrder';
|
|
path?: string;
|
|
};
|
|
|
|
const { t } = useI18n();
|
|
const router = useRouter();
|
|
|
|
/** 默认收起,避免占满首屏 */
|
|
const expanded = ref(false);
|
|
const warehouseVisible = ref(false);
|
|
const shipVisible = ref(false);
|
|
const placeOrderVisible = ref(false);
|
|
const contactVisible = ref(false);
|
|
const contactProfile = ref<CustomerProfileCompleteness | null>(null);
|
|
let pendingPlaceOrder = false;
|
|
|
|
const steps: Step[] = [
|
|
{
|
|
key: 'price',
|
|
titleKey: 'h5.journey.step.price',
|
|
hintKey: 'h5.journey.step.priceHint',
|
|
icon: IconSearch,
|
|
action: 'route',
|
|
path: '/h5/price',
|
|
},
|
|
{
|
|
key: 'warehouse',
|
|
titleKey: 'h5.journey.step.warehouse',
|
|
hintKey: 'h5.journey.step.warehouseHint',
|
|
icon: IconHome,
|
|
action: 'warehouse',
|
|
},
|
|
{
|
|
key: 'order',
|
|
titleKey: 'h5.journey.step.order',
|
|
hintKey: 'h5.journey.step.orderHint',
|
|
icon: IconPlus,
|
|
action: 'placeOrder',
|
|
},
|
|
{
|
|
key: 'ship',
|
|
titleKey: 'h5.journey.step.ship',
|
|
hintKey: 'h5.journey.step.shipHint',
|
|
icon: IconSend,
|
|
action: 'ship',
|
|
},
|
|
{
|
|
key: 'pay',
|
|
titleKey: 'h5.journey.step.pay',
|
|
hintKey: 'h5.journey.step.payHint',
|
|
icon: IconSafe,
|
|
action: 'route',
|
|
path: '/h5/orders?group=actionNeeded',
|
|
},
|
|
{
|
|
key: 'done',
|
|
titleKey: 'h5.journey.step.done',
|
|
hintKey: 'h5.journey.step.doneHint',
|
|
icon: IconCheckCircle,
|
|
action: 'route',
|
|
path: '/h5/orders?group=shipping',
|
|
},
|
|
];
|
|
|
|
async function openPlaceOrder() {
|
|
const { needContact, profile } = await checkCustomerContactRequired();
|
|
if (needContact) {
|
|
pendingPlaceOrder = true;
|
|
contactProfile.value = profile;
|
|
contactVisible.value = true;
|
|
return;
|
|
}
|
|
placeOrderVisible.value = true;
|
|
}
|
|
|
|
function onContactSuccess() {
|
|
if (!pendingPlaceOrder) return;
|
|
pendingPlaceOrder = false;
|
|
placeOrderVisible.value = true;
|
|
}
|
|
|
|
function onContactCancel() {
|
|
pendingPlaceOrder = false;
|
|
}
|
|
|
|
function onStep(step: Step) {
|
|
if (step.action === 'warehouse') {
|
|
warehouseVisible.value = true;
|
|
return;
|
|
}
|
|
if (step.action === 'ship') {
|
|
shipVisible.value = true;
|
|
return;
|
|
}
|
|
if (step.action === 'placeOrder') {
|
|
void openPlaceOrder();
|
|
return;
|
|
}
|
|
if (step.path) {
|
|
const [path, queryStr] = step.path.split('?');
|
|
if (queryStr) {
|
|
const query: Record<string, string> = {};
|
|
queryStr.split('&').forEach((pair) => {
|
|
const [k, v] = pair.split('=');
|
|
if (k) query[k] = v || '';
|
|
});
|
|
h5Navigate(router, { path, query });
|
|
} else {
|
|
h5Navigate(router, path);
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
.h5-journey {
|
|
margin-top: 16px;
|
|
padding: 6px 4px 10px;
|
|
border-radius: 18px;
|
|
background: #fff;
|
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
|
|
}
|
|
|
|
.h5-journey__summary {
|
|
width: 100%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: 10px;
|
|
min-height: 72px;
|
|
padding: 16px 14px 14px;
|
|
border: none;
|
|
background: transparent;
|
|
text-align: left;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.h5-journey__summary-text {
|
|
min-width: 0;
|
|
|
|
h3 {
|
|
margin: 0 0 6px;
|
|
font-size: 16px;
|
|
font-weight: 700;
|
|
color: #1d2129;
|
|
}
|
|
|
|
p {
|
|
margin: 0;
|
|
font-size: 13px;
|
|
color: #86909c;
|
|
line-height: 1.5;
|
|
}
|
|
}
|
|
|
|
.h5-journey__toggle {
|
|
flex-shrink: 0;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 2px;
|
|
font-size: 12px;
|
|
font-weight: 600;
|
|
color: var(--app-primary-color);
|
|
|
|
:deep(.arco-icon) {
|
|
transition: transform 0.2s ease;
|
|
|
|
&.is-open {
|
|
transform: rotate(180deg);
|
|
}
|
|
}
|
|
}
|
|
|
|
.h5-journey__flow {
|
|
list-style: none;
|
|
margin: 0;
|
|
padding: 0 8px 8px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 8px;
|
|
}
|
|
|
|
.h5-journey__main {
|
|
width: 100%;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
padding: 12px;
|
|
border: 1px solid #eef0f3;
|
|
border-radius: 14px;
|
|
background: #fafbfc;
|
|
text-align: left;
|
|
cursor: pointer;
|
|
|
|
&:active {
|
|
opacity: 0.92;
|
|
}
|
|
}
|
|
|
|
.h5-journey__index {
|
|
width: 22px;
|
|
height: 22px;
|
|
border-radius: 50%;
|
|
background: #e5e6eb;
|
|
color: #4e5969;
|
|
font-size: 12px;
|
|
font-weight: 700;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.h5-journey__icon {
|
|
width: 34px;
|
|
height: 34px;
|
|
border-radius: 10px;
|
|
background: color-mix(in srgb, var(--app-primary-color) 12%, #fff);
|
|
color: var(--app-primary-color);
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 18px;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.h5-journey__text {
|
|
flex: 1;
|
|
min-width: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 2px;
|
|
|
|
strong {
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
color: #1d2129;
|
|
}
|
|
|
|
em {
|
|
font-style: normal;
|
|
font-size: 12px;
|
|
color: #86909c;
|
|
line-height: 1.35;
|
|
}
|
|
}
|
|
|
|
.h5-journey__arrow {
|
|
color: #c9cdd4;
|
|
font-size: 14px;
|
|
flex-shrink: 0;
|
|
}
|
|
</style>
|