Commit 991563c4 by 李伟康

feat(orderEntry): 新增录单页面及订单列表功能

- 在底部导航栏添加录单入口
- 新增订单列表查询API接口支持分页和筛选
- 修改TabBar跳转逻辑,使用切换选项卡方式进入录单页
- 重构录单页UI,采用TabBarShell容器结构
- 订单列表组件改为动态请求数据替代静态数据
- 优化订单列表数据字段映射显示客户名及电话、支付金额和状态名称
- 调整预约时间默认提示文案为“请选择预约时间”
- 移除录单相关组件的提交按钮中的多余勾选图标元素
- 修复录单页计算内容高度时状态栏高度未扣除问题
1 parent 49a74733
import { request } from "@/api/modules/http/http.uts";
/**
*
* 订单列表查询(分页,pageSize=100)。可按门店/客户/状态筛选。
* GET /api/orders
*/
export function getOrdersList(params: UTSJSONObject = {} as UTSJSONObject): Promise<any> {
return request("/orders", params, "GET");
}
...@@ -126,7 +126,8 @@ export function navigateToTab(index: number, currentTabIndex: number): void { ...@@ -126,7 +126,8 @@ export function navigateToTab(index: number, currentTabIndex: number): void {
return; return;
} }
if (index == 2) { if (index == 2) {
uni.navigateTo({ url: "/pages/common/orderEntry/index" }); // uni.navigateTo({ url: "/pages/common/orderEntry/index" });
switchTabPage("pages/common/orderEntry/index");
return; return;
} }
if (index == 3) { if (index == 3) {
......
...@@ -184,6 +184,12 @@ ...@@ -184,6 +184,12 @@
"selectedIconPath": "static/images/tabbar/home-active.png" "selectedIconPath": "static/images/tabbar/home-active.png"
}, },
{ {
"pagePath": "pages/common/orderEntry/index",
"text": "录单",
"iconPath": "static/images/tabbar/home.png",
"selectedIconPath": "static/images/tabbar/home-active.png"
},
{
"pagePath": "pages/person/myCenter", "pagePath": "pages/person/myCenter",
"text": "我的", "text": "我的",
"iconPath": "static/images/tabbar/study.png", "iconPath": "static/images/tabbar/study.png",
......
...@@ -64,9 +64,6 @@ ...@@ -64,9 +64,6 @@
</view> </view>
<view class="submit-wrap"> <view class="submit-wrap">
<view class="submit-btn" @click="submitOrder"> <view class="submit-btn" @click="submitOrder">
<view class="check-icon-box">
<text class="check-icon-text">✓</text>
</view>
<text class="submit-btn-text">提交</text> <text class="submit-btn-text">提交</text>
</view> </view>
</view> </view>
......
...@@ -27,12 +27,12 @@ ...@@ -27,12 +27,12 @@
<text class="date-month">{{ item.month }}</text> <text class="date-month">{{ item.month }}</text>
</view> </view>
<view class="recent-info"> <view class="recent-info">
<text class="info-name">{{ item.name }}</text> <text class="info-name">{{ item.customerName }}</text>
<text class="info-desc">{{ item.desc }}</text> <text class="info-desc">{{ item.customerPhone}}</text>
</view> </view>
<view class="recent-amount"> <view class="recent-amount">
<text class="amount-text">{{ item.amount }}</text> <text class="amount-text">{{ item.payAmount }}</text>
<text class="status-text" :class="item.statusClass">{{ item.status }}</text> <text class="status-text" >{{ item.statusName }}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -41,96 +41,52 @@ ...@@ -41,96 +41,52 @@
<script setup lang="uts"> <script setup lang="uts">
import { ref, computed } from "vue"; import { ref, computed } from "vue";
import { getOrdersList } from "@/api/modules/orders.uts";
type RecentItem = { type RecentItem = {
id: string;
orderNo: string;
storeId: number;
customerId: number;
customerName: string;
customerPhone: string;
staffId: string;
sceneId: number | null;
totalAmount: number;
discountAmount: number;
payAmount: number;
status: number;
statusName: string;
payType: number | null;
payTime: string | null;
remark: string | null;
createdAt: string;
items: any[];
day: string; day: string;
month: string; month: string;
name: string;
desc: string;
amount: string;
status: string;
statusClass: string;
}; };
const recentList = ref<RecentItem[]>([ const recentList = ref<RecentItem[]>([]);
{
day: "10",
month: "07/10",
name: "刘先生",
desc: "发动机延保3年 · 销售单",
amount: "¥3500",
status: "已完成",
statusClass: "status-done"
},
{
day: "15",
month: "07/15",
name: "黄先生",
desc: "4K行车记录仪 · 销售单",
amount: "¥999",
status: "已完成",
statusClass: "status-done"
},
{
day: "16",
month: "07/15",
name: "先生",
desc: "4K记录仪 · 销售单",
amount: "¥999",
status: "已完成",
statusClass: "status-done"
},
{
day: "17",
month: "07/17",
name: "张先生",
desc: "4K行车记录仪 · 销售单",
amount: "¥999",
status: "已完成",
statusClass: "status-done"
},
{
day: "18",
month: "07/18",
name: "李先生",
desc: "4K行车记录仪 · 销售单",
amount: "¥999",
status: "已完成",
statusClass: "status-done"
},
{
day: "19",
month: "07/19",
name: "王先生",
desc: "4K行车记录仪 · 销售单",
amount: "¥999",
status: "已完成",
statusClass: "status-done"
},
{
day: "20",
month: "07/20",
name: "张先生",
desc: "4K行车记录仪 · 销售单",
amount: "¥999",
status: "已完成",
statusClass: "status-done"
},
{
day: "21",
month: "07/21",
name: "张先生",
desc: "4K行车记录仪 · 销售单",
amount: "¥999",
status: "已完成",
statusClass: "status-done"
},
]);
function goAll(): void { function goAll(): void {
uni.showToast({ title: "查看全部", icon: "none" }); uni.showToast({ title: "查看全部", icon: "none" });
} }
function onRecentClick(item: RecentItem): void { function onRecentClick(item: RecentItem): void {
uni.showToast({ title: `${item.name} ${item.desc}`, icon: "none" }); uni.showToast({ title: `1`, icon: "none" });
} }
const getRecentList = async (): Promise<void> => {
try {
const data = await getOrdersList() as RecentItem[];
for (let i = 0; i < data.length; i++) {
data[i].day = data[i].createdAt.split("T")[0].split("-")[2];
data[i].month = data[i].createdAt.split("T")[0].split("-")[1] + "/" + data[i].day;
}
recentList.value = data;
} catch (error) {
console.error("获取最近录单列表失败:", error);
}
};
onMounted(() => {
getRecentList();
});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
......
...@@ -48,9 +48,6 @@ ...@@ -48,9 +48,6 @@
</view> </view>
<view class="submit-wrap"> <view class="submit-wrap">
<view class="submit-btn" @click="submitOrder"> <view class="submit-btn" @click="submitOrder">
<view class="check-icon-box">
<text class="check-icon-text">✓</text>
</view>
<text class="submit-btn-text">提交</text> <text class="submit-btn-text">提交</text>
</view> </view>
</view> </view>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<text class="form-label">预约时间</text> <text class="form-label">预约时间</text>
<view class="form-select" @click="openTimePicker"> <view class="form-select" @click="openTimePicker">
<text class="form-select-text" :class="{ placeholder: form.appointmentTime == '' }"> <text class="form-select-text" :class="{ placeholder: form.appointmentTime == '' }">
{{ form.appointmentTime == "" ? "yyyy-mm日 --:--" : form.appointmentTime }} {{ form.appointmentTime == "" ? "请选择预约时间" : form.appointmentTime }}
</text> </text>
<uni-icons type="calendar" size="14" color="#999999"></uni-icons> <uni-icons type="calendar" size="14" color="#999999"></uni-icons>
</view> </view>
...@@ -56,9 +56,6 @@ ...@@ -56,9 +56,6 @@
</view> </view>
<view class="submit-wrap"> <view class="submit-wrap">
<view class="submit-btn" @click="submitOrder"> <view class="submit-btn" @click="submitOrder">
<view class="check-icon-box">
<text class="check-icon-text">✓</text>
</view>
<text class="submit-btn-text">提交</text> <text class="submit-btn-text">提交</text>
</view> </view>
</view> </view>
......
<template> <template>
<layout-root :page-vars="pageVars"> <!-- <layout-root :page-vars="pageVars"> -->
<TabBarShell ref="shellRef" :active-tab-index="1" :page-vars="pageVars as UTSJSONObject">
<view class="navbar-wrapper"> <view class="navbar-wrapper">
<app-navbar <!-- <app-navbar
:fixed="false" :fixed="false"
:placeholder="false" :placeholder="false"
title="录单" title="录单"
...@@ -10,12 +11,16 @@ ...@@ -10,12 +11,16 @@
:auto-back="false" :auto-back="false"
:safe-area-inset-top="false" :safe-area-inset-top="false"
@leftClick="back" @leftClick="back"
/> /> -->
</view> </view>
<view class="order-entry-container" :style="contentStyle"> <view class="order-entry-container" :style="contentStyle">
<view class="tab-box"> <view class="tab-box">
<view v-for="(tab, idx) in tabs" :key="idx" :class="['tab-item', tabActiveIndex == idx ? 'active-tab' : '']" @click="onTabChange(idx)"> <view
v-for="(tab, idx) in tabs"
:key="idx"
:class="['tab-item', tabActiveIndex == idx ? 'active-tab' : '']"
@click="onTabChange(idx)"
>
<un-icon <un-icon
:label="tab.name" :label="tab.name"
:name="tab.iconType" :name="tab.iconType"
...@@ -31,10 +36,13 @@ ...@@ -31,10 +36,13 @@
<RecentOrderEntry /> <RecentOrderEntry />
</scroll-view> </scroll-view>
</view> </view>
</layout-root> </TabBarShell>
<!-- </layout-root> -->
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import TabBarShell from "@/components/TabBar/TabBarShell.uvue";
import pageVars from "./styles/index.vars"; import pageVars from "./styles/index.vars";
import { ref, computed, getCurrentInstance, onMounted, nextTick, onResize } from "vue"; import { ref, computed, getCurrentInstance, onMounted, nextTick, onResize } from "vue";
import { calcWindowTopInsetPx } from "@/utils/safe-area.uts"; import { calcWindowTopInsetPx } from "@/utils/safe-area.uts";
...@@ -54,11 +62,17 @@ const navbarHeight = ref(0); ...@@ -54,11 +62,17 @@ const navbarHeight = ref(0);
const windowHeight = ref(uni.getSystemInfoSync().windowHeight); const windowHeight = ref(uni.getSystemInfoSync().windowHeight);
const statusBarHeight = ref(0); const statusBarHeight = ref(0);
const contentStyle = computed((): string => { const contentStyle = computed((): string => {
return `height: ${windowHeight.value - navbarHeight.value - statusBarHeight.value}px`; return `height: ${windowHeight.value - statusBarHeight.value}px`;
// return `height: ${windowHeight.value - navbarHeight.value - statusBarHeight.value}px`;
}); });
function measureNavbarHeight(): void { function measureNavbarHeight(): void {
uni.createSelectorQuery().in(currentInstance!.proxy).select('.navbar-wrapper').boundingClientRect().exec((ret) => { uni
.createSelectorQuery()
.in(currentInstance!.proxy)
.select(".navbar-wrapper")
.boundingClientRect()
.exec((ret) => {
if (ret.length > 0) { if (ret.length > 0) {
navbarHeight.value = (ret[0] as NodeInfo).height!; navbarHeight.value = (ret[0] as NodeInfo).height!;
} }
...@@ -66,8 +80,8 @@ function measureNavbarHeight(): void { ...@@ -66,8 +80,8 @@ function measureNavbarHeight(): void {
} }
onMounted(() => { onMounted(() => {
statusBarHeight.value = calcWindowTopInsetPx(uni.getWindowInfo());
nextTick(() => { nextTick(() => {
statusBarHeight.value = calcWindowTopInsetPx(uni.getWindowInfo());
measureNavbarHeight(); measureNavbarHeight();
}); });
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!