Commit da497650 by 李伟康

feat(orderEntry): 新增录单页面及关联样式和导航修改

- 移除tabbar中的“录单”项,录单通过页面跳转进入
- 修改TabBar组件跳转录单页面方式为navigateTo
- 新增录单页面,包含自定义导航栏和多个子订单标签页
- 录单页面根据屏幕尺寸动态计算内容高度,适配上下安全区域
- 录单标签页新增图标支持,激活状态样式突出显示
- 优化录单页面样式,增加阴影和圆角等视觉效果
- 修改录单页面中提交按钮宽度及居中显示
- 定义录单样式变量,区分横竖屏显示不同的tab图标和布局
- 实现录单页面返回功能,绑定导航栏左侧返回按钮事件
1 parent ebeaaaa7
...@@ -116,7 +116,7 @@ export function navigateToTab(index: number, currentTabIndex: number): void { ...@@ -116,7 +116,7 @@ export function navigateToTab(index: number, currentTabIndex: number): void {
return; return;
} }
if (index == 3) { if (index == 3) {
switchTabPage("pages/common/orderEntry/index"); uni.navigateTo({ url: "/pages/common/orderEntry/index" });
return; return;
} }
} }
......
...@@ -160,12 +160,6 @@ ...@@ -160,12 +160,6 @@
"text": "我的", "text": "我的",
"iconPath": "static/images/tabbar/study.png", "iconPath": "static/images/tabbar/study.png",
"selectedIconPath": "static/images/tabbar/study-active.png" "selectedIconPath": "static/images/tabbar/study-active.png"
},
{
"pagePath": "pages/common/orderEntry/index",
"text": "录单",
"iconPath": "static/images/tabbar/study.png",
"selectedIconPath": "static/images/tabbar/study-active.png"
} }
] ]
}, },
......
<template> <template>
<layout-root :page-vars="pageVars"> <layout-root :page-vars="pageVars">
<view class="order-entry-container"> <view class="navbar-wrapper">
<app-navbar
:fixed="false"
:placeholder="false"
title="录单"
bg-color="#fff"
:border="false"
:auto-back="false"
:safe-area-inset-top="false"
@leftClick="back"
/>
</view>
<view class="order-entry-container" :style="contentStyle">
<view class="tab-box"> <view class="tab-box">
<view <view v-for="(tab, idx) in tabs" :key="idx" :class="['tab-item', tabActiveIndex == idx ? 'active-tab' : '']" @click="onTabChange(idx)">
v-for="(tab, idx) in tabs" <un-icon
:key="idx" :label="tab.name"
class="tab-item" :name="tab.iconType"
@click="onTabChange(idx)" :class="['tab-icon', tabActiveIndex == idx ? 'active-icon' : '']"
> ></un-icon>
<text :class="tabActiveIndex == idx ? 'tab-text active' : 'tab-text'">{{ tab.name }}</text> <text :class="tabActiveIndex == idx ? 'tab-text active' : 'tab-text'">
{{ tab.name }}
</text>
</view> </view>
</view> </view>
<scroll-view class="form-box"> <scroll-view class="form-box">
...@@ -21,7 +36,8 @@ ...@@ -21,7 +36,8 @@
<script setup lang="uts"> <script setup lang="uts">
import pageVars from "./styles/index.vars"; import pageVars from "./styles/index.vars";
import { ref, computed } from "vue"; import { ref, computed, getCurrentInstance, onMounted, nextTick, onResize } from "vue";
import { calcWindowTopInsetPx } from "@/utils/safe-area.uts";
import WorkOrder from "./components/WorkOrder.uvue"; import WorkOrder from "./components/WorkOrder.uvue";
import ContractOrder from "./components/ContractOrder.uvue"; import ContractOrder from "./components/ContractOrder.uvue";
import SalesOrder from "./components/SalesOrder.uvue"; import SalesOrder from "./components/SalesOrder.uvue";
...@@ -33,10 +49,41 @@ type TabItem = { ...@@ -33,10 +49,41 @@ type TabItem = {
}; };
const activeTab = ref(0); const activeTab = ref(0);
const tabActiveIndex = computed((): number => activeTab.value); const tabActiveIndex = computed((): number => activeTab.value);
const currentInstance = getCurrentInstance();
const navbarHeight = ref(0);
const windowHeight = ref(uni.getSystemInfoSync().windowHeight);
const statusBarHeight = ref(0);
const contentStyle = computed((): string => {
return `height: ${windowHeight.value - navbarHeight.value - statusBarHeight.value}px`;
});
function measureNavbarHeight(): void {
uni.createSelectorQuery().in(currentInstance!.proxy).select('.navbar-wrapper').boundingClientRect().exec((ret) => {
if (ret.length > 0) {
navbarHeight.value = (ret[0] as NodeInfo).height!;
}
});
}
onMounted(() => {
statusBarHeight.value = calcWindowTopInsetPx(uni.getWindowInfo());
nextTick(() => {
measureNavbarHeight();
});
});
onResize((_res: any): void => {
const winInfo = uni.getWindowInfo();
windowHeight.value = winInfo.windowHeight;
statusBarHeight.value = calcWindowTopInsetPx(winInfo);
nextTick(() => {
measureNavbarHeight();
});
});
const tabs = ref<TabItem[]>([ const tabs = ref<TabItem[]>([
{ name: "施工单", iconType: "gear", componentName: WorkOrder }, { name: "施工单", iconType: "warning-fill", componentName: WorkOrder },
{ name: "合同单", iconType: "compose", componentName: ContractOrder }, { name: "合同单", iconType: "lock-fill", componentName: ContractOrder },
{ name: "销售单", iconType: "medal", componentName: SalesOrder } { name: "销售单", iconType: "rmb-circle-fill", componentName: SalesOrder }
]); ]);
function onTabChange(index: number): void { function onTabChange(index: number): void {
if (activeTab.value == index) return; if (activeTab.value == index) return;
...@@ -46,6 +93,9 @@ const activeEntryComponent = computed((): any => { ...@@ -46,6 +93,9 @@ const activeEntryComponent = computed((): any => {
let component = tabs.value[tabActiveIndex.value].componentName; let component = tabs.value[tabActiveIndex.value].componentName;
return component; return component;
}); });
const back = (): void => {
uni.navigateBack();
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
......
...@@ -10,7 +10,11 @@ ...@@ -10,7 +10,11 @@
background-color: #fff; background-color: #fff;
display: flex; display: flex;
flex-direction: var(--order-tab-direction); flex-direction: var(--order-tab-direction);
margin: var(--order-tab-margin);
border-radius: var(--order-tab-border-radius);
padding: var(--order-tab-padding);
box-sizing: border-box;
box-shadow: var(--order-tab-box-shadow);
.tab-item { .tab-item {
flex: 1; flex: 1;
display: flex; display: flex;
...@@ -26,6 +30,19 @@ ...@@ -26,6 +30,19 @@
color: #2c66f7; color: #2c66f7;
font-weight: bold; font-weight: bold;
} }
.tab-icon{
display: var(--order-tab-icon-display);
font-size: 32px;
color: #333;
margin-bottom: 6px;
}
.active-icon{
color: #2c66f7;
}
}
.active-tab{
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
border-radius: 16px;
} }
} }
...@@ -42,6 +59,7 @@ ...@@ -42,6 +59,7 @@
width: 100%; width: 100%;
border-radius: 8px; border-radius: 8px;
background-color: #fff; background-color: #fff;
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
} }
.form-card{ .form-card{
width: 100%; width: 100%;
...@@ -317,7 +335,7 @@ ...@@ -317,7 +335,7 @@
} }
.submit-btn { .submit-btn {
width: 100%; width: 75%;
height: 48px; height: 48px;
background-color: #2c66f7; background-color: #2c66f7;
border-radius: 24px; border-radius: 24px;
...@@ -325,6 +343,7 @@ ...@@ -325,6 +343,7 @@
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin: 0 auto;
} }
.submit-btn .check-icon-box { .submit-btn .check-icon-box {
...@@ -360,6 +379,7 @@ ...@@ -360,6 +379,7 @@
padding: 16px; padding: 16px;
box-sizing: border-box; box-sizing: border-box;
margin-top: 16px; margin-top: 16px;
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
} }
.recent-header { .recent-header {
......
...@@ -6,20 +6,28 @@ export default { ...@@ -6,20 +6,28 @@ export default {
'--order-tab-height': '60px', '--order-tab-height': '60px',
'--order-tab-direction': 'row', '--order-tab-direction': 'row',
'--order-form-item-width': '100%', '--order-form-item-width': '100%',
}, },
portrait: { portrait: {
'--order-entry-direction': 'column', '--order-entry-direction': 'column',
'--order-form-width': '100%', '--order-form-width': '100%',
'--order-tab-icon-display':'none',
'--order-tab-padding': '4px 8px',
}, },
landscape: { landscape: {
'--order-entry-direction': 'row', '--order-entry-direction': 'row',
'--order-tab-width': '15%', '--order-tab-width': '15%',
'--order-form-width': '85%', '--order-form-width': '85%',
'--order-tab-height': '100%', '--order-tab-height': '95%',
'--order-tab-direction': 'column', '--order-tab-direction': 'column',
'--order-form-item-width': '50%', '--order-form-item-width': '50%',
'--order-tab-icon-display':'flex',
'--order-tab-margin':'16px',
'--order-tab-border-radius': '8px',
'--order-tab-padding': '16px',
'--order-tab-box-shadow': '0 2px 8px rgba(0, 0, 0, 0.1)',
}, },
resolutions: { resolutions: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!