From 1d401a0581b4460c202da609fe510c1b8f18f7e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=85=81=E6=9E=9E?= <3422692813@qq.com> Date: Mon, 21 Oct 2024 13:11:14 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=B4=E4=BF=AEapp=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=E5=90=8E=E6=8C=87=E5=AE=9A=E6=96=BD=E5=B7=A5?= =?UTF-8?q?=E4=BA=BA=E5=91=98=E5=92=8C=E9=94=80=E5=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages-order/addOrder/addOrder.vue | 7 +- pages-order/choosePeople/choosePeople.vue | 270 +++++++++++++++++----- pages-order/orderDetail/orderDetail.vue | 5 +- 3 files changed, 218 insertions(+), 64 deletions(-) diff --git a/pages-order/addOrder/addOrder.vue b/pages-order/addOrder/addOrder.vue index 4fc4126..38e0c24 100644 --- a/pages-order/addOrder/addOrder.vue +++ b/pages-order/addOrder/addOrder.vue @@ -232,9 +232,10 @@ export default { title: '创建成功', icon: 'success' }) - setTimeout(() => { - uni.navigateBack(); - }, 600) + console.log("工单提交返回的结果", res) + uni.navigateTo({ + url: `/pages-order/orderDetail/orderDetail?id=${res.data.id}&isDetail=0` + }); }) }, listUserInfo() { diff --git a/pages-order/choosePeople/choosePeople.vue b/pages-order/choosePeople/choosePeople.vue index 7a74e1f..5853525 100644 --- a/pages-order/choosePeople/choosePeople.vue +++ b/pages-order/choosePeople/choosePeople.vue @@ -2,27 +2,46 @@ - - - - - - + + + + + +
- - - - + + + + - - + + + + + + + + + + + + + + +
@@ -38,6 +57,7 @@ import VNavigationBar from '@/components/VNavigationBar.vue' import {bus} from "@/utils/eventBus"; import request from '@/utils/request'; import {getDictTextByCodeAndValue} from "@/utils/utils"; + export default { components: { VNavigationBar, @@ -45,25 +65,43 @@ export default { data() { return { current: 0, - ticketId:'', + ticketId: '', list: [], - checkedUserId:"", - checkedUserName:"", - ifDetail:false, + checkedUserId: "", + checkedUserName: "", + ifDetail: false, + type: "sg", + sgIds: [], // 初始化为数组 + sgNames : [], + xsId: [], + xsName: [] } }, onLoad(data) { - if(data.id){ + console.log("data", data) + if (data.id) { this.ticketId = data.id this.workByTicketId() } - if(data.ifDetail){ + if (data.ifDetail) { //从订单详情页跳过来的,返回时需要返回2步 this.ifDetail = true } + if (data.type) { + this.type = data.type + if (data.type == 'xs') { + this.getStaffList() + } else { + this.getRepairWorder() + } + } + //创建工单后,订单详情页跳转过来携带 + if (data.ticketId) { + this.ticketId = data.ticketId + } }, methods: { - radioChange: function(evt) { + radioChange: function (evt) { for (let i = 0; i < this.list.length; i++) { if (this.list[i].userId == evt.detail.value) { this.current = i; @@ -75,51 +113,162 @@ export default { console.log(this.checkedUserName) }, /** - * 通过工单id查询维修工人 + * 获取销售列表 */ - workByTicketId(){ + getStaffList() { request({ - url: '/admin-api/repair/worker/listByTicketId', - method: 'get', - params:{ticketId:this.ticketId} - }).then((res)=>{ + url: '/admin-api/company/staff/list', + method: 'get' + }).then(res => { this.list = res.data - this.list.map((item)=>{ - item.workTypeText = getDictTextByCodeAndValue('repair_work_type',item.workType) + this.list.map((item) => { + item.userName = item.name }) }) }, - submit() { - const param = { - id:this.ticketId, - nowRepairId:this.checkedUserId, - nowRepairName:this.checkedUserName, - } - console.log(param) + /** + * 获取维修工人 + */ + getRepairWorder(){ request({ - url: '/admin-api/repair/tickets/notify', - method: 'post', - data:param - }).then((res)=>{ - uni.showToast({ - title: '指派成功!', - icon: 'none' + url: '/admin-api/repair/worker/page', + method: 'get', + params:{ + pageNo: 1, + pageSize: 9999 + } + }).then(res => { + this.list = res.data.records + this.list.map((item) => { + item.workTypeText = getDictTextByCodeAndValue('repair_work_type', item.workType) }) - setTimeout(()=>{ - if(this.ifDetail){ - uni.navigateBack({ - delta: 2 // 返回倒数第2页 - }) - }else{ - uni.navigateBack() - } - },700) }) - // - // console.log('this.checked', this.checked) - // const selected = this.list.filter(f => this.checked.includes(f.id)) - // bus.$emit('choosePeople', selected) - // uni.navigateBack() + }, + /** + * 通过工单id查询维修工人 + */ + workByTicketId() { + request({ + url: '/admin-api/repair/worker/listByTicketId', + method: 'get', + params: {ticketId: this.ticketId} + }).then((res) => { + this.list = res.data + this.list.map((item) => { + item.workTypeText = getDictTextByCodeAndValue('repair_work_type', item.workType) + }) + }) + }, + cs(e){ + let arr = [] + let nameArr = [] + for (let i = 0; i < this.list.length; i++) { + for (let j = 0; j < e.detail.value.length; j++) { + if (this.list[i].userId == e.detail.value[j]) { + this.current = i; + let checkedUserId = this.list[i].userId + let checkedUserName = this.list[i].userName + arr.push(checkedUserId) + nameArr.push(checkedUserName) + } + } + } + console.log(this.checkedUserName) + this.sgIds = arr + this.sgNames = nameArr + }, + submit() { + if (this.type == 'sg') { + if (this.sgIds.length == 0) { + uni.showToast({ + title: '请选择维修人员!', + icon: 'none' + }) + } else { + //以逗号拼接 + const sgIds = this.sgIds.join(',') + const sgNames = this.sgNames.join(',') + console.log(sgIds) + console.log(sgNames) + const param = { + ticketId: this.ticketId, + repairIds: sgIds, + repairNames: sgNames, + } + request({ + url: '/admin-api/repair/titem/updateRepairAndSale', + method: 'put', + data: param + }).then((res) => { + uni.showToast({ + title: '选择维修人员成功!', + icon: 'none' + }) + setTimeout(() => { + uni.navigateBack() + }, 700) + }) + } + + }else if (this.type == 'xs') { + if (this.checkedUserId == '' && this.checkedUserName == '') { + uni.showToast({ + title: '请选择销售人员!', + icon: 'none' + }) + } else { + //以逗号拼接 + const param = { + ticketId: this.ticketId, + saleId: this.checkedUserId, + saleName: this.checkedUserName, + } + request({ + url: '/admin-api/repair/titem/updateRepairAndSale', + method: 'put', + data: param + }).then((res) => { + uni.showToast({ + title: '选择销售人员成功!', + icon: 'none' + }) + setTimeout(() => { + uni.navigateBack() + }, 700) + }) + } + } else { + const param = { + id: this.ticketId, + nowRepairId: this.checkedUserId, + nowRepairName: this.checkedUserName, + } + console.log(param) + request({ + url: '/admin-api/repair/tickets/notify', + method: 'post', + data: param + }).then((res) => { + uni.showToast({ + title: '指派成功!', + icon: 'none' + }) + setTimeout(() => { + if (this.ifDetail) { + uni.navigateBack({ + delta: 2 // 返回倒数第2页 + }) + } else { + uni.navigateBack() + } + }, 700) + }) + // + // console.log('this.checked', this.checked) + // const selected = this.list.filter(f => this.checked.includes(f.id)) + // bus.$emit('choosePeople', selected) + // uni.navigateBack() + } } } } @@ -176,11 +325,13 @@ export default { display: flex; flex-direction: column; row-gap: 20rpx; + .name { font-weight: 500; font-size: 28rpx; color: #333333; } + .trade { font-weight: 500; font-size: 24rpx; @@ -188,6 +339,7 @@ export default { } } } + .userItem:last-child { border-bottom: none; } diff --git a/pages-order/orderDetail/orderDetail.vue b/pages-order/orderDetail/orderDetail.vue index 1240b41..246b4a1 100644 --- a/pages-order/orderDetail/orderDetail.vue +++ b/pages-order/orderDetail/orderDetail.vue @@ -355,6 +355,7 @@ export default { onLoad(data) { this.loginUser = getUserInfo() console.log(this.loginUser,294) + console.log(data) if (data.id) { this.ticketId = data.id } @@ -399,7 +400,6 @@ export default { console.log('删除文件'); this.fileList.splice(index, 1); }, - /** * 保存工作记录信息 */ @@ -682,7 +682,8 @@ export default { console.log('proj', proj) }) uni.navigateTo({ - url: `/pages-order/choosePeople/choosePeople?type=${type}` + url: `/pages-order/choosePeople/choosePeople?type=${type}&ticketId=${this.ticketId}` + // url: `/pages-order/choosePeople/choosePeople?type=${type}&id=${this.ticketId}` }) }, /**