|
@@ -1,4 +1,5 @@
|
|
|
// pagesPublic/pages/work-order-detail/work-order-detail.js
|
|
|
+const FormData = require('../../pages/menu/formData.js');
|
|
|
import {
|
|
|
imgUrl
|
|
|
} from "../api/request"
|
|
@@ -22,7 +23,9 @@ Page({
|
|
|
statusText2: '待审核',
|
|
|
statusText3: '待上门',
|
|
|
statusText4: '待确认',
|
|
|
- tempFileList: []
|
|
|
+ tempFileList: [],
|
|
|
+ typeList: [],
|
|
|
+ infoId: ''
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -31,113 +34,35 @@ Page({
|
|
|
onLoad(options) {
|
|
|
console.info(options);
|
|
|
this.setData({
|
|
|
- isUser: options.isuser
|
|
|
- });
|
|
|
- request({
|
|
|
- url: '/mini/worker/orderInfo',
|
|
|
- method: 'GET',
|
|
|
- data: {
|
|
|
- 'id': options.id
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- console.info(res)
|
|
|
- let data = res.data;
|
|
|
- this.setData({
|
|
|
- type: data.repairType,
|
|
|
- address: data.maintenanceAddress,
|
|
|
- phone: data.phoneNum,
|
|
|
- arriveTime: data.appointmentTime,
|
|
|
- description: data.userDescription
|
|
|
- });
|
|
|
-
|
|
|
- request({
|
|
|
- url: '/food/getFoodPicByPicId',
|
|
|
- method: 'GET',
|
|
|
- data: {
|
|
|
- 'picId': data.repairPic
|
|
|
- }
|
|
|
- }).then(re => {
|
|
|
- console.info(re)
|
|
|
- if (re.data && re.data.length > 0) {
|
|
|
- let arr = [];
|
|
|
- for (let i in re.data) {
|
|
|
- arr.push(baseUrl + '/' + re.data[i].path);
|
|
|
- }
|
|
|
- this.setData({
|
|
|
- image: arr
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- if (data.status == 0) {
|
|
|
- this.setData({
|
|
|
- checked2: '',
|
|
|
- checked3: '',
|
|
|
- checked4: '',
|
|
|
- });
|
|
|
- } else if (data.status == 1) {
|
|
|
- this.setData({
|
|
|
- checked2: 'checked',
|
|
|
- checked3: '',
|
|
|
- checked4: '',
|
|
|
- statusText2: '已审核'
|
|
|
- });
|
|
|
- } else if (data.status == 2) {
|
|
|
- this.setData({
|
|
|
- checked2: 'checked',
|
|
|
- checked3: 'checked',
|
|
|
- checked4: '',
|
|
|
- statusText2: '已审核',
|
|
|
- statusText3: '已上门'
|
|
|
- });
|
|
|
- } else if (data.status == 3) {
|
|
|
- this.setData({
|
|
|
- checked2: 'checked',
|
|
|
- checked3: 'checked',
|
|
|
- checked4: 'checked',
|
|
|
- statusText2: '已审核',
|
|
|
- statusText3: '已上门',
|
|
|
- statusText4: '已确认'
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.setData({
|
|
|
- checked2: 'checked',
|
|
|
- checked3: 'checked',
|
|
|
- checked4: 'checked',
|
|
|
- statusText2: '已审核',
|
|
|
- statusText3: '已上门',
|
|
|
- statusText4: '已确认'
|
|
|
- });
|
|
|
- }
|
|
|
+ isUser: (options.isuser == 'true' ? true : false),
|
|
|
+ infoId: options.id
|
|
|
});
|
|
|
+ // 设置所有报修类型
|
|
|
+ this.setRepairType(options.id);
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
|
onReady() {
|
|
|
-
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow() {
|
|
|
-
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
onHide() {
|
|
|
-
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
onUnload() {
|
|
|
-
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -169,15 +94,16 @@ Page({
|
|
|
* 上传报修结果图片
|
|
|
*/
|
|
|
uploadImage() {
|
|
|
+ let that = this;
|
|
|
wx.chooseMedia({
|
|
|
success(res) {
|
|
|
console.info(res);
|
|
|
if (res.errMsg == 'chooseMedia:ok') {
|
|
|
- let tempList = this.data.tempFileList;
|
|
|
+ let tempList = that.data.tempFileList;
|
|
|
for (let i in res.tempFiles) {
|
|
|
tempList.push(res.tempFiles[i].tempFilePath);
|
|
|
}
|
|
|
- this.setData({
|
|
|
+ that.setData({
|
|
|
tempFileList: tempList
|
|
|
});
|
|
|
}
|
|
@@ -185,9 +111,21 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
|
|
|
+ /**
|
|
|
+ * 提交维修结果
|
|
|
+ * @param {*} e
|
|
|
+ */
|
|
|
submitReport(e) {
|
|
|
console.info(e)
|
|
|
let complete = this.data.complete;
|
|
|
+ let tempList = this.data.tempFileList;
|
|
|
+ if (complete && tempList.length == 0) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '请上传维修结果照片',
|
|
|
+ icon: 'error'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (!complete && !e.detail.value.reason) {
|
|
|
wx.showToast({
|
|
|
title: '请填写失败原因',
|
|
@@ -202,7 +140,8 @@ Page({
|
|
|
} else {
|
|
|
formData.append('status', -1);
|
|
|
}
|
|
|
- formData.append('workerDescription', e.detail.value.reason);
|
|
|
+ formData.append('id', this.data.infoId);
|
|
|
+ formData.append('workerDescription', e.detail.value.reason ? e.detail.value.reason : '');
|
|
|
// formData.append('userId', wx.getStorageSync('userid'));
|
|
|
for (let i in tempList) {
|
|
|
formData.appendFile('files', tempList[i]);
|
|
@@ -233,4 +172,148 @@ Page({
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置报修类型
|
|
|
+ */
|
|
|
+ setRepairType(id) {
|
|
|
+ request({
|
|
|
+ url: '/mini/worker/getDictByType',
|
|
|
+ method: 'GET',
|
|
|
+ data: {
|
|
|
+ types: 'repair_type',
|
|
|
+ codes: ''
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ // console.info(res)
|
|
|
+ if (res.result) {
|
|
|
+ let data = res.data;
|
|
|
+ this.setData({
|
|
|
+ typeList: data
|
|
|
+ });
|
|
|
+ // 加载工单详情
|
|
|
+ this.loadWorkOrderInfo(id);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 加载工单详情
|
|
|
+ * @param {*} id
|
|
|
+ */
|
|
|
+ loadWorkOrderInfo(id) {
|
|
|
+ wx.showLoading({
|
|
|
+ title: '加载中...'
|
|
|
+ });
|
|
|
+ request({
|
|
|
+ url: '/mini/worker/orderInfo',
|
|
|
+ method: 'GET',
|
|
|
+ data: {
|
|
|
+ 'id': id
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.info(res)
|
|
|
+ let data = res.data;
|
|
|
+ this.setData({
|
|
|
+ type: data.repairType,
|
|
|
+ address: data.maintenanceAddress,
|
|
|
+ phone: data.phoneNum,
|
|
|
+ arriveTime: data.appointmentTime,
|
|
|
+ description: data.userDescription,
|
|
|
+ status: data.status,
|
|
|
+ workerDescription: data.workerDescription
|
|
|
+ });
|
|
|
+ let typeList = this.data.typeList;
|
|
|
+ for (let i in typeList) {
|
|
|
+ if (typeList[i].code == data.repairType) {
|
|
|
+ this.setData({
|
|
|
+ type: typeList[i].codeValue,
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ request({
|
|
|
+ url: '/food/getFoodPicByPicId',
|
|
|
+ method: 'GET',
|
|
|
+ data: {
|
|
|
+ 'picId': data.repairPic
|
|
|
+ }
|
|
|
+ }).then(re => {
|
|
|
+ console.info(re)
|
|
|
+ if (re.data && re.data.length > 0) {
|
|
|
+ let arr = [];
|
|
|
+ for (let i in re.data) {
|
|
|
+ arr.push(baseUrl + '/' + re.data[i].path);
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ image: arr
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (data.resultPic) {
|
|
|
+ request({
|
|
|
+ url: '/food/getFoodPicByPicId',
|
|
|
+ method: 'GET',
|
|
|
+ data: {
|
|
|
+ 'picId': data.repairPic
|
|
|
+ }
|
|
|
+ }).then(re => {
|
|
|
+ console.info(re)
|
|
|
+ if (re.data && re.data.length > 0) {
|
|
|
+ let arr = [];
|
|
|
+ for (let i in re.data) {
|
|
|
+ arr.push(baseUrl + '/' + re.data[i].path);
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ images: arr
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (data.status == 0) {
|
|
|
+ this.setData({
|
|
|
+ checked2: '',
|
|
|
+ checked3: '',
|
|
|
+ checked4: '',
|
|
|
+ });
|
|
|
+ } else if (data.status == 1) {
|
|
|
+ this.setData({
|
|
|
+ checked2: 'checked',
|
|
|
+ checked3: '',
|
|
|
+ checked4: '',
|
|
|
+ statusText2: '已审核'
|
|
|
+ });
|
|
|
+ } else if (data.status == 2) {
|
|
|
+ this.setData({
|
|
|
+ checked2: 'checked',
|
|
|
+ checked3: 'checked',
|
|
|
+ checked4: '',
|
|
|
+ statusText2: '已审核',
|
|
|
+ statusText3: '已上门'
|
|
|
+ });
|
|
|
+ } else if (data.status == 3) {
|
|
|
+ this.setData({
|
|
|
+ checked2: 'checked',
|
|
|
+ checked3: 'checked',
|
|
|
+ checked4: 'checked',
|
|
|
+ statusText2: '已审核',
|
|
|
+ statusText3: '已上门',
|
|
|
+ statusText4: '已确认'
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.setData({
|
|
|
+ checked2: 'checked',
|
|
|
+ checked3: 'checked',
|
|
|
+ checked4: 'checked',
|
|
|
+ statusText2: '已审核',
|
|
|
+ statusText3: '已上门',
|
|
|
+ statusText4: '已确认'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ wx.hideLoading();
|
|
|
+ });
|
|
|
+ }
|
|
|
})
|