feat: 添加商户端页面

This commit is contained in:
2026-07-07 10:42:09 +08:00
parent baf82cec86
commit 948957d805
9 changed files with 1026 additions and 1 deletions
@@ -0,0 +1,183 @@
<template>
<view class="tabbar-wrap">
<view class="tabbar safe-bottom">
<view class="tabbar-inner">
<view
v-for="item in items"
:key="item.pagePath"
class="tabbar-item flex1 flex-center flex-column"
:class="{ 'tabbar-item--mid': item.isMid }"
@tap.stop="onTap(item)"
>
<view class="iconBox" :class="{ iconBoxMid: item.isMid }">
<uni-icons
:type="item.icon"
:size="item.isMid ? 30 : 24"
:color="isActive(item) ? activeColor : normalColor"
/>
</view>
<view class="text" :class="{ textActive: isActive(item), textMid: item.isMid }">
{{ item.text }}
</view>
</view>
</view>
</view>
<view v-if="props.placeholder" class="tabbar-placeholder safe-bottom"></view>
</view>
</template>
<script setup>
import { computed, ref, watch } from 'vue';
import { onShow } from '@dcloudio/uni-app';
const props = defineProps({
path: {
type: String,
default: '',
},
placeholder: {
type: Boolean,
default: false,
},
});
const normalColor = '#666';
const activeColor = '#2556EC';
const currentPath = ref('');
const normalizePath = (p) => {
if (!p) return '';
return p.startsWith('/') ? p : `/${p}`;
};
const updateCurrentPath = () => {
const pages = getCurrentPages?.() || [];
const current = pages[pages.length - 1];
const route = current?.route || '';
currentPath.value = normalizePath(route);
};
const hideNativeTabBar = () => {
try {
uni.hideTabBar({
fail: () => {},
});
} catch (e) {}
};
onShow(() => {
hideNativeTabBar();
updateCurrentPath();
});
watch(
() => props.path,
(val) => {
if (val) currentPath.value = normalizePath(val);
},
{ immediate: true },
);
const items = computed(() => [
{
pagePath: '/pages/merchant/pickupList',
text: '提货清单',
icon: 'list',
},
{
pagePath: '/pages/merchant/scanVerify',
text: '扫码核销',
icon: 'scan',
isMid: true,
},
{
pagePath: '/pages/merchant/storeManage',
text: '网店管理',
icon: 'shop',
},
]);
const isActive = (item) => {
return normalizePath(item.pagePath) === normalizePath(currentPath.value);
};
const onTap = (item) => {
if (isActive(item)) return;
hideNativeTabBar();
uni.reLaunch({
url: item.pagePath,
fail: () => {
uni.navigateTo({ url: item.pagePath });
},
});
};
</script>
<style lang="scss">
.tabbar-wrap {
width: 100%;
}
.tabbar {
position: fixed;
left: 0;
right: 0;
bottom: 0;
padding: 14rpx 24rpx;
box-sizing: border-box;
z-index: 10;
}
.tabbar-inner {
width: 100%;
height: 110rpx;
border-radius: 30rpx;
background: rgba(255, 255, 255, 0.98);
display: flex;
align-items: center;
padding: 0 16rpx;
box-sizing: border-box;
box-shadow: 0 16rpx 40rpx rgba(0, 0, 0, 0.08);
}
.tabbar-item {
height: 110rpx;
justify-content: center;
}
.iconBox {
width: 56rpx;
height: 56rpx;
display: flex;
align-items: center;
justify-content: center;
}
.iconBoxMid {
width: 76rpx;
height: 76rpx;
border-radius: 22rpx;
background: rgba(37, 86, 236, 0.12);
}
.text {
margin-top: 6rpx;
font-size: 22rpx;
color: #666;
line-height: 1;
}
.textActive {
color: #2556ec;
font-weight: 600;
}
.textMid {
font-size: 20rpx;
}
.tabbar-placeholder {
height: calc(110rpx + 28rpx);
}
</style>