init
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"g-upload": "/components/uploadPic/uploadPic",
|
||||
"van-popup": "@vant/weapp/popup/index",
|
||||
"van-datetime-picker": "@vant/weapp/datetime-picker/index"
|
||||
},
|
||||
"navigationBarTitleText": "事故处理反馈"
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
/* pages/backlog/accidentFeedback/accidentFeedback.wxss */
|
||||
.container {
|
||||
height: 100vh;
|
||||
padding-top: 2px;
|
||||
box-sizing: border-box;
|
||||
background: #EFF1F4;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
.content {
|
||||
max-height: calc(100vh - 110px);
|
||||
padding: 12px 8px 4px;
|
||||
background: #fff;
|
||||
border-radius: 0 0 8px 8px;
|
||||
overflow-y: auto;
|
||||
.row {
|
||||
width: 100%;
|
||||
min-height: 36px;
|
||||
padding: 8px 10px;
|
||||
margin-bottom: 8px;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0px 1px 0px 0px #E6EAF2;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
.label {
|
||||
color: #2F3B50;
|
||||
font-size: 14px;
|
||||
}
|
||||
.select {
|
||||
width: 70%;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
picker {
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
position: relative;
|
||||
.picker {
|
||||
width: 100%;
|
||||
height: 38px;
|
||||
padding-right: 20px;
|
||||
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: 4px;
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
}
|
||||
}
|
||||
.date-select {
|
||||
width: 70%;
|
||||
padding-right: 20px;
|
||||
text-align: right;
|
||||
position: relative;
|
||||
.arrow {
|
||||
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: 4px;
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
}
|
||||
.marker {
|
||||
width: 100%;
|
||||
margin-top: 8px;
|
||||
color: #949CB5;
|
||||
font-size: 14px;
|
||||
}
|
||||
.upload {
|
||||
width: 100%;
|
||||
margin-top: 8px;
|
||||
.upload-btn {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
background: #ECF1FF;
|
||||
border-radius: 4px;
|
||||
border: 1px dashed #4381FC;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
image {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin: 16rpx 0 8rpx;
|
||||
}
|
||||
.val {
|
||||
color: #4381FC;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
// pages/backlog/accidentFeedback/accidentFeedback.ts
|
||||
import { putAction } from '../../../api/base';
|
||||
const dayjs = require('dayjs');
|
||||
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
detailInf: {} as any,
|
||||
currentDate: new Date().getTime(),
|
||||
dateTimeStr: '请选择时间',
|
||||
options: [
|
||||
{
|
||||
name: '请选择',
|
||||
type: ''
|
||||
},
|
||||
{
|
||||
name: '是',
|
||||
type: 1
|
||||
},
|
||||
{
|
||||
name: '否',
|
||||
type: 0
|
||||
}
|
||||
],
|
||||
selectIndex: 0,
|
||||
selectOption: {} as any,
|
||||
marker: '',
|
||||
photoList: {
|
||||
accidentCertificatePhoto: [],
|
||||
compensationAgreementPhoto: [],
|
||||
lossAssessmentPhoto: [],
|
||||
otherPhoto: []
|
||||
} as any,
|
||||
uploadUrl: 'api/vehicles/accidentInfo/upload'
|
||||
},
|
||||
bindPicker(e: any) {
|
||||
console.log(e.detail.value);
|
||||
let index = Number(e.detail.value);
|
||||
this.setData({
|
||||
selectIndex: index,
|
||||
selectOption: this.data.options[index]
|
||||
});
|
||||
},
|
||||
showDateTimePicker() {
|
||||
this.setData({
|
||||
show: true
|
||||
});
|
||||
},
|
||||
dateOnInput(event: any) {
|
||||
console.log(event.detail);
|
||||
|
||||
this.setData({
|
||||
currentDate: event.detail,
|
||||
dateTimeStr: dayjs(new Date(event.detail)).format('YYYY-MM-DD HH:mm'),
|
||||
show: false
|
||||
});
|
||||
},
|
||||
getMarker(e: any) {
|
||||
this.setData({
|
||||
marker: e.detail.value
|
||||
});
|
||||
},
|
||||
onClose() {
|
||||
this.setData({
|
||||
show: false
|
||||
});
|
||||
},
|
||||
returnPic(e: any) {
|
||||
console.log(e.detail.photoList);
|
||||
let urlList = [] as any;
|
||||
e.detail.photoList.forEach((item: any) => {
|
||||
urlList.push(item.fileUrl);
|
||||
});
|
||||
let tmp = this.data.photoList;
|
||||
tmp[e.currentTarget.dataset.key] = urlList;
|
||||
this.setData({
|
||||
photoList: tmp
|
||||
});
|
||||
},
|
||||
|
||||
checkStr(str: string) {
|
||||
let returnStr = '';
|
||||
let spaceRegex = /^\S*$/;
|
||||
let regex = /[!@#$%^&*?><|\\\\]/;
|
||||
let tooLong = str.length > 32;
|
||||
if (!spaceRegex.test(str)) {
|
||||
returnStr = '不支持含有空格';
|
||||
} else if (regex.test(str)) {
|
||||
returnStr = '不支持特殊字符';
|
||||
} else if (tooLong) {
|
||||
returnStr = '输入长度不得超过32个字符';
|
||||
} else {
|
||||
returnStr = '';
|
||||
}
|
||||
return returnStr;
|
||||
},
|
||||
bindSend() {
|
||||
let parms = this.data.detailInf;
|
||||
parms.accidentProgress = Object.assign(parms.accidentProgress, {
|
||||
accidentCertificatePhoto:
|
||||
this.data.photoList.accidentCertificatePhoto.join(','),
|
||||
compensationAgreementPhoto:
|
||||
this.data.photoList.compensationAgreementPhoto.join(','),
|
||||
lossAssessmentPhoto: this.data.photoList.lossAssessmentPhoto.join(','),
|
||||
otherPhoto: this.data.photoList.otherPhoto.join(','),
|
||||
remark: this.data.marker,
|
||||
closingTime: this.data.dateTimeStr,
|
||||
caseClosed: this.data.selectOption.type
|
||||
});
|
||||
if (this.data.selectIndex == 0) {
|
||||
wx.showToast({
|
||||
title: '请选择是否结案',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (parms.accidentProgress.closingTime == '请选择时间') {
|
||||
wx.showToast({
|
||||
title: '请选择结案时间',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 验证非必填
|
||||
if (parms.accidentProgress.remark) {
|
||||
let msg = this.checkStr(parms.accidentProgress.remark);
|
||||
if (msg) {
|
||||
wx.showToast({
|
||||
title: '备注:' + msg,
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
console.log(parms);
|
||||
putAction('api/vehicles/accidentInfo/smallprogramEdit', parms).then(
|
||||
(res: any) => {
|
||||
if (res.code == 200) {
|
||||
console.log(res.result);
|
||||
// setTimeout(() => {
|
||||
// wx.navigateBack({ delta: 2 });
|
||||
// }, 1500);
|
||||
wx.navigateTo({
|
||||
url: '../backlogFeedback/backlogFeedback',
|
||||
fail: e => {
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res.message,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
// 接收传参
|
||||
const eventChannel = this.getOpenerEventChannel();
|
||||
|
||||
eventChannel &&
|
||||
eventChannel.on &&
|
||||
eventChannel.on('eventName', (data: any) => {
|
||||
console.log('接收参数', data);
|
||||
this.setData({
|
||||
detailInf: data
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {}
|
||||
});
|
||||
@@ -0,0 +1,86 @@
|
||||
<!--pages/backlog/accidentFeedback/accidentFeedback.wxml-->
|
||||
<view class="container">
|
||||
<view class="content">
|
||||
<view class="row">
|
||||
<view class="label">是否结案</view>
|
||||
<view class="select">
|
||||
<picker bindchange="bindPicker" value="{{selectIndex}}" range-key="name" range="{{options}}">
|
||||
<view class="picker project-select">
|
||||
{{options[selectIndex].name}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="label">结案时间</view>
|
||||
<view class="date-select" catch:tap="showDateTimePicker">
|
||||
{{ dateTimeStr }}
|
||||
<view class="arrow"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="label">备注</view>
|
||||
<view class="marker">
|
||||
<textarea type="text"
|
||||
placeholder="请输入备注"
|
||||
style="height: 96rpx;"
|
||||
placeholder-style="color: #949CB5; font-size: 28rpx; font-weight: 400;"
|
||||
value="{{marker}}"
|
||||
bindinput="getMarker"/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="label">事故认定书</view>
|
||||
<view class="upload">
|
||||
<g-upload
|
||||
maxLength="{{10}}"
|
||||
uploadUrl="{{uploadUrl}}"
|
||||
data-key="accidentCertificatePhoto"
|
||||
bind:returnPic="returnPic"></g-upload>
|
||||
</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="label">赔偿协议书</view>
|
||||
<view class="upload">
|
||||
<g-upload
|
||||
maxLength="{{10}}"
|
||||
uploadUrl="{{uploadUrl}}"
|
||||
data-key="compensationAgreementPhoto"
|
||||
bind:returnPic="returnPic"></g-upload>
|
||||
</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="label">定损单</view>
|
||||
<view class="upload">
|
||||
<g-upload
|
||||
maxLength="{{10}}"
|
||||
uploadUrl="{{uploadUrl}}"
|
||||
data-key="lossAssessmentPhoto"
|
||||
bind:returnPic="returnPic"></g-upload>
|
||||
</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="label">其他定损理赔资料</view>
|
||||
<view class="upload">
|
||||
<g-upload
|
||||
maxLength="{{10}}"
|
||||
uploadUrl="{{uploadUrl}}"
|
||||
data-key="otherPhoto"
|
||||
bind:returnPic="returnPic"></g-upload>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom">
|
||||
<view class="btn-box">
|
||||
<view class="btn" catch:tap="bindSend">已处理</view>
|
||||
</view>
|
||||
</view>
|
||||
<van-popup show="{{ show }}" position="bottom" bind:close="onClose">
|
||||
<van-datetime-picker
|
||||
type="datetime"
|
||||
value="{{ currentDate }}"
|
||||
bind:confirm="dateOnInput"
|
||||
bind:cancel="onClose"
|
||||
/>
|
||||
</van-popup>
|
||||
</view>
|
||||
Reference in New Issue
Block a user