init
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-picker": "@vant/weapp/picker/index",
|
||||
"van-popup": "@vant/weapp/popup/index",
|
||||
"van-search": "@vant/weapp/search/index",
|
||||
"van-dialog": "@vant/weapp/dialog/index"
|
||||
},
|
||||
"navigationBarTitleText": "新增测算"
|
||||
}
|
||||
@@ -0,0 +1,453 @@
|
||||
/* pages/violationReporting/violationReporting.wxss */
|
||||
page {
|
||||
background-color: #EFF1F4;
|
||||
}
|
||||
|
||||
.identificationBox {
|
||||
background-color: #ffffff;
|
||||
padding: 16rpx 0;
|
||||
width: 100%;
|
||||
padding: 16rpx 0;
|
||||
position: relative;
|
||||
|
||||
.textarea {
|
||||
height: 176rpx;
|
||||
width: calc(100% - 56rpx);
|
||||
border-radius: 16rpx;
|
||||
border: 2rpx solid #E6EAF2;
|
||||
margin: 0 16rpx 16rpx 16rpx;
|
||||
padding: 12rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.analysisBtn {
|
||||
position: relative;
|
||||
width: calc(100% - 32rpx);
|
||||
margin: 0 16rpx;
|
||||
|
||||
.tips {
|
||||
color: red;
|
||||
font-size: 25rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.button {
|
||||
width: 128rpx;
|
||||
height: 64rpx;
|
||||
background: linear-gradient(90deg, #3B7CFC 0%, #548BFC 100%);
|
||||
border-radius: 16rpx;
|
||||
text-align: center;
|
||||
line-height: 64rpx;
|
||||
color: #fff;
|
||||
|
||||
// position: absolute;
|
||||
// right: 16px;
|
||||
&.disabled {
|
||||
opacity: 0.35;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.flex-between {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.flex-align {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.flex-end {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.box {
|
||||
background-color: #ffffff;
|
||||
font-size: 28rpx;
|
||||
padding: 28rpx 20rpx 0 20rpx;
|
||||
|
||||
&:not(:first-child) {
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
|
||||
.row {
|
||||
.left {
|
||||
color: #333F53;
|
||||
font-weight: bold;
|
||||
|
||||
.bg {
|
||||
width: 8rpx;
|
||||
height: 44rpx;
|
||||
background: linear-gradient(180deg, #4E87FC 0%, #38B1FE 100%);
|
||||
border-radius: 4rpx;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
color: #2E3A4F;
|
||||
|
||||
.btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
image {
|
||||
margin-right: 4px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.info-item {
|
||||
padding: 20rpx;
|
||||
border-bottom: 2rpx solid #E6EAF2;
|
||||
background-color: #fff;
|
||||
|
||||
&.borderBottomNone {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
&.disabledItem {
|
||||
background: #EFF1F4;
|
||||
box-shadow: 0px 1px 0px 0px #E6EAF2;
|
||||
|
||||
.right {
|
||||
color: #949CB5;
|
||||
}
|
||||
}
|
||||
|
||||
.left {
|
||||
color: #2F3B50;
|
||||
width: 40%;
|
||||
|
||||
.require {
|
||||
color: #EA4955;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
width: 60%;
|
||||
text-align: right;
|
||||
|
||||
&.selectItem {
|
||||
width: 100%;
|
||||
justify-content: flex-end;
|
||||
|
||||
.placeholder {
|
||||
color: #949CB5;
|
||||
}
|
||||
}
|
||||
|
||||
.arrow {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 13rpx solid transparent;
|
||||
border-right: 13rpx solid transparent;
|
||||
border-top: 15rpx solid #636B83;
|
||||
margin-left: 18rpx;
|
||||
}
|
||||
|
||||
.van-radio-group {
|
||||
display: flex;
|
||||
|
||||
van-radio {
|
||||
margin-right: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.button-list {
|
||||
display: flex;
|
||||
|
||||
.button-selected {
|
||||
position: relative;
|
||||
height: 34px;
|
||||
width: 88px;
|
||||
margin-left: 8px;
|
||||
|
||||
.bg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
|
||||
image {
|
||||
border-radius: 4px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.disabled {
|
||||
color: #93C0FF;
|
||||
}
|
||||
|
||||
.selected {
|
||||
color: #1677FF;
|
||||
}
|
||||
}
|
||||
|
||||
.button {
|
||||
display: flex;
|
||||
height: 32px;
|
||||
width: 86px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 1px solid #C3CBE4;
|
||||
margin-left: 8px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.tips {
|
||||
color: red;
|
||||
text-align: right;
|
||||
margin-top: 10rpx;
|
||||
font-size: 25rpx;
|
||||
}
|
||||
|
||||
.uploadBox {
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
|
||||
.reset-btn {
|
||||
background-color: #E9F2FF;
|
||||
color: #4381FC;
|
||||
width: 100px;
|
||||
text-align: center;
|
||||
border: 1px dashed #4381FC;
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.template-info {
|
||||
padding: 20rpx;
|
||||
background-color: #ECEFF5;
|
||||
|
||||
.template-category {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.template-content {
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
|
||||
.template-title {
|
||||
background: #F8F9FB;
|
||||
border-bottom: 2rpx solid #E6EAF2;
|
||||
text-align: center;
|
||||
padding: 3px 0;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.template-item {
|
||||
padding: 20rpx;
|
||||
border-bottom: 2rpx solid #E6EAF2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.vehicle-info {
|
||||
background-color: #ECEFF5;
|
||||
border: 1px #ECEFF5 solid;
|
||||
border-radius: 6px;
|
||||
|
||||
.vehicle-title {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
padding: 8rpx 0;
|
||||
}
|
||||
|
||||
.vehicle-content {
|
||||
background-color: #fff;
|
||||
max-height: 273px;
|
||||
overflow-y: auto;
|
||||
|
||||
.vehicle-item {
|
||||
padding: 17rpx 16rpx 8rpx;
|
||||
|
||||
&:not(:last-child) {
|
||||
border-bottom: 1px solid #ECEFF5;
|
||||
}
|
||||
|
||||
.vehicle-item-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 20px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.vehicle-item-remark {
|
||||
border-radius: 4px;
|
||||
border: 1px solid #4381FC;
|
||||
height: 36px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 16rpx;
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.left-item {
|
||||
display: flex;
|
||||
|
||||
.cancel-icon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.right-item {
|
||||
margin-right: 8px;
|
||||
|
||||
.van-radio-group {
|
||||
display: flex;
|
||||
|
||||
van-radio {
|
||||
margin-right: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tips {
|
||||
color: red;
|
||||
font-size: 25rpx;
|
||||
text-align: right;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pdb_20 {
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.searchBox {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
top: 80rpx;
|
||||
z-index: 63;
|
||||
}
|
||||
|
||||
.operateBtn {
|
||||
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;
|
||||
|
||||
.submitBtn {
|
||||
height: 80rpx;
|
||||
background: linear-gradient(90deg, #3B7CFC 0%, #548BFC 100%);
|
||||
border-radius: 16rpx;
|
||||
color: #FFFFFF;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.container {
|
||||
height: calc(100vh - 100px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.weui-input {
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
.append {
|
||||
margin-left: 8px;
|
||||
color: #636B83;
|
||||
}
|
||||
|
||||
.add-btn {
|
||||
width: 70px;
|
||||
background-color: #E9F2FF;
|
||||
border-radius: 4px;
|
||||
border: 1px dashed #4381FC;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
color: #4381FC;
|
||||
margin-right: 16px;
|
||||
padding: 4px 0;
|
||||
|
||||
image {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
.vehicleCostList {
|
||||
width: calc(100% - 40rpx);
|
||||
padding: 20rpx;
|
||||
background: #ECEFF5;
|
||||
border-radius: 4px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.delete {
|
||||
border-radius: 4px;
|
||||
border: 1px solid #FDD0DD;
|
||||
color: #FA5955;
|
||||
width: 60px;
|
||||
height: 30px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: #FFEEEE;
|
||||
}
|
||||
|
||||
.title {
|
||||
background-color: #F8F9FB;
|
||||
padding: 8px 20rpx;
|
||||
border-radius: 4px 4px 0px 0px;
|
||||
border: 1px solid #E6EAF2;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.title2 {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.other {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.icon {
|
||||
image {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,482 @@
|
||||
import Dialog from '@vant/weapp/dialog/dialog';
|
||||
import { getAction, upload, postAction } from '../../../api/base';
|
||||
const dayjs = require('dayjs');
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
costList: [], // 车型数据
|
||||
filterCostList: [], // 车型过滤
|
||||
costListVal: '', // 车型查询
|
||||
currentIndex: '', // 当前点击车型的序号
|
||||
isSubmit: false, // 是否提交
|
||||
// 展开/收起
|
||||
showBox: {
|
||||
base: true,
|
||||
vehicleList: true
|
||||
},
|
||||
// 下拉选择/日期弹窗展示
|
||||
showList: {
|
||||
yearLimitShow: false,
|
||||
costListShow: false
|
||||
},
|
||||
// 提交数据
|
||||
params: {
|
||||
projectId: '', //项目
|
||||
yearLimit: 8, //年限
|
||||
financingRatio: 0, //融资比例
|
||||
financingRate: 0, //融资利率
|
||||
overheadSharing: 0, //管理费用分担
|
||||
vehicleCostList: [] // 车型信息
|
||||
},
|
||||
// 年限下拉
|
||||
yearLimitList: [
|
||||
{ value: 1, text: '1年' },
|
||||
{ value: 2, text: '2年' },
|
||||
{ value: 3, text: '3年' },
|
||||
{ value: 4, text: '4年' },
|
||||
{ value: 5, text: '5年' },
|
||||
{ value: 6, text: '6年' },
|
||||
{ value: 7, text: '7年' },
|
||||
{ value: 8, text: '8年' }
|
||||
],
|
||||
// 翻译回显
|
||||
dictTextList: {
|
||||
yearLimit_dictText: '8年' // 租赁年限
|
||||
},
|
||||
// 基础信息校验
|
||||
requireObj: {
|
||||
projectId: '', //项目
|
||||
financingRatio: '', //融资比例
|
||||
financingRate: '', //融资利率
|
||||
overheadSharing: '' //管理费用分担
|
||||
},
|
||||
// 车型信息校验
|
||||
validateObj: {
|
||||
vehicleCostList: [],
|
||||
obj: {
|
||||
unitPrice: '', //单价
|
||||
purchaseTax: '', //上牌费用/购置税
|
||||
insurance: '', //保险
|
||||
repair: '', //维修及易损件
|
||||
upkeep: '', //保养
|
||||
annualAudit: '', //年审
|
||||
quantity: '', //数量
|
||||
salvageValue: '', //残值
|
||||
oneYear: '',
|
||||
twoYear: '',
|
||||
threeYear: '',
|
||||
fourYear: '',
|
||||
fiveYear: '',
|
||||
sixYear: '',
|
||||
sevenYear: '',
|
||||
eightYear: '',
|
||||
vehicleType: '' // 车型
|
||||
}
|
||||
},
|
||||
|
||||
// 车型信息收起
|
||||
vehicleCostListShow: [],
|
||||
// 车型信息
|
||||
vehicleTypeInfo: [
|
||||
{ label: '单价', prop: 'unitPrice', append: '万元' },
|
||||
{ label: '上牌/购置税', prop: 'purchaseTax', append: '万元' },
|
||||
{ label: '保险(万元/台/年)', prop: 'insurance', append: '万元' },
|
||||
{ label: '维修及易损件(万元)', prop: 'repair', append: '万元' },
|
||||
{ label: '保养(万元)', prop: 'upkeep', append: '万元' },
|
||||
{ label: '年审(万元)', prop: 'annualAudit', append: '万元' }
|
||||
],
|
||||
// 年收益
|
||||
yearList: [
|
||||
{ label: '第一年', prop: 'oneYear', append: '万元', value: 1 },
|
||||
{ label: '第二年', prop: 'twoYear', append: '万元', value: 2 },
|
||||
{ label: '第三年', prop: 'threeYear', append: '万元', value: 3 },
|
||||
{ label: '第四年', prop: 'fourYear', append: '万元', value: 4 },
|
||||
{ label: '第五年', prop: 'fiveYear', append: '万元', value: 5 },
|
||||
{ label: '第六年', prop: 'sixYear', append: '万元', value: 6 },
|
||||
{ label: '第七年', prop: 'sevenYear', append: '万元', value: 7 },
|
||||
{ label: '第八年', prop: 'eightYear', append: '万元', value: 8 }
|
||||
]
|
||||
},
|
||||
// 新增车型信息
|
||||
addCostList() {
|
||||
let data: any = { ...this.data };
|
||||
let params = {
|
||||
unitPrice: 0, //单价
|
||||
purchaseTax: 0, //上牌费用/购置税
|
||||
insurance: 0, //保险
|
||||
repair: 0, //维修及易损件
|
||||
upkeep: 0, //保养
|
||||
annualAudit: 0, //年审
|
||||
quantity: 0, //数量
|
||||
salvageValue: 0, //残值
|
||||
oneYear: 0,
|
||||
twoYear: 0,
|
||||
threeYear: 0,
|
||||
fourYear: 0,
|
||||
fiveYear: 0,
|
||||
sixYear: 0,
|
||||
sevenYear: 0,
|
||||
eightYear: 0,
|
||||
vehicleType_dictText: '', // 车型回显
|
||||
vehicleType: '' // 车型
|
||||
};
|
||||
data.params.vehicleCostList.push(JSON.parse(JSON.stringify(params)));
|
||||
data.validateObj.vehicleCostList.push(JSON.parse(JSON.stringify(params))); // 校验
|
||||
data.vehicleCostListShow.push(true); // 显隐
|
||||
this.setData(data);
|
||||
},
|
||||
deleteCostList(event: any) {
|
||||
let { index } = event.currentTarget.dataset;
|
||||
let data: any = { ...this.data };
|
||||
data.params.vehicleCostList.splice(index, 1);
|
||||
data.vehicleCostListShow.splice(index, 1); // 删除显隐
|
||||
this.setData(data);
|
||||
},
|
||||
// 展示和收起
|
||||
showBoxInf(event: any) {
|
||||
let data: any = { ...this.data };
|
||||
let { fieldname, index } = event.currentTarget.dataset;
|
||||
if (fieldname == 'vehicleCostList') {
|
||||
data.vehicleCostListShow[index] = !data.vehicleCostListShow[index];
|
||||
} else data.showBox[fieldname] = !data.showBox[fieldname];
|
||||
this.setData(data);
|
||||
},
|
||||
//下拉框切换是否展示
|
||||
pickerChange(event: any) {
|
||||
let { fieldname, index } = event.currentTarget.dataset;
|
||||
let data: any = { ...this.data };
|
||||
data.showList[fieldname] = true;
|
||||
data.currentIndex = index;
|
||||
this.setData(data);
|
||||
},
|
||||
// 下拉选择/日期确认
|
||||
pickerConfirm(event: any) {
|
||||
//下拉框点击确认
|
||||
let { fieldname, dicttext } = event.currentTarget.dataset;
|
||||
let detail = event.detail;
|
||||
let data: any = { ...this.data };
|
||||
if (fieldname == 'yearLimit') {
|
||||
data.params[fieldname] = detail.value.value;
|
||||
data.dictTextList[dicttext] = detail.value.text;
|
||||
} else if (fieldname == 'vehicleType') {
|
||||
// data.params.vehicleCostList[data.currentIndex].vehicleType = detail.value.value
|
||||
let keys = Object.keys(data.params.vehicleCostList[data.currentIndex]);
|
||||
keys.forEach((item: any) => {
|
||||
if (detail.value[item])
|
||||
data.params.vehicleCostList[data.currentIndex][item] =
|
||||
detail.value[item];
|
||||
else data.params.vehicleCostList[data.currentIndex][item] = 0;
|
||||
});
|
||||
data.params.vehicleCostList[data.currentIndex].vehicleType_dictText =
|
||||
detail.value.value;
|
||||
data.validateObj.vehicleCostList[data.currentIndex].vehicleType = '';
|
||||
}
|
||||
|
||||
this.setData(data);
|
||||
this.hidePicker();
|
||||
},
|
||||
|
||||
// 项目过滤
|
||||
filterCostList(event: any) {
|
||||
let list = [] as any;
|
||||
this.data.costList.forEach((item: any) => {
|
||||
if (item.text.toLowerCase().indexOf(event.detail.toLowerCase()) >= 0) {
|
||||
list.push(item);
|
||||
}
|
||||
});
|
||||
this.setData({
|
||||
filterCostList: list,
|
||||
costListVal: event.detail
|
||||
});
|
||||
},
|
||||
|
||||
// 关闭下拉选择/日期选择
|
||||
hidePicker() {
|
||||
let keys = Object.keys(this.data.showList);
|
||||
let list = this.data.showList as any;
|
||||
keys.forEach(item => {
|
||||
list[item] = false;
|
||||
});
|
||||
this.setData({
|
||||
showList: list
|
||||
});
|
||||
},
|
||||
// input输入
|
||||
inputChange(event: any) {
|
||||
let { fieldname, type, require } = event.currentTarget.dataset;
|
||||
let data: any = this.data;
|
||||
let result = event.detail.value;
|
||||
let regex = /[!@#$%^&*?><|\\\\]/;
|
||||
let spaceRegex = new RegExp(/\s+/g);
|
||||
let message = '';
|
||||
// 有填写内容,校验特殊字符
|
||||
if (result && regex.test(result)) {
|
||||
message = '不支持特殊字符';
|
||||
} else if (spaceRegex.test(result)) message = '不支持含有空格';
|
||||
// 没有填写内容且不为必填
|
||||
else if (!result && require != 'norequire') {
|
||||
message = '请填写必填项';
|
||||
} else if (result.length > 32) {
|
||||
message = '输入长度不得超过32个字符';
|
||||
} else if (result) {
|
||||
message = '';
|
||||
}
|
||||
if (require != 'norequire') {
|
||||
data.requireObj[fieldname] = message;
|
||||
}
|
||||
data.params[fieldname] = result;
|
||||
this.setData(data);
|
||||
},
|
||||
|
||||
// 数字输入
|
||||
numberChange(event: any) {
|
||||
let { fieldname, type, require, index } = event.currentTarget.dataset;
|
||||
let data: any = this.data;
|
||||
let result = event.detail.value;
|
||||
let message = '';
|
||||
const moneyNumberExp: RegExp = /^\d{1,9}(\.\d{1,4})?$/; //金额限制整数部分不能大于9位 小数部分不能大于4位
|
||||
const rateNumberExp: RegExp = /^\d+(\.\d{1,2})?$/; //小数部分不能大于2位
|
||||
if (type == 'rate') {
|
||||
if (result != '') {
|
||||
data.params[fieldname] = Number(result);
|
||||
if (result > 100) message = '百分比不能大于100%';
|
||||
else if (result < 0) data.params[fieldname] = 0;
|
||||
else if (!rateNumberExp.test(event.detail.value))
|
||||
message = '小数部分不能大于2位';
|
||||
} else data.params[fieldname] = 0;
|
||||
} else if (type == 'money') {
|
||||
if (result != '') {
|
||||
data.params.vehicleCostList[index][fieldname] = Number(result);
|
||||
if (result < 0) data.params.vehicleCostList[index][fieldname] = 0;
|
||||
else if (!moneyNumberExp.test(event.detail.value))
|
||||
message = '金额限制整数部分不能大于9位,小数部分不能大于4位';
|
||||
} else data.params.vehicleCostList[index][fieldname] = 0;
|
||||
} else if (type == 'quantity') {
|
||||
if (result != '') {
|
||||
data.params.vehicleCostList[index][fieldname] = Number(result);
|
||||
if (result < 0) data.params.vehicleCostList[index][fieldname] = 0;
|
||||
else if (result > 100000) message = '数量不能大于100000';
|
||||
} else data.params.vehicleCostList[index][fieldname] = 0;
|
||||
}
|
||||
if (require != 'noRequire') {
|
||||
data.requireObj[fieldname] = message;
|
||||
} else {
|
||||
if (index !== undefined) {
|
||||
data.validateObj.vehicleCostList[index][fieldname] = message;
|
||||
}
|
||||
}
|
||||
|
||||
this.setData(data);
|
||||
},
|
||||
// 数量加减
|
||||
plusAndsubtract(event: any) {
|
||||
let { type, index } = event.currentTarget.dataset;
|
||||
let data: any = this.data;
|
||||
let message = '';
|
||||
if (type == 'plus') data.params.vehicleCostList[index].quantity += 1;
|
||||
else if (type == 'subtract')
|
||||
data.params.vehicleCostList[index].quantity -= 1;
|
||||
if (data.params.vehicleCostList[index].quantity < 0)
|
||||
data.params.vehicleCostList[index].quantity = 0;
|
||||
else if (data.params.vehicleCostList[index].quantity > 100000)
|
||||
message = '数量不能大于100000';
|
||||
else if (data.params.vehicleCostList[index].quantity <= 100000)
|
||||
message = '';
|
||||
data.validateObj.vehicleCostList[index].quantity = message;
|
||||
this.setData(data);
|
||||
},
|
||||
// 校验
|
||||
validateFn() {
|
||||
let data: any = this.data;
|
||||
let result = true;
|
||||
// 基础信息校验
|
||||
let requireObjKeys = Object.keys(data.requireObj);
|
||||
requireObjKeys.forEach((item: any) => {
|
||||
if (data.params[item] === '') {
|
||||
data.requireObj[item] = '请填写必填项';
|
||||
result = false;
|
||||
}
|
||||
});
|
||||
// 车型信息校验
|
||||
let validateObjKeys = Object.keys(data.validateObj.obj);
|
||||
data.params.vehicleCostList.forEach((item: any, index: any) => {
|
||||
validateObjKeys.forEach((el: any) => {
|
||||
let message = '';
|
||||
const moneyNumberExp: RegExp = /^\d{1,9}(\.\d{1,4})?$/; //金额限制整数部分不能大于9位 小数部分不能大于4位
|
||||
if (el == 'vehicleType') {
|
||||
if (!item[el]) {
|
||||
message = '请填写必填项';
|
||||
result = false;
|
||||
}
|
||||
} else if (el == 'quantity') {
|
||||
if (item[el] > 100000) {
|
||||
message = '数量不能大于100000';
|
||||
result = false;
|
||||
}
|
||||
} else {
|
||||
if (!moneyNumberExp.test(item[el])) {
|
||||
message = '金额限制整数部分不能大于9位,小数部分不能大于4位';
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
// item[el] = message
|
||||
data.validateObj.vehicleCostList[index][el] = message;
|
||||
});
|
||||
});
|
||||
this.setData(data);
|
||||
return result;
|
||||
},
|
||||
|
||||
// 提交
|
||||
formSubmit() {
|
||||
let data: any = this.data;
|
||||
if (data.isSubmit) return;
|
||||
// if (data.params.vehicleCostList.length == 0 ? true : false) {
|
||||
// wx.showToast({
|
||||
// title: '请新增车型信息',
|
||||
// icon: 'none'
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
// 校验
|
||||
if (!this.validateFn()) return;
|
||||
// 如果有修改租赁年限,需要清空高于租赁年限的数据
|
||||
// 当前年限以上的数据归零
|
||||
data.params.vehicleCostList.forEach((item: any) => {
|
||||
data.yearList.forEach((el: any, index: number) => {
|
||||
if (data.yearLimitList[index].value > data.params.yearLimit)
|
||||
item[el.prop] = 0;
|
||||
});
|
||||
});
|
||||
// 校验是否有数量为0
|
||||
let result = data.params.vehicleCostList.some((item: any) => {
|
||||
return item.quantity === 0;
|
||||
});
|
||||
if (result) {
|
||||
Dialog.confirm({
|
||||
title: '提示',
|
||||
message: '有车型信息数据中的数量值为零,会影响测算结果,是否进行测算'
|
||||
})
|
||||
.then(() => {
|
||||
wx.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
this.setData({
|
||||
isSubmit: true
|
||||
});
|
||||
this.submitFn(data);
|
||||
})
|
||||
.catch(() => {});
|
||||
} else {
|
||||
wx.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
this.setData({
|
||||
isSubmit: true
|
||||
});
|
||||
this.submitFn(data);
|
||||
}
|
||||
},
|
||||
submitFn(data: any) {
|
||||
postAction('api/finance/calculate/calculate', data.params)
|
||||
.then((res: any) => {
|
||||
if (res.success) {
|
||||
wx.showToast({
|
||||
title: '测算成功',
|
||||
icon: 'none'
|
||||
});
|
||||
let data: any = this.data;
|
||||
data.params.calculateObject = res.result;
|
||||
wx.setStorageSync('costEstimationData', {
|
||||
info: data.params,
|
||||
type: 'add'
|
||||
});
|
||||
setTimeout(() => {
|
||||
wx.navigateTo({
|
||||
url: '../costEstimationDetail/costEstimationDetail',
|
||||
fail: e => {
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
this.setData({
|
||||
isSubmit: false
|
||||
});
|
||||
wx.hideLoading();
|
||||
}, 1000);
|
||||
} else {
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
title: res.message,
|
||||
icon: 'none'
|
||||
});
|
||||
this.setData({
|
||||
isSubmit: false
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
this.setData({
|
||||
isSubmit: false
|
||||
});
|
||||
wx.hideLoading();
|
||||
});
|
||||
},
|
||||
// 获取车型数据
|
||||
getCostList() {
|
||||
getAction('api/finance/calculate/costList').then((res: any) => {
|
||||
let result: any = res.result;
|
||||
result.forEach((item: any) => {
|
||||
item.text = item.vehicleType;
|
||||
item.value = item.vehicleType;
|
||||
});
|
||||
this.setData({
|
||||
costList: result, // 车型数据
|
||||
filterCostList: result // 车型过滤
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad() {
|
||||
this.getCostList();
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {}
|
||||
});
|
||||
@@ -0,0 +1,221 @@
|
||||
<view>
|
||||
<view class="container">
|
||||
<view class="box {{showBox.base ? '' : 'pdb_20'}}">
|
||||
<view class="row flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="bg"></view>
|
||||
<view>基础信息</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="btn" wx:if="{{showBox.base}}" data-fieldName="base" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_up.png" mode="" />
|
||||
<view class="val">收起</view>
|
||||
</view>
|
||||
<view class="btn" wx:if="{{!showBox.base}}" data-fieldName="base" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_down.png" mode="" />
|
||||
<view class="val">展开</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{showBox.base}}">
|
||||
<view class="info-item">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="require">*</view>
|
||||
<view>项目</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<input placeholder-style="color:#949CB5" data-fieldName="projectId" bindinput="inputChange" value="{{params.projectId}}" type="text" placeholder="请输入" style="width:100%;" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="tips" wx:if="{{requireObj.projectId}}">{{requireObj.projectId}}</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="require">*</view>
|
||||
<view>租赁年限</view>
|
||||
</view>
|
||||
<view class="right flex-align selectItem" data-fieldName="yearLimitShow" catch:tap="pickerChange">
|
||||
<view wx:if="{{dictTextList.yearLimit_dictText}}">{{dictTextList.yearLimit_dictText}}</view>
|
||||
<view class="placeholder" wx:else>请选择</view>
|
||||
<view class="arrow"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<van-popup show="{{showList.yearLimitShow}}" position="bottom" bind:close="hidePicker">
|
||||
<van-picker data-fieldname="yearLimit" data-dicttext="yearLimit_dictText" show-toolbar columns="{{yearLimitList}}" bind:confirm="pickerConfirm" bind:cancel="hidePicker"></van-picker>
|
||||
</van-popup>
|
||||
<view class="info-item">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="require">*</view>
|
||||
<view>融资比例</view>
|
||||
</view>
|
||||
<view class="right flex-align">
|
||||
<input placeholder-style="color:#949CB5" data-fieldName="financingRatio" data-type="rate" bindblur="numberChange" value="{{params.financingRatio}}" type="digit" placeholder="请输入" style="width:100%;" />
|
||||
<view class="append">%</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tips" wx:if="{{requireObj.financingRatio}}">{{requireObj.financingRatio}}</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="require">*</view>
|
||||
<view>融资利率</view>
|
||||
</view>
|
||||
<view class="right flex-align">
|
||||
<input placeholder-style="color:#949CB5" data-fieldName="financingRate" data-type="rate" bindblur="numberChange" value="{{params.financingRate}}" type="digit" placeholder="请输入" style="width:100%;" />
|
||||
<view class="append">%</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tips" wx:if="{{requireObj.financingRate}}">{{requireObj.financingRate}}</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="require">*</view>
|
||||
<view>管理分担费用</view>
|
||||
</view>
|
||||
<view class="right flex-align">
|
||||
<input placeholder-style="color:#949CB5" data-fieldName="overheadSharing" data-type="rate" bindblur="numberChange" value="{{params.overheadSharing}}" type="digit" placeholder="请输入" style="width:100%;" />
|
||||
<view class="append">%</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tips" wx:if="{{requireObj.overheadSharing}}">{{requireObj.overheadSharing}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="box pdb_20">
|
||||
<view class="row flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="bg"></view>
|
||||
<view>车型信息</view>
|
||||
</view>
|
||||
<view class="right flex-align">
|
||||
<view class="add-btn" catch:tap="addCostList">
|
||||
<image src="../../../images/btn_add.png" mode="" />
|
||||
<view>新增</view>
|
||||
</view>
|
||||
<view class="btn" wx:if="{{showBox.vehicleList}}" data-fieldName="vehicleList" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_up.png" mode="" />
|
||||
<view class="val">收起</view>
|
||||
</view>
|
||||
<view class="btn" wx:if="{{!showBox.vehicleList}}" data-fieldName="vehicleList" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_down.png" mode="" />
|
||||
<view class="val">展开</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{showBox.vehicleList}}">
|
||||
<view class="vehicleCostList" wx:for="{{params.vehicleCostList}}" wx:for-item="item" wx:for-index="index" wx:key="index">
|
||||
<view class="row flex-between title2">
|
||||
<view class="left flex-align">
|
||||
<view class="delete" data-index="index" catch:tap="deleteCostList">删除</view>
|
||||
</view>
|
||||
<view class="right flex-align">
|
||||
<view class="btn" wx:if="{{vehicleCostListShow[index]}}" data-fieldName="vehicleCostList" data-index="{{index}}" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_up.png" mode="" />
|
||||
<view class="val">收起</view>
|
||||
</view>
|
||||
<view class="btn" wx:if="{{!vehicleCostListShow[index]}}" data-fieldName="vehicleCostList" data-index="{{index}}" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_down.png" mode="" />
|
||||
<view class="val">展开</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="require">*</view>
|
||||
<view>车型</view>
|
||||
</view>
|
||||
<view class="right flex-align selectItem" data-fieldName="costListShow" data-index="{{index}}" catch:tap="pickerChange">
|
||||
<view wx:if="{{item.vehicleType_dictText}}">{{item.vehicleType_dictText}}</view>
|
||||
<view class="placeholder" wx:else>请选择</view>
|
||||
<view class="arrow"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tips" wx:if="{{validateObj.vehicleCostList[index].vehicleType}}">{{validateObj.vehicleCostList[index].vehicleType}}</view>
|
||||
</view>
|
||||
<view class="content" wx:if="{{vehicleCostListShow[index]}}">
|
||||
<view class="vehicleInfo">
|
||||
<view class="info-item" wx:for="{{vehicleTypeInfo}}" wx:for-item="el" wx:for-index="idx" wx:key="idx">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view>{{el.label}}</view>
|
||||
</view>
|
||||
<view class="right flex-align">
|
||||
<input placeholder-style="color:#949CB5" data-fieldName="{{el.prop}}" data-type="money" data-index="{{index}}" data-require='noRequire' bindblur="numberChange" value="{{item[el.prop]}}" type="digit" placeholder="请输入" style="width:100%;" />
|
||||
<view class="append" style="width:40px;">万元</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tips" wx:if="{{validateObj.vehicleCostList[index][el.prop]}}">{{validateObj.vehicleCostList[index][el.prop]}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<view style="margin-top: 8px;">
|
||||
<view class="title">租赁费用(万元/月/台)</view>
|
||||
<view class="info-item" style="border-bottom: 2rpx solid #E6EAF2;" wx:for="{{yearList}}" wx:for-item="el" wx:for-index="idx" wx:key="idx" wx:if="{{el.value <= params.yearLimit }}">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="label">{{el.label}}</view>
|
||||
</view>
|
||||
<view class="right flex-align">
|
||||
<input placeholder-style="color:#949CB5" data-fieldName="{{el.prop}}" data-type="money" data-index="{{index}}" data-require='noRequire' bindblur="numberChange" value="{{item[el.prop]}}" type="digit" placeholder="请输入" style="width:100%;" />
|
||||
<view class="append" style="width:40px;">万元</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tips" wx:if="{{validateObj.vehicleCostList[index][el.prop]}}">{{validateObj.vehicleCostList[index][el.prop]}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="other">
|
||||
<view class="info-item">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view>数量</view>
|
||||
</view>
|
||||
<view class="right flex-end">
|
||||
<view class="icon" style="margin-right: 8px;" catch:tap="plusAndsubtract" data-type="subtract" data-index="{{index}}">
|
||||
<image src="../../../images/num_subtract.png" mode="" />
|
||||
</view>
|
||||
<input placeholder-style="color:#949CB5" data-fieldName="quantity" data-type="quantity" data-index="{{index}}" data-require='noRequire' bindblur="numberChange" value="{{item.quantity}}" type="number" placeholder="请输入" style="width:40%;text-align: center;" />
|
||||
<view class="icon" style="margin-left: 8px;" catch:tap="plusAndsubtract" data-type="plus" data-index="{{index}}">
|
||||
<image src="../../../images/num_add.png" mode="" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tips" wx:if="{{validateObj.vehicleCostList[index].quantity}}">{{validateObj.vehicleCostList[index].quantity}}</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view>残值(台)</view>
|
||||
</view>
|
||||
<view class="right flex-align">
|
||||
<input placeholder-style="color:#949CB5" data-fieldName="salvageValue" data-type="money" data-index="{{index}}" data-require='noRequire' bindblur="numberChange" value="{{item.salvageValue}}" type="digit" placeholder="请输入" style="width:100%;" />
|
||||
<view class="append" style="width:40px;">万元</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tips" wx:if="{{validateObj.vehicleCostList[index].salvageValue}}">{{validateObj.vehicleCostList[index].salvageValue}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<van-popup show="{{showList.costListShow}}" position="bottom" bind:close="hidePicker">
|
||||
<view class="searchBox">
|
||||
<van-search value="{{ costListVal }}" placeholder="请输入车型" bind:search="filterCostList" />
|
||||
</view>
|
||||
<van-picker data-fieldname="vehicleType" data-dicttext="vehicleType_dictText" show-toolbar columns="{{filterCostList}}" bind:confirm="pickerConfirm" bind:cancel="hidePicker"></van-picker>
|
||||
</van-popup>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="operateBtn">
|
||||
<view catchtap="formSubmit" class="submitBtn" wx:if="{{params.vehicleCostList.length !== 0}}">测算</view>
|
||||
<view class="submitBtn" style="background: #C2D6FE;" wx:else>测算</view>
|
||||
</view>
|
||||
<van-dialog id="van-dialog" />
|
||||
</view>
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-dialog": "@vant/weapp/dialog/index"
|
||||
},
|
||||
"navigationBarTitleText": "财务测算"
|
||||
}
|
||||
@@ -0,0 +1,251 @@
|
||||
/* pages/violationReporting/violationReporting.wxss */
|
||||
page {
|
||||
background-color: #EFF1F4;
|
||||
}
|
||||
|
||||
.flex-between {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.flex-align {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.flex-end {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.box {
|
||||
background-color: #ffffff;
|
||||
font-size: 28rpx;
|
||||
padding: 28rpx 20rpx 0 20rpx;
|
||||
|
||||
&:not(:first-child) {
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
|
||||
.row {
|
||||
.left {
|
||||
color: #333F53;
|
||||
font-weight: bold;
|
||||
|
||||
.bg {
|
||||
width: 8rpx;
|
||||
height: 44rpx;
|
||||
background: linear-gradient(180deg, #4E87FC 0%, #38B1FE 100%);
|
||||
border-radius: 4rpx;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
color: #2E3A4F;
|
||||
|
||||
.btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
image {
|
||||
margin-right: 4px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.info-item {
|
||||
padding: 8px 20rpx;
|
||||
background-color: #fff;
|
||||
|
||||
.left {
|
||||
color: #2F3B50;
|
||||
width: 50%;
|
||||
|
||||
.label {
|
||||
color: #858CA0;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
width: 50%;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
.total-item {
|
||||
background-color: transparent;
|
||||
padding: 8px 0px 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.pdb_20 {
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.container {
|
||||
height: calc(100vh - 100px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.operateBtn {
|
||||
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;
|
||||
|
||||
.submitBtn {
|
||||
height: 80rpx;
|
||||
background: linear-gradient(90deg, #3B7CFC 0%, #548BFC 100%);
|
||||
border-radius: 16rpx;
|
||||
color: #FFFFFF;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.cancelBtn {
|
||||
height: 80rpx;
|
||||
border-radius: 16rpx;
|
||||
border: 1px solid #D6D6D6;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.button-list {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.vehicleCostList {
|
||||
width: calc (100% - 40rpx);
|
||||
background: #ECEFF5;
|
||||
border-radius: 4px;
|
||||
padding: 20rpx;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.title {
|
||||
background-color: #F8F9FB;
|
||||
padding: 8px 20rpx;
|
||||
border-radius: 4px 4px 0px 0px;
|
||||
border: 1px solid #E6EAF2;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.title2 {
|
||||
padding: 8px 0px 10px;
|
||||
}
|
||||
|
||||
.border-bottom {
|
||||
border-bottom: 2rpx solid #E6EAF2;
|
||||
}
|
||||
|
||||
.total {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
color: #4381FC;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.top {
|
||||
height: 240px;
|
||||
|
||||
.top-bg {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
|
||||
image {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.second {
|
||||
top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
position: relative;
|
||||
top: 6px;
|
||||
z-index: 10;
|
||||
padding: 20px 20px;
|
||||
|
||||
.content-top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.val {
|
||||
font-size: 26px;
|
||||
font-weight: bold;
|
||||
color: #4381FC;
|
||||
}
|
||||
}
|
||||
|
||||
.content-middle {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.item {
|
||||
width: calc((100% - 20px) / 3);
|
||||
height: 72px;
|
||||
background: #ECEFF5;
|
||||
border-radius: 8px;
|
||||
margin-top: 6px;
|
||||
text-align: center;
|
||||
|
||||
.val-container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 34px;
|
||||
}
|
||||
|
||||
.val {
|
||||
width: 100%;
|
||||
max-height: 100%;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
color: #4381FC;
|
||||
overflow-wrap: break-word;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
.over9 {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.over12 {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.over14 {
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
import Dialog from '@vant/weapp/dialog/dialog';
|
||||
import { deleteAction, postAction } from '../../../api/base';
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
type: '', // add 测算 check 详情
|
||||
issubmit: false,
|
||||
// 展开/收起
|
||||
showBox: {
|
||||
base: true, // 基本信息
|
||||
vehicle: true, // 车型信息
|
||||
result: true, // 测试机构
|
||||
rentalIncome: true, // 租金收入
|
||||
manageCostList: true, // 管理、运维、保险费用
|
||||
incomeAndTax: true, // 收入与税金表
|
||||
costAndProfitList: true, // 成本与利润表
|
||||
showBoxChild: {}
|
||||
},
|
||||
dataInfo: {} as any, // 数据
|
||||
showList: {
|
||||
// 基本信息
|
||||
baseInfo: [
|
||||
{ label: '所属项目', prop: 'projectId' },
|
||||
{ label: '租赁年限', prop: 'yearLimit', append: '年' },
|
||||
{ label: '融资比例', prop: 'financingRatio', append: '%' },
|
||||
{ label: '融资利率', prop: 'financingRate', append: '%' },
|
||||
{ label: '管理分担费用', prop: 'overheadSharing', append: '%' }
|
||||
],
|
||||
// 车型信息
|
||||
vehicleInfo: [
|
||||
{ label: '车型', prop: 'vehicleType' },
|
||||
{ label: '单价', prop: 'unitPrice', append: '万元' },
|
||||
{ label: '上牌费用/购置税', prop: 'purchaseTax', append: '万元' },
|
||||
{ label: '保险', prop: 'insurance', append: '万元' },
|
||||
{ label: '维修及易损件(台/年)', prop: 'repair', append: '万元' },
|
||||
{ label: '保养', prop: 'upkeep', append: '万元' },
|
||||
{ label: '年审', prop: 'annualAudit', append: '万元' }
|
||||
],
|
||||
// 测试结果
|
||||
result: [
|
||||
{ label: '购车成本回收期', prop: 'carCostRecovery', append: '年' },
|
||||
{ label: '融资成本', prop: 'financingCost', append: '万元' },
|
||||
{ label: '内部收益率', prop: 'internalRate', append: '%' },
|
||||
{ label: '实缴增值税及附加', prop: 'vatAndAdditional', append: '万元' },
|
||||
{ label: '所得税', prop: 'incomeTax', append: '万元' },
|
||||
{ label: '净利润', prop: 'netProfit', append: '万元' },
|
||||
{ label: '残值', prop: 'salvageValue', append: '万元' }
|
||||
],
|
||||
// 固定模板 一至八年
|
||||
yearList: [
|
||||
{ label: '第一年', prop: 'oneYear', append: '万元' },
|
||||
{ label: '第二年', prop: 'twoYear', append: '万元' },
|
||||
{ label: '第三年', prop: 'threeYear', append: '万元' },
|
||||
{ label: '第四年', prop: 'fourYear', append: '万元' },
|
||||
{ label: '第五年', prop: 'fiveYear', append: '万元' },
|
||||
{ label: '第六年', prop: 'sixYear', append: '万元' },
|
||||
{ label: '第七年', prop: 'sevenYear', append: '万元' },
|
||||
{ label: '第八年', prop: 'eightYear', append: '万元' }
|
||||
]
|
||||
}
|
||||
},
|
||||
// 展示和收起
|
||||
showBoxInf(e: any) {
|
||||
let data: any = { ...this.data };
|
||||
let { fieldname, type, index } = e.currentTarget.dataset;
|
||||
if (type) {
|
||||
data.showBox.showBoxChild[fieldname][index] =
|
||||
!data.showBox.showBoxChild[fieldname][index];
|
||||
} else data.showBox[fieldname] = !data.showBox[fieldname];
|
||||
this.setData(data);
|
||||
},
|
||||
// 删除
|
||||
delete() {
|
||||
Dialog.confirm({
|
||||
title: '',
|
||||
message: '是否确认删除当前项?'
|
||||
})
|
||||
.then(() => {
|
||||
deleteAction('api/finance/calculate/delete', {
|
||||
id: this.data.dataInfo.id
|
||||
})
|
||||
.then((res: any) => {
|
||||
if (res.success) {
|
||||
wx.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
});
|
||||
setTimeout(() => {
|
||||
wx.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
}, 1000);
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res.message,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((err: any) => {
|
||||
console.log(err);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
// 上一步
|
||||
goback() {
|
||||
wx.navigateBack();
|
||||
},
|
||||
// 提交
|
||||
submit() {
|
||||
if (this.data.issubmit) return;
|
||||
this.setData({
|
||||
issubmit: true
|
||||
});
|
||||
wx.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
postAction('api/finance/calculate/add', this.data.dataInfo)
|
||||
.then((res: any) => {
|
||||
if (res.success) {
|
||||
wx.showToast({
|
||||
title: '提交成功',
|
||||
icon: 'none'
|
||||
});
|
||||
setTimeout(() => {
|
||||
wx.navigateBack({
|
||||
delta: 2
|
||||
});
|
||||
}, 1000);
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res.message,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
this.setData({
|
||||
issubmit: false
|
||||
});
|
||||
wx.hideLoading();
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
this.setData({
|
||||
issubmit: false
|
||||
});
|
||||
wx.hideLoading();
|
||||
});
|
||||
},
|
||||
// 获取数据
|
||||
getInf() {
|
||||
let { info, type } = wx.getStorageSync('costEstimationData');
|
||||
let list = {
|
||||
manageCostList: [],
|
||||
incomeAndTax: [],
|
||||
costAndProfitList: []
|
||||
} as any;
|
||||
let keys = Object.keys(list);
|
||||
keys.forEach((item: any) => {
|
||||
for (let index = 0; index < info.calculateObject[item].length; index++) {
|
||||
list[item].push(true);
|
||||
}
|
||||
});
|
||||
this.setData({
|
||||
dataInfo: info,
|
||||
['showBox.showBoxChild']: list,
|
||||
type: type
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
this.getInf();
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {}
|
||||
});
|
||||
@@ -0,0 +1,407 @@
|
||||
<wxs module="test" src="./costEstimationDetail.wxs"></wxs>
|
||||
<view>
|
||||
<view class="container">
|
||||
<view class="box {{showBox.base ? '' : 'pdb_20'}}" wx:if="{{type == 'check'}}">
|
||||
<view class="row flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="bg"></view>
|
||||
<view>基本信息</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="btn" wx:if="{{showBox.base}}" data-fieldName="base" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_up.png" mode="" />
|
||||
<view class="val">收起</view>
|
||||
</view>
|
||||
<view class="btn" wx:if="{{!showBox.base}}" data-fieldName="base" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_down.png" mode="" />
|
||||
<view class="val">展开</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{showBox.base}}">
|
||||
<view class="info-item" wx:for="{{showList.baseInfo}}" wx:for-item="item" wx:for-index="index">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="label">{{item.label}}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view>{{(dataInfo[item.prop] !== '' && dataInfo[item.prop] !== null) ? dataInfo[item.prop] : '/'}}
|
||||
{{ (dataInfo[item.prop] !== '' && dataInfo[item.prop] !== null) && item.append ? item.append : ''}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="box pdb_20" wx:if="{{type == 'check'}}">
|
||||
<view class="row flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="bg"></view>
|
||||
<view>车型信息</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="btn" wx:if="{{showBox.vehicle}}" data-fieldName="vehicle" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_up.png" mode="" />
|
||||
<view class="val">收起</view>
|
||||
</view>
|
||||
<view class="btn" wx:if="{{!showBox.vehicle}}" data-fieldName="vehicle" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_down.png" mode="" />
|
||||
<view class="val">展开</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{showBox.vehicle}}">
|
||||
<view class="vehicleCostList" wx:for="{{dataInfo.vehicleCostList}}" wx:for-item="item" wx:for-index="index">
|
||||
<view>
|
||||
<view class="info-item border-bottom" wx:for="{{showList.vehicleInfo}}" wx:for-item="el" wx:for-index="index">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="label">{{el.label}}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view>{{(item[el.prop] !== '' && item[el.prop] !== null) ? item[el.prop] : '/'}}
|
||||
{{ (item[el.prop] !== '' && item[el.prop] !== '') && el.append ? el.append : ''}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="margin-top: 8px;">
|
||||
<view class="title">租赁费用(万元/月/台)</view>
|
||||
<view class="info-item" style="border-bottom: 2rpx solid #E6EAF2;" wx:for="{{showList.yearList}}" wx:for-item="el" wx:for-index="index">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="label">{{el.label}}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view>{{(item[el.prop] !== '' && item[el.prop] !== null) ? item[el.prop] : '/'}}{{ (item[el.prop] !== '' && item[el.prop] !== null) && el.append ? el.append : ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{type == 'add'}}" class="top">
|
||||
<view class="top-bg">
|
||||
<image class="first" src="../../../images/bg_page_blue.png" mode="" />
|
||||
<image class="second" src="../../../images/top-bg.png" mode="" />
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="content-top">
|
||||
<view class="label">净利润(万元)</view>
|
||||
<view class="val">{{dataInfo.calculateObject.result[0].netProfit}}</view>
|
||||
</view>
|
||||
<view class="content-middle">
|
||||
<view class="item">
|
||||
<view class="val-container">
|
||||
<view class="val {{test.numberLength(dataInfo.calculateObject.result[0].carCostRecovery)}}">{{dataInfo.calculateObject.result[0].carCostRecovery}}</view>
|
||||
</view>
|
||||
<view class="label">购车成本回收期(年)</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="val-container">
|
||||
<view class="val {{test.numberLength(dataInfo.calculateObject.result[0].financingCost)}}">{{dataInfo.calculateObject.result[0].financingCost}}</view>
|
||||
</view>
|
||||
<view class="label">融资成本(万元)</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="val-container">
|
||||
<view class="val {{test.numberLength(dataInfo.calculateObject.result[0].internalRate)}}">{{dataInfo.calculateObject.result[0].internalRate !== null ? dataInfo.calculateObject.result[0].internalRate : '/'}}</view>
|
||||
</view>
|
||||
<view class="label">内部收益率(%)</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="val-container">
|
||||
<view class="val {{test.numberLength(dataInfo.calculateObject.result[0].vatAndAdditional)}}">{{dataInfo.calculateObject.result[0].vatAndAdditional}}</view>
|
||||
</view>
|
||||
<view class="label">实缴增值税及附加(万元)</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="val-container">
|
||||
<view class="val {{test.numberLength(dataInfo.calculateObject.result[0].incomeTax)}}">{{dataInfo.calculateObject.result[0].incomeTax}}</view>
|
||||
</view>
|
||||
<view class="label">所得税(万元)</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="val-container">
|
||||
<view class="val {{test.numberLength(dataInfo.calculateObject.result[0].salvageValue)}}">{{dataInfo.calculateObject.result[0].salvageValue}}</view>
|
||||
</view>
|
||||
<view class="label">残值(万元)</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="box {{showBox.result ? '' : 'pdb_20'}}" wx:if="{{type == 'check'}}">
|
||||
<view class="row flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="bg"></view>
|
||||
<view>测算结果</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="btn" wx:if="{{showBox.result}}" data-fieldName="result" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_up.png" mode="" />
|
||||
<view class="val">收起</view>
|
||||
</view>
|
||||
<view class="btn" wx:if="{{!showBox.result}}" data-fieldName="result" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_down.png" mode="" />
|
||||
<view class="val">展开</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{showBox.result}}">
|
||||
<view class="info-item" wx:for="{{showList.result}}" wx:for-item="item" wx:for-index="index">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="label">{{item.label}}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view>{{(dataInfo.calculateObject.result[0][item.prop] !== '' && dataInfo.calculateObject.result[0][item.prop] !== null) ? dataInfo.calculateObject.result[0][item.prop] : '/'}}
|
||||
{{ (dataInfo.calculateObject.result[0][item.prop] !== '' || dataInfo.calculateObject.result[0][item.prop] !== null) && item.append ? item.append : ''}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="box {{showBox.rentalIncome ? '' : 'pdb_20'}}">
|
||||
<view class="row flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="bg"></view>
|
||||
<view>租金收入</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="btn" wx:if="{{showBox.rentalIncome}}" data-fieldName="rentalIncome" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_up.png" mode="" />
|
||||
<view class="val">收起</view>
|
||||
</view>
|
||||
<view class="btn" wx:if="{{!showBox.rentalIncome}}" data-fieldName="rentalIncome" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_down.png" mode="" />
|
||||
<view class="val">展开</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{showBox.rentalIncome}}">
|
||||
<view wx:for="{{dataInfo.calculateObject.rentalIncome}}" wx:for-item="el" wx:for-index="idx">
|
||||
<view class="info-item border-bottom" wx:for="{{showList.yearList}}" wx:for-item="item" wx:for-index="index">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="label">{{item.label}}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view>{{(el[item.prop] !== '' && el[item.prop] !== null) ? el[item.prop] : '/'}}
|
||||
{{ (el[item.prop] !== '' || el[item.prop] !== null) && item.append ? item.append : ''}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="label" style="font-weight: bold;">合计</view>
|
||||
</view>
|
||||
<view class="right flex-end ">
|
||||
<view class="total">{{(el.total !== '' && el.total !== null) ? el.total : '/'}}</view>
|
||||
<view>万元</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="box pdb_20">
|
||||
<view class="row flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="bg"></view>
|
||||
<view>管理、运维、保险费用</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="btn" wx:if="{{showBox.manageCostList}}" data-fieldName="manageCostList" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_up.png" mode="" />
|
||||
<view class="val">收起</view>
|
||||
</view>
|
||||
<view class="btn" wx:if="{{!showBox.manageCostList}}" data-fieldName="manageCostList" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_down.png" mode="" />
|
||||
<view class="val">展开</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{showBox.manageCostList}}">
|
||||
<view class="vehicleCostList" wx:for="{{dataInfo.calculateObject.manageCostList}}" wx:for-item="item" wx:for-index="index">
|
||||
<view>
|
||||
<view class="row flex-between title2">
|
||||
<view class="left flex-align">
|
||||
<view>{{item.itemName}}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="btn" wx:if="{{showBox.showBoxChild.manageCostList[index]}}" data-type="showBoxChild" data-fieldName="manageCostList" data-index="{{index}}" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_up.png" mode="" />
|
||||
<view class="val">收起</view>
|
||||
</view>
|
||||
<view class="btn" wx:if="{{!showBox.showBoxChild.manageCostList[index]}}" data-type="showBoxChild" data-fieldName="manageCostList" data-index="{{index}}" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_down.png" mode="" />
|
||||
<view class="val">展开</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{showBox.showBoxChild.manageCostList[index]}}">
|
||||
<view class="info-item" style="border-bottom: 2rpx solid #E6EAF2;" wx:for="{{showList.yearList}}" wx:for-item="el" wx:for-index="index">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="label">{{el.label}}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view>{{(item[el.prop] !== '' && item[el.prop] !== null) ? item[el.prop] : '/'}}{{ (item[el.prop] !== '' && item[el.prop] !== null) && el.append ? el.append : ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="total-item">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="label" style="font-weight: bold;">合计</view>
|
||||
</view>
|
||||
<view class="right flex-end ">
|
||||
<view class="total">{{(item.total !== '' && item.total !== null) ? item.total : '/'}}</view>
|
||||
<view>万元</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="box pdb_20">
|
||||
<view class="row flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="bg"></view>
|
||||
<view>收入与税金表</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="btn" wx:if="{{showBox.incomeAndTax}}" data-fieldName="incomeAndTax" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_up.png" mode="" />
|
||||
<view class="val">收起</view>
|
||||
</view>
|
||||
<view class="btn" wx:if="{{!showBox.incomeAndTax}}" data-fieldName="incomeAndTax" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_down.png" mode="" />
|
||||
<view class="val">展开</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{showBox.incomeAndTax}}">
|
||||
<view class="vehicleCostList" wx:for="{{dataInfo.calculateObject.incomeAndTax}}" wx:for-item="item" wx:for-index="index">
|
||||
<view>
|
||||
<view class="row flex-between title2">
|
||||
<view class="left flex-align">
|
||||
<view>{{item.itemName}}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="btn" wx:if="{{showBox.showBoxChild.incomeAndTax[index]}}" data-type="showBoxChild" data-fieldName="incomeAndTax" data-index="{{index}}" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_up.png" mode="" />
|
||||
<view class="val">收起</view>
|
||||
</view>
|
||||
<view class="btn" wx:if="{{!showBox.showBoxChild.incomeAndTax[index]}}" data-type="showBoxChild" data-fieldName="incomeAndTax" data-index="{{index}}" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_down.png" mode="" />
|
||||
<view class="val">展开</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{showBox.showBoxChild.incomeAndTax[index]}}">
|
||||
<view class="info-item" style="border-bottom: 2rpx solid #E6EAF2;" wx:for="{{showList.yearList}}" wx:for-item="el" wx:for-index="index">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="label">{{el.label}}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view>{{(item[el.prop] !== '' && item[el.prop] !== null) ? item[el.prop] : '/'}}{{ (item[el.prop] !== '' && item[el.prop] !== null) && el.append ? el.append : ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="total-item">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="label" style="font-weight: bold;">合计</view>
|
||||
</view>
|
||||
<view class="right flex-end ">
|
||||
<view class="total">{{(item.total !== '' && item.total !== null) ? item.total : '/'}}</view>
|
||||
<view>万元</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="box pdb_20">
|
||||
<view class="row flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="bg"></view>
|
||||
<view>成本与利润表</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="btn" wx:if="{{showBox.costAndProfitList}}" data-fieldName="costAndProfitList" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_up.png" mode="" />
|
||||
<view class="val">收起</view>
|
||||
</view>
|
||||
<view class="btn" wx:if="{{!showBox.costAndProfitList}}" data-fieldName="costAndProfitList" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_down.png" mode="" />
|
||||
<view class="val">展开</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{showBox.costAndProfitList}}">
|
||||
<view class="vehicleCostList" wx:for="{{dataInfo.calculateObject.costAndProfitList}}" wx:for-item="item" wx:for-index="index">
|
||||
<view>
|
||||
<view class="row flex-between title2">
|
||||
<view class="left flex-align">
|
||||
<view>{{item.itemName}}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="btn" wx:if="{{showBox.showBoxChild.costAndProfitList[index]}}" data-type="showBoxChild" data-fieldName="costAndProfitList" data-index="{{index}}" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_up.png" mode="" />
|
||||
<view class="val">收起</view>
|
||||
</view>
|
||||
<view class="btn" wx:if="{{!showBox.showBoxChild.costAndProfitList[index]}}" data-type="showBoxChild" data-fieldName="costAndProfitList" data-index="{{index}}" catch:tap="showBoxInf">
|
||||
<image src="../../../images/icon_down.png" mode="" />
|
||||
<view class="val">展开</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{showBox.showBoxChild.costAndProfitList[index]}}">
|
||||
<view class="info-item" style="border-bottom: 2rpx solid #E6EAF2;" wx:for="{{showList.yearList}}" wx:for-item="el" wx:for-index="index">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="label">{{el.label}}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view>{{(item[el.prop] !== '' && item[el.prop] !== null) ? item[el.prop] : '/'}}{{ (item[el.prop] !== '' && item[el.prop] !== null) && el.append ? el.append : ''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="total-item">
|
||||
<view class="flex-between">
|
||||
<view class="left flex-align">
|
||||
<view class="label" style="font-weight: bold;">合计</view>
|
||||
</view>
|
||||
<view class="right flex-end ">
|
||||
<view class="total">{{(item.total !== '' && item.total !== null) ? item.total : '/'}}</view>
|
||||
<view>万元</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="operateBtn">
|
||||
<view catchtap="delete" class="cancelBtn" wx:if="{{type == 'check'}}">删除</view>
|
||||
<view class="button-list" wx:if="{{type == 'add'}}">
|
||||
<view class="cancelBtn" style="width: 49%;" catchtap="goback">上一步</view>
|
||||
<view class="submitBtn" style="width: 49%;" catchtap="submit">提交</view>
|
||||
</view>
|
||||
</view>
|
||||
<van-dialog id="van-dialog" />
|
||||
</view>
|
||||
@@ -0,0 +1,22 @@
|
||||
var obj = {
|
||||
numberLength: function (value) {
|
||||
if(value) {
|
||||
var num = (value + '').length
|
||||
if(num > 9 && num <= 12) {
|
||||
return 'over9'
|
||||
}
|
||||
if(num > 12 && num <= 14) {
|
||||
return 'over12'
|
||||
}
|
||||
if(num > 14) {
|
||||
return 'over14'
|
||||
}
|
||||
else return ''
|
||||
}
|
||||
return ''
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
numberLength: obj.numberLength
|
||||
}
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user