init
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"g-upload": "/components/uploadPic/uploadPic",
|
||||
"van-picker": "@vant/weapp/picker/index",
|
||||
"van-popup": "@vant/weapp/popup/index",
|
||||
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
|
||||
"van-search": "@vant/weapp/search/index"
|
||||
},
|
||||
"navigationBarTitleText": "保养录入"
|
||||
}
|
||||
@@ -0,0 +1,431 @@
|
||||
.container {
|
||||
height: 100vh;
|
||||
padding-top: 2px;
|
||||
box-sizing: border-box;
|
||||
background: #EFF1F4;
|
||||
position: relative;
|
||||
|
||||
.row {
|
||||
margin-bottom: 8px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.label {
|
||||
color: #858CA0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.val {
|
||||
color: #2E3A4F;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.repair {
|
||||
width: 100%;
|
||||
|
||||
.row {
|
||||
width: 100%;
|
||||
height: 36px;
|
||||
padding: 8px 10px;
|
||||
margin-bottom: 8px;
|
||||
box-sizing: border-box;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #E6EAF2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.icon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin-right: 8px;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
input {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-container {
|
||||
height: calc(100vh - 72px);
|
||||
max-height: calc(100vh - 72px);
|
||||
overflow-y: auto;
|
||||
|
||||
// background-color: #bfa;
|
||||
.item {
|
||||
padding: 12px 10px;
|
||||
background: #fff;
|
||||
position: relative;
|
||||
|
||||
&:not(:last-child) {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.require {
|
||||
&::after {
|
||||
content: '*';
|
||||
width: 6px;
|
||||
height: 100%;
|
||||
color: red;
|
||||
margin-left: 8px;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
color: #333F53;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
width: 4px;
|
||||
height: 22px;
|
||||
background: linear-gradient(180deg, #4E87FC 0%, #38B1FE 100%);
|
||||
border-radius: 2px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.car-info {
|
||||
width: calc(100% - 16px);
|
||||
background: #ECEFF5;
|
||||
border-radius: 4px;
|
||||
padding: 8px 8px 4px;
|
||||
margin-top: 8px;
|
||||
|
||||
.paroject-select {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.select-row {
|
||||
width: calc(50% - 4px);
|
||||
height: 36px;
|
||||
padding: 8px 10px;
|
||||
margin-bottom: 8px;
|
||||
box-sizing: border-box;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #E6EAF2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
|
||||
&::before {
|
||||
content: '*';
|
||||
width: 6px;
|
||||
height: 100%;
|
||||
color: red;
|
||||
margin-right: 8px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
picker {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
|
||||
.picker {
|
||||
width: 100%;
|
||||
height: 38px;
|
||||
box-sizing: border-box;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.classify-select {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.classify-button {
|
||||
width: 30%;
|
||||
height: 36px;
|
||||
margin-right: 8px;
|
||||
margin-top: 8px;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.classify-button-select {
|
||||
background: #E9F2FF;
|
||||
border: 1px solid #24A2FE;
|
||||
}
|
||||
|
||||
.classify-button-notSelect {
|
||||
background: #FFFFFF;
|
||||
border: 1px solid #E6EAF2;
|
||||
}
|
||||
}
|
||||
|
||||
.weui-input {
|
||||
border-radius: 8px;
|
||||
border: 1px solid #E6EAF2;
|
||||
width: calc(100% - 16px);
|
||||
height: 83px;
|
||||
padding: 8px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.picker view:first-child {
|
||||
word-break: break-all;
|
||||
overflow: hidden;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
}
|
||||
|
||||
.select-row {
|
||||
&::before {
|
||||
content: '*';
|
||||
width: 6px;
|
||||
height: 100%;
|
||||
color: red;
|
||||
margin-right: 8px;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bottom {
|
||||
width: 100%;
|
||||
padding: 10px 8px 14px;
|
||||
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;
|
||||
|
||||
.row {
|
||||
width: 100%;
|
||||
height: 36px;
|
||||
padding: 8px 10px;
|
||||
margin-bottom: 8px;
|
||||
box-sizing: border-box;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #E6EAF2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.icon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin-right: 8px;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
input {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.select-row {
|
||||
|
||||
// width: calc((100% - 6px) / 2);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn-box {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.btn {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
background-color: #FFFFFF;
|
||||
line-height: 40px;
|
||||
border-radius: 8px;
|
||||
color: #2E3A4F;
|
||||
text-align: center;
|
||||
border: 1px solid #D6D6D6;
|
||||
}
|
||||
|
||||
.apply {
|
||||
background: linear-gradient(90deg, #3B7CFC 0%, #548BFC 100%);
|
||||
color: #2E3A4F;
|
||||
color: #fff;
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.input-content {
|
||||
height: 40px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.input-label {
|
||||
// width: 17%;
|
||||
color: #2F3B50;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.input {
|
||||
margin-right: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.icon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin-right: 8px;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.searchBox {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
top: 80rpx;
|
||||
z-index: 63;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 11rpx solid transparent;
|
||||
border-right: 11rpx solid transparent;
|
||||
border-top: 13rpx solid #636B83;
|
||||
margin-left: 18rpx;
|
||||
}
|
||||
|
||||
.delete {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.requireItem {
|
||||
&::before {
|
||||
content: '*';
|
||||
width: 6px;
|
||||
height: 100%;
|
||||
color: red;
|
||||
margin-right: 4px;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
.picker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.upload {
|
||||
padding: 12px 0;
|
||||
}
|
||||
|
||||
.echoFile {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.photo-list {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
margin-left: 8px;
|
||||
border-radius: 4px;
|
||||
position: relative;
|
||||
margin-top: 8px;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.del {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
position: absolute;
|
||||
top: -10px;
|
||||
right: -10px;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,545 @@
|
||||
import { getAction } from '../../../../api/base';
|
||||
const dayjs = require('dayjs');
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
upKeepObject: null as any, // 保养单数据
|
||||
selectProject: null as any, // 项目所选
|
||||
selectCar: null as any, // 车辆所选
|
||||
selectOption: null as any, // 选择的维修厂
|
||||
projectOptions: [], // 项目数据
|
||||
options: [] as any, // 维修厂数据
|
||||
carOptions: [] as any, // 车辆数据
|
||||
filterCarOptions: [] as any, // 过滤后的车辆数据
|
||||
filterProjectOptions: [] as any, // 过滤后的项目数据
|
||||
filterOptions: [] as any, // 维修厂过滤后数据
|
||||
lastMileage: '', // 上次保养里程
|
||||
predictMileage: '', // 预计保养里程
|
||||
content: '', // 保养内容
|
||||
uploadUrl: 'api/vehicles/repair/fileUpload', // 上传图片地址
|
||||
attachmentList: [] as any, //附件
|
||||
lastTimeShow: false, // 展示上次保养时间选择框
|
||||
predictTimeShow: false, // 展示预计保养时间选择框
|
||||
startTimeShow: false, // 展示实际保养开始时间选择框
|
||||
endTimeShow: false, // 展示实际保养结束时间选择框
|
||||
repairShopShow: false, // 展示维修厂选择框
|
||||
lastTime: '', // 上传保养时间
|
||||
predictTime: '', // 预计保养时间
|
||||
startTime: '', // 实际保养开始时间
|
||||
endTime: '', // 实际保养结束时间
|
||||
lastTimestamp: new Date().getTime(),
|
||||
predictTimestamp: new Date().getTime(),
|
||||
startTimestamp: new Date().getTime(),
|
||||
endTimestamp: new Date().getTime(),
|
||||
plateNumberShow: false, //展示车牌号选择框
|
||||
projectShow: false, //展示项目选择框
|
||||
plateNumberSearchVal: '', // 查找车牌号输入值
|
||||
projectSearchVal: '', // 查找项目输入值
|
||||
repairShopSearchVal: '', // 维修厂查询过滤输入值
|
||||
echoFile: null as any, // 回显附件
|
||||
contactPhone: '', // 维修厂联系电话
|
||||
contact: '' // 联系人
|
||||
},
|
||||
// 输入保养里程
|
||||
getMileage(e: any) {
|
||||
let { fieldname } = e.currentTarget.dataset;
|
||||
let res = null as any;
|
||||
e.detail.value = Number(Number(e.detail.value).toFixed(2));
|
||||
if (e.detail.value > 99999999) {
|
||||
res = 99999999;
|
||||
wx.showToast({
|
||||
title: '保养里程不能大于99999999',
|
||||
icon: 'none'
|
||||
});
|
||||
} else if (e.detail.value < 0) {
|
||||
res = 0;
|
||||
wx.showToast({
|
||||
title: '保养里程不能小于0',
|
||||
icon: 'none'
|
||||
});
|
||||
} else res = e.detail.value;
|
||||
if (fieldname == 'lastMileage') {
|
||||
this.setData({
|
||||
lastMileage: res
|
||||
});
|
||||
} else if (fieldname == 'predictMileage') {
|
||||
this.setData({
|
||||
predictMileage: res
|
||||
});
|
||||
}
|
||||
},
|
||||
// 输入保养内容
|
||||
textareaInput(e: any) {
|
||||
this.setData({
|
||||
content: e.detail.value
|
||||
});
|
||||
},
|
||||
// 维修厂联系人
|
||||
getContactPerson(e: any) {
|
||||
this.setData({
|
||||
contact: e.detail.value
|
||||
});
|
||||
},
|
||||
// 维修厂联系电话
|
||||
getTel(e: any) {
|
||||
this.setData({
|
||||
contactPhone: e.detail.value
|
||||
});
|
||||
},
|
||||
// 上传图片回显
|
||||
returnPic(e: any) {
|
||||
let list = [] as any;
|
||||
e.detail.photoList.forEach((item: any) => {
|
||||
list.push(item);
|
||||
});
|
||||
this.setData({
|
||||
attachmentList: list
|
||||
});
|
||||
},
|
||||
// 提交申请
|
||||
submit() {
|
||||
// 校验必填
|
||||
let checkProject, checkCar, checkTextarea;
|
||||
this.data.selectProject?.projectId
|
||||
? (checkProject = true)
|
||||
: (checkProject = false);
|
||||
this.data.selectCar?.id ? (checkCar = true) : (checkCar = false);
|
||||
this.data.content ? (checkTextarea = true) : (checkTextarea = false);
|
||||
|
||||
if (!checkProject) {
|
||||
wx.showToast({
|
||||
title: '请选择所属项目',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!checkCar) {
|
||||
wx.showToast({
|
||||
title: '请选择所属车辆',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.data.lastTime) {
|
||||
wx.showToast({
|
||||
title: '请选择上次保养时间',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.data.lastMileage === '') {
|
||||
wx.showToast({
|
||||
title: '请输入上次保养里程',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.data.predictTime) {
|
||||
wx.showToast({
|
||||
title: '请选择预计保养时间',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.data.predictMileage === '') {
|
||||
wx.showToast({
|
||||
title: '请输入预计保养里程',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.data.startTime) {
|
||||
wx.showToast({
|
||||
title: '请选择保养开始时间',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.data.endTime) {
|
||||
wx.showToast({
|
||||
title: '请选择保养结束时间',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!checkTextarea) {
|
||||
wx.showToast({
|
||||
title: '请填写保养内容',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!this.data.selectOption) {
|
||||
wx.showToast({
|
||||
title: '请选择维修厂',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
let checkPhone2 = this.checkPhoneTwo();
|
||||
if (!checkPhone2) return;
|
||||
let upkeepBill = {
|
||||
id: null, //id
|
||||
projectId: this.data.selectProject?.projectId, //所属项目
|
||||
plateNumber: this.data.selectCar?.plateNumber, //车牌号
|
||||
deliveryTime: this.data.selectCar?.deliveryTime, //交车时间
|
||||
frameNumber: this.data.selectCar?.frameNumber, //车架号
|
||||
vehicleBrand: this.data.selectCar?.vehicleBrand, //车辆品牌
|
||||
vehicleModel: this.data.selectCar?.vehicleModel, //车辆型号
|
||||
vehicleType: this.data.selectCar?.vehicleType, //车辆种类
|
||||
vinCode: this.data.selectCar?.vinCode, //VIN码
|
||||
engineNumber: this.data.selectCar?.engineNumber, //发动机码
|
||||
lastMileage: this.data.lastMileage, //上次保养里程
|
||||
lastTime: this.data.lastTime, //上次保养时间
|
||||
predictMileage: this.data.predictMileage, //上次保养里程
|
||||
predictTime: this.data.predictTime, //上次保养时间
|
||||
startTime: this.data.startTime, //上次保养时间
|
||||
endTime: this.data.endTime, //上次保养时间
|
||||
content: this.data.content, //保养内容
|
||||
attachmentList: this.data.attachmentList // 附件
|
||||
};
|
||||
let upkeepAssign = {
|
||||
repairShop: this.data.selectOption.repairShop, //维修厂id
|
||||
contact: this.data.contact, //联系人
|
||||
contactPhone: this.data.contactPhone //联系电话
|
||||
};
|
||||
let params = {
|
||||
upkeepBill,
|
||||
upkeepAssign
|
||||
};
|
||||
wx.setStorageSync('paramsInfo', params);
|
||||
wx.navigateTo({
|
||||
url: '../dataEntryTwo/dataEntryTwo',
|
||||
fail: e => {
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取项目数据
|
||||
getProjects() {
|
||||
getAction('api/vehicles/repair/queryProjects')
|
||||
.then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
let data = [] as any;
|
||||
res.result.forEach((el: any) => {
|
||||
el.value = el.projectId;
|
||||
el.text = el.projectName;
|
||||
});
|
||||
data = res.result;
|
||||
this.setData({
|
||||
projectOptions: data,
|
||||
filterProjectOptions: data
|
||||
});
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res.message,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((err: any) => {
|
||||
wx.showToast({
|
||||
title: err.message,
|
||||
icon: 'none'
|
||||
});
|
||||
});
|
||||
},
|
||||
// 获取维修厂信息
|
||||
getRepairShop() {
|
||||
getAction('api/vehicles/repair/getRepairShop')
|
||||
.then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
let data = [] as any;
|
||||
res.result.forEach((el: any) => {
|
||||
el.value = el.repairShop;
|
||||
el.text = el.repairShop_dictText;
|
||||
});
|
||||
data = res.result;
|
||||
this.setData({
|
||||
options: data,
|
||||
filterOptions: data
|
||||
});
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res.message,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((err: any) => {
|
||||
wx.showToast({
|
||||
title: err.message,
|
||||
icon: 'none'
|
||||
});
|
||||
});
|
||||
},
|
||||
// 展示选择框
|
||||
pickerChange(event: any) {
|
||||
//下拉框切换是否展示
|
||||
let fieldName: any = event.currentTarget.dataset.fieldname;
|
||||
let data: any = { ...this.data };
|
||||
data[fieldName] = true;
|
||||
this.setData(data);
|
||||
},
|
||||
// 隐藏展示框
|
||||
hidePicker() {
|
||||
this.setData({
|
||||
lastTimeShow: false,
|
||||
predictTimeShow: false,
|
||||
startTimeShow: false,
|
||||
endTimeShow: false,
|
||||
plateNumberShow: false,
|
||||
projectShow: false,
|
||||
repairShopShow: false
|
||||
});
|
||||
},
|
||||
// 选择器点击确认
|
||||
pickerConfirm(event: any) {
|
||||
let { fieldname } = event.currentTarget.dataset;
|
||||
let detail = event.detail;
|
||||
// 选择保养时间
|
||||
if (fieldname == 'lastTime') {
|
||||
this.setData({
|
||||
lastTime: dayjs(detail).format('YYYY-MM-DD'),
|
||||
lastTimestamp: detail
|
||||
});
|
||||
} else if (fieldname == 'predictTime') {
|
||||
this.setData({
|
||||
predictTime: dayjs(detail).format('YYYY-MM-DD'),
|
||||
predictTimestamp: detail
|
||||
});
|
||||
} else if (fieldname == 'startTime') {
|
||||
this.setData({
|
||||
startTime: dayjs(detail).format('YYYY-MM-DD HH:mm:ss'),
|
||||
startTimestamp: detail
|
||||
});
|
||||
} else if (fieldname == 'endTime') {
|
||||
this.setData({
|
||||
endTime: dayjs(detail).format('YYYY-MM-DD HH:mm:ss'),
|
||||
endTimestamp: detail
|
||||
});
|
||||
}
|
||||
// 选择车牌号
|
||||
else if (fieldname == 'plateNumber') {
|
||||
this.setData({
|
||||
selectCar: event.detail.value
|
||||
});
|
||||
}
|
||||
// 选择项目
|
||||
else if (fieldname == 'project') {
|
||||
this.setData({
|
||||
selectProject: event.detail.value
|
||||
});
|
||||
if (event.detail.value.projectId) {
|
||||
this.getCarFn(event.detail.value.projectId);
|
||||
}
|
||||
}
|
||||
// 选择维修厂
|
||||
else if (fieldname == 'repairShop') {
|
||||
this.setData({
|
||||
selectOption: detail.value,
|
||||
contact: detail.value.contact,
|
||||
contactPhone: detail.value.contactPhone
|
||||
});
|
||||
}
|
||||
this.hidePicker();
|
||||
},
|
||||
// 获取车辆数据
|
||||
getCarFn(projectId: any) {
|
||||
getAction(
|
||||
`api/vehicles/repair/queryVehicleInfoByProjectId?projectId=${projectId}`
|
||||
)
|
||||
.then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
// 清空当前所选的车辆数据
|
||||
this.setData({
|
||||
selectCar: null
|
||||
});
|
||||
let data = [] as any;
|
||||
res.result.forEach((el: any) => {
|
||||
el.value = el.plateNumber;
|
||||
el.text = el.plateNumber;
|
||||
});
|
||||
data = res.result;
|
||||
this.setData({
|
||||
carOptions: data,
|
||||
filterCarOptions: data
|
||||
});
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res.message,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((err: any) => {
|
||||
wx.showToast({
|
||||
title: err.message,
|
||||
icon: 'none'
|
||||
});
|
||||
});
|
||||
},
|
||||
// 清空数据
|
||||
resetData(event: any) {
|
||||
let { fieldname } = event.currentTarget.dataset;
|
||||
if (fieldname == 'contact') {
|
||||
this.setData({
|
||||
contact: ''
|
||||
});
|
||||
} else if (fieldname == 'contactPhone') {
|
||||
this.setData({
|
||||
contactPhone: ''
|
||||
});
|
||||
}
|
||||
},
|
||||
// 过滤车牌号
|
||||
filterPlateNumber(event: any) {
|
||||
let list = [] as any;
|
||||
this.data.carOptions.forEach((item: any) => {
|
||||
if (
|
||||
item.plateNumber.toLowerCase().indexOf(event.detail.toLowerCase()) >= 0
|
||||
) {
|
||||
list.push(item);
|
||||
}
|
||||
});
|
||||
this.setData({
|
||||
filterCarOptions: list,
|
||||
plateNumberSearchVal: event.detail
|
||||
});
|
||||
},
|
||||
// 过滤项目
|
||||
filterProject(event: any) {
|
||||
let list = [] as any;
|
||||
this.data.projectOptions.forEach((item: any) => {
|
||||
if (
|
||||
item.projectName.toLowerCase().indexOf(event.detail.toLowerCase()) >= 0
|
||||
) {
|
||||
list.push(item);
|
||||
}
|
||||
});
|
||||
this.setData({
|
||||
filterProjectOptions: list,
|
||||
projectSearchVal: event.detail
|
||||
});
|
||||
},
|
||||
// 过滤维修厂
|
||||
filterRepairShop(event: any) {
|
||||
let list = [] as any;
|
||||
this.data.options.forEach((item: any) => {
|
||||
if (
|
||||
item.repairShop_dictText
|
||||
.toLowerCase()
|
||||
.indexOf(event.detail.toLowerCase()) >= 0
|
||||
) {
|
||||
list.push(item);
|
||||
}
|
||||
});
|
||||
this.setData({
|
||||
filterOptions: list,
|
||||
repairShopSearchVal: event.detail
|
||||
});
|
||||
},
|
||||
// 删除回显图片
|
||||
delImg(e: any) {
|
||||
let that = this;
|
||||
let { index } = e.currentTarget.dataset;
|
||||
let { echoFile } = this.data;
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '是否删除当前照片',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
echoFile.splice(index, 1);
|
||||
that.setData({
|
||||
echoFile: echoFile
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 图片预览
|
||||
showImage(event: any) {
|
||||
let { index, image } = event.currentTarget.dataset;
|
||||
let list = [] as any;
|
||||
if (image == 'echoFile') {
|
||||
this.data.echoFile.forEach((item: any) => {
|
||||
list.push(item.fileUrl);
|
||||
});
|
||||
}
|
||||
wx.previewImage({
|
||||
current: list[index | 0], // 当前显示图片的http链接 默认urls[0]
|
||||
urls: list // 需要预览的图片http链接列表
|
||||
});
|
||||
},
|
||||
// 手机号校验方法
|
||||
checkMobilephone(target: any) {
|
||||
const regex = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/;
|
||||
if (target == '') {
|
||||
return true;
|
||||
} else {
|
||||
if (!regex.test(target)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
},
|
||||
// 维修厂联系人电话
|
||||
checkPhoneTwo() {
|
||||
let res = this.checkMobilephone(this.data.contactPhone);
|
||||
if (!res) {
|
||||
wx.showToast({
|
||||
title: '维修厂联系人联系电话格式不正确',
|
||||
icon: 'none'
|
||||
});
|
||||
return false;
|
||||
} else return true;
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
// 不放onReady 是因为有可能切出去然后状态改了得跳转到别的页面
|
||||
// 默认保养人为当前用户
|
||||
// let userInfo = wx.getStorageSync('userInfo');
|
||||
this.getProjects();
|
||||
this.getRepairShop();
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {}
|
||||
});
|
||||
@@ -0,0 +1,184 @@
|
||||
<view class="container">
|
||||
<view class="item-container">
|
||||
<view class="item" style="padding-bottom: 0;">
|
||||
<view class="title">车辆信息</view>
|
||||
<view class="car-info">
|
||||
<view class="paroject-select">
|
||||
<view class="select-row" data-fieldName="projectShow" catch:tap="pickerChange">
|
||||
<view class="picker">
|
||||
<view style="color: #aaa;font-size: 14px;" wx:if="{{!selectProject}}">请选择所属项目</view>
|
||||
<view style="font-size: 14px;" wx:if="{{selectProject}}">{{selectProject.projectName}}</view>
|
||||
<view class="arrow"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="select-row" data-fieldName="plateNumberShow" catch:tap="pickerChange">
|
||||
<view class="picker">
|
||||
<view style="color: #aaa;font-size: 14px;" wx:if="{{carOptions.length == 0}}">请选择所属项目</view>
|
||||
<view style="color: #aaa;font-size: 14px;" wx:if="{{carOptions.length > 0 && !selectCar}}">请选择车牌号</view>
|
||||
<view style="font-size: 14px;" wx:if="{{carOptions.length > 0 && selectCar}}">{{selectCar.plateNumber}}</view>
|
||||
<view class="arrow"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<van-popup show="{{projectShow}}" position="bottom" bind:close="hidePicker">
|
||||
<view class="searchBox">
|
||||
<van-search value="{{ projectSearchVal }}" placeholder="请输入项目名称" bind:search="filterProject" />
|
||||
</view>
|
||||
<van-picker data-fieldname="project" show-toolbar columns="{{filterProjectOptions}}" bind:confirm="pickerConfirm" bind:cancel="hidePicker">
|
||||
</van-picker>
|
||||
</van-popup>
|
||||
<van-popup show="{{plateNumberShow}}" position="bottom" bind:close="hidePicker">
|
||||
<view class="searchBox">
|
||||
<van-search value="{{ plateNumberSearchVal }}" placeholder="请输入车牌号" bind:search="filterPlateNumber" />
|
||||
</view>
|
||||
<van-picker data-fieldname="plateNumber" show-toolbar columns="{{filterCarOptions}}" bind:confirm="pickerConfirm" bind:cancel="hidePicker">
|
||||
</van-picker>
|
||||
</van-popup>
|
||||
<view class="row">
|
||||
<view class="label">车架号</view>
|
||||
<view class="val">{{selectCar.frameNumber ? selectCar.frameNumber : '暂无'}}</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="label">交车时间</view>
|
||||
<view class="val">{{selectCar.deliveryTime ? selectCar.deliveryTime : '暂无'}}</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="label">车辆品牌</view>
|
||||
<view class="val">{{selectCar.vehicleBrand_dictText ? selectCar.vehicleBrand_dictText : '暂无'}}</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="label">车辆型号</view>
|
||||
<view class="val">{{selectCar.vehicleModel ? selectCar.vehicleModel : '暂无'}}</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="label">车辆种类</view>
|
||||
<view class="val">{{selectCar.vehicleType_dictText ? selectCar.vehicleType_dictText : '暂无'}}</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="label">VIN码</view>
|
||||
<view class="val">{{selectCar.vinCode ? selectCar.vinCode : '暂无'}}</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="label">发动机码</view>
|
||||
<view class="val">{{selectCar.engineNumber ? selectCar.engineNumber : '暂无'}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="input-content">
|
||||
<view class="input-label requireItem">上次保养时间</view>
|
||||
<view class="input" data-fieldName="lastTimeShow" catch:tap="pickerChange">
|
||||
<view style="color: #aaa;font-size: 14px;" wx:if="{{!lastTime}}">请选择</view>
|
||||
<view style="font-size: 14px;" wx:if="{{lastTime}}">{{lastTime}}</view>
|
||||
<view class="arrow"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="input-content" style="border-bottom: 1px solid #E6EAF2;">
|
||||
<view class="input-label requireItem">上次保养里程</view>
|
||||
<view class="input">
|
||||
<input type="text" placeholder="请输入" placeholder-style="color:#949CB5; font-size: 14px; font-weight: 400;text-align: right;" value="{{lastMileage}}" data-fieldname="lastMileage" bindblur="getMileage" style="font-size: 14px;text-align: right;" />
|
||||
<view style="font-size: 14px;color: #636B83;margin-left: 4px;">km</view>
|
||||
<image src="../../../../images/icon_delete.png" mode="" class="delete" data-fieldName="lastMileage" catch:tap="resetData" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="input-content">
|
||||
<view class="input-label requireItem">预计保养时间</view>
|
||||
<view class="input" data-fieldName="predictTimeShow" catch:tap="pickerChange">
|
||||
<view style="color: #aaa;font-size: 14px;" wx:if="{{!predictTime}}">请选择</view>
|
||||
<view style="font-size: 14px;" wx:if="{{predictTime}}">{{predictTime}}</view>
|
||||
<view class="arrow"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="input-content" style="border-bottom: 1px solid #E6EAF2;">
|
||||
<view class="input-label requireItem">预计保养里程</view>
|
||||
<view class="input">
|
||||
<input type="text" placeholder="请输入" placeholder-style="color:#949CB5; font-size: 14px; font-weight: 400;text-align: right;" value="{{predictMileage}}" data-fieldname="predictMileage" bindblur="getMileage" style="font-size: 14px;text-align: right;" />
|
||||
<view style="font-size: 14px;color: #636B83;margin-left: 4px;">km</view>
|
||||
<image src="../../../../images/icon_delete.png" mode="" class="delete" data-fieldName="predictMileage" catch:tap="resetData" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="input-content">
|
||||
<view class="input-label requireItem">保养开始时间</view>
|
||||
<view class="input" data-fieldName="startTimeShow" catch:tap="pickerChange">
|
||||
<view style="color: #aaa;font-size: 14px;" wx:if="{{!startTime}}">请选择</view>
|
||||
<view style="font-size: 14px;" wx:if="{{startTime}}">{{startTime}}</view>
|
||||
<view class="arrow"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="input-content">
|
||||
<view class="input-label requireItem">保养结束时间</view>
|
||||
<view class="input" data-fieldName="endTimeShow" catch:tap="pickerChange">
|
||||
<view style="color: #aaa;font-size: 14px;" wx:if="{{!endTime}}">请选择</view>
|
||||
<view style="font-size: 14px;" wx:if="{{endTime}}">{{endTime}}</view>
|
||||
<view class="arrow"></view>
|
||||
</view>
|
||||
</view>
|
||||
<van-popup show="{{lastTimeShow}}" position="bottom" bind:close="hidePicker">
|
||||
<van-datetime-picker data-fieldname="lastTime" type="date" value="{{ lastTimestamp }}" bind:cancel="hidePicker" bind:confirm="pickerConfirm" />
|
||||
</van-popup>
|
||||
<van-popup show="{{predictTimeShow}}" position="bottom" bind:close="hidePicker">
|
||||
<van-datetime-picker data-fieldname="predictTime" type="date" value="{{ predictTimestamp }}" bind:cancel="hidePicker" bind:confirm="pickerConfirm" />
|
||||
</van-popup>
|
||||
<van-popup show="{{startTimeShow}}" position="bottom" bind:close="hidePicker">
|
||||
<van-datetime-picker data-fieldname="startTime" type="datetime" value="{{ startTimestamp }}" bind:cancel="hidePicker" bind:confirm="pickerConfirm" />
|
||||
</van-popup>
|
||||
<van-popup show="{{endTimeShow}}" position="bottom" bind:close="hidePicker">
|
||||
<van-datetime-picker data-fieldname="endTime" type="datetime" value="{{ endTimestamp }}" bind:cancel="hidePicker" bind:confirm="pickerConfirm" />
|
||||
</van-popup>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="title require">保养内容</view>
|
||||
<textarea class="weui-input" maxlength="200" placeholder="最大输入长度为200" value="{{content}}" bindblur="textareaInput" />
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="title" style="margin-bottom: 8px;">附件(最大上传10张)</view>
|
||||
<view wx:if="{{echoFile}}" class="echoFile">
|
||||
<view class="photo-list" wx:for="{{echoFile}}" data-index="{{index}}" wx:key="index">
|
||||
<image src="{{item.fileUrl}}" mode="" data-index="{{index}}" data-image="echoFile" catch:tap="showImage" />
|
||||
<view class="del" catchtap="delImg" data-index="{{index}}">
|
||||
<image src="../../../../images/btn_del.png" mode="" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="upload" style="margin-left: 8px;">
|
||||
<g-upload id="g-upload" maxLength="{{10 - (echoFile ? echoFile.length : 0)}}" uploadUrl="{{uploadUrl}}" bind:returnPic="returnPic"></g-upload>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="title" style="margin-bottom: 8px;">维修厂信息</view>
|
||||
<view class="repair">
|
||||
<view class="row select-row" data-fieldName="repairShopShow" catch:tap="pickerChange">
|
||||
<view class="picker">
|
||||
<view style="color: #aaa;font-size: 14px;" wx:if="{{!selectOption}}">请选择维修厂</view>
|
||||
<view style="font-size: 14px;" wx:else>{{selectOption.repairShop_dictText}}</view>
|
||||
<view class="arrow"></view>
|
||||
</view>
|
||||
</view>
|
||||
<van-popup show="{{repairShopShow}}" position="bottom" bind:close="hidePicker">
|
||||
<view class="searchBox">
|
||||
<van-search value="{{ repairShopSearchVal }}" placeholder="请输入维修厂名" bind:search="filterRepairShop" />
|
||||
</view>
|
||||
<van-picker data-fieldname="repairShop" show-toolbar columns="{{filterOptions}}" bind:confirm="pickerConfirm" bind:cancel="hidePicker">
|
||||
</van-picker>
|
||||
</van-popup>
|
||||
<view class="row">
|
||||
<view class="icon">
|
||||
<image src="../../../../images/icon_contact.png" mode="" />
|
||||
</view>
|
||||
<input type="text" placeholder="请输入联系人" placeholder-style="color:#949CB5; font-size: 28rpx; font-weight: 400;" value="{{contact}}" bindinput="getContactPerson" />
|
||||
<image src="../../../../images/icon_delete.png" mode="" class="delete" data-fieldName="contact" catch:tap="resetData" />
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="icon">
|
||||
<image src="../../../../images/icon_phone.png" mode="" />
|
||||
</view>
|
||||
<input type="text" placeholder="请输入联系号码" placeholder-style="color:#949CB5; font-size: 28rpx; font-weight: 400;" value="{{contactPhone}}" bindinput="getTel" bindblur="checkPhoneTwo" />
|
||||
<image src="../../../../images/icon_delete.png" mode="" class="delete" data-fieldName="contactPhone" catch:tap="resetData" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom">
|
||||
<view class="btn-box">
|
||||
<view class="btn apply" catch:tap="submit">下一步</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
Reference in New Issue
Block a user