This commit is contained in:
2025-06-19 17:33:18 +08:00
commit f8f31dc4d9
437 changed files with 103080 additions and 0 deletions
@@ -0,0 +1,12 @@
{
"usingComponents": {
"van-picker": "@vant/weapp/picker/index",
"van-popup": "@vant/weapp/popup/index",
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index",
"van-empty": "@vant/weapp/empty/index",
"van-divider": "@vant/weapp/divider/index"
},
"enablePullDownRefresh": true,
"navigationBarTitleText": "财务测算"
}
@@ -0,0 +1,321 @@
.container {
height: 100vh;
background: #EFF1F4;
overflow: hidden;
position: relative;
.van-tabs {
height: 100%;
.van-tabs__content {
height: calc(100% - 44px);
}
}
.search-container {
padding: 10px 8px;
border-top: 1px solid #DBDBDB;
background: #ffffff;
.row {
margin-bottom: 8px;
display: flex;
justify-content: space-between;
align-items: center;
>.project-select {
width: calc((100% - 6px) / 3);
height: 36px;
padding: 8px 10px;
box-sizing: border-box;
border-radius: 4px;
border: 1px solid #E6EAF2;
display: flex;
align-items: center;
picker {
width: 100%;
position: relative;
.picker {
width: 100%;
height: 38px;
// padding-left: 14px;
box-sizing: border-box;
// border: 1px solid #E6EAF2;
border-radius: 4px;
font-size: 14px;
display: flex;
// justify-content: space-between;
align-items: center;
}
.picker::after {
content: '';
width: 0;
height: 0;
border-top: 6px solid #636B83;
border-right: 6px solid transparent;
border-bottom: 6px solid transparent;
border-left: 6px solid transparent;
position: absolute;
top: 50%;
right: 14px;
transform: translateY(-2px);
}
}
&.selectItem {
// width: 100%;
justify-content: space-between;
.val {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 14px;
}
.placeholder {
color: #949CB5;
font-size: 14px;
white-space: nowrap;
}
}
.arrow {
width: 0;
height: 0;
border-left: 13rpx solid transparent;
border-right: 13rpx solid transparent;
border-top: 15rpx solid #636B83;
margin-left: 18rpx;
}
.date {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
.icon {
width: 16px;
height: 16px;
margin-left: 8px;
image {
width: 100%;
height: 100%;
}
}
}
}
.line {
width: 10px;
height: 1px;
background: #949CB5;
}
}
}
.list-content {
.list {
// height: calc(100vh - 44px - 65px - 88px);
height: calc(100vh - 44px - 65px);
padding: 8px 0;
box-sizing: border-box;
// overflow-y: auto;
.scroll-view_H {
height: calc(100% - 80rpx);
// padding: 0 8px;
box-sizing: border-box;
}
.item {
padding: 8px 11px;
margin: 0 8px 8px;
background: #FFFFFF;
border-radius: 8px;
// box-shadow: 0 0 4px 0 rgba(0,0,0,.4);
.row {
&:first-child {
margin-bottom: 8px;
}
color: #2E3A4F;
font-size: 28rpx;
display: flex;
align-items: center;
justify-content: space-between;
.title {
font-size: 30rpx;
font-weight: 600;
}
.time {
color: #858CA0;
}
.val {
display: flex;
align-items: center;
.type {
height: 30px;
font-size: 26px;
font-weight: bold;
line-height: 30px;
}
.blue{
color: #4381FC;
}
.red{
color: #F56B6B;
}
}
.project {
height: 21px;
font-size: 16px;
font-weight: bold;
color: #2E3A4F;
line-height: 21px;
}
.status {
height: 21px;
font-size: 16px;
color: #858CA0;
line-height: 21px;
}
.status1 {
color: #4381FC;
font-weight: 600;
}
}
}
}
}
.nodata {
text-align: center;
margin: 60px;
font-size: 26px;
}
.bottom {
width: 100%;
padding: 16px 12px 30px;
background: #fff;
box-sizing: border-box;
border-radius: 8px 8px 0 0;
box-shadow: 0px -2px 12px 0px rgba(0, 0, 0, 0.2);
position: absolute;
bottom: 0;
left: 0;
.btn-box {
width: 100%;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.btn {
width: 100%;
height: 40px;
line-height: 40px;
border-radius: 8px;
background: linear-gradient(90deg, #3B7CFC 0%, #548BFC 100%);
color: #fff;
font-size: 30rpx;
font-weight: 600;
text-align: center;
}
}
}
}
// 时间选择器
.date-btn-box {
// background: #fff;
// border-radius: 4px 4px 0 0;
border-bottom: 2rpx solid #F1F1F1;
font-size: 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
.btn {
padding: 20rpx 36rpx;
color: #888888;
}
.btn-confirm {
color: #3D7EEA;
}
}
.date-title {
padding: 20rpx 36rpx;
font-size: 36rpx;
color: #888888;
border-bottom: 2rpx solid #F1F1F1;
display: flex;
justify-content: space-evenly;
align-items: center;
.line {
width: 10px;
height: 1px;
margin: 0 14px;
background: #949CB5;
}
.date {
width: calc((100% - 10px - 28px) / 2);
height: 36px;
padding: 8px 10px;
box-sizing: border-box;
border-radius: 4px;
border: 1px solid #E6EAF2;
display: flex;
align-items: center;
.icon {
width: 16px;
height: 16px;
margin-left: 8px;
image {
width: 100%;
height: 100%;
display: block;
}
}
input {
flex: 1;
color: #2E3A4F;
font-size: 14px;
}
}
.select {
border: 1px solid #1677FF;
input {
color: #1677FF !important;
}
}
}
.picker-box {
width: 100%;
display: flex;
justify-content: space-between;
}
@@ -0,0 +1,297 @@
import { getAction } from '../../../api/base';
const dayjs = require('dayjs');
Page({
/**
* 页面的初始数据
*/
data: {
current: 1,
isLast: false,
loading: false,
list1: [],
projectId: '', // 项目名
startDate: '', // 开始日期
endDate: '', // 结束日期
startDateTmp: '',
endDateTmp: '',
showDateSelect: false, // 日期弹窗
selectDate: '', // 开始/结束
dateList: {
// 日期列表
years: [2023, 2024, 2025],
months: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
date: [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
]
},
dateValue: [0, 0, 0]
},
// 获取数据
getList() {
let parms = {
projectId: this.data.projectId,
startTime: this.data.startDate + ' ' + '00:00:00',
endTime: this.data.endDate + ' ' + '23:59:59',
pageNo: this.data.current,
pageSize: 10
};
wx.showLoading({
title: '加载中'
});
if (!this.data.loading) {
this.setData({
loading: true
});
}
getAction('api/finance/calculate/list', parms).then((res: any) => {
wx.hideLoading();
this.setData({
loading: false
});
if (res.code == 200) {
let data: any = { ...this.data };
data.list1 = data.list1.concat(res.result.records);
this.setData(data);
if (data.list1.length == res.result.total) {
this.setData({
isLast: true
});
}
} else {
wx.showToast({
title: res.message,
icon: 'none'
});
}
});
},
hidePicker() {
this.setData({
showDateSelect: false
});
},
setProject(event: any) {
let data: any = { ...this.data };
// 初始化列表
data.current = 1;
data.isLast = false;
data.list1 = [];
data.projectId = event.detail.value;
this.setData(data);
this.getList();
},
// 跳转
toDetail(event: any) {
let { inf } = event.currentTarget.dataset;
getAction('api/finance/calculate/getById', { id: inf.id })
.then((res: any) => {
if (res.success) {
wx.setStorageSync('costEstimationData', {
info: res.result,
type: 'check'
});
wx.navigateTo({
url: '../costEstimationDetail/costEstimationDetail',
fail: e => {
console.log(e);
}
});
} else {
wx.showToast({
title: res.message,
icon: 'none'
});
}
})
.catch((err: any) => {
console.log(err);
});
},
add() {
wx.navigateTo({
url: '../costEstimationAdd/costEstimationAdd',
fail: e => {
console.log(e);
}
});
},
// 日期相关--------------
showDate(e: any) {
let clickDate = null as any;
if (e.currentTarget.dataset.key == 'startDate') {
clickDate = this.data.startDate;
} else {
clickDate = this.data.endDate;
}
let y = this.data.dateList.years.findIndex(
(x: number) => x == Number(clickDate.split('-')[0])
);
let m = this.data.dateList.months.findIndex(
(x: number) => x == Number(clickDate.split('-')[1])
);
let d = this.data.dateList.date.findIndex(
(x: number) => x == Number(clickDate.split('-')[2])
);
this.setData({
showDateSelect: true,
selectDate: e.currentTarget.dataset.key,
startDateTmp: this.data.startDate,
endDateTmp: this.data.endDate,
dateValue: [y, m, d]
});
},
// 确认选择时间
changeDate(e: any) {
if (
new Date(this.data.startDateTmp).getTime() >
new Date(this.data.endDateTmp).getTime()
) {
wx.showToast({
title: '结束时间不能早于开始时间',
icon: 'none'
});
return;
}
this.setData({
startDate: this.data.startDateTmp,
endDate: this.data.endDateTmp,
showDateSelect: false,
list1: [],
current: 1,
isLast: false
});
this.getList();
},
// 选择时间
selectDate(e: any) {
let y: string | number = this.data.dateList.years[e.detail.value[0]];
let m: string | number = this.data.dateList.months[e.detail.value[1]];
let d: string | number = this.data.dateList.date[e.detail.value[2]];
y = y < 10 ? '0' + y : y;
m = m < 10 ? '0' + m : m;
d = d < 10 ? '0' + d : d;
if (this.data.selectDate == 'startDate') {
this.setData({
startDateTmp: `${y}-${m}-${d}`
});
} else {
this.setData({
endDateTmp: `${y}-${m}-${d}`
});
}
},
// 日期初始化
initDate() {
if (this.data.startDate) {
this.getList();
} else {
let year = new Date().getFullYear();
let mon = (new Date().getMonth() + 1) as any;
let day =
new Date().getDate() < 10
? '0' + new Date().getDate()
: new Date().getDate();
let years = [] as any;
let sy = mon > 1 ? year : year - 1;
let smon = mon > 1 ? mon - 1 : (12 as any);
mon = mon < 10 ? '0' + mon : mon;
smon = smon < 10 ? '0' + smon : smon;
for (let i = -3; i < 6; i++) {
years.push(year + i);
}
this.setData({
dateList: {
years: years,
months: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
date: [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
]
},
dateValue: [0, 0, 0],
startDate: `${sy}-${smon}-${day}`,
endDate: `${year}-${mon}-${day}`,
startDateTmp: `${sy}-${smon}-${day}`,
endDateTmp: `${year}-${mon}-${day}`
});
this.getList();
}
},
// 下拉
lower(e: any) {
if (this.data.isLast) {
wx.showToast({
title: '已经是最后一页',
icon: 'none'
});
return;
}
if (e.detail.direction == 'bottom' && !this.data.loading) {
// this.data.current += 1
this.setData({
loading: true,
current: (this.data.current += 1)
});
this.getList();
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.setData({
current: 1,
isLast: false,
list1: []
});
this.initDate();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
this.setData({
current: 1,
list1: []
});
this.getList();
// 手动控制回弹
wx.stopPullDownRefresh();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
});
@@ -0,0 +1,95 @@
<view class="container">
<view class="search-container">
<view class="row">
<view class="project-select">
<input type="text" placeholder="输入项目" bindblur="setProject"/>
</view>
<view class="project-select selectItem">
<view class="date" data-key="startDate" catchtap="showDate">
<view class="val" wx:if="{{startDate}}">{{startDate}}</view>
<view class="placeholder" wx:else>开始日期</view>
<view class="icon">
<image src="../../../images/icon_cal.png" mode="" />
</view>
</view>
</view>
<view class="project-select selectItem">
<view class="date" data-key="endDate" catchtap="showDate">
<view class="val" wx:if="{{endDate}}">{{endDate}}</view>
<view class="placeholder" wx:else>结束日期</view>
<view class="icon">
<image src="../../../images/icon_cal.png" mode="" />
</view>
</view>
</view>
</view>
</view>
<view class="list-content">
<view class="list">
<scroll-view class="scroll-view_H" scroll-y="true" bindscrolltolower="lower" style="width: 100%">
<view class="item" wx:for="{{list1}}" wx:key="index" data-inf="{{item}}" catchtap="toDetail">
<view class="row">
<view class="val project">{{item.projectId ? item.projectId : '/'}}</view>
<view class="status">净利润(万元)</view>
</view>
<view class="row">
<view class="val">{{item.createTime}}</view>
<view class="val">
<view class="type {{item.netProfit < 0 ? 'red' : 'blue'}}">{{item.netProfit}}</view>
</view>
</view>
</view>
<view class="is-last" wx:if="{{isLast && list1.length > 0}}">
<van-divider contentPosition="center">已加载完全部数据</van-divider>
</view>
<view class="no-data" wx:if="{{list1.length == 0}}">
<van-empty description="无数据" />
</view>
</scroll-view>
</view>
</view>
<view class="bottom">
<view class="btn-box">
<view class="btn" catch:tap="add">新增测算</view>
</view>
</view>
<!-- 日期 -->
<van-popup show="{{ showDateSelect }}" position="bottom" custom-style="height: 50%;" bind:click-overlay="hidePicker">
<view style="background: #fff;border-radius: 4px 4px 0 0;overflow: hidden;">
<view class="date-btn-box">
<view class="btn btn-cancel" bindtap="hidePicker">取消</view>
<view class="title">选择开始结束时间</view>
<view class="btn btn-confirm" bindtap="changeDate">确定</view>
</view>
<view class="date-title">
<view class="date {{selectDate == 'startDate' ? 'select' : ''}}" data-key="startDate">
<input type="text" value="{{startDateTmp}}" disabled="true" />
<view class="icon">
<image src="../../../images/icon_cal.png" mode="" />
</view>
</view>
<view class="line"></view>
<view class="date {{selectDate == 'endDate' ? 'select' : ''}}" data-key="endDate">
<input type="text" value="{{endDateTmp}}" disabled="true" />
<view class="icon">
<image src="../../../images/icon_cal.png" mode="" />
</view>
</view>
</view>
<view class="picker-box">
<picker-view data-key="dateRang" value="{{dateValue}}" indicator-style="height: 50px;" style="width: 100%; height: 500rpx;" bindchange="selectDate">
<picker-view-column>
<view style="line-height: 50px; text-align: center;" wx:for="{{dateList.years}}" wx:key="index">{{item}}年</view>
</picker-view-column>
<picker-view-column>
<view style="line-height: 50px; text-align: center;" wx:for="{{dateList.months}}" wx:key="index">{{item}}月</view>
</picker-view-column>
<picker-view-column>
<view style="line-height: 50px; text-align: center;" wx:for="{{dateList.date}}" wx:key="index">{{item}}日</view>
</picker-view-column>
</picker-view>
</view>
</view>
</van-popup>
</view>