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>
|
||||
Reference in New Issue
Block a user