管理端增加任务列表99%

This commit is contained in:
xiaofajia 2024-12-12 18:51:08 +08:00
parent fe911c6965
commit 0352507b0e
7 changed files with 355 additions and 3 deletions

View File

@ -2,6 +2,10 @@
// launchtypelocalremote, localremote
"version": "0.0",
"configurations": [{
"app-plus" :
{
"launchtype" : "local"
},
"default" :
{
"launchtype" : "local"

View File

@ -1,7 +1,8 @@
// 应用全局配置
module.exports = {
// baseUrl: 'https://www.nuoyunr.com/admin-api',
baseUrl: 'http://127.0.0.1:48080/admin-api',
// baseUrl: 'http://127.0.0.1:48080/admin-api',
baseUrl: 'http://wcw8ax.natappfree.cc/admin-api',
imagesUrl: 'http://www.nuoyunr.com/lananRsc',
baseImageUrl: 'https://www.nuoyunr.com/minio',
wsUrl: 'ws://127.0.0.1:48080',

View File

@ -380,6 +380,13 @@
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
{
"path": "pages/index/TodayTable",
"style": {
"navigationBarTitleText": "当日订单",
"navigationStyle": "custom"
}
}
],
"globalStyle": {

282
pages/index/TodayTable.vue Normal file
View File

@ -0,0 +1,282 @@
<template>
<view class="content">
<view class="c-top">
<view style="width: 100%; height: 44px;"></view>
<view class="top-ail">
<!-- 新增 -->
<view class="top-two">
<view class="" @click="getback()">
<uni-icons type="left" color="#ffffff" size="22"></uni-icons>
</view>
<view class="bai-title">当日订单</view>
<view style="width: 15px; height: 100%;"></view>
</view>
<view class="example-body" style="width: 75%;margin-top: 1rem;display: flex;justify-content: space-between">
<uni-datetime-picker v-model="queryParams.queryTime" type="daterange" @maskClick="maskClick"/>
<view class="sou" @click="handleSearch">搜索</view>
<view class="sou" @click="handleReset">重置</view>
</view>
<view class="table-container">
<view class="table-row header-row">
<view class="table-cell">序号</view>
<view class="table-cell">车牌号</view>
<view class="table-cell">检测类型</view>
<view class="table-cell">检测状态</view>
<view class="table-cell">检测结果</view>
<view class="table-cell">是否支付</view>
<view class="table-cell">支付方式</view>
</view>
<view v-for="(item, index) in tableData" :key="index" class="table-row">
<view class="table-cell">{{ index + 1 }}</view>
<view class="table-cell">{{ item.carNum }}</view>
<view class="table-cell">{{ item.type }}</view>
<view class="table-cell">{{ item.status }}</view>
<view class="table-cell">{{ item.result }}</view>
<view class="table-cell">{{ item.pay }}</view>
<view class="table-cell">{{ getPayType(item.payType) }}</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import request from '../../utils/request';
import {getDictDataByType} from '../../utils/utils'
export default {
name: "TodayTable",
data() {
return {
platform: process.env.UNI_PLATFORM, //
tableData: [],
queryParams: {
queryTime: null,
pageNum: 1,
pageSize: 10,
},
loading: false, //
payTypes: [],
};
},
onReady() {
this.setLandscape();
this.getTableData();
this.getDictData()
},
onUnload() {
this.resetOrientation();
},
onReachBottom() { //
if (!this.loading) {
this.queryParams.pageNum += 1;
this.getTableData(true);
}
},
methods: {
maskClick(){
this.handleReset()
},
getDictData() {
if (!this.payTypes || this.payTypes.length === 0) {
this.payTypes = getDictDataByType("pay_type")
}
},
getPayType(type) {
if (!this.payTypes || this.payTypes.length === 0){
this.getDictData()
}
if (type){
const index = this.payTypes.findIndex(item => item.value === type)
if (index !== -1){
return this.payTypes[index].label
}
}
},
handleReset() {
this.queryParams = {
queryTime: null,
pageNum: 1,
pageSize: 10,
};
this.tableData = []; //
this.getTableData();
},
handleSearch() {
if (this.queryParams.queryTime) {
this.queryParams.startTime = this.queryParams.queryTime[0];
this.queryParams.endTime = this.queryParams.queryTime[1];
this.getTableData();
}
},
getTableData(isLoadMore = false) {
this.loading = true; //
request({
url: '/partnerOwn/partner/getOrderByDate',
method: 'get',
params: this.queryParams
}).then(res => {
const newData = res.data.records || [];
if (isLoadMore) {
this.tableData = this.tableData.concat(newData); //
} else {
this.tableData = newData; //
}
this.loading = false; //
}).catch(err => {
console.error('获取订单数据失败', err);
this.loading = false; //
});
},
getback() {
uni.navigateBack();
},
setLandscape() {
const platform = this.platform;
// 使 uni.setScreenOrientation
if (uni.setScreenOrientation) {
try {
uni.setScreenOrientation({
orientation: 'landscape'
});
} catch (err) {
console.error('Setting screen orientation failed', err);
}
}
// APP-PLUS 使 plus.screen.lockOrientation
if (platform === 'app-plus') {
this.lockOrientationForAppPlus('landscape-primary');
}
},
resetOrientation() {
const platform = this.platform;
//
if (uni.setScreenOrientation) {
try {
uni.setScreenOrientation({
orientation: 'portrait'
});
} catch (err) {
console.error('Resetting screen orientation failed', err);
}
}
// APP-PLUS
if (platform === 'app-plus') {
this.lockOrientationForAppPlus('portrait-primary');
}
},
lockOrientationForAppPlus(orientation) {
if (typeof plus !== 'undefined' && plus.screen) {
plus.screen.lockOrientation(orientation);
} else {
// plus.screen plusReady
document.addEventListener('plusready', () => {
if (plus.screen) {
plus.screen.lockOrientation(orientation);
} else {
console.error('plus.screen is not available');
}
}, false);
}
}
}
};
</script>
<style scoped lang="scss">
.content {
box-sizing: border-box;
width: 100%;
height: 100%;
background-color: #F4F4F4;
}
.c-top {
width: 100%;
height: 283px;
background-color: cornflowerblue;
background: url("../../static/detection/mybj.png") center no-repeat;
background-size: 100% 100%;
position: relative;
}
.top-ail {
width: 100%;
box-sizing: border-box;
padding: 20px;
}
.top-two {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.bai-title {
font-size: 20px;
font-weight: bold;
color: white;
}
.table-container {
width: 100%;
overflow: hidden;
border-collapse: collapse;
}
.table-row {
display: flex;
width: 100%;
border-bottom: 1px solid #ddd;
}
.table-cell {
flex: 1; /* 确保每个单元格宽度相同 */
min-width: 0; /* 防止内容过多时破坏布局 */
padding: 12px;
text-align: center; /* 内容居中 */
border-right: 1px solid #ddd;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center; /* 确保即使内容为空也居中 */
}
.header-row .table-cell {
font-weight: bold;
background-color: #f8f8f8; /* 表头背景颜色 */
}
.table-row:last-child {
border-bottom: none;
}
.table-cell:last-child {
border-right: none;
}
/* 可选:为表格添加一些间距和阴影,使其更美观 */
.table-container {
margin: 5px 0;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
border-radius: 4px;
}
.sou {
width: 15%;
color: white;
margin-left: 1rem;
background-color: #4575e1;
border-radius: 5px;
display: flex; /* 使用Flexbox布局 */
align-items: center; /* 垂直居中 */
justify-content: center; /* 水平居中 */
box-sizing: border-box; /* 确保 padding 和 border 不会增加元素的实际宽度 */
}
</style>

View File

@ -21,7 +21,7 @@
</view>
<view class="threebox">
<!-- @click="gostatistics()" -->
<view class="t-box">
<view class="t-box" @click="ToToday">
<view class="xbai">当日订单</view>
<view class="dbai">{{threenum.todayOrderNum}}</view>
</view>
@ -187,7 +187,6 @@
this.baseUrl = this.$baseUrl
let times = new Date()
this.timeday = this.timeWeekFormat(times)
},
onShow() {
this.getAppointAndPickNum()
@ -200,6 +199,11 @@
tabBar,
},
methods: {
ToToday(){
uni.navigateTo({
url: '/pages/index/TodayTable'
})
},
goshowMenu() {
uni.navigateTo({
url: '/pages/manage/manage'

View File

@ -29,3 +29,34 @@ export function hasRole(roleCode) {
}
return false
}
// 设置本地存储,并设置一个过期时间(单位为秒)
export function setStorageWithExpiry(key, value, ttl) {
const now = new Date();
// 计算过期时间
const item = {
value: value,
expiry: now.getTime() + ttl * 1000,
};
// 将数据对象转换为字符串存储
uni.setStorageSync(key, JSON.stringify(item));
}
// 获取本地存储的数据,检查是否过期
export function getStorageWithExpiry(key) {
// 从本地存储获取数据
const itemStr = uni.getStorageSync(key);
if (!itemStr) {
return null; // 未找到数据
}
const item = JSON.parse(itemStr);
const now = new Date();
// 检查项目是否过期
if (now.getTime() > item.expiry) {
// 如果过期,从存储中移除该项
uni.removeStorageSync(key);
return null;
}
return item.value; // 数据未过期,返回数据
}

23
utils/utils.js Normal file
View File

@ -0,0 +1,23 @@
import request from "./request";
import {
setStorageWithExpiry,
getStorageWithExpiry
} from './auth'
export function getDictDataByType(type) {
let data = getStorageWithExpiry(type)
if (data === null || data === undefined) {
request({
url: '/system/dict-data/type',
method: 'get',
params: {type: type}
}).then(res => {
setStorageWithExpiry(type, res.data, 3600)
return res.data
}).catch(() => {
console.log("出现了异常")
})
} else {
return data
}
}