用户上报故障对接接口

This commit is contained in:
小朱 2025-04-18 17:23:27 +08:00
parent e7ce5a2eeb
commit 1732c2eb38
2 changed files with 149 additions and 70 deletions

View File

@ -1,15 +1,15 @@
<template> <template>
<view class="container" :style="{ height: scrollHeight -113+ 'px' }"> <view class="container" :style="{ height: scrollHeight -113+ 'px' }">
<scroll-view class="scroll-container" :scroll-y="isScrollY" :style="{ height: scrollHeight-113 + 'px' }"> <scroll-view class="scroll-container" :scroll-y="isScrollY" :style="{ height: scrollHeight-113 + 'px' }">
<uni-card>
<view class="padding">
<uni-forms> <uni-forms>
<uni-forms-item label="车辆编号"> <uni-forms-item label="车辆编号">
<uni-easyinput :disabled="true" v-model="bikeCode" placeholder="车辆编号" /> <uni-easyinput :disabled="true" v-model="bikeCode" placeholder="车辆编号" />
</uni-forms-item> </uni-forms-item>
<span @click="goToSH">去审核</span> <span @click="goToSH">去审核</span>
</uni-forms> </uni-forms>
</view>
</uni-card>
<view class=""> <view class="">
<view class="containerup"> <view class="containerup">
<view class="titleup"> <view class="titleup">
@ -116,7 +116,7 @@
const delChangeImg = (res) => { const delChangeImg = (res) => {
const fileUniqueKey = fileLists.value[res.index].fileUniqueKey; const fileUniqueKey = fileLists.value[res.index].fileUniqueKey;
fileLists.value.splice(res.index, 1); fileLists.value.splice(res.index, 1);
api.callEbikeInfo("deletedFile?fileUniqueKey=" + fileUniqueKey, {}, "get"); api.callMaintenanceApi("ebikeOrdersSystem/deletedFile?fileUniqueKey=" + fileUniqueKey, {}, "get");
} }
const isScrollY = ref(true) const isScrollY = ref(true)
const getEndDetail = ({ const getEndDetail = ({
@ -273,24 +273,24 @@
.filter(name => name !== null) .filter(name => name !== null)
]; ];
const params = { const params = {
// "faultReportId": "string", // "faultReportId": "string",
"bikeCode": bikeCode.value, "bikeCode": bikeCode.value,
// "position": "string", // "position": "string",
"faultPart": faultPart.join("|"), "faultPart": faultPart.join("|"),
"faultDescription": bzxx.value, "faultDescription": bzxx.value,
// "reportAt": "string", // "reportAt": "string",
// "isDeleted": "string", // "isDeleted": "string",
// "updatedAt": "string", // "updatedAt": "string",
// "deletedAt": "string", // "deletedAt": "string",
"reportUser": wechat_user.value.nickname, "reportUser": wechat_user.value.nickname,
"userMobile": wechat_user.value.mobile, "userMobile": wechat_user.value.mobile,
"reportSource": "微信小程序", "reportSource": "微信小程序",
// "handleState": "string", // "handleState": "string",
"longitude": Number(ebikeInfo.value.longitude), "longitude": Number(ebikeInfo.value.longitude),
"latitude": Number(ebikeInfo.value.latitude), "latitude": Number(ebikeInfo.value.latitude),
"orderCode": orderCode.value, "orderCode": orderCode.value,
// "workorderId": "string", // "workorderId": "string",
"attachmentFiles": fileLists.value "attachmentFiles": fileLists.value
} }
api.callOrdereApi("ebikeUserFaultreport/save", params).then((res) => { api.callOrdereApi("ebikeUserFaultreport/save", params).then((res) => {
if (res.code == 200) { if (res.code == 200) {
@ -357,14 +357,14 @@
const currentCoordinates = ref(null); const currentCoordinates = ref(null);
onLoad((options) => { onLoad((options) => {
userInfo.value = uni.getStorageSync('userInfo'); userInfo.value = uni.getStorageSync('userInfo');
wechat_user.value = uni.getStorageSync('wechat_user'); wechat_user.value = uni.getStorageSync('wechat_user');
const systemInfo = uni.getSystemInfoSync(); const systemInfo = uni.getSystemInfoSync();
const screenHeight = systemInfo.screenHeight; const screenHeight = systemInfo.screenHeight;
const statusBarHeight = systemInfo.statusBarHeight; const statusBarHeight = systemInfo.statusBarHeight;
scrollHeight.value = screenHeight - statusBarHeight; scrollHeight.value = screenHeight - statusBarHeight;
if (options.bikeCode) { if (options.bikeCode) {
bikeCode.value = options.bikeCode; bikeCode.value = options.bikeCode;
orderCode.value =options.orderCode; orderCode.value = options.orderCode;
} }
}) })
onMounted(() => { onMounted(() => {
@ -392,7 +392,7 @@
.container { .container {
height: 100vh; height: 100vh;
padding: 0px 0px; padding: 0px 0px;
background-color: #f3f4f6; background-color: #ffffff;
} }
.example { .example {
@ -529,6 +529,7 @@
.chetoubox { .chetoubox {
margin: 10px; margin: 10px;
border-radius: 10px;
padding: 10px; padding: 10px;
box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.3) box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.3)
} }

View File

@ -20,7 +20,7 @@
<view> <view>
<view v-show="selectedTab === 'consume'"> <view v-show="selectedTab === 'consume'">
<!-- 审核处理的具体内容 --> <!-- 审核处理的具体内容 -->
<scroll-view scroll-y="true" :style="{ height: scrollHeight-145 + 'px' }"> <scroll-view scroll-y="true" :style="{ height: (scrollHeight - 190) + 'px', marginTop: '10px' }">
<view class="content"> <view class="content">
<view class="card"> <view class="card">
<view class="card-header"> <view class="card-header">
@ -70,17 +70,20 @@
</view> </view>
</view> </view>
</view> </view>
<view class="nav-panel">
<uni-goods-nav :fill="true" :options="[]" :buttonGroup="navButtonGroup"
@buttonClick="navButtonClick" />
</view>
</scroll-view> </scroll-view>
<view class="nav-panel">
<view class="warning-message">
<uni-icons type="info" color="#c1c1c1" size="20"></uni-icons>
<span>故障上报属实后车辆不可被用户租用</span>
</view>
<uni-goods-nav :fill="true" :options="[]" :buttonGroup="navButtonGroup"
@buttonClick="navButtonClick" />
</view>
</view> </view>
<view v-show="selectedTab === 'report'"> <view v-show="selectedTab === 'report'">
<view class=""> <view class="">
<view class="query-selector"> <view class="query-selector">
<view class="query-option" :class="{ 'query-select': selectedOption === option }" <view class="query-option" :class="{ 'query-select': selectedOption === option }"
v-for="(option, index) in options" :key="index" @click="selectOption(option)"> v-for="(option, index) in options" :key="index" @click="selectOption(option)">
@ -90,9 +93,9 @@
<scroll-view scroll-y="true" :style="{ height: scrollHeight-170 + 'px' }"> <scroll-view scroll-y="true" :style="{ height: scrollHeight-170 + 'px' }">
<view v-for="(item,index) in dataList" :key="index"> <view v-for="(item,index) in dataList" :key="index">
<uni-card> <view style=" margin: 8px; background: #fff; border-radius: 10px; padding: 5px 10px;">
<uni-forms> <uni-forms>
<view class="flex justify-between" style="margin: 5px 0px;"> <view class="flex justify-between" style="margin: 10px 0px;">
<view class="label"> <view class="label">
用户姓名 用户姓名
</view> </view>
@ -100,13 +103,13 @@
<view class="deepBlackBoldText"> <view class="deepBlackBoldText">
{{ item.reportUser }} {{ item.reportUser }}
</view> </view>
<view v-if="item.phoneNumber" @click="makeACall(item.phoneNumber)"> <view v-if="item.mobile" @click="makeACall(item.mobile)">
<text style="font-size: 18px; color: orange;" <text style="font-size: 18px; color: orange;"
class="cuIcon-phone"></text> class="cuIcon-phone"></text>
</view> </view>
</view> </view>
</view> </view>
<view class="flex justify-between" style="margin: 5px 0px;"> <view class="flex justify-between" style="margin: 10px 0px;">
<view class="label"> <view class="label">
上报来源 上报来源
</view> </view>
@ -114,7 +117,7 @@
{{ item.reportSource }} {{ item.reportSource }}
</view> </view>
</view> </view>
<view class="flex justify-between" style="margin: 5px 0px;"> <view class="flex justify-between" style="margin: 10px 0px;">
<view class="label"> <view class="label">
订单编号 订单编号
</view> </view>
@ -128,7 +131,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="flex justify-between" style="margin: 5px 0px;"> <view class="flex justify-between" style="margin: 10px 0px;">
<view class="label"> <view class="label">
上报时间 上报时间
</view> </view>
@ -136,7 +139,7 @@
{{ item.reportAt }} {{ item.reportAt }}
</view> </view>
</view> </view>
<view class="flex justify-between" style="margin: 5px 0px;"> <view class="flex justify-between" style="margin: 10px 0px;">
<view class="label"> <view class="label">
故障部件 故障部件
</view> </view>
@ -144,7 +147,7 @@
{{ item.faultPart }} {{ item.faultPart }}
</view> </view>
</view> </view>
<view class="flex justify-between" style="margin: 5px 0px;"> <view class="flex justify-between" style="margin: 10px 0px;">
<view class="label"> <view class="label">
故障原因 故障原因
</view> </view>
@ -152,21 +155,21 @@
{{ item.faultDescription }} {{ item.faultDescription }}
</view> </view>
</view> </view>
<view class="flex justify-between" style="margin: 5px 0px;"> <view class="flex justify-between" style="margin: 10px 0px;">
<view class="label"> <view class="label">
上报图片 上报图片
</view> </view>
<view class="deepBlackBoldText" style="width: 75%;"> <view class="deepBlackBoldText" style="width: 75%;">
<uni-file-picker readonly="true" limit="9" <uni-file-picker readonly="true" limit="9"
:value="formatImageFiles(item.attachmentFiles)"></uni-file-picker> :value="item.reportAttachments"></uni-file-picker>
</view> </view>
</view> </view>
</uni-forms> </uni-forms>
</uni-card>
<view style="height: 20px;">
</view> </view>
</view> </view>
<view style="height: 10px;">
</view>
</scroll-view> </scroll-view>
</view> </view>
@ -258,11 +261,11 @@
const baseFormData = ref([]); const baseFormData = ref([]);
const results = ref([{ const results = ref([{
text: '属实', text: '属实',
value: 0 value: 1
}, },
{ {
text: '虚假', text: '虚假',
value: 1 value: 0
} }
]); ]);
@ -302,47 +305,81 @@
} }
const delChangeImg = (res) => { const delChangeImg = (res) => {
const fileUniqueKey = fileLists.value[res.index].fileUniqueKey; const fileUniqueKey = fileLists.value[res.index].fileUniqueKey;
if (!fileLists.value[res.index].nodelete) {
api.callEbikeInfo("deletedFile?fileUniqueKey=" + fileUniqueKey, {}, "get");
}
fileLists.value.splice(res.index, 1); fileLists.value.splice(res.index, 1);
api.callEbikeInfo("deletedFile?fileUniqueKey=" + fileUniqueKey, {}, "get");
} }
const userInfo = ref(null);
onLoad((options) => { onLoad((options) => {
const systemInfo = uni.getSystemInfoSync(); const systemInfo = uni.getSystemInfoSync();
userInfo.value = uni.getStorageSync('userInfo');
const screenHeight = systemInfo.screenHeight; const screenHeight = systemInfo.screenHeight;
const statusBarHeight = systemInfo.statusBarHeight; const statusBarHeight = systemInfo.statusBarHeight;
scrollHeight.value = screenHeight - statusBarHeight; scrollHeight.value = screenHeight - statusBarHeight;
bikeCode.value = "250306001002"; bikeCode.value = "250306001002";
loadMoreData(); showInfo();
}) })
onMounted(() => { onMounted(() => {
// //
}); });
const formatImageFiles = (data) => {
let imglist = []; const showInfo = () => {
data.forEach(res => { api.callMaintenanceApi("ebikeFaultreportReview/getInfo?bikeCode=" + bikeCode.value, {}, 'get').then((
let map = { res) => {
url: res.fileUrl, if (res.code == 200) {
extname: 'png', workorderId.value = res.data.reviewId;
name: res.fileName loadMoreData();
}; } else {
imglist.push(map);
}) loadMoreData();
return imglist; }
});
} }
const workorderId = ref("")
const reportfaults = ref(null); const reportfaults = ref(null);
const dataList = ref([]) const dataList = ref([])
const dataListAll = ref([]); const dataListAll = ref([]);
const loadMoreData = () => { const loadMoreData = () => {
// //
api.callOrdereApi("ebikeUserFaultreport/list?bikeCode=" + bikeCode.value, {}, 'get').then(( let params = {}
if (workorderId.value) {
params = {
"bikeCode": bikeCode.value,
"workorderId": workorderId.value
}
} else {
params = {
"bikeCode": bikeCode.value
}
}
api.callMaintenanceApi("ebikeFaultreportReview/userFaultreports", params).then((
res) => { res) => {
if (res.code == 200) { if (res.code == 200) {
dataListAll.value = res.data; dataListAll.value = res.data;
updateOptions(res.data, options.value); updateOptions(res.data, options.value);
dataList.value = res.data; dataList.value = res.data;
if (!workorderId.value) {
updateOptions(res.data, faultyParts.value);
collectAndSaveImages(res.data);
}
} }
}); });
}; };
const collectAndSaveImages = (data) => {
data.forEach(res => {
res.reportAttachments.forEach(s => {
s.nodelete = true; // nodelete
});
fileLists.value = fileLists.value.concat(res.reportAttachments); //
});
}
function updateOptions(dataList, options) { function updateOptions(dataList, options) {
dataList.forEach(res => { dataList.forEach(res => {
// faultPart "|" // faultPart "|"
@ -370,13 +407,12 @@
// //
const addFaultyPart = () => { const addFaultyPart = () => {
// //
popup.value.open("center");
let data = faultyParts.value; let data = faultyParts.value;
selectedParts.value = []; selectedParts.value = [];
data.forEach(res => { data.forEach(res => {
selectedParts.value.push(res); selectedParts.value.push(res);
}) })
popup.value.open("center");
}; };
// //
@ -388,16 +424,41 @@
popup.value.close("center"); popup.value.close("center");
} }
const navButtonClick = (index, content) => { const navButtonClick = (index, content) => {
if (!checkscan()) {
return
}
uni.showModal({ uni.showModal({
title: '确认提交', title: '确认提交',
content: '您确定要进行提交操作吗?', content: '您确定要进行提交操作吗?',
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
const params = {
// "reviewId": "string",
"faultParts": faultyParts.value.join("|"),
"result": baseFormData.value.result,
"remark": baseFormData.value.remark,
"bikeCode": bikeCode.value,
// "reviewTime": "string",
"reviewer": userInfo.value.staffId,
// "isDelete": "string",
// "deleteTime": "string",
// "dealState": "string",
"attachmentFiles": fileLists.value,
"faultReports": dataListAll.value
}
api.callMaintenanceApi("ebikeFaultreportReview/save", params).then(res => {
if (res.code == 200) {
uni.showToast({
title: '提交成功',
icon: 'success',
duration: 500
});
setTimeout(() => {
uni.switchTab({
url: "/pages/user/mine/MePage"
})
}, 500);
}
})
} else if (res.cancel) { } else if (res.cancel) {
console.log('用户取消出库'); console.log('用户取消出库');
} }
@ -528,7 +589,6 @@
} }
.content { .content {
margin-top: 10px;
padding-bottom: 70px; padding-bottom: 70px;
padding: 10px; padding: 10px;
background-color: #fff; background-color: #fff;
@ -580,7 +640,8 @@
.fault-parts-container { .fault-parts-container {
width: 280px; width: 280px;
padding: 20px 10px; padding: 10px 10px;
border-radius: 10px;
height: auto; height: auto;
} }
@ -626,8 +687,9 @@
.deepBlackBoldText { .deepBlackBoldText {
color: rgb(134 134 134); color: rgb(134 134 134);
overflow-wrap: break-word; overflow-wrap: break-word;
font-size: 14px; font-size: 14px;
line-height: 20px;
} }
.uni-card__header { .uni-card__header {
@ -662,4 +724,20 @@
color: #ffffff; color: #ffffff;
background: rgb(0, 132, 255); background: rgb(0, 132, 255);
} }
.uni-popup .uni-popup__wrapper {
border-radius: 10px;
}
/* 警告信息样式 */
.warning-message {
display: flex;
align-items: center;
font-size: 12px;
letter-spacing: 1px;
gap: 8px;
color: #c1c1c1;
padding-left: 20px;
padding-top: 10px;
}
</style> </style>