feat: 引入uView Plus组件库,新增部分静态页面
This commit is contained in:
@@ -28,39 +28,41 @@
|
||||
<!-- 订单列表 -->
|
||||
<scroll-view class="order-list" scroll-y="true" :style="{ height: listHeight + 'px' }">
|
||||
<view v-for="order in filteredOrders" :key="order.id" class="order-card">
|
||||
<!-- 头部编号 -->
|
||||
<view class="order-header">
|
||||
<view class="order-badge">{{ order.type === 'pickup' ? '取' : '送' }}</view>
|
||||
<view class="order-title">
|
||||
<text class="shop-name">{{ order.shopName }}</text>
|
||||
<text class="order-id">#{{ order.id }}</text>
|
||||
</view>
|
||||
<view class="order-status">{{ order.statusText }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 地址信息 -->
|
||||
<view class="order-info">
|
||||
<view class="address-row">
|
||||
<view class="icon pickup">取</view>
|
||||
<view class="address-content">
|
||||
<text class="address-title">{{ order.pickupAddress }}</text>
|
||||
<text class="address-sub">商家已出餐 · {{ order.pickupNote || '' }}</text>
|
||||
<view @click="toDetail(order.id)">
|
||||
<!-- 头部编号 -->
|
||||
<view class="order-header">
|
||||
<view class="order-badge">{{ order.type === 'pickup' ? '取' : '送' }}</view>
|
||||
<view class="order-title">
|
||||
<text class="shop-name">{{ order.shopName }}</text>
|
||||
<text class="order-id">#{{ order.id }}</text>
|
||||
</view>
|
||||
<view class="nav-icon" @click="openMap(order.pickupLat, order.pickupLng, order.pickupAddress)">导航</view>
|
||||
<view class="order-status">{{ order.statusText }}</view>
|
||||
</view>
|
||||
<view class="address-row">
|
||||
<view class="icon deliver">送</view>
|
||||
<view class="address-content">
|
||||
<text class="address-title">{{ order.deliveryAddress }}</text>
|
||||
<text class="address-sub">收货人:{{ order.receiverName }} {{ order.receiverPhone ? ('尾号' + (order.receiverPhone + '').slice(-4)) : ''}}</text>
|
||||
|
||||
<!-- 地址信息 -->
|
||||
<view class="order-info">
|
||||
<view class="address-row">
|
||||
<view class="icon pickup">取</view>
|
||||
<view class="address-content">
|
||||
<text class="address-title">{{ order.pickupAddress }}</text>
|
||||
<text class="address-sub">商家已出餐 · {{ order.pickupNote || '' }}</text>
|
||||
</view>
|
||||
<view class="nav-icon" @click="openMap(order.pickupLat, order.pickupLng, order.pickupAddress)">导航</view>
|
||||
</view>
|
||||
<view class="address-row">
|
||||
<view class="icon deliver">送</view>
|
||||
<view class="address-content">
|
||||
<text class="address-title">{{ order.deliveryAddress }}</text>
|
||||
<text class="address-sub">收货人:{{ order.receiverName }} {{ order.receiverPhone ? ('尾号' + (order.receiverPhone + '').slice(-4)) : ''}}</text>
|
||||
</view>
|
||||
<view class="nav-icon" @click="openMap(order.deliveryLat, order.deliveryLng, order.deliveryAddress)">导航</view>
|
||||
</view>
|
||||
<view class="nav-icon" @click="openMap(order.deliveryLat, order.deliveryLng, order.deliveryAddress)">导航</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 备注 -->
|
||||
<view class="order-note" v-if="order.note">
|
||||
<text>顾客:{{ order.note }}</text>
|
||||
|
||||
<!-- 备注 -->
|
||||
<view class="order-note" v-if="order.note">
|
||||
<text>顾客:{{ order.note }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 操作区 -->
|
||||
@@ -86,6 +88,7 @@
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
|
||||
// 驿站/骑手信息(从 store 获取或 mock)
|
||||
const driverInfo = ref({
|
||||
@@ -214,20 +217,6 @@ function openManualInput() {
|
||||
});
|
||||
}
|
||||
|
||||
// 入口:计算列表高度适配底部栏
|
||||
onMounted(() => {
|
||||
try {
|
||||
const sys = uni.getSystemInfoSync();
|
||||
const windowHeight = sys.windowHeight || 667;
|
||||
// 留出顶部和底部空间
|
||||
listHeight.value = windowHeight - 200;
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
});
|
||||
// 顶部安全区处理:参考 pages/index/user.vue 的实现
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
|
||||
const headerStyle = ref({});
|
||||
|
||||
function setHeaderSafeArea() {
|
||||
@@ -246,17 +235,15 @@ function setHeaderSafeArea() {
|
||||
}
|
||||
}
|
||||
|
||||
//跳转订单详情
|
||||
function toDetail(id) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/order/detail?orderId=${id}`
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
setHeaderSafeArea();
|
||||
// 计算列表高度适配底部栏
|
||||
try {
|
||||
const sys = uni.getSystemInfoSync();
|
||||
const windowHeight = sys.windowHeight || 667;
|
||||
// 留出顶部和底部空间
|
||||
listHeight.value = windowHeight - 200;
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
// setHeaderSafeArea();
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
|
||||
@@ -4,13 +4,16 @@
|
||||
<view class="header-wrap" :style="headerStyle">
|
||||
<view class="header-bg"></view>
|
||||
<view class="header-inner">
|
||||
<image class="avatar" :src="user.avatar || defautAvatar"></image>
|
||||
<view class="user-meta">
|
||||
<view class="user-name">{{ user.nickName || '姓名(账号)' }}</view>
|
||||
<image class="avatar" :src="userInfo.avatar || defautAvatar"></image>
|
||||
<view class="user-meta" v-if="userInfo.nickname">
|
||||
<view class="user-name">{{ userInfo.nickname + `(${userInfo.mobile})` }}</view>
|
||||
<view class="user-status" @click="handleStatusToggle">
|
||||
{{ user.isOnline ? '在线' : '离线' }}<uni-icons style="margin-left:10rpx;" type="right" size="13" color="#fff"></uni-icons>
|
||||
{{ userInfo.isOnline ? '在线' : '离线' }}<uni-icons style="margin-left:10rpx;" type="right" size="13" color="#fff"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="user-meta" v-else>
|
||||
<view class="user-name" @tap="login">请登录</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -73,7 +76,8 @@
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
ref
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
onShow,
|
||||
@@ -81,12 +85,15 @@
|
||||
onPullDownRefresh
|
||||
} from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import {
|
||||
showAuthModal,
|
||||
} from '@/sheep/hooks/useModal';
|
||||
|
||||
// 现有 store / 模板数据
|
||||
const template = computed(() => sheep.$store('app').template.user);
|
||||
const isLogin = computed(() => sheep.$store('user').isLogin);
|
||||
|
||||
const user = ref({});
|
||||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
||||
|
||||
const todayIncome = ref(0);
|
||||
const todayOrders = ref(0);
|
||||
const showBind = ref(false);
|
||||
@@ -115,9 +122,8 @@
|
||||
|
||||
// 页面显示时拉取用户信息并填充统计数据(从 store 获取或使用占位)
|
||||
onShow(async () => {
|
||||
const data = await sheep.$store('user').getInfo();
|
||||
const data = userInfo.value;
|
||||
if (data) {
|
||||
user.value = data;
|
||||
// 兼容后端字段名,优先使用 data.todayIncome / data.income / placeholder
|
||||
todayIncome.value = data.todayIncome ?? data.income ?? 137.9;
|
||||
todayOrders.value = data.todayOrders ?? data.orders ?? 39;
|
||||
@@ -149,13 +155,13 @@
|
||||
|
||||
// 判断用户是否被禁止接单(兼容多种字段)
|
||||
function isUserForbidden() {
|
||||
const u = user.value || {};
|
||||
const u = userInfo.value || {};
|
||||
return !!(u.forbidden || u.isForbidden || u.forbid || u.forbidReceive || u.disableReceive || u.receive === false);
|
||||
}
|
||||
|
||||
// 点击状态:根据当前状态弹不同的确认框
|
||||
function handleStatusToggle() {
|
||||
if (user.value.isOnline) {
|
||||
if (userInfo.value.isOnline) {
|
||||
confirmType.value = 'offline';
|
||||
modalTitle.value = '确认下线?';
|
||||
modalMsg.value = '下线需平台进行核准\n此时正常接单请留意核准信息';
|
||||
@@ -186,10 +192,10 @@
|
||||
showStatusPopup.value = false;
|
||||
if (type === 'online') {
|
||||
// TODO: 调用后端接口变更上线状态
|
||||
user.value.isOnline = true;
|
||||
userInfo.value.isOnline = true;
|
||||
sheep.$helper && sheep.$helper.toast && sheep.$helper.toast('已上线');
|
||||
} else if (type === 'offline') {
|
||||
user.value.isOnline = false;
|
||||
userInfo.value.isOnline = false;
|
||||
sheep.$helper && sheep.$helper.toast && sheep.$helper.toast('已下线');
|
||||
} else if (type === 'forbidden') {
|
||||
// 仅展示信息,无操作
|
||||
@@ -242,6 +248,11 @@
|
||||
url: '/pages/public/setting'
|
||||
});
|
||||
}
|
||||
|
||||
function login() {
|
||||
showAuthModal();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user