This commit is contained in:
2025-06-19 17:33:18 +08:00
commit f8f31dc4d9
437 changed files with 103080 additions and 0 deletions
@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "作废"
}
@@ -0,0 +1,203 @@
/* pages/vehicleMaintenance/maintainSend/maintainSend.wxss */
.container {
height: 100vh;
padding-top: 2px;
box-sizing: border-box;
background: #EFF1F4;
position: relative;
.top {
margin: 8px 8px 10px;
padding: 12px 10px;
margin-bottom: 8px;
background: #fff;
border-radius: 8px;
position: relative;
.row:first-child {
margin-bottom: 8px;
}
.row {
color: #2E3A4F;
display: flex;
justify-content: space-between;
align-items: center;
.number-plate {
display: flex;
.status {
padding: 0 6px;
margin-right: 4px;
border-radius: 2px;
color: #FFFFFF;
font-size: 14px;
}
.status1 {
background: linear-gradient(90deg, #0D92FF 0%, #38B1FE 100%);
}
.status2 {
background: linear-gradient(270deg, #4CDBAD 0%, #2FCBAB 100%);
}
.status3 {
background: linear-gradient(270deg, #A1A8BB 0%, #838EAA 100%);
}
.val {
font-size: 16px;
font-weight: bold;
}
}
.project-name,
.code {
font-size: 14px;
}
.time {
font-size: 14px;
color: #858CA0;
}
}
}
.row {
margin-bottom: 8px;
display: flex;
justify-content: space-between;
.label {
color: #858CA0;
font-size: 14px;
}
.val {
color: #2E3A4F;
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;
}
}
}
}
.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;
}
}
.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;
}
}
}
.weui-input {
border-radius: 8px;
border: 1px solid #E6EAF2;
width: calc(100% - 16px);
height: 83px;
padding: 8px;
margin-top: 8px;
}
}
@@ -0,0 +1,133 @@
// pages/vehicleMaintenance/maintainSend/maintainSend.ts
import { postAction } from '../../../../api/base';
const dayjs = require('dayjs');
Page({
/**
* 页面的初始数据
*/
data: {
cancelIdea: '', // 作废原因
upkeepObject: '' as any, // 维修单数据
userInfo: '' as any, // 用户信息
checkPeople: '' //审批人
},
// 输入报修内容
textareaInput(e: any) {
this.setData({
cancelIdea: e.detail.value
});
},
// 提交申请
submit() {
// 未完成的情况下没有填写原因
if (!this.data.cancelIdea) {
wx.showToast({
title: '请填写作废原因',
icon: 'none'
});
return;
}
let params = {
id: this.data.upkeepObject.id,
cancelIdea: this.data.cancelIdea,
realname: this.data.userInfo.realname
};
wx.showLoading({
title: '加载中',
mask: true
});
postAction('api/vehicles/upkeepBill/cancel', params)
.then((res: any) => {
if (res.code == 200) {
wx.hideLoading();
wx.showToast({
title: '作废成功',
icon: 'none'
});
wx.setStorageSync('message', {
checkPeople: this.data.userInfo.realname,
date: dayjs().format('YYYY-MM-DD HH:mm:ss'),
cancelIdea: this.data.cancelIdea,
id: this.data.upkeepObject.id,
flowStatus: 9
});
wx.redirectTo({
url: '../message/message',
fail: e => {
console.log(e);
}
});
} else {
wx.hideLoading();
wx.showToast({
title: res.message,
icon: 'none'
});
}
})
.catch((err: any) => {
wx.hideLoading();
wx.showToast({
title: err.message,
icon: 'none'
});
});
},
getInf() {
// 获取信息
let info = wx.getStorageSync('upkeepObject');
console.log('看书', info);
wx.removeStorage({ key: 'upkeepObject' });
let userInfo = wx.getStorageSync('userInfo');
this.setData({
upkeepObject: info,
userInfo: userInfo,
checkPeople: userInfo.realname
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.getInf();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 不放onReady 是因为有可能切出去然后状态改了得跳转到别的页面
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
});
@@ -0,0 +1,31 @@
<!--pages/vehicleMaintenance/maintainSend/maintainSend.wxml-->
<view class="container">
<view class="item-container">
<view class="top">
<view class="row">
<view class="code">{{upkeepObject.upkeepBill.orderNo}}</view>
<view class="number-plate">
<view class="status status1" wx:if="{{upkeepObject.flowStatus == 2}}">待派单</view>
<view class="status status1" wx:if="{{upkeepObject.flowStatus == 3}}">待报价</view>
<view class="status status2" wx:if="{{upkeepObject.flowStatus == 4}}">待审核</view>
<view class="status status2" wx:if="{{upkeepObject.flowStatus == 5}}">待审批</view>
<view class="status status1" wx:if="{{upkeepObject.flowStatus == 6}}">维修中</view>
<view class="val">{{upkeepObject.upkeepBill.plateNumber}}</view>
</view>
</view>
<view class="row">
<view class="project-name">{{upkeepObject.upkeepBill.projectId_dictText}}</view>
<view class="time">{{upkeepObject.upkeepBill.predictTime}}</view>
</view>
</view>
<view class="item">
<view class="title require">作废原因</view>
<textarea class="weui-input" maxlength="200" placeholder="最大输入长度为200" value="{{checkIdea}}" bindblur="textareaInput" />
</view>
</view>
<view class="bottom">
<view class="btn-box">
<view class="btn apply" catch:tap="submit">确认作废</view>
</view>
</view>
</view>
@@ -0,0 +1,7 @@
{
"usingComponents": {
"van-radio-group": "@vant/weapp/radio-group/index",
"van-radio": "@vant/weapp/radio/index"
},
"navigationBarTitleText": "审核"
}
@@ -0,0 +1,152 @@
/* pages/vehicleMaintenance/maintainSend/maintainSend.wxss */
.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;
}
}
.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;
}
}
}
}
.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;
}
}
.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;
}
}
}
.weui-input {
border-radius: 8px;
border: 1px solid #E6EAF2;
width: calc(100% - 16px);
height: 83px;
padding: 8px;
margin-top: 8px;
}
.radio-group {
margin-top: 16px;
display: block;
.van-radio-group {
display: flex;
}
}
}
@@ -0,0 +1,170 @@
// pages/vehicleMaintenance/maintainSend/maintainSend.ts
import { postAction } from '../../../../api/base';
const dayjs = require('dayjs');
Page({
/**
* 页面的初始数据
*/
data: {
checkIdea: '', // 报修内容
upkeepObject: '' as any, // 保养单数据
checkResult: '' as any, // 评审结果
userInfo: '' as any, // 用户信息
checkPeople: '' //审批人
},
// 输入报修内容
textareaInput(e: any) {
this.setData({
checkIdea: e.detail.value
});
},
selectRadio(e: any) {
this.setData({
checkResult: e.currentTarget.dataset.inf
});
},
// 提交申请
submit() {
if (this.data.checkResult) {
if (this.data.checkResult == '2' && !this.data.checkIdea) {
wx.showToast({
title:
this.data.upkeepObject.flowStatus == 4
? '请填写评审意见'
: this.data.upkeepObject.flowStatus == 5
? '请填写审批意见'
: '请填写复核意见',
icon: 'none'
});
return;
}
let params = {
id: this.data.upkeepObject.id, //id
flowStatus: this.data.upkeepObject.flowStatus, //当前流程状态
checkFlag: this.data.checkResult, //审核状态 1-》通过, 2-》不通过
upkeepBill: {},
upkeepAssign: {},
upkeepOffer: {},
currentUpkeepCheck: {
checkResult: this.data.checkResult, //审核结果/保养结果
checkPeople: this.data.userInfo.realname, //审批人
checkIdea: this.data.checkIdea //审核意见
}
};
wx.showLoading({
title: '加载中',
mask: true
});
postAction('api/vehicles/upkeepBill/submitUpkeepObject', params)
.then((res: any) => {
if (res.code == 200) {
wx.hideLoading();
wx.showToast({
title: '提交成功',
icon: 'none'
});
wx.setStorageSync('message', {
checkPeople: this.data.userInfo.realname,
date: dayjs().format('YYYY-MM-DD HH:mm:ss'),
checkIdea: this.data.checkIdea,
checkResult: this.data.checkResult,
price: this.data.upkeepObject.upkeepOffer.repairCost, // 保养金额
id: this.data.upkeepObject.id,
flowStatus: this.data.upkeepObject.flowStatus,
checkFlag: this.data.checkResult // 通过结果
});
wx.redirectTo({
url: '../message/message',
fail: e => {
console.log(e);
}
});
} else {
wx.hideLoading();
wx.showToast({
title: res.message,
icon: 'none'
});
}
})
.catch((err: any) => {
wx.hideLoading();
wx.showToast({
title: err.message,
icon: 'none'
});
});
} else {
wx.showToast({
title:
this.data.upkeepObject.flowStatus == 4
? '请填写评审意见'
: this.data.upkeepObject.flowStatus == 5
? '请填写审批意见'
: '请填写复核意见',
icon: 'none'
});
}
},
getInf() {
// 获取信息
let info = wx.getStorageSync('upkeepObject');
wx.removeStorage({ key: 'upkeepObject' });
let userInfo = wx.getStorageSync('userInfo');
let title = '';
if (info.flowStatus == 4) title = '评审';
else if (info.flowStatus == 10) title = '复核';
wx.setNavigationBarTitle({
title: title
});
this.setData({
upkeepObject: info,
userInfo: userInfo,
checkPeople: userInfo.realname
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.getInf();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 不放onReady 是因为有可能切出去然后状态改了得跳转到别的页面
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
});
@@ -0,0 +1,21 @@
<!--pages/vehicleMaintenance/maintainSend/maintainSend.wxml-->
<view class="container">
<view class="item-container">
<view class="item">
<view class="title require">{{upkeepObject.flowStatus == 4 ? '审核' : '复核'}}结果</view>
<van-radio-group class="radio-group">
<van-radio name="1" style="margin-right: 16px;" catch:tap="selectRadio" data-inf='{{1}}'>通过</van-radio>
<van-radio name="2" catch:tap="selectRadio" data-inf='{{2}}'>不通过</van-radio>
</van-radio-group>
</view>
<view class="item">
<view class="title {{checkResult == 2 ? 'require' : ''}}">{{upkeepObject.flowStatus == 4 ? '审核' : '复核'}}意见</view>
<textarea class="weui-input" maxlength="200" placeholder="最大输入长度为200" value="{{checkIdea}}" bindblur="textareaInput" />
</view>
</view>
<view class="bottom">
<view class="btn-box">
<view class="btn apply" catch:tap="submit">提交{{upkeepObject.flowStatus == 4 ? '审核' : '复核'}}</view>
</view>
</view>
</view>
@@ -0,0 +1,7 @@
{
"usingComponents": {
"van-radio-group": "@vant/weapp/radio-group/index",
"van-radio": "@vant/weapp/radio/index"
},
"navigationBarTitleText": "确认结果"
}
@@ -0,0 +1,152 @@
/* pages/vehicleMaintenance/maintainSend/maintainSend.wxss */
.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;
}
}
.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;
}
}
}
}
.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;
}
}
.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;
}
}
}
.weui-input {
border-radius: 8px;
border: 1px solid #E6EAF2;
width: calc(100% - 16px);
height: 83px;
padding: 8px;
margin-top: 8px;
}
.radio-group {
margin-top: 16px;
display: block;
.van-radio-group {
display: flex;
}
}
}
@@ -0,0 +1,158 @@
// pages/vehicleMaintenance/maintainSend/maintainSend.ts
import { postAction } from '../../../../api/base';
const dayjs = require('dayjs');
Page({
/**
* 页面的初始数据
*/
data: {
checkIdea: '', // 报修内容
upkeepObject: '' as any, // 保养单数据
checkResult: '' as any, // 评审结果
userInfo: '' as any, // 用户信息
checkPeople: '', //审批人
finished: '' as any // 已完成/未完成
},
// 选择保养结果
selectRadio(e: any) {
this.setData({
finished: e.currentTarget.dataset.inf,
checkResult: e.currentTarget.dataset.inf
});
},
// 输入报修内容
textareaInput(e: any) {
this.setData({
checkIdea: e.detail.value
});
},
// 提交申请
submit() {
// 未完成的情况下没有填写原因
if (!this.data.finished) {
wx.showToast({
title: '请选择保养结果',
icon: 'none'
});
return;
}
if (this.data.finished == 2 && !this.data.checkIdea) {
wx.showToast({
title: '请填写未完成原因',
icon: 'none'
});
return;
}
let params = {
id: this.data.upkeepObject.id, //id
flowStatus: this.data.upkeepObject.flowStatus, //当前流程状态
checkFlag: this.data.checkResult, //审核状态 1-》通过, 2-》不通过
upkeepBill: {},
upkeepAssign: {},
upkeepOffer: {},
currentUpkeepCheck: {
checkResult: this.data.checkResult, //审核结果/保养结果
checkPeople: this.data.userInfo.realname, //审批人
checkIdea: this.data.checkIdea //审核意见
}
};
wx.showLoading({
title: '加载中',
mask: true
});
postAction('api/vehicles/upkeepBill/submitUpkeepObject', params)
.then((res: any) => {
if (res.code == 200) {
wx.hideLoading();
wx.showToast({
title: '提交成功',
icon: 'none'
});
wx.setStorageSync('message', {
checkPeople: this.data.userInfo.realname,
date: dayjs().format('YYYY-MM-DD HH:mm:ss'),
checkIdea: this.data.checkIdea,
checkResult: this.data.checkResult,
id: this.data.upkeepObject.id,
flowStatus: this.data.upkeepObject.flowStatus,
checkFlag: this.data.checkResult, // 通过结果
finished: this.data.finished == 1 ? true : false
});
wx.redirectTo({
url: '../message/message',
fail: e => {
console.log(e);
}
});
} else {
wx.hideLoading();
wx.showToast({
title: res.message,
icon: 'none'
});
}
})
.catch((err: any) => {
wx.hideLoading();
wx.showToast({
title: err.message,
icon: 'none'
});
});
},
getInf() {
// 获取信息
let info = wx.getStorageSync('upkeepObject');
wx.removeStorage({ key: 'upkeepObject' });
let userInfo = wx.getStorageSync('userInfo');
this.setData({
upkeepObject: info,
userInfo: userInfo,
checkPeople: userInfo.realname
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.getInf();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 不放onReady 是因为有可能切出去然后状态改了得跳转到别的页面
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
});
@@ -0,0 +1,22 @@
<!--pages/vehicleMaintenance/maintainSend/maintainSend.wxml-->
<view class="container">
<view class="item-container">
<view class="item">
<view class="title">保养结果</view>
<van-radio-group class="radio-group" v-model="finished">
<van-radio name="1" style="margin-right: 16px;" catch:tap="selectRadio" data-inf='{{1}}'>完成</van-radio>
<van-radio name="2" catch:tap="selectRadio" data-inf='{{2}}'>未完成</van-radio>
</van-radio-group>
</view>
<view class="item">
<view class="title" wx:if="{{finished != 2}}">保养意见</view>
<view class="title require" wx:if="{{finished == 2}}">不通过原因</view>
<textarea class="weui-input" maxlength="200" placeholder="最大输入长度为200" value="{{checkIdea}}" bindblur="textareaInput" />
</view>
</view>
<view class="bottom">
<view class="btn-box">
<view class="btn apply" catch:tap="submit">提交</view>
</view>
</view>
</view>
@@ -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>
@@ -0,0 +1,9 @@
{
"usingComponents": {
"g-upload": "/components/uploadPic/uploadPic",
"van-picker": "@vant/weapp/picker/index",
"van-popup": "@vant/weapp/popup/index",
"van-search": "@vant/weapp/search/index"
},
"navigationBarTitleText": "保养录入"
}
@@ -0,0 +1,389 @@
/* pages/vehicleMaintenance/operation/offer/offer.wxss */
.container {
height: 100vh;
background: #EFF1F4;
position: relative;
overflow: hidden;
.content-box {
height: calc(100vh - 84px);
overflow-y: auto;
.content {
padding: 8px;
margin-bottom: 10px;
background: #fff;
.top {
margin-bottom: 8px;
display: flex;
justify-content: space-between;
align-items: center;
.left {
display: flex;
align-items: center;
.line {
width: 4px;
height: 22px;
margin: 0 8px 0 2px;
background: linear-gradient(180deg, #4E87FC 0%, #38B1FE 100%);
border-radius: 2px;
}
.title {
color: #333F53;
font-size: 14px;
font-weight: bold;
}
}
.right {
.btn-add {
padding: 8px 24px;
background: #E9F2FF;
border-radius: 4px;
border: 1px dashed #4381FC;
color: #4381FC;
font-size: 14px;
display: flex;
align-items: center;
image {
width: 18px;
height: 18px;
margin-right: 9px;
display: inline-block;
}
}
}
}
.offer-content {
.offer-list {
.offer-item {
padding: 8px;
margin-bottom: 10px;
background: #ECEFF5;
border-radius: 4px;
color: #2F3B50;
font-size: 14px;
.row {
padding: 10px 12px;
background: #fff;
border-bottom: 1px solid #E6EAF2;
display: flex;
justify-content: space-between;
align-items: center;
.label {}
.val {
width: 60%;
display: flex;
align-items: center;
>.project-select {
width: 100%;
// border: 1px solid #DBDBDB;
border-radius: 4px;
background: #ffffff;
picker {
width: 100%;
position: relative;
.picker {
width: 100%;
height: 20px;
padding: 0 20px 0 8px;
box-sizing: border-box;
// border: 1px solid #E6EAF2;
border-radius: 4px;
font-size: 14px;
display: flex;
justify-content: flex-end;
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: 6px;
transform: translateY(-2px);
}
}
}
>input {
width: 100%;
font-size: 14px;
text-align: right;
}
.unit {
width: 56rpx;
margin-left: 6px;
color: #636B83;
font-size: 24rpx;
white-space: nowrap;
}
}
.num-val {
width: 50%;
display: flex;
align-items: center;
justify-content: flex-end;
>input {
width: 50%;
text-align: center;
}
.up,
.down {
width: 20px;
height: 20px;
line-height: 18px;
box-sizing: border-box;
border-radius: 50%;
border: 1px solid #C3CBE4;
color: #C3CBE4;
font-size: 18px;
font-weight: bold;
display: flex;
justify-content: center;
align-items: center;
// image {
// width: 100%;
// height: 100%;
// display: block;
// }
}
}
}
.total-row {
margin-top: 8px;
display: flex;
align-items: center;
justify-content: space-between;
.total {
padding: 0 6px;
color: #2E3A4F;
font-size: 14px;
display: flex;
align-items: center;
.num {
margin: 0 8px;
font-size: 16px;
font-weight: bold;
}
}
.btn-del {
padding: 2px 16px;
background: #FFEEEE;
border: 1px solid #FDD0DD;
border-radius: 4px;
color: #FA5955;
font-size: 14px;
}
}
}
}
.btn-show,
.btn-hide {
padding: 8px;
color: #2F3B50;
font-size: 14px;
display: flex;
justify-content: center;
align-items: center;
image {
width: 18px;
height: 18px;
margin-right: 10px;
display: block;
}
}
}
>.row {
display: flex;
align-items: center;
justify-content: space-between;
.label {
color: #2F3B50;
font-size: 14px;
}
.val {
display: flex;
align-items: center;
>input {
width: 100%;
font-size: 14px;
text-align: right;
}
.unit {
width: 56rpx;
margin-left: 6px;
color: #636B83;
font-size: 24rpx;
white-space: nowrap;
}
}
}
.marker {
padding: 12px 8px;
border: 1px solid #E6EAF2;
border-radius: 8px;
}
.upload {
padding: 12px 0;
}
}
.echoFile {
display: flex;
flex-wrap: wrap;
}
.photo-list {
width: 64px;
height: 64px;
margin-left: 8px;
border-radius: 4px;
position: relative;
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;
}
}
}
}
.bottom {
width: 100%;
padding: 22px 10px;
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;
.btn {
width: calc(50% - 8px);
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;
}
}
}
.require {
&::after {
content: '*';
width: 6px;
height: 100%;
color: red;
margin-left: 8px;
display: inline-block;
}
}
.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: flex-end;
width: 100%;
}
}
@@ -0,0 +1,492 @@
// pages/vehicleMaintenance/operation/offer/offer.ts
import { getAction, postAction } from '../../../../api/base';
Page({
/**
* 页面的初始数据
*/
data: {
showMore: true, // 展示/收起明细
classifyOptions: [] as any, // 保养分类数据
filterClassifyOptions: [] as any, // 过滤保养分类数据
repairDetailList: [] as any, // 保养明细
materialCost: '' as any, // 总计材料费
totalWorkHours: '' as any, // 总计工时
totalWorkHoursCost: '' as any, // 总计工时费用
totaCost: '' as any, // 总计
offerContent: '', // 内容说明
attachmentUpkeepList: [], // 单据附件
beforeUpkeepImgUrl: [], // 保养前图片
inUpkeepImgUrl: [], // 保养中图片
afterUpkeepImgUrl: [], // 保养后图片
paramsInfo: {} as any, // 保养单数据
uploadUrl: 'api/vehicles/repair/fileUpload', // 上传图片地址
classifySearchVal: '', // 保养分类过滤查询
currentIndex: null // 当前选中的保养明细
},
showDetail() {
this.setData({
showMore: !this.data.showMore
});
},
// 明细相关值修改-------------------
addOffer() {
let tmpArr = this.data.repairDetailList;
tmpArr.push({
repairClass: '',
repairClass_dictText: '',
repairContent: '',
quantity: '',
unitPrice: '',
workHours: '',
workHoursCost: '',
totalCost: 0
});
this.setData({
repairDetailList: tmpArr
});
},
changeOfferVal(e: any) {
let tmpArr = this.data.repairDetailList;
let index = e.currentTarget.dataset.index;
let { key, fixed } = e.currentTarget.dataset;
if (key != 'repairContent') {
if (e.detail.value > 99999999) {
wx.showToast({
title: '输入值不能大于99999999',
icon: 'none'
});
e.detail.value = 99999999;
} else if (e.detail.value < 0) {
wx.showToast({
title: '输入值不能小于0',
icon: 'none'
});
e.detail.value = 0;
}
tmpArr[index][key] = Number(Number(e.detail.value).toFixed(fixed));
} else tmpArr[index][key] = e.detail.value;
this.setData({
repairDetailList: tmpArr
});
if (key == 'repairContent') {
this.checkString(tmpArr[index][key]);
// 保养内容不用计算
return;
}
// 调用计算总金额
this.calculateTotal();
},
// 校验字符串
checkString(str: string) {
let res = true;
const spaceRegex = new RegExp(/\s+/g);
if (str && spaceRegex.test(str)) {
wx.showToast({
title: '保养内容不支持含有空格',
icon: 'none'
});
res = false;
}
const regex = /['"{};<>!@#$%^&*|\\]/;
if (str && regex.test(str)) {
wx.showToast({
title: '保养内容不支持特殊字符',
icon: 'none'
});
res = false;
}
const tooLong = str.length > 100;
if (str && tooLong) {
wx.showToast({
title: '保养内容输入长度不得超过100个字符',
icon: 'none'
});
res = false;
}
return res;
},
changeNum(e: any) {
console.log(e);
let tmpArr = this.data.repairDetailList;
let index = e.currentTarget.dataset.index;
if (tmpArr[index].quantity == '') {
tmpArr[index].quantity = 0;
}
if (e.currentTarget.dataset.type == 'up') {
tmpArr[index].quantity += 1;
tmpArr[index].quantity = Number(
Number(tmpArr[index].quantity).toFixed(0)
);
} else {
if (tmpArr[index].quantity == 0) {
wx.showToast({
title: '数量不能为负数',
icon: 'none'
});
return;
}
tmpArr[index].quantity -= 1;
tmpArr[index].quantity = Number(
Number(tmpArr[index].quantity).toFixed(0)
);
}
this.setData({
repairDetailList: tmpArr
});
// 调用计算总金额
this.calculateTotal();
},
delOffer(e: any) {
console.log(e.currentTarget.dataset.index);
let tmpArr = this.data.repairDetailList.filter(
(x: any, i: number) => i != e.currentTarget.dataset.index
);
this.setData({
repairDetailList: tmpArr
});
// 调用计算总金额
this.calculateTotal();
},
calculateTotal() {
let tmpArr = this.data.repairDetailList;
let materialCost = 0;
let totalWorkHours = 0;
let totalWorkHoursCost = 0;
let totaCost = 0;
tmpArr.forEach((item: any) => {
let quantity = item.quantity ? Number(item.quantity) : 0;
let unitPrice = item.unitPrice ? Number(item.unitPrice) : 0;
let workHours = item.workHours ? Number(item.workHours) : 0;
let workHoursCost = item.workHoursCost ? Number(item.workHoursCost) : 0;
item.totalCost = Number(
(quantity * unitPrice + workHours * workHoursCost).toFixed(2)
);
materialCost += Number((quantity * unitPrice).toFixed(2));
totalWorkHours += workHours;
totalWorkHoursCost += Number((workHours * workHoursCost).toFixed(2));
totaCost += item.totalCost;
});
this.setData({
repairDetailList: tmpArr,
materialCost: materialCost,
totalWorkHours: totalWorkHours,
totalWorkHoursCost: totalWorkHoursCost,
totaCost: totaCost
});
},
// 明细相关值修改-------------------
getMarker(e: any) {
console.log(e);
this.setData({
offerContent: e.detail.value
});
},
// 上一步
goBack() {
wx.navigateBack();
},
// 提交报价
bindSend() {
// 校验是否新增了保养明细
if (this.data.repairDetailList.length == 0) {
wx.showToast({
title: '请先新建保养明细',
icon: 'none'
});
return;
}
// 校验保养明细
let res = true;
let result = true;
this.data.repairDetailList.forEach((item: any) => {
let key = Object.keys(item);
key.forEach(el => {
if (item[el] === '') res = false;
if (el == 'repairContent') {
let check = this.checkString(item[el]);
if (!check) result = false;
}
});
});
if (!res) {
wx.showToast({
title: '请完成保养明细的填写',
icon: 'none'
});
return;
}
// 保养内容不符合校验
if (!result) {
return;
}
if (!this.data.offerContent) {
wx.showToast({
title: '请输入内容说明',
icon: 'none'
});
return;
}
if (this.data.attachmentUpkeepList.length == 0) {
wx.showToast({
title: '请上传单据附件',
icon: 'none'
});
return;
}
if (this.data.beforeUpkeepImgUrl.length == 0) {
wx.showToast({
title: '请上传保养前图片',
icon: 'none'
});
return;
}
if (this.data.inUpkeepImgUrl.length == 0) {
wx.showToast({
title: '请上传保养中图片',
icon: 'none'
});
return;
}
if (this.data.afterUpkeepImgUrl.length == 0) {
wx.showToast({
title: '请上传保养后图片',
icon: 'none'
});
return;
}
let params = {
upkeepBill: this.data.paramsInfo.upkeepBill,
upkeepAssign: this.data.paramsInfo.upkeepAssign,
upkeepOffer: {
repairDetailList: this.data.repairDetailList,
materialCost: this.data.materialCost, //总计材料费
totalWorkHours: this.data.totalWorkHours, //总计工时
totalWorkHoursCost: this.data.totalWorkHoursCost, //工时费用总计
totaCost: this.data.totaCost, //总计
offerContent: this.data.offerContent, //内容说明
attachmentUpkeepList: this.data.attachmentUpkeepList, //单据附件
beforeUpkeepImgUrl:
this.data.beforeUpkeepImgUrl.length > 0
? this.data.beforeUpkeepImgUrl.join(',')
: '', //保养前图片
inUpkeepImgUrl:
this.data.inUpkeepImgUrl.length > 0
? this.data.inUpkeepImgUrl.join(',')
: '', //保养中图片
afterUpkeepImgUrl:
this.data.afterUpkeepImgUrl.length > 0
? this.data.afterUpkeepImgUrl.join(',')
: '' //保养后图片
}
};
wx.showLoading({
title: '加载中',
mask: true
});
postAction('api/vehicles/upkeepBill/addDataEntry', params)
.then((res: any) => {
if (res.code == 200) {
wx.hideLoading();
wx.showToast({
title: '录入成功',
icon: 'none'
});
wx.setStorageSync('message', {
flowStatus: 100,
id: res.message
});
wx.redirectTo({
url: '../message/message',
fail: e => {
console.log(e);
}
});
} else {
wx.hideLoading();
wx.showToast({
title: res.message,
icon: 'none'
});
}
})
.catch((err: any) => {
wx.hideLoading();
wx.showToast({
title: err.message,
icon: 'none'
});
});
},
// 单据附件上传回调
returnPicOne(e: any) {
this.setData({
attachmentUpkeepList: e.detail.photoList
});
},
// 保养中图片上传回调
returnPicTwo(e: any) {
let list = [] as any;
e.detail.photoList.forEach((item: any) => {
list.push(item.fileUrl);
});
this.setData({
inUpkeepImgUrl: list
});
},
// 保养后图片上传回调
returnPicThree(e: any) {
let list = [] as any;
e.detail.photoList.forEach((item: any) => {
list.push(item.fileUrl);
});
this.setData({
afterUpkeepImgUrl: list
});
},
// 保养前图片上传回调
returnPicFour(e: any) {
let list = [] as any;
e.detail.photoList.forEach((item: any) => {
list.push(item.fileUrl);
});
this.setData({
beforeUpkeepImgUrl: list
});
},
getInf() {
// 获取信息
let info = wx.getStorageSync('paramsInfo');
wx.removeStorage({ key: 'paramsInfo' });
this.setData({
paramsInfo: info
});
console.log('看看数据', this.data.paramsInfo);
},
// 获取报修分类
getRepairClass() {
getAction('api/vehicles/repair/getRepairClass')
.then((res: any) => {
if (res.code == 200) {
let data = [] as any;
res.result.forEach((el: any) => {
el.value = el.value;
el.text = el.text;
});
data = res.result;
this.setData({
classifyOptions: data,
filterClassifyOptions: data
});
} else {
wx.showToast({
title: res.message,
icon: 'none'
});
}
})
.catch((err: any) => {
wx.showToast({
title: err.message,
icon: 'none'
});
});
},
// 展示选择框
pickerChange(event: any) {
//下拉框切换是否展示
let { fieldname, index } = event.currentTarget.dataset;
let data: any = { ...this.data };
data[fieldname] = true;
this.setData(data);
this.setData({
currentIndex: index
});
},
// 隐藏展示框
hidePicker() {
this.setData({
classifyShow: false
});
},
// 选择器点击确认
pickerConfirm(event: any) {
let { fieldname } = event.currentTarget.dataset;
let detail = event.detail;
let data = this.data.repairDetailList;
let index = this.data.currentIndex;
if (index != null) {
data[index].repairClass = detail.value.value;
data[index].repairClass_dictText = detail.value.text;
// 选择报修分类
if (fieldname == 'classify') {
this.setData({
repairDetailList: data
});
}
}
this.hidePicker();
},
// 清空数据
resetData(event: any) {
let { fieldname, index } = event.currentTarget.dataset;
let data = this.data.repairDetailList;
if (fieldname == 'repairPeople') {
this.setData({
repairPeople: ''
});
} else if (fieldname == 'phone') {
this.setData({
phone: ''
});
} else if (fieldname == 'repairContent') {
data[index].repairContent = '';
this.setData({
repairDetailList: data
});
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.getInf();
this.getRepairClass();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
});
@@ -0,0 +1,190 @@
<!--pages/vehicleMaintenance/operation/offer/offer.wxml-->
<view class="container">
<view class="content-box">
<view class="content">
<view class="top">
<view class="left">
<view class="line"></view>
<view class="title require">保养明细 ({{repairDetailList.length}})</view>
</view>
<view class="right">
<view class="btn-add" catch:tap="addOffer">
<image src="../../../../images/btn_add.png" mode="" />
新增明细
</view>
</view>
</view>
<view class="offer-content">
<view class="offer-list">
<view class="offer-item" wx:if="{{showMore}}" wx:for="{{repairDetailList}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<view class="row">
<view class="label">保养分类</view>
<view class="val">
<view class="project-select" data-fieldName="classifyShow" data-index="{{index}}" catch:tap="pickerChange">
<view class="picker">
<view style="color: #aaa;font-size: 14px;" wx:if="{{!item.repairClass}}">请选择保养分类</view>
<view style="font-size: 14px;" wx:else>{{item.repairClass_dictText}}</view>
<view class="arrow"></view>
</view>
</view>
<van-popup show="{{classifyShow}}" position="bottom" bind:close="hidePicker">
<van-picker data-fieldname="classify" show-toolbar columns="{{filterClassifyOptions}}" bind:confirm="pickerConfirm" bind:cancel="hidePicker">
</van-picker>
</van-popup>
</view>
</view>
<view class="row">
<view class="label">保养内容</view>
<view class="val">
<input type="text" placeholder="请输入" value="{{ item.repairContent }}" data-index="{{index}}" data-key="repairContent" bindblur="changeOfferVal" />
<image src="../../../../images/icon_delete.png" mode="" class="delete" data-fieldName="repairContent" data-index="{{index}}" catch:tap="resetData" />
</view>
</view>
<view class="row">
<view class="label">数量</view>
<view class="num-val">
<view class="down" data-index="{{index}}" data-type="down" catch:tap="changeNum">-</view>
<input type="digit" placeholder="请输入" value="{{ item.quantity }}" data-index="{{index}}" data-key="quantity" data-fixed="0" bindblur="changeOfferVal" />
<view class="up" data-index="{{index}}" data-type="up" catch:tap="changeNum">+</view>
</view>
</view>
<view class="row">
<view class="label">材料单价</view>
<view class="val">
<input type="digit" placeholder="请输入" value="{{ item.unitPrice }}" data-index="{{index}}" data-key="unitPrice" data-fixed="2" bindblur="changeOfferVal" />
<view class="unit">元</view>
</view>
</view>
<view class="row">
<view class="label">工时</view>
<view class="val">
<input type="digit" placeholder="请输入" value="{{ item.workHours }}" data-index="{{index}}" data-key="workHours" data-fixed="2" bindblur="changeOfferVal" />
<view class="unit">小时</view>
</view>
</view>
<view class="row">
<view class="label">工时单价</view>
<view class="val">
<input type="digit" placeholder="请输入" value="{{ item.workHoursCost}}" data-index="{{index}}" data-key="workHoursCost" data-fixed="2" bindblur="changeOfferVal" />
<view class="unit">元</view>
</view>
</view>
<view class="total-row">
<view class="total">费用小记 <view class="num">{{ item.totalCost }}</view> 元</view>
<view class="btn-del" data-index="{{index}}" catch:tap="delOffer">删除</view>
</view>
</view>
</view>
<view class="btn-hide" wx:if="{{showMore}}" catch:tap="showDetail">
<image src="../../../../images/icon_up.png" mode="" /> 收起明细
</view>
<view class="btn-show" wx:if="{{!showMore}}" catch:tap="showDetail">
<image src="../../../../images/icon_down.png" mode="" /> 展开明细
</view>
</view>
</view>
<view class="content">
<view class="top">
<view class="left">
<view class="line"></view>
<view class="title">保养费用总计</view>
</view>
<view class="right"></view>
</view>
<view class="row" style="margin: 0 8px 8px 16px;">
<view class="label">材料费</view>
<view class="val">
<input type="number" placeholder="自动计算" value="{{ totalWorkHours}}" disabled="true" />
<view class="unit">元</view>
</view>
</view>
<view class="row" style="margin: 0 8px 8px 16px;">
<view class="label">工时</view>
<view class="val">
<input type="number" placeholder="自动计算" value="{{ totalWorkHours}}" disabled="true" />
<view class="unit">小时</view>
</view>
</view>
<view class="row" style="margin: 0 8px 8px 16px;">
<view class="label">工时费用</view>
<view class="val">
<input type="number" placeholder="自动计算" value="{{ totalWorkHoursCost }}" disabled="true" />
<view class="unit">元</view>
</view>
</view>
<view class="row" style="margin: 0 8px 0 16px;">
<view class="label">保养报价</view>
<view class="val">
<input type="number" placeholder="自动计算" value="{{ totaCost }}" disabled="true" />
<view class="unit">元</view>
</view>
</view>
</view>
<view class="content">
<view class="top">
<view class="left">
<view class="line"></view>
<view class="title require">内容说明</view>
</view>
<view class="right"></view>
</view>
<view class="marker">
<textarea type="text" maxlength="100" placeholder="最大输入长度为100" style="height: 96rpx;width: 100%;" placeholder-style="color: #949CB5; font-size: 28rpx; font-weight: 400;" value="{{offerContent}}" bindblur="getMarker" />
</view>
</view>
<view class="content">
<view class="top">
<view class="left">
<view class="line"></view>
<view class="title require">单据附件(最大上传10张)</view>
</view>
<view class="right"></view>
</view>
<view class="upload" style="margin-left: 8px;">
<g-upload id="g-upload" maxLength="{{10}}" uploadUrl="{{uploadUrl}}" bind:returnPic="returnPicOne"></g-upload>
</view>
</view>
<view class="content">
<view class="top">
<view class="left">
<view class="line"></view>
<view class="title require">保养前图片(最大上传10张)</view>
</view>
<view class="right"></view>
</view>
<view class="upload" style="margin-left: 8px;">
<g-upload id="g-upload" maxLength="{{10}}" uploadUrl="{{uploadUrl}}" bind:returnPic="returnPicFour"></g-upload>
</view>
</view>
<view class="content">
<view class="top">
<view class="left">
<view class="line"></view>
<view class="title require">保养中图片(最大上传10张)</view>
</view>
<view class="right"></view>
</view>
<view class="upload" style="margin-left: 8px;">
<g-upload id="g-upload" maxLength="{{10}}" uploadUrl="{{uploadUrl}}" bind:returnPic="returnPicTwo"></g-upload>
</view>
</view>
<view class="content">
<view class="top">
<view class="left">
<view class="line"></view>
<view class="title require">保养后图片(最大上传10张)</view>
</view>
<view class="right"></view>
</view>
<view class="upload" style="margin-left: 8px;">
<g-upload id="g-upload" maxLength="{{10}}" uploadUrl="{{uploadUrl}}" bind:returnPic="returnPicThree"></g-upload>
</view>
</view>
</view>
<view class="bottom">
<view class="btn-box">
<view class="btn cancel" catch:tap="goBack">上一步</view>
<view class="btn apply" catch:tap="bindSend">提交</view>
</view>
</view>
</view>
@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "操作成功"
}
@@ -0,0 +1,123 @@
/* pages/vehicleMaintenance/maintainSend/maintainSend.wxss */
.container {
.bg {
width: 100%;
height: 250px;
position: absolute;
top: 0;
image {
width: 100%;
height: 100%;
display: block;
}
}
.success {
position: absolute;
width: 100%;
top: 18px;
text-align: center;
image {
width: 85px;
height: 69px;
}
.title {
font-size: 20px;
font-weight: bold;
color: #FFFFFF;
margin-top: 8px;
}
.info {
width: 100%;
margin-top: 10px;
display: flex;
flex-wrap: wrap;
justify-content: center;
.info-top {
width: 90%;
height: 11px;
}
.info-bottom {
width: 87%;
height: 12px;
}
.info-content {
width: calc(85.7% - 16px);
padding: 8px;
background-color: #FFFFFF;
box-shadow: 0rpx 0px 10rpx 2rpx rgba(165, 165, 165, 0.34);
.info-title {
font-size: 16px;
font-weight: bold;
color: #4381FC;
text-align: left;
margin-bottom: 8px;
}
}
.info-button {
width: calc(85.7% - 16px);
padding: 8px;
background-color: #FFFFFF;
box-shadow: 0px 5px 10rpx 2rpx rgba(165, 165, 165, 0.34);
border-radius: 0px 0px 10px 10px;
display: flex;
justify-content: space-between;
.btn {
width: calc(50% - 8px);
height: 40px;
line-height: 40px;
border-radius: 8px;
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;
}
.cancel {
border: 1px solid #4381FC;
background-color: #FFFFFF;
color: #4381FC;
}
}
}
}
.row {
width: calc(100% -16px);
display: flex;
margin-bottom: 8px;
.label {
width: 22%;
color: #858CA0;
font-size: 14px;
text-align: left;
}
.val {
width: 78%;
text-align: left;
color: #2E3A4F;
font-size: 14px;
word-break: break-word;
}
}
}
@@ -0,0 +1,234 @@
// pages/vehicleMaintenance/maintainSend/maintainSend.ts
Page({
/**
* 页面的初始数据
*/
data: {
message: {} as any, // 展示的信息
userInfo: {} as any, // 用户信息
doNotUnload: false // 是否触发页面卸载的navigateBack方法
},
// 前往下一状态的维修单
goRepair() {
let data = this.data.message;
// 如果步骤4 10审核不通过,返回上一步
// 报价3 <- 审核4 <- 复审10
if (
data.checkFlag == '2' &&
(data.flowStatus == 4 || data.flowStatus == 10)
) {
switch (data.flowStatus) {
case 4:
data.flowStatus = 3;
break;
case 10:
data.flowStatus = 4;
break;
}
}
// 审核后进入复核
else if (data.flowStatus == 4) {
data.flowStatus = 10;
}
// 复核后 到步骤6 维修中
else if (data.flowStatus == 10) {
data.flowStatus = 6;
}
// 如果步骤7确认维修结果不通过,返回步骤6
else if (data.checkFlag == '2' && data.flowStatus == 7) {
data.flowStatus = 6;
}
// 如果是数据录入,跳转道步骤8 已归档数据
else if (data.flowStatus == 100) {
data.flowStatus = 8;
}
// 如果是作废,跳转到已作废
else if (data.flowStatus == 9) {
data.flowStatus = 9;
} else data.flowStatus += 1;
wx.setStorageSync('selectMaintain', this.data.message);
let url = '';
switch (data.flowStatus) {
case 2:
url = '../../UpkeepBillSend/UpkeepBillSend';
break;
case 3:
url = '../../UpkeepBillSend/UpkeepBillSend';
break;
case 4:
url = '../../UpkeepBillCheck/UpkeepBillCheck';
break;
case 6:
url = '../../UpkeepBillProcedure/UpkeepBillProcedure';
break;
case 7:
url = '../../UpkeepBillProcedure/UpkeepBillProcedure';
break;
case 8:
url = '../../UpkeepBillResult/UpkeepBillResult';
break;
case 9:
url = '../../UpkeepBillResult/UpkeepBillResult';
break;
case 10:
url = '../../UpkeepBillCheck/UpkeepBillCheck';
break;
}
this.setData({
doNotUnload: true
});
wx.redirectTo({
url: url,
fail: e => {
console.log(e);
}
});
},
// 返回首页
backHome() {
if (this.data.message.flowStatus == 100) {
if (this.data.userInfo.type == '1') {
wx.reLaunch({
url: '/pages/index/index'
});
} else if (this.data.userInfo.type == '2') {
wx.reLaunch({
url: '/pages/manufacturerIndex/manufacturerIndex'
});
} else if (this.data.userInfo.type == '3') {
wx.reLaunch({
url: '/pages/projectIndex/projectIndex'
});
} else if (this.data.userInfo.type == '4') {
wx.reLaunch({
url: '/pages/maintenanceIndex/maintenanceIndex'
});
} else {
wx.reLaunch({
url: '/pages/login/login'
});
}
}
// 返回列表
else {
this.setData({
doNotUnload: true
});
if (this.data.message.flowStatus == 2) this.goBack(1);
else this.goBack(2);
}
},
goBack(delta: number) {
wx.navigateBack({
delta: delta,
success: function (res) {
// 通过eventChannel向被打开页面传送数据
if (getApp().EventChannel) getApp().EventChannel.emit('refresh');
},
fail: e => {
console.log(e);
}
});
},
getInf() {
// 获取信息
let info = wx.getStorageSync('message');
wx.removeStorage({ key: 'message' });
this.setData({
message: info
});
this.changeTitle(info);
},
// 获取用户信息
getUserInfo() {
let userInfo = wx.getStorageSync('userInfo');
this.setData({
userInfo: userInfo
});
},
// 修改页眉
changeTitle(info: any) {
let title = '操作成功';
switch (info.flowStatus) {
case 1:
title = '已提交';
break;
case 2:
title = '派单成功';
break;
case 3:
title = '报价成功';
break;
case 4:
title = '已提交';
break;
case 5:
title = '已提交';
break;
case 6:
title = '已提交';
break;
case 7:
title = '已提交';
break;
}
wx.setNavigationBarTitle({
title: title
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.getInf();
this.getUserInfo();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 不放onReady 是因为有可能切出去然后状态改了得跳转到别的页面
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
if (!this.data.doNotUnload) {
// 非待派单
if (this.data.message.flowStatus !== 2) {
this.goBack(1);
} else if (getApp().EventChannel) getApp().EventChannel.emit('refresh');
} else {
this.setData({
doNotUnload: false
});
}
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
});
@@ -0,0 +1,144 @@
<!--pages/vehicleMaintenance/maintainSend/maintainSend.wxml-->
<view class="container">
<view class="bg">
<image src="../../../../images/bg_page_blue.png" mode="" />
</view>
<view class="success">
<image src="../../../../images/icon_success.png" mode="" />
<view class="title" wx:if="{{message.flowStatus == 1}}">已提交保养申请</view>
<view class="title" wx:if="{{message.flowStatus == 2}}">已派单</view>
<view class="title" wx:if="{{message.flowStatus == 3}}">已报价</view>
<view class="title" wx:if="{{message.flowStatus == 4 || message.flowStatus == 10}}">已提交</view>
<view class="title" wx:if="{{message.flowStatus == 6}}">已完成保养</view>
<view class="title" wx:if="{{message.flowStatus == 7 && message.finished}}">确认保养结果完成</view>
<view class="title" wx:if="{{message.flowStatus == 7 && !message.finished}}">确认保养结果未完成</view>
<view class="title" wx:if="{{message.flowStatus == 9}}">已作废</view>
<view class="title" wx:if="{{message.flowStatus == 100}}">保养数据录入成功</view>
<view class="info">
<image class="info-top" src="../../../../images/info-top.png" mode="" />
<view class="info-content" wx:if="{{message.flowStatus == 1}}">
<view class="row">
<view class="label">所属项目</view>
<view class="val">{{message.projectName}}</view>
</view>
<view class="row">
<view class="label">车牌号码</view>
<view class="val">{{message.plateNumber}}</view>
</view>
<view class="row">
<view class="label">申请时间</view>
<view class="val">{{message.date}}</view>
</view>
</view>
<view class="info-content" wx:if="{{message.flowStatus == 2}}">
<view class="row">
<view class="label">保养厂</view>
<view class="val">{{message.repairShop}}</view>
</view>
<view class="row">
<view class="label">联系人</view>
<view class="val">{{message.contact}}</view>
</view>
<view class="row">
<view class="label">联系号码</view>
<view class="val">{{message.phone}}</view>
</view>
</view>
<view class="info-content" wx:if="{{message.flowStatus == 3}}">
<view class="row">
<view class="label">保养单</view>
<view class="val">{{message.upkeepOffer}}</view>
</view>
<view class="row">
<view class="label">车牌号</view>
<view class="val">{{message.plateNumber}}</view>
</view>
<view class="row">
<view class="label">报价金额</view>
<view class="val">{{message.price}}元</view>
</view>
</view>
<view class="info-content" wx:if="{{message.flowStatus == 4}}">
<view class="info-title" style="color: #4381FC;" wx:if="{{message.checkResult == 1}}">审核通过</view>
<view class="info-title" style="color: red;" wx:if="{{message.checkResult == 2}}">审核不通过</view>
<view class="row">
<view class="label">审核人</view>
<view class="val">{{message.checkPeople}}</view>
</view>
<view class="row">
<view class="label">审核时间</view>
<view class="val">{{message.date}}</view>
</view>
<view class="row">
<view class="label">审核意见</view>
<view class="val">{{message.checkIdea ? message.checkIdea : '/'}}</view>
</view>
</view>
<view class="info-content" wx:if="{{message.flowStatus == 10}}">
<view class="info-title" style="color: #4381FC;" wx:if="{{message.checkResult == 1}}">复核通过</view>
<view class="info-title" style="color: red;" wx:if="{{message.checkResult == 2}}">复核不通过</view>
<view class="row">
<view class="label">复核人</view>
<view class="val">{{message.checkPeople}}</view>
</view>
<view class="row">
<view class="label">复核时间</view>
<view class="val">{{message.date}}</view>
</view>
<view class="row">
<view class="label">复核意见</view>
<view class="val">{{message.checkIdea ? message.checkIdea : '/'}}</view>
</view>
</view>
<view class="info-content" wx:if="{{message.flowStatus == 6}}">
<view class="row">
<view class="label">所属项目</view>
<view class="val">{{message.projectName}}</view>
</view>
<view class="row">
<view class="label">车牌号码</view>
<view class="val">{{message.plateNumber}}</view>
</view>
<view class="row">
<view class="label">完成时间</view>
<view class="val">{{message.date}}</view>
</view>
</view>
<view class="info-content" wx:if="{{message.flowStatus == 7}}">
<view class="info-title" style="color: #4381FC;" wx:if="{{message.finished}}">保养通过</view>
<view class="info-title" style="color: red;" wx:if="{{!message.finished}}">保养不通过</view>
<view class="row">
<view class="label">确认人</view>
<view class="val">{{message.checkPeople}}</view>
</view>
<view class="row">
<view class="label">确认时间</view>
<view class="val">{{message.date}}</view>
</view>
<view class="row">
<view class="label">确认意见</view>
<view class="val">{{message.checkIdea ? message.checkIdea : '/'}}</view>
</view>
</view>
<view class="info-content" wx:if="{{message.flowStatus == 9}}">
<view class="row">
<view class="label">作废人</view>
<view class="val">{{message.checkPeople}}</view>
</view>
<view class="row">
<view class="label">作废时间</view>
<view class="val">{{message.date}}</view>
</view>
<view class="row">
<view class="label">作废原因</view>
<view class="val">{{message.cancelIdea ? message.cancelIdea : '/'}}</view>
</view>
</view>
<image class="info-bottom" src="../../../../images/info-bottom.png" mode="" />
<view class="info-button">
<view class="btn cancel" catch:tap="goRepair">保养单详情</view>
<view class="btn apply" catch:tap="backHome">{{message.flowStatus == 100 ? '回首页' : '回列表'}}</view>
</view>
</view>
</view>
</view>
@@ -0,0 +1,9 @@
{
"usingComponents": {
"g-upload": "/components/uploadPic/uploadPic",
"van-picker": "@vant/weapp/picker/index",
"van-popup": "@vant/weapp/popup/index",
"van-search": "@vant/weapp/search/index"
},
"navigationBarTitleText": "报价"
}
@@ -0,0 +1,381 @@
/* pages/vehicleMaintenance/operation/offer/offer.wxss */
.container {
height: 100vh;
background: #EFF1F4;
position: relative;
overflow: hidden;
.content-box {
height: calc(100vh - 84px);
overflow-y: auto;
.content {
padding: 8px;
margin-bottom: 10px;
background: #fff;
.top {
margin-bottom: 8px;
display: flex;
justify-content: space-between;
align-items: center;
.left {
display: flex;
align-items: center;
.line {
width: 4px;
height: 22px;
margin: 0 8px 0 2px;
background: linear-gradient(180deg, #4E87FC 0%, #38B1FE 100%);
border-radius: 2px;
}
.title {
color: #333F53;
font-size: 14px;
font-weight: bold;
}
}
.right {
.btn-add {
padding: 8px 24px;
background: #E9F2FF;
border-radius: 4px;
border: 1px dashed #4381FC;
color: #4381FC;
font-size: 14px;
display: flex;
align-items: center;
image {
width: 18px;
height: 18px;
margin-right: 9px;
display: inline-block;
}
}
}
}
.offer-content {
.offer-list {
.offer-item {
padding: 8px;
margin-bottom: 10px;
background: #ECEFF5;
border-radius: 4px;
color: #2F3B50;
font-size: 14px;
.row {
padding: 10px 12px;
background: #fff;
border-bottom: 1px solid #E6EAF2;
display: flex;
justify-content: space-between;
align-items: center;
.label {}
.val {
width: 60%;
display: flex;
align-items: center;
>.project-select {
width: 100%;
// border: 1px solid #DBDBDB;
border-radius: 4px;
background: #ffffff;
picker {
width: 100%;
position: relative;
.picker {
width: 100%;
height: 20px;
padding: 0 20px 0 8px;
box-sizing: border-box;
// border: 1px solid #E6EAF2;
border-radius: 4px;
font-size: 14px;
display: flex;
justify-content: flex-end;
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: 6px;
transform: translateY(-2px);
}
}
}
>input {
width: 100%;
font-size: 14px;
text-align: right;
}
.unit {
width: 56rpx;
margin-left: 6px;
color: #636B83;
font-size: 24rpx;
white-space: nowrap;
}
}
.num-val {
width: 50%;
display: flex;
align-items: center;
justify-content: flex-end;
>input {
width: 50%;
text-align: center;
}
.up,
.down {
width: 20px;
height: 20px;
line-height: 18px;
box-sizing: border-box;
border-radius: 50%;
border: 1px solid #C3CBE4;
color: #C3CBE4;
font-size: 18px;
font-weight: bold;
display: flex;
justify-content: center;
align-items: center;
// image {
// width: 100%;
// height: 100%;
// display: block;
// }
}
}
}
.total-row {
margin-top: 8px;
display: flex;
align-items: center;
justify-content: space-between;
.total {
padding: 0 6px;
color: #2E3A4F;
font-size: 14px;
display: flex;
align-items: center;
.num {
margin: 0 8px;
font-size: 16px;
font-weight: bold;
}
}
.btn-del {
padding: 2px 16px;
background: #FFEEEE;
border: 1px solid #FDD0DD;
border-radius: 4px;
color: #FA5955;
font-size: 14px;
}
}
}
}
.btn-show,
.btn-hide {
padding: 8px;
color: #2F3B50;
font-size: 14px;
display: flex;
justify-content: center;
align-items: center;
image {
width: 18px;
height: 18px;
margin-right: 10px;
display: block;
}
}
}
>.row {
display: flex;
align-items: center;
justify-content: space-between;
.label {
color: #2F3B50;
font-size: 14px;
}
.val {
display: flex;
align-items: center;
>input {
width: 100%;
font-size: 14px;
text-align: right;
}
.unit {
width: 56rpx;
margin-left: 6px;
color: #636B83;
font-size: 24rpx;
white-space: nowrap;
}
}
}
.marker {
padding: 12px 8px;
border: 1px solid #E6EAF2;
border-radius: 8px;
}
.upload {
padding: 12px 0;
}
}
.echoFile {
display: flex;
flex-wrap: wrap;
}
.photo-list {
width: 64px;
height: 64px;
margin-left: 8px;
border-radius: 4px;
position: relative;
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;
}
}
}
}
.bottom {
width: 100%;
padding: 22px 10px;
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;
.btn {
width: 100%;
height: 40px;
line-height: 40px;
border-radius: 8px;
background: linear-gradient(90deg, #3B7CFC 0%, #548BFC 100%);
color: #fff;
font-weight: bold;
text-align: center;
}
}
}
.require {
&::after {
content: '*';
width: 6px;
height: 100%;
color: red;
margin-left: 8px;
display: inline-block;
}
}
.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: flex-end;
width: 100%;
}
}
@@ -0,0 +1,519 @@
// pages/vehicleMaintenance/operation/offer/offer.ts
import { getAction, postAction } from '../../../../api/base';
Page({
/**
* 页面的初始数据
*/
data: {
showMore: true, // 展示/收起明细
classifyOptions: [] as any, // 保养分类数据
filterClassifyOptions: [] as any, // 过滤保养分类数据
repairDetailList: [] as any, // 保养明细
materialCost: '' as any, // 总计材料费
totalWorkHours: '' as any, // 总计工时
totalWorkHoursCost: '' as any, // 总计工时费用
totaCost: '' as any, // 总计
offerContent: '', // 内容说明
beforeUpkeepImgUrl: [], // 保养前图片
attachmentUpkeepList: [], // 单据附件
echoFile: null as any, // 回显时的单据附件
echoBeforeFile: null as any, // 回显保养前
upkeepObject: {} as any, // 保养单数据
uploadUrl: 'api/vehicles/repair/fileUpload', // 上传图片地址
classifySearchVal: '', // 保养分类过滤查询
currentIndex: null // 当前选中的保养明细
},
showDetail() {
this.setData({
showMore: !this.data.showMore
});
},
// 明细相关值修改-------------------
addOffer() {
let tmpArr = this.data.repairDetailList;
tmpArr.push({
repairClass: '',
repairClass_dictText: '',
repairContent: '',
quantity: '',
unitPrice: '',
workHours: '',
workHoursCost: '',
totalCost: 0
});
this.setData({
repairDetailList: tmpArr
});
},
changeOfferVal(e: any) {
let tmpArr = this.data.repairDetailList;
let index = e.currentTarget.dataset.index;
let { key, fixed } = e.currentTarget.dataset;
if (key != 'repairContent') {
if (e.detail.value > 99999999) {
wx.showToast({
title: '输入值不能大于99999999',
icon: 'none'
});
e.detail.value = 99999999;
} else if (e.detail.value < 0) {
wx.showToast({
title: '输入值不能小于0',
icon: 'none'
});
e.detail.value = 0;
}
tmpArr[index][key] = Number(Number(e.detail.value).toFixed(fixed));
} else tmpArr[index][key] = e.detail.value;
this.setData({
repairDetailList: tmpArr
});
if (key == 'repairContent') {
this.checkString(tmpArr[index][key]);
// 保养内容不用计算
return;
}
// 调用计算总金额
this.calculateTotal();
},
// 校验字符串
checkString(str: string) {
let res = true;
const spaceRegex = new RegExp(/\s+/g);
if (str && spaceRegex.test(str)) {
wx.showToast({
title: '保养内容不支持含有空格',
icon: 'none'
});
res = false;
}
const regex = /['"{};<>!@#$%^&*|\\]/;
if (str && regex.test(str)) {
wx.showToast({
title: '保养内容不支持特殊字符',
icon: 'none'
});
res = false;
}
const tooLong = str.length > 100;
if (str && tooLong) {
wx.showToast({
title: '保养内容输入长度不得超过100个字符',
icon: 'none'
});
res = false;
}
return res;
},
changeNum(e: any) {
let tmpArr = this.data.repairDetailList;
let index = e.currentTarget.dataset.index;
if (tmpArr[index].quantity == '') {
tmpArr[index].quantity = 0;
}
if (e.currentTarget.dataset.type == 'up') {
tmpArr[index].quantity += 1;
tmpArr[index].quantity = Number(
Number(tmpArr[index].quantity).toFixed(0)
);
} else {
if (tmpArr[index].quantity == 0) {
wx.showToast({
title: '数量不能为负数',
icon: 'none'
});
return;
}
tmpArr[index].quantity -= 1;
tmpArr[index].quantity = Number(
Number(tmpArr[index].quantity).toFixed(0)
);
}
this.setData({
repairDetailList: tmpArr
});
// 调用计算总金额
this.calculateTotal();
},
delOffer(e: any) {
let tmpArr = this.data.repairDetailList.filter(
(x: any, i: number) => i != e.currentTarget.dataset.index
);
this.setData({
repairDetailList: tmpArr
});
// 调用计算总金额
this.calculateTotal();
},
calculateTotal() {
let tmpArr = this.data.repairDetailList;
let materialCost = 0;
let totalWorkHours = 0;
let totalWorkHoursCost = 0;
let totaCost = 0;
tmpArr.forEach((item: any) => {
let quantity = item.quantity ? Number(item.quantity) : 0;
let unitPrice = item.unitPrice ? Number(item.unitPrice) : 0;
let workHours = item.workHours ? Number(item.workHours) : 0;
let workHoursCost = item.workHoursCost ? Number(item.workHoursCost) : 0;
item.totalCost = Number(
(quantity * unitPrice + workHours * workHoursCost).toFixed(2)
);
materialCost += Number((quantity * unitPrice).toFixed(2));
totalWorkHours += workHours;
totalWorkHoursCost += Number((workHours * workHoursCost).toFixed(2));
totaCost += item.totalCost;
});
this.setData({
repairDetailList: tmpArr,
materialCost: materialCost,
totalWorkHours: totalWorkHours,
totalWorkHoursCost: totalWorkHoursCost,
totaCost: totaCost
});
},
// 明细相关值修改-------------------
getMarker(e: any) {
this.setData({
offerContent: e.detail.value
});
},
// 提交报价
bindSend() {
// 校验是否新增了保养明细
if (this.data.repairDetailList.length == 0) {
wx.showToast({
title: '请先新建保养明细',
icon: 'none'
});
return;
}
// 校验保养明细
let res = true;
let result = true;
this.data.repairDetailList.forEach((item: any) => {
let key = Object.keys(item);
key.forEach(el => {
if (item[el] === '') res = false;
if (el == 'repairContent') {
let check = this.checkString(item[el]);
if (!check) result = false;
}
});
});
if (!res) {
wx.showToast({
title: '请完成保养明细的填写',
icon: 'none'
});
return;
}
// 保养内容不符合校验
if (!result) {
return;
}
if (!this.data.offerContent) {
wx.showToast({
title: '请输入内容说明',
icon: 'none'
});
return;
}
// 单据附件数据
let fileList = JSON.parse(
JSON.stringify(this.data.attachmentUpkeepList)
) as any;
let beforeFileList = JSON.parse(
JSON.stringify(this.data.beforeUpkeepImgUrl)
) as any;
// 如何有回显的附件且未删除
if (this.data.echoFile) {
this.data.echoFile.forEach((item: any) => {
fileList.push(item);
});
}
if (this.data.echoBeforeFile) {
this.data.echoBeforeFile.forEach((item: any) => {
beforeFileList.push(item);
});
}
if (beforeFileList.length > 0) {
beforeFileList = beforeFileList.join(',');
} else beforeFileList = '';
if (beforeFileList == 0) {
wx.showToast({
title: '请上传保养前图片',
icon: 'none'
});
return;
}
if (fileList == 0) {
wx.showToast({
title: '请上传单据附件',
icon: 'none'
});
return;
}
let params = {
id: this.data.upkeepObject.id, //id
flowStatus: 3, //当前流程状态
checkFlag: 1, //审核状态 1-》通过, 2-》不通过
upkeepBill: {},
upkeepAssign: {},
upkeepOffer: {
id: null,
repairDetailList: this.data.repairDetailList,
materialCost: this.data.materialCost, //总计材料费
totalWorkHours: this.data.totalWorkHours, //总计工时
totalWorkHoursCost: this.data.totalWorkHoursCost, //工时费用总计
totaCost: this.data.totaCost, //总计
offerContent: this.data.offerContent, //内容说明
beforeUpkeepImgUrl: beforeFileList, // 维修前图片
attachmentUpkeepList: fileList // 单据附件
},
currentUpkeepCheck: {}
};
wx.showLoading({
title: '加载中',
mask: true
});
postAction('api/vehicles/upkeepBill/submitUpkeepObject', params)
.then((res: any) => {
if (res.code == 200) {
wx.hideLoading();
wx.showToast({
title: '派单成功',
icon: 'none'
});
wx.setStorageSync('message', {
upkeepOffer: this.data.upkeepObject.upkeepBill.orderNo,
plateNumber: this.data.upkeepObject.upkeepBill.plateNumber,
price: this.data.totaCost,
id: this.data.upkeepObject.id,
flowStatus: 3
});
wx.redirectTo({
url: '../message/message',
fail: e => {
console.log(e);
}
});
} else {
wx.hideLoading();
wx.showToast({
title: res.message,
icon: 'none'
});
}
})
.catch((err: any) => {
wx.hideLoading();
wx.showToast({
title: err.message,
icon: 'none'
});
});
},
returnPicOne(e: any) {
this.setData({
attachmentUpkeepList: e.detail.photoList
});
},
// 获取图片上传后的数据 维修前
returnPicTwo(e: any) {
let list = [] as any;
e.detail.photoList.forEach((item: any) => {
list.push(item.fileUrl);
});
this.setData({
beforeUpkeepImgUrl: list
});
},
// 删除回显图片
delImg(e: any) {
let that = this;
let { index, fieldname } = e.currentTarget.dataset;
let { echoFile, echoBeforeFile } = this.data;
wx.showModal({
title: '提示',
content: '是否删除当前照片',
success(res) {
if (res.confirm) {
// 删除单据附件回显
if (fieldname == 'echoFile') {
echoFile.splice(index, 1);
that.setData({
echoFile: echoFile
});
}
// 删除维修前回显
else if (fieldname == 'echoBeforeFile') {
echoBeforeFile.splice(index, 1);
that.setData({
echoBeforeFile: echoBeforeFile
});
}
}
}
});
},
getInf() {
// 获取信息
let info = wx.getStorageSync('upkeepObject');
wx.removeStorage({ key: 'upkeepObject' });
this.setData({
upkeepObject: info
});
},
// 获取报修分类
getRepairClass() {
getAction('api/vehicles/repair/getRepairClass')
.then((res: any) => {
if (res.code == 200) {
let data = [] as any;
res.result.forEach((el: any) => {
el.value = el.value;
el.text = el.text;
});
data = res.result;
this.setData({
classifyOptions: data,
filterClassifyOptions: data
});
// 如果是审核不通过的数据,需要回显
// 需要等待保养分类的数据出来
if (this.data.upkeepObject.upkeepOffer) {
this.setData({
repairDetailList:
this.data.upkeepObject.upkeepOffer.repairDetailList,
materialCost: this.data.upkeepObject.upkeepOffer.materialCost, //总计材料费
totalWorkHours: this.data.upkeepObject.upkeepOffer.totalWorkHours, //总计工时
totalWorkHoursCost:
this.data.upkeepObject.upkeepOffer.totalWorkHoursCost, //工时费用总计
totaCost: this.data.upkeepObject.upkeepOffer.totaCost, //总计
offerContent: this.data.upkeepObject.upkeepOffer.offerContent, //内容说明
echoBeforeFile:
this.data.upkeepObject.upkeepOffer.beforeUpkeepImgUrl, // 回显附件
echoFile: this.data.upkeepObject.upkeepOffer.attachmentUpkeepList // 回显附件
});
}
} else {
wx.showToast({
title: res.message,
icon: 'none'
});
}
})
.catch((err: any) => {
wx.showToast({
title: err.message,
icon: 'none'
});
});
},
// 展示选择框
pickerChange(event: any) {
//下拉框切换是否展示
let { fieldname, index } = event.currentTarget.dataset;
let data: any = { ...this.data };
data[fieldname] = true;
this.setData(data);
this.setData({
currentIndex: index
});
},
// 隐藏展示框
hidePicker() {
this.setData({
classifyShow: false
});
},
// 选择器点击确认
pickerConfirm(event: any) {
let { fieldname } = event.currentTarget.dataset;
let detail = event.detail;
let data = this.data.repairDetailList;
let index = this.data.currentIndex;
if (index != null) {
data[index].repairClass = detail.value.value;
data[index].repairClass_dictText = detail.value.text;
// 选择报修分类
if (fieldname == 'classify') {
this.setData({
repairDetailList: data
});
}
}
this.hidePicker();
},
// 清空数据
resetData(event: any) {
let { fieldname, index } = event.currentTarget.dataset;
let data = this.data.repairDetailList;
if (fieldname == 'repairContent') {
data[index].repairContent = '';
this.setData({
repairDetailList: data
});
}
},
// 图片预览
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);
});
} else if (image == 'echoBeforeFile') {
list = this.data.echoBeforeFile;
}
wx.previewImage({
current: list[index | 0], // 当前显示图片的http链接 默认urls[0]
urls: list // 需要预览的图片http链接列表
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.getRepairClass();
this.getInf();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
});
@@ -0,0 +1,181 @@
<!--pages/vehicleMaintenance/operation/offer/offer.wxml-->
<view class="container">
<view class="content-box">
<view class="content">
<view class="top">
<view class="left">
<view class="line"></view>
<view class="title require">保养明细 ({{repairDetailList.length}})</view>
</view>
<view class="right">
<view class="btn-add" catch:tap="addOffer">
<image src="../../../../images/btn_add.png" mode="" />
新增明细
</view>
</view>
</view>
<view class="offer-content">
<view class="offer-list">
<view class="offer-item" wx:if="{{showMore}}" wx:for="{{repairDetailList}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<view class="row">
<view class="label">保养分类</view>
<view class="val">
<view class="project-select" data-fieldname="classifyShow" data-index="{{index}}" catch:tap="pickerChange">
<view class="picker">
<view style="color: #aaa;font-size: 14px;" wx:if="{{!item.repairClass}}">请选择保养分类</view>
<view style="font-size: 14px;" wx:else>{{item.repairClass_dictText}}</view>
<view class="arrow"></view>
</view>
</view>
</view>
</view>
<view class="row">
<view class="label">保养内容</view>
<view class="val">
<input type="text" placeholder="请输入" value="{{ item.repairContent }}" data-index="{{index}}" data-key="repairContent" value="{{ item.repairContent }}" data-index="{{index}}" data-key="repairContent" bindblur="changeOfferVal" />
<image src="../../../../images/icon_delete.png" mode="" class="delete" data-fieldName="repairContent" data-index="{{index}}" catch:tap="resetData" />
</view>
</view>
<view class="row">
<view class="label">数量</view>
<view class="num-val">
<view class="down" data-index="{{index}}" data-type="down" catch:tap="changeNum">-</view>
<input type="digit" placeholder="请输入" value="{{ item.quantity }}" data-index="{{index}}" data-key="quantity" data-fixed="0" bindblur="changeOfferVal"/>
<view class="up" data-index="{{index}}" data-type="up" catch:tap="changeNum">+</view>
</view>
</view>
<view class="row">
<view class="label">材料单价</view>
<view class="val">
<input type="digit" placeholder="请输入" value="{{ item.unitPrice }}" data-index="{{index}}" data-key="unitPrice" data-fixed="2" bindblur="changeOfferVal" />
<view class="unit">元</view>
</view>
</view>
<view class="row">
<view class="label">工时</view>
<view class="val">
<input type="digit" placeholder="请输入" value="{{ item.workHours }}" data-index="{{index}}" data-key="workHours" data-fixed="2" bindblur="changeOfferVal" />
<view class="unit">小时</view>
</view>
</view>
<view class="row">
<view class="label">工时单价</view>
<view class="val">
<input type="digit" max='100' placeholder="请输入" value="{{ item.workHoursCost}}" data-index="{{index}}" data-fixed="2" data-key="workHoursCost" bindblur="changeOfferVal" />
<view class="unit">元</view>
</view>
</view>
<view class="total-row">
<view class="total">费用小记 <view class="num">{{ item.totalCost }}</view> 元</view>
<view class="btn-del" data-index="{{index}}" catch:tap="delOffer">删除</view>
</view>
</view>
<van-popup show="{{classifyShow}}" position="bottom" bind:close="hidePicker">
<van-picker data-fieldname="classify" show-toolbar columns="{{filterClassifyOptions}}" bind:confirm="pickerConfirm" bind:cancel="hidePicker">
</van-picker>
</van-popup>
</view>
<view class="btn-hide" wx:if="{{showMore}}" catch:tap="showDetail">
<image src="../../../../images/icon_up.png" mode="" /> 收起明细
</view>
<view class="btn-show" wx:if="{{!showMore}}" catch:tap="showDetail">
<image src="../../../../images/icon_down.png" mode="" /> 展开明细
</view>
</view>
</view>
<view class="content">
<view class="top">
<view class="left">
<view class="line"></view>
<view class="title">保养费用总计</view>
</view>
<view class="right"></view>
</view>
<view class="row" style="margin: 0 8px 8px 16px;">
<view class="label">材料费</view>
<view class="val">
<input type="digit" placeholder="自动计算" value="{{ materialCost}}" disabled="true" />
<view class="unit">元</view>
</view>
</view>
<view class="row" style="margin: 0 8px 8px 16px;">
<view class="label">工时</view>
<view class="val">
<input type="digit" placeholder="自动计算" value="{{ totalWorkHours}}" disabled="true" />
<view class="unit">小时</view>
</view>
</view>
<view class="row" style="margin: 0 8px 8px 16px;">
<view class="label">工时费用</view>
<view class="val">
<input type="digit" placeholder="自动计算" value="{{ totalWorkHoursCost }}" disabled="true" />
<view class="unit">元</view>
</view>
</view>
<view class="row" style="margin: 0 8px 0 16px;">
<view class="label">保养报价</view>
<view class="val">
<input type="digit" placeholder="自动计算" value="{{ totaCost }}" disabled="true" />
<view class="unit">元</view>
</view>
</view>
</view>
<view class="content">
<view class="top">
<view class="left">
<view class="line"></view>
<view class="title require">内容说明</view>
</view>
<view class="right"></view>
</view>
<view class="marker">
<textarea type="text" maxlength="100" placeholder="最大输入长度为100" style="height: 96rpx;width: 100%;" placeholder-style="color: #949CB5; font-size: 28rpx; font-weight: 400;" value="{{offerContent}}" bindblur="getMarker" />
</view>
</view>
<view class="content">
<view class="top">
<view class="left">
<view class="line"></view>
<view class="title require">保养前(最大上传10张)</view>
</view>
<view class="right"></view>
</view>
<view wx:if="{{echoBeforeFile}}" class="echoFile">
<view class="photo-list" wx:for="{{echoBeforeFile}}" data-index="{{index}}" wx:key="index">
<image src="{{item}}" mode="" data-index="{{index}}" data-image="echoBeforeFile" catch:tap="showImage" />
<view class="del" catchtap="delImg" data-index="{{index}}" data-fieldName="echoBeforeFile">
<image src="../../../../images/btn_del.png" mode="" />
</view>
</view>
</view>
<view class="upload" style="margin-left: 8px;">
<g-upload id="g-upload" maxLength="{{10 - (echoBeforeFile ? echoBeforeFile.length : 0)}}" uploadUrl="{{uploadUrl}}" bind:returnPic="returnPicTwo"></g-upload>
</view>
</view>
<view class="content">
<view class="top">
<view class="left">
<view class="line"></view>
<view class="title require">单据附件(最大上传10张)</view>
</view>
<view class="right"></view>
</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}}" data-fieldName="echoFile">
<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="returnPicOne"></g-upload>
</view>
</view>
</view>
<view class="bottom">
<view class="btn-box">
<view class="btn" catch:tap="bindSend">提交报价</view>
</view>
</view>
</view>
@@ -0,0 +1,6 @@
{
"usingComponents": {
"g-upload": "/components/uploadPic/uploadPic"
},
"navigationBarTitleText": "保养"
}
@@ -0,0 +1,186 @@
/* pages/vehicleMaintenance/maintainSend/maintainSend.wxss */
.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;
}
}
.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;
}
}
.echoFile {
display: flex;
flex-wrap: wrap;
margin-top: 16px;
}
}
.photo-list {
width: 64px;
height: 64px;
margin-left: 8px;
border-radius: 4px;
position: relative;
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;
}
}
}
}
.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;
}
}
.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;
}
}
}
.weui-input {
border-radius: 8px;
border: 1px solid #E6EAF2;
width: calc(100% - 16px);
height: 83px;
padding: 8px;
margin-top: 8px;
}
.radio-group {
margin-top: 16px;
display: block;
.van-radio-group {
display: flex;
}
}
}
@@ -0,0 +1,271 @@
// pages/vehicleMaintenance/maintainSend/maintainSend.ts
import { postAction } from '../../../../api/base';
const dayjs = require('dayjs');
Page({
/**
* 页面的初始数据
*/
data: {
checkIdea: '', // 报修内容
upkeepObject: '' as any, // 保养单数据
checkResult: '' as any, // 评审结果
userInfo: '' as any, // 用户信息
inUpkeepImgUrl: [] as any, // 保养中图片
afterUpkeepImgUrl: [] as any, // 保养后图片
uploadUrl: 'api/vehicles/repair/fileUpload', // 上传图片地址
echoInUpkeep: null as any, // 保养中回显图片
echoAfterUpkeep: null as any // 保养后回显图片
},
// 输入报修内容
textareaInput(e: any) {
this.setData({
checkIdea: e.detail.value
});
},
selectRadio(e: any) {
this.setData({
checkResult: e.currentTarget.dataset.inf
});
},
// 提交申请
submit() {
// 保养中图片
let inRepairImgList = JSON.parse(
JSON.stringify(this.data.inUpkeepImgUrl)
) as any;
// 保养后图片
let afterRepairImgList = JSON.parse(
JSON.stringify(this.data.afterUpkeepImgUrl)
) as any;
// 如何有回显的图片且未删除
if (this.data.echoInUpkeep) {
this.data.echoInUpkeep.forEach((item: any) => {
inRepairImgList.push(item);
});
}
if (this.data.echoAfterUpkeep) {
this.data.echoAfterUpkeep.forEach((item: any) => {
afterRepairImgList.push(item);
});
}
if (inRepairImgList == 0) {
wx.showToast({
title: '请上传保养中照片',
icon: 'none'
});
return;
}
if (afterRepairImgList == 0) {
wx.showToast({
title: '请上传保养后照片',
icon: 'none'
});
return;
}
let params = {
id: this.data.upkeepObject.id, //id
flowStatus: this.data.upkeepObject.flowStatus, //当前流程状态
checkFlag: 1, //审核状态 1-》通过, 2-》不通过
upkeepBill: {},
upkeepAssign: {},
currentUpkeepCheck: {},
upkeepOffer: {
id: this.data.upkeepObject.upkeepOffer.id,
repairDetailList: this.data.upkeepObject.upkeepOffer.repairDetailList,
materialCost: this.data.upkeepObject.upkeepOffer.materialCost, // 材料费
totalWorkHours: this.data.upkeepObject.upkeepOffer.totalWorkHours, //总计工时
totalWorkHoursCost:
this.data.upkeepObject.upkeepOffer.totalWorkHoursCost, //工时费用总计
totaCost: this.data.upkeepObject.upkeepOffer.totaCost, //总计
offerContent: this.data.upkeepObject.upkeepOffer.offerContent, //内容说明
beforeUpkeepImgUrl: this.data.upkeepObject.upkeepOffer
.beforeUpkeepImgUrl
? this.data.upkeepObject.upkeepOffer.beforeUpkeepImgUrl.join(',')
: '', //保养前图片
inUpkeepImgUrl: inRepairImgList ? inRepairImgList.join(',') : '', //保养中图片
afterUpkeepImgUrl: afterRepairImgList
? afterRepairImgList.join(',')
: '', //保养后图片
attachmentUpkeepList:
this.data.upkeepObject.upkeepOffer.attachmentUpkeepList //单据附件,
}
};
wx.showLoading({
title: '加载中',
mask: true
});
postAction('api/vehicles/upkeepBill/submitUpkeepObject', params)
.then((res: any) => {
if (res.code == 200) {
wx.hideLoading();
wx.showToast({
title: '提交成功',
icon: 'none'
});
wx.setStorageSync('message', {
projectName: this.data.upkeepObject.upkeepBill?.projectId_dictText,
plateNumber: this.data.upkeepObject.upkeepBill?.plateNumber,
date: dayjs().format('YYYY-MM-DD HH:mm:ss'),
id: this.data.upkeepObject.id,
flowStatus: this.data.upkeepObject.flowStatus
});
wx.redirectTo({
url: '../message/message',
fail: e => {
console.log(e);
}
});
} else {
wx.hideLoading();
wx.showToast({
title: res.message,
icon: 'none'
});
}
})
.catch((err: any) => {
wx.hideLoading();
wx.showToast({
title: err.message,
icon: 'none'
});
});
},
// 获取图片上传后的数据 保养中
returnPicOne(e: any) {
let list = [] as any;
e.detail.photoList.forEach((item: any) => {
list.push(item.fileUrl);
});
this.setData({
inUpkeepImgUrl: list
});
},
// 保养后
returnPicTwo(e: any) {
let list = [] as any;
e.detail.photoList.forEach((item: any) => {
list.push(item.fileUrl);
});
this.setData({
afterUpkeepImgUrl: list
});
},
// 删除保养中回显图片
delInImg(e: any) {
let that = this;
let { index } = e.currentTarget.dataset;
let { echoInUpkeep } = this.data;
wx.showModal({
title: '提示',
content: '是否删除当前照片',
success(res) {
if (res.confirm) {
echoInUpkeep.splice(index, 1);
that.setData({
echoInUpkeep: echoInUpkeep
});
}
}
});
},
// 删除保养后回显图片
delAfterImg(e: any) {
let that = this;
let { index } = e.currentTarget.dataset;
let { echoAfterUpkeep } = this.data;
wx.showModal({
title: '提示',
content: '是否删除当前照片',
success(res) {
if (res.confirm) {
echoAfterUpkeep.splice(index, 1);
that.setData({
echoAfterUpkeep: echoAfterUpkeep
});
}
}
});
},
getInf() {
// 获取信息
let info = wx.getStorageSync('upkeepObject');
wx.removeStorage({ key: 'upkeepObject' });
console.log('数据有没有问题', info);
// let userInfo = wx.getStorageSync('userInfo');
this.setData({
upkeepObject: info
});
// 回显的图片
if (info.upkeepOffer.inUpkeepImgUrl) {
this.setData({
echoInUpkeep: info.upkeepOffer.inUpkeepImgUrl // 回显附件
});
}
if (info.upkeepOffer.afterUpkeepImgUrl) {
this.setData({
echoAfterUpkeep: info.upkeepOffer.afterUpkeepImgUrl // 回显附件
});
}
},
showImage(event: any) {
let { index, image } = event.currentTarget.dataset;
let list = [] as any;
console.log(123);
if (image == 'echoInUpkeep') {
list = this.data.echoInUpkeep;
} else if (image == 'echoAfterUpkeep') {
list = this.data.echoAfterUpkeep;
}
wx.previewImage({
current: list[index | 0], // 当前显示图片的http链接 默认urls[0]
urls: list // 需要预览的图片http链接列表
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.getInf();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 不放onReady 是因为有可能切出去然后状态改了得跳转到别的页面
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
});
@@ -0,0 +1,38 @@
<!--pages/vehicleMaintenance/maintainSend/maintainSend.wxml-->
<view class="container">
<view class="item-container">
<view class="item">
<view class="title require">保养中(最大上传10张)</view>
<view wx:if="{{echoInUpkeep && echoInUpkeep.length > 0}}" class="echoFile">
<view class="photo-list" wx:for="{{echoInUpkeep}}" data-index="{{index}}" wx:key="index">
<image src="{{item}}" mode="" data-index="{{index}}" data-image="echoInUpkeep" catch:tap="showImage" />
<view class="del" catchtap="delInImg" data-index="{{index}}">
<image src="../../../../images/btn_del.png" mode="" />
</view>
</view>
</view>
<view class="upload" style="margin-left: 8px;margin-top: 16px;">
<g-upload id="g-upload" maxLength="{{10 - (echoInUpkeep ? echoInUpkeep.length : 0)}}" uploadUrl="{{uploadUrl}}" bind:returnPic="returnPicOne"></g-upload>
</view>
</view>
<view class="item">
<view class="title require">保养后(最大上传10张)</view>
<view wx:if="{{echoAfterUpkeep && echoAfterUpkeep.length > 0}}" class="echoFile">
<view class="photo-list" wx:for="{{echoAfterUpkeep}}" data-index="{{index}}" wx:key="index">
<image src="{{item}}" mode="" data-index="{{index}}" data-image="echoAfterUpkeep" catch:tap="showImage" />
<view class="del" catchtap="delAfterImg" data-index="{{index}}">
<image src="../../../../images/btn_del.png" mode="" />
</view>
</view>
</view>
<view class="upload" style="margin-left: 8px;margin-top: 16px;">
<g-upload id="g-upload" maxLength="{{10 - (echoAfterUpkeep ? echoAfterUpkeep.length : 0)}}" uploadUrl="{{uploadUrl}}" bind:returnPic="returnPicTwo"></g-upload>
</view>
</view>
</view>
<view class="bottom">
<view class="btn-box">
<view class="btn apply" catch:tap="submit">完成保养</view>
</view>
</view>
</view>