维修转单和退单测试完成

This commit is contained in:
java110 2020-07-25 23:19:33 +08:00
parent e08756060a
commit 18701e502f
3 changed files with 173 additions and 35 deletions

View File

@ -73,9 +73,16 @@ const listRepairStaffs = baseUrl + "app/ownerRepair.listRepairStaffs";
//查询员工报修单 //查询员工报修单
const listStaffRepairs = baseUrl + "app/ownerRepair.listStaffRepairs"; const listStaffRepairs = baseUrl + "app/ownerRepair.listStaffRepairs";
//查询报修师傅查询
const listRepairTypeUsers = baseUrl + "app/repair.listRepairTypeUsers";
//查询完成报修单 //查询完成报修单
const listStaffFinishRepairs = baseUrl +"app/ownerRepair.listStaffFinishRepairs"; const listStaffFinishRepairs = baseUrl +"app/ownerRepair.listStaffFinishRepairs";
const repairDispatch = baseUrl+"app/ownerRepair.repairDispatch";
module.exports = { module.exports = {
@ -113,5 +120,7 @@ module.exports = {
updateInspectionTaskDetail:updateInspectionTaskDetail, updateInspectionTaskDetail:updateInspectionTaskDetail,
listRepairStaffs:listRepairStaffs, listRepairStaffs:listRepairStaffs,
listStaffRepairs:listStaffRepairs, listStaffRepairs:listStaffRepairs,
listStaffFinishRepairs:listStaffFinishRepairs listStaffFinishRepairs:listStaffFinishRepairs,
listRepairTypeUsers:listRepairTypeUsers,
repairDispatch:repairDispatch
}; };

View File

@ -32,9 +32,9 @@
</view> </view>
<view class="solid-top flex justify-end margin-top padding-top-sm "> <view class="solid-top flex justify-end margin-top padding-top-sm ">
<button class="cu-btn sm line-gray" @click="repairDetail(item)">详情</button> <button class="cu-btn sm line-gray" @click="repairDetail(item)">详情</button>
<button class="cu-btn sm bg-orange margin-left" @click="dealRepair(item,'transfer')">转单</button> <button class="cu-btn sm bg-orange margin-left" @click="dealRepair(item,'TRANSFER')">转单</button>
<button class="cu-btn sm bg-red margin-left" @click="dealRepair(item,'back')">退单</button> <button class="cu-btn sm bg-red margin-left" @click="dealRepair(item,'BACK')">退单</button>
<button class="cu-btn sm bg-green margin-left" @click="dealRepair(item,'finish')">办结</button> <button class="cu-btn sm bg-green margin-left" @click="dealRepair(item,'FINISH')">办结</button>
</view> </view>
</view> </view>
@ -110,7 +110,8 @@
console.log('_item',_item); console.log('_item',_item);
//wx.setStorageSync("_toModifyComplaint_"+_item.complaintId, _item); //wx.setStorageSync("_toModifyComplaint_"+_item.complaintId, _item);
uni.navigateTo({ uni.navigateTo({
url:"/pages/repairDetail/repairDetail?repairId=" + _item.repairId+'&storeId='+this.storeId url:"/pages/repairDetail/repairDetail?repairId="
+ _item.repairId+'&storeId='+this.storeId
}); });
}, },
@ -119,6 +120,8 @@
url:'/pages/repairHandle/repairHandle?action=' url:'/pages/repairHandle/repairHandle?action='
+action+"&repairId="+item.repairId +action+"&repairId="+item.repairId
+"&repairType="+item.repairType +"&repairType="+item.repairType
+"&preStaffId="+item.preStaffId
+"&preStaffName="+item.preStaffName
}); });
} }
} }

View File

