diff --git a/components/orderCard.vue b/components/orderCard.vue index a503ff6..c88f368 100644 --- a/components/orderCard.vue +++ b/components/orderCard.vue @@ -41,21 +41,6 @@ 服务顾问:{{ order.counselorName }} - - - - - - - - - - - - - 保存 - - 项目派工 @@ -140,7 +125,6 @@ export default { //当前用户 userInfo:{}, ifLeader:false, - takeOrderId:'', } }, mounted(){ @@ -163,32 +147,6 @@ export default { }, methods: { - /** - * 接单上传附件 - */ - openFile(id){ - this.takeOrderId = id - this.$refs.popup.open("bottom") - }, - - - afterRead(file) { - for (let i = 0; i < file.tempFilePaths.length; i++) { - upload({ - url:'/admin-api/infra/file/upload', - filePath: file.tempFilePaths[i] - }).then((res)=>{ - this.fileList.push({ - url: config.baseImageUrl+res.data - }) - console.log(this.fileList) - }) - } - }, - - deleteFile(file, index) { - this.fileList.splice(index, 1); - }, getFlagColor(flag) { if (flag == 1) { @@ -197,34 +155,7 @@ export default { return '#999' } }, - /** - * 接单 - */ - receiveOrder(){ - let fileStr = this.fileList.map(item=>item.url.replace(config.baseImageUrl,"")).join(",") - request({ - url: '/admin-api/repair/tickets/take', - method: 'get', - params:{ - id:this.takeOrderId, - image:fileStr - } - }).then((res) => { - console.log(res) - if (res.code == 200) { - uni.showToast({ - icon: 'none', - title: '接单成功,请尽快处理!' - }) - this.$emit('childEvent'); - }else{ - uni.showToast({ - icon: 'none', - title: res.message - }) - } - }) - }, + /** * 开始施工 */ @@ -244,12 +175,7 @@ export default { * 作废 */ doVoid(row){ - this.show = true - this.voidData = { - id : row.id, - remark : '', - ticketsStatus : '03' - } + this.$emit('doVoid',row); }, /** * 添加项目 @@ -257,29 +183,11 @@ export default { addProj(order){ this.$emit('addProj',order); }, - /** - * 作废请求后台方法 + * 接单 */ - doVoidConfirm(){ - request({ - url: '/admin-api/repair/tickets/void', - method: 'POST', - data:this.voidData - }).then((res) => { - if (res.code == 200){ - uni.showToast({ - title: "操作成功", - icon: "success", - }) - } - this.doVoidCancel() - this.$emit('childEvent') - }) - }, - - doVoidCancel(){ - this.show = false + openFile(orderId){ + this.$emit('getOrder',orderId); }, /** diff --git a/pages-home/home/home.vue b/pages-home/home/home.vue index 1e6687f..63e3066 100644 --- a/pages-home/home/home.vue +++ b/pages-home/home/home.vue @@ -96,7 +96,7 @@ - + @@ -116,6 +116,21 @@ + + + + + + + + + + + + + 保存 + + @@ -124,9 +139,10 @@ import tabBarVue from '@/components/tabBar/tabBar.vue' import VNavigationBar from '@/components/VNavigationBar.vue' import OrderCard from "@/components/orderCard.vue"; import ProjectPicker from "@/components/projectPicker.vue"; -import config from '@/config' import request from '@/utils/request'; import {formatTimestamp,getOrderStatusText,builderOrder,saveTicketsRecords} from "@/utils/utils"; +import config from "@/config"; +import upload from "@/utils/upload"; import { getToken, getUserInfo, @@ -145,6 +161,13 @@ export default { }, data() { return { + //上传的图片数组 + fileList: [], + sizeType:['compressed'], + show:false, + title:'作废', + voidData:{}, + takeOrderId:'', imgUrlPrex:config.baseImageUrl, userInfo: { avatar: undefined, @@ -238,6 +261,93 @@ export default { } }, methods: { + /** + * 作废 + */ + doVoidReq(row){ + this.show = true + this.voidData = { + id : row.id, + remark : '', + ticketsStatus : '03' + } + }, + /** + * 作废请求后台方法 + */ + doVoidConfirm(){ + request({ + url: '/admin-api/repair/tickets/void', + method: 'POST', + data:this.voidData + }).then((res) => { + if (res.code == 200){ + uni.showToast({ + title: "操作成功", + icon: "success", + }) + } + this.doVoidCancel() + this.onRefresherrefresh() + }) + }, + + doVoidCancel(){ + this.show = false + }, + /** + * 接单上传附件 + */ + openFile(id){ + this.takeOrderId = id + this.$refs.popup.open("bottom") + }, + /** + * 接单 + */ + receiveOrder(){ + let fileStr = this.fileList.map(item=>item.url.replace(config.baseImageUrl,"")).join(",") + request({ + url: '/admin-api/repair/tickets/take', + method: 'get', + params:{ + id:this.takeOrderId, + image:fileStr + } + }).then((res) => { + console.log(res) + this.$refs.popup.close() + if (res.code == 200) { + uni.showToast({ + icon: 'none', + title: '接单成功,请尽快处理!' + }) + this.onRefresherrefresh() + }else{ + uni.showToast({ + icon: 'none', + title: res.message + }) + } + }) + }, + afterRead(file) { + for (let i = 0; i < file.tempFilePaths.length; i++) { + upload({ + url:'/admin-api/infra/file/upload', + filePath: file.tempFilePaths[i] + }).then((res)=>{ + this.fileList.push({ + url: config.baseImageUrl+res.data + }) + console.log(this.fileList) + }) + } + }, + + deleteFile(file, index) { + this.fileList.splice(index, 1); + }, /** * 保存当前项目 */ @@ -581,6 +691,14 @@ export default { box-sizing: border-box; } +.popup-content { +@include flex; + align-items: center; + justify-content: center; + padding: 30rpx; + height: auto; + background-color: #fff; +} .container { height: 100%; //background: linear-gradient(180deg, #0174F6 0%, rgba(1, 116, 246, 0) 100%); diff --git a/pages-order/addOrder/addOrder.vue b/pages-order/addOrder/addOrder.vue index 1cfff3f..f059e88 100644 --- a/pages-order/addOrder/addOrder.vue +++ b/pages-order/addOrder/addOrder.vue @@ -207,18 +207,18 @@ 定损费 - + 维修类型 - + {{ repairTypes[repairTypeIndex].label}} - + 旧件处置方式 - + {{ partDisposals[partDisposalIndex].label}} @@ -334,7 +334,8 @@ export default { this.phone = data.phone this.listUserInfo() } - this.initDict() + this.initDict("repair_type") + this.initDict("repair_part_disposal") }, onShow() { if (this.phone != '') { @@ -367,27 +368,38 @@ export default { }, - initDict(){ - let dictArray = getStorageWithExpiry('repair_type'); + async initDict(dictCode){ + let dictArray = getStorageWithExpiry(dictCode); + console.log(dictArray,"partDisposals") if(null==dictArray || undefined==dictArray){ request({ url: '/admin-api/system/dict-data/type', method: 'get', - params:{type:'repair_type'} + params:{type:dictCode} }).then((res) => { console.log(res) if (res.code == 200) { - setStorageWithExpiry('repair_type',res.data,3600) - this.repairTypes = dictArray - this.buildRepairType() + setStorageWithExpiry(dictCode,res.data,3600) + this.$nextTick(()=>{ + if("repair_type"==dictCode){ + this.repairTypes = res.data + this.buildRepairType() + }else{ + this.partDisposals = res.data + } + }) } }) }else{ - this.repairTypes = dictArray - this.buildRepairType() + this.$nextTick(()=>{ + if("repair_type"==dictCode){ + this.repairTypes = dictArray + this.buildRepairType() + }else{ + this.partDisposals = dictArray + } + }) } - this.partDisposals = getDictByCode('repair_part_disposal') - console.log(this.pageData.repairType,"this.pageData.repairType") }, buildRepairType(){ if(this.pageData.repairType){