init
This commit is contained in:
@@ -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,264 @@
|
||||
// pages/vehicleMaintenance/maintainSend/maintainSend.ts
|
||||
import { postAction } from '../../../../api/base';
|
||||
const dayjs = require('dayjs');
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
checkIdea: '', // 报修内容
|
||||
repairObject: '' as any, // 维修单数据
|
||||
checkResult: '' as any, // 评审结果
|
||||
userInfo: '' as any, // 用户信息
|
||||
inRepairImgUrl: [] as any, // 维修中图片
|
||||
afterRepairImgUrl: [] as any, // 维修后图片
|
||||
uploadUrl: 'api/vehicles/repair/fileUpload', // 上传图片地址
|
||||
echoInRepair: null as any, // 维修中回显图片
|
||||
echoAfterRepair: 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.inRepairImgUrl)
|
||||
) as any;
|
||||
// 维修后图片
|
||||
let afterRepairImgList = JSON.parse(
|
||||
JSON.stringify(this.data.afterRepairImgUrl)
|
||||
) as any;
|
||||
// 如何有回显的图片且未删除
|
||||
if (this.data.echoInRepair) {
|
||||
this.data.echoInRepair.forEach((item: any) => {
|
||||
inRepairImgList.push(item);
|
||||
});
|
||||
}
|
||||
if (this.data.echoAfterRepair) {
|
||||
this.data.echoAfterRepair.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.repairObject.id, //id
|
||||
flowStatus: this.data.repairObject.flowStatus, //当前流程状态
|
||||
checkFlag: 1, //审核状态 1-》通过, 2-》不通过
|
||||
repairInfo: {},
|
||||
repairAssign: {},
|
||||
currentRepairCheck: {},
|
||||
repairOffer: {
|
||||
id: this.data.repairObject.repairOffer.id,
|
||||
repairDetailList: this.data.repairObject.repairOffer.repairDetailList,
|
||||
materialCost: this.data.repairObject.repairOffer.materialCost, // 材料费
|
||||
totalWorkHours: this.data.repairObject.repairOffer.totalWorkHours, //总计工时
|
||||
totalWorkHoursCost:
|
||||
this.data.repairObject.repairOffer.totalWorkHoursCost, //工时费用总计
|
||||
repairCost: this.data.repairObject.repairOffer.repairCost, //联维修报价
|
||||
content: this.data.repairObject.repairOffer.content, //内容说明
|
||||
inRepairImgUrl: inRepairImgList ? inRepairImgList.join(',') : '', //维修中图片
|
||||
afterRepairImgUrl: afterRepairImgList
|
||||
? afterRepairImgList.join(',')
|
||||
: '', //维修后图片
|
||||
attachmentList: this.data.repairObject.repairOffer.attachmentList //单据附件,
|
||||
}
|
||||
};
|
||||
wx.showLoading({
|
||||
title: '加载中',
|
||||
mask: true
|
||||
});
|
||||
postAction('api/vehicles/repair/submitRepairObject', params)
|
||||
.then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
title: '提交成功',
|
||||
icon: 'none'
|
||||
});
|
||||
wx.setStorageSync('message', {
|
||||
projectName: this.data.repairObject.repairInfo?.projectId_dictText,
|
||||
plateNumber: this.data.repairObject.repairInfo?.plateNumber,
|
||||
date: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
id: this.data.repairObject.id,
|
||||
flowStatus: this.data.repairObject.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({
|
||||
inRepairImgUrl: list
|
||||
});
|
||||
},
|
||||
// 维修后
|
||||
returnPicTwo(e: any) {
|
||||
let list = [] as any;
|
||||
e.detail.photoList.forEach((item: any) => {
|
||||
list.push(item.fileUrl);
|
||||
});
|
||||
this.setData({
|
||||
afterRepairImgUrl: list
|
||||
});
|
||||
},
|
||||
// 删除维修中回显图片
|
||||
delInImg(e: any) {
|
||||
let that = this;
|
||||
let { index } = e.currentTarget.dataset;
|
||||
let { echoInRepair } = this.data;
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '是否删除当前照片',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
echoInRepair.splice(index, 1);
|
||||
that.setData({
|
||||
echoInRepair: echoInRepair
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 删除维修后回显图片
|
||||
delAfterImg(e: any) {
|
||||
let that = this;
|
||||
let { index } = e.currentTarget.dataset;
|
||||
let { echoAfterRepair } = this.data;
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '是否删除当前照片',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
echoAfterRepair.splice(index, 1);
|
||||
that.setData({
|
||||
echoAfterRepair: echoAfterRepair
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
getInf() {
|
||||
// 获取信息
|
||||
let info = wx.getStorageSync('repairObject');
|
||||
wx.removeStorage({ key: 'repairObject' });
|
||||
// let userInfo = wx.getStorageSync('userInfo');
|
||||
this.setData({
|
||||
repairObject: info
|
||||
});
|
||||
// 回显的图片
|
||||
if (info.repairOffer.inRepairImgUrl) {
|
||||
this.setData({
|
||||
echoInRepair: info.repairOffer.inRepairImgUrl // 回显附件
|
||||
});
|
||||
}
|
||||
if (info.repairOffer.afterRepairImgUrl) {
|
||||
this.setData({
|
||||
echoAfterRepair: info.repairOffer.afterRepairImgUrl // 回显附件
|
||||
});
|
||||
}
|
||||
},
|
||||
showImage(event: any) {
|
||||
let { index, image } = event.currentTarget.dataset;
|
||||
let list = [] as any;
|
||||
console.log(123);
|
||||
|
||||
if (image == 'echoInRepair') {
|
||||
list = this.data.echoInRepair;
|
||||
} else if (image == 'echoAfterRepair') {
|
||||
list = this.data.echoAfterRepair;
|
||||
}
|
||||
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="{{echoInRepair && echoInRepair.length > 0}}" class="echoFile">
|
||||
<view class="photo-list" wx:for="{{echoInRepair}}" data-index="{{index}}" wx:key="index">
|
||||
<image src="{{item}}" mode="" data-index="{{index}}" data-image="echoInRepair" 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 - (echoInRepair ? echoInRepair.length : 0)}}" uploadUrl="{{uploadUrl}}" bind:returnPic="returnPicOne"></g-upload>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="title require">维修后(最大上传10张)</view>
|
||||
<view wx:if="{{echoAfterRepair && echoAfterRepair.length > 0}}" class="echoFile">
|
||||
<view class="photo-list" wx:for="{{echoAfterRepair}}" data-index="{{index}}" wx:key="index">
|
||||
<image src="{{item}}" mode="" data-index="{{index}}" data-image="echoAfterRepair" 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 - (echoAfterRepair ? echoAfterRepair.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>
|
||||
Reference in New Issue
Block a user