@ -1,16 +1,20 @@
<template> <template>
<view> <view>
<view class="cu-form-group margin-top"> <view class="cu-form-group margin-top" v-if="action == 'BACK'">
<view class="title">维修师傅</view> <view class="title">维修师傅</view>
<picker bindchange="PickerChange" :value="index" :range="staffCloums" @change="staffChange"> <input v-model="staffName" disabled="disabled" placeholder="请输入报修人"></input>
</view>
<view class="cu-form-group margin-top" v-else>
<view class="title">维修师傅</view>
<picker bindchange="PickerChange" :value="repairStaffIndex" :range="staffCloums" :range-key="'staffName'" @change="staffChange">
<view class="picker"> <view class="picker">
{{roomName?roomName:'请选择'}} {{staffCloums[repairStaffIndex].staffName}}
</view> </view>
</picker> </picker>
</view> </view>
<view class="cu-form-group margin-top"> <view class="cu-form-group margin-top">
<textarea v-model="context" placeholder="请输入报修内容"></textarea> <textarea v-model="context" placeholder="请输入处理意见"></textarea>
</view> </view>
<view class="cu-bar bg-white margin-top"> <view class="cu-bar bg-white margin-top">
@ -23,20 +27,20 @@
</view> </view>
<view class="cu-form-group "> <view class="cu-form-group ">
<view class="grid col-4 grid-square flex-sub"> <view class="grid col-4 grid-square flex-sub">
<view class="bg-img" v-for="(img,index) in imgList" bindtap="ViewImage" :data-url="imgList[index]"> <view class="bg-img" v-for="(img,index) in imgList" bindtap="ViewImage" :key="index" :data-url="imgList[index]">
<image :src='imgList[index]' mode='aspectFill'></image> <image :src='imgList[index]' mode='aspectFill'></image>
<view class="cu-tag bg-red" @tap="deleteImage(index)" :data-index="index"> <view class="cu-tag bg-red" @tap="_deleteImage(index)" :data-index="index">
<text class="cuIcon-close"></text> <text class="cuIcon-close"></text>
</view> </view>
</view> </view>
<view class="solids" @tap="ChooseImage" v-if="imgList.length<4"> <view class="solids" @tap="_chooseImage" v-if="imgList.length<4">
<text class="cuIcon-cameraadd"></text> <text class="cuIcon-cameraadd"></text>
</view> </view>
</view> </view>
</view> </view>
<view class="flex flex-direction margin-top"> <view class="flex flex-direction margin-top">
<button class="cu-btn bg-green margin-tb-sm lg" @click="submitRepair()">提交</button> <button class="cu-btn bg-green margin-tb-sm lg" @click="_dispatchRepair()">提交</button>
</view> </view>
</view> </view>
@ -46,18 +50,33 @@
export default { export default {
data() { data() {
return { return {
staffCloums:[], staffCloums: [{
staffName: '请选择员工'
}],
action: '', action: '',
repairId: '', repairId: '',
repairType: '', repairType: '',
imgList:[] imgList: [],
photos: [],
repairStaffIndex: 0,
staffId: '',
staffName: '',
context: '',
userId:'',
userName:''
} }
}, },
onLoad(options) { onLoad(options) {
this.action = options.action; this.action = options.action;
this.repairId = options.repairId; this.repairId = options.repairId;
this.repairType = options.repairType; this.repairType = options.repairType;
let _userInfo = this.java110Context.getUserInfo();
this.userId = _userInfo.userId;
this.userName = _userInfo.userName;
if(this.action == 'BACK'){
this.staffId = options.preStaffId
this.staffName = options.preStaffName
}
this._loadRepairStaff(); this._loadRepairStaff();
}, },
methods: { methods: {
@ -68,10 +87,11 @@
repairType: this.repairType, repairType: this.repairType,
communtiyId: this.java110Context.getCurrentCommunity().communityId, communtiyId: this.java110Context.getCurrentCommunity().communityId,
page: 1, page: 1,
row:50 row: 50,
state: '9999'
} }
this.java110Context.request({ this.java110Context.request({
url: _that.java110Constant.url.listRepairStaffs, url: _that.java110Constant.url.listRepairTypeUsers,
header: _that.java110Context.getHeaders(), header: _that.java110Context.getHeaders(),
method: "GET", method: "GET",
data: _data, // data: _data, //
@ -86,7 +106,7 @@
return; return;
} }
let _data = _json.data; let _data = _json.data;
_that.staffCloums = _data; _that.staffCloums = _that.staffCloums.concat(_data);
}, },
fail: function(e) { fail: function(e) {
wx.showToast({ wx.showToast({
@ -96,7 +116,113 @@
}); });
} }
}); });
},
staffChange: function(e) {
this.repairStaffIndex = e.target.value //
if (this.repairStaffIndex == 0) {
this.staffId = '' //id
this.staffName = ''
return;
} }
let selected = this.staffCloums[this.repairStaffIndex] //
this.staffId = selected.staffId //id
this.staffName = selected.staffName
},
_deleteImage: function(e) {
let imageArr = this.imgList;
imageArr.splice(e, 1);
this.photos.splice(e, 1);
},
_chooseImage: function(e) {
let that = this;
wx.chooseImage({
count: 4, //9
sizeType: ['original', 'compressed'], //
sourceType: ['album'], //
success: (res) => {
console.log(res);
that.imgList.push(res.tempFilePaths[0]);
let _base64Photo = '';
this.java110Factory.base64.urlTobase64(res.tempFilePaths[0]).then(function(_res) {
_base64Photo = _res;
console.log('base64', _base64Photo);
that.photos.push(_base64Photo);
});
}
});
},
_dispatchRepair: function(e) {
let obj = {
"staffId": this.staffId,
"staffName": this.staffName,
"context": this.context,
"repairId": this.repairId,
"repairType": this.repairType,
"action": this.action,
"communityId":this.java110Context.getCurrentCommunity().communityId,
"photos":[],
"userId":this.userId,
"userName":this.userName
}
let _photos = this.photos;
_photos.forEach(function(_item) {
obj.photos.push({
"photo": _item
});
});
let msg = "";
if (obj.context == "") {
msg = "请填写处理意见";
} else if (obj.staffId == "") {
msg = "请填写师傅";
} else if (obj.staffName == "") {
msg = "请填写师傅";
} else if (obj.repairId == "") {
msg = "数据错误";
}
if (msg != "") {
wx.showToast({
title: msg,
icon: 'none',
duration: 2000
});
return;
}
this.java110Context.request({
url: this.java110Constant.url.repairDispatch, // http://hc.demo.winqi.cn:8012/appApi/ownerRepair.saveOwnerRepair
header: this.java110Context.getHeaders(),
method: "POST",
data: obj, //
success: function(res) {
let _json = res.data;
if (_json.code == 0) {
uni.navigateBack({
delta: 1
})
return;
}
wx.showToast({
title: _json.msg,
icon: 'none',
duration: 2000
})
},
fail: function(e) {
wx.showToast({
title: "服务器异常了",
icon: 'none',
duration: 2000
})
}
});
},
} }
} }