diff --git a/pages/index/Neworder.vue b/pages/index/Neworder.vue index 02ed124..0e56e28 100644 --- a/pages/index/Neworder.vue +++ b/pages/index/Neworder.vue @@ -7,7 +7,7 @@ - 新增线下订单 + {{title}} @@ -84,7 +84,7 @@ - + * 商品选择 点击选择 @@ -128,7 +128,7 @@ - + 检测流程 @@ -138,22 +138,25 @@ - + 开始检测 - + + 确认修改 + + - - - @@ -175,6 +178,7 @@ export default { return { imagePath: '', fileList: [], + title: '新增线下订单', customerSource: '', buyName: '', nickname:'', @@ -193,6 +197,9 @@ export default { showLeadMan: false, skuId: 0, inspectionWorkNodes: [], + defaultIndex:[0], + kehuDefaultIndex:[0], + goodsDefaultIndex:[0,0], columns: [], options: [], nature: [], @@ -217,10 +224,13 @@ export default { customerData: [], inspectionWorkNodeStr: "", leadManId:undefined, - leadManList: [] + leadManList: [], + isInsert:true, + inspectionId: undefined, + xinDefaultIndex:[0] } }, - onLoad() { + onLoad(options) { this.getinitialize() this.getLeadeMan() uni.$on('selectProject', (data) => { @@ -229,15 +239,29 @@ export default { this.inspectionWorkNodeStr = this.inspectionWorkNodeStr + this.inspectionWorkNodes[i].projectName + " " this.inspectionWorkNodes[i].orderNum = i + 1 } - - }); + if (options.inspectionInfoId){ + this.isInsert = false + this.inspectionId = options.inspectionInfoId + this.title = '修改线下订单' + this.getInspectionInfo() + } }, onShow() { }, methods: { + handleClick() { + if (this.isInsert) { + this.showgoods = true; + } else { + uni.showToast({ + title: '不可修改商品', + icon: 'none' + }) + } + }, changeHandler(e) { const { columnIndex, @@ -393,8 +417,136 @@ export default { setTimeout(() => { uni.navigateBack() }, 2000); + }, + async edit() { + if (this.carNum == '' || this.customerSource == "" || this.leadManId == undefined) { + uni.showToast({ + title: '车牌号 客户来源 引车员 必填!', + icon: 'none' + }) + return + } + let data = { + partnerId: uni.getStorageSync('partnerId'), + id: this.inspectionId, + buyName: this.buyName, + buyPhone: this.buyPhone, + userAddress: this.userAddress, + unitName: this.unitName, + carNum: this.carNum, + carModel: this.carModel, + carStatus: this.carStatus, + carIdNo: this.carIdNo, + customerSource: this.customerSource, + skuId: this.skuId, + carNature: this.carNature, + inspectionWorkNodes: this.inspectionWorkNodes, + leadManId: this.leadManId + } + let res = await request({ + url: '/system/info/update', + method: 'post', + data: data + }) + if (res.code == 200) { + uni.showToast({ + title: "修改成功" + }) + let resp = await request({ + url: '/system/info/getWeorkNodesById', + method: 'get', + params: { + inspectionId: this.inspectionId + } + }) + //调用重新检测 + let res = await request({ + url: '/system/info/recheck', + method: 'post', + data: { + inspectionInfoId: this.inspectionId, + workNodes: resp.data + } + }) + } + setTimeout(() => { + uni.navigateTo({ + url: '/pages/staff/staff' + }) + }, 2000); + }, + /*根据工单Id查询工单详情*/ + getInspectionInfo(){ + request({ + url: '/system/info/' + this.inspectionId, + method: 'get' + }).then(res => { + this.shoplist = res.data + this.buyName = res.data.buyName + this.buyPhone = res.data.buyPhone + this.userAddress = res.data.userAddress + this.unitName = res.data.unitName + this.carNum = res.data.carNum + this.carModel = res.data.carModel + this.carStatus = res.data.carStatus + this.carIdNo = res.data.carIdNo + this.customerSource = res.data.customerSource + this.skuId = res.data.skuId + this.carNature = res.data.carNature + this.leadManId = res.data.leadManId + setTimeout(() => { + let result = this.leadManList + .map((subArray, subArrayIndex) => { + const index = subArray.findIndex(item => item.id === res.data.leadManId); + if (index !== -1) { + // 返回的是子数组的索引和匹配项的索引 + return { subArrayIndex, itemIndex: index }; + } else { + // 没有找到匹配项,返回 null 或 undefined + return null; + } + }) + .filter(item => item !== null); // 过滤掉没有匹配的项 + let index = result[0].itemIndex + let subArrayIndex = result[0].subArrayIndex + this.defaultIndex = [index] + this.nickname = this.leadManList[subArrayIndex][index].nickname + + //客户来源 + let kehuResult = this.columns + .map((subArray, subArrayIndex) => { + const index = subArray.findIndex(item => item.label === res.data.customerSource); + if (index !== -1) { + // 返回的是子数组的索引和匹配项的索引 + return { subArrayIndex, itemIndex: index }; + } else { + // 没有找到匹配项,返回 null 或 undefined + return null; + } + }) + .filter(item => item !== null); // 过滤掉没有匹配的项 + this.kehuDefaultIndex = [kehuResult[0].itemIndex] + + // 新旧车 + //客户来源 + let xinResult = this.xinlist + .map((subArray, subArrayIndex) => { + const index = subArray.findIndex(item => item.label === res.data.carStatus); + if (index !== -1) { + // 返回的是子数组的索引和匹配项的索引 + return { subArrayIndex, itemIndex: index }; + } else { + // 没有找到匹配项,返回 null 或 undefined + return null; + } + }) + .filter(item => item !== null); // 过滤掉没有匹配的项 + let a = [kehuResult[0]] + this.xinDefaultIndex = [a.itemIndex] + }, 1000); + }) }, // 提交 diff --git a/pages/index/orderdetails.vue b/pages/index/orderdetails.vue index 72ad21a..bd11d37 100644 --- a/pages/index/orderdetails.vue +++ b/pages/index/orderdetails.vue @@ -1,1108 +1,1129 @@ diff --git a/pages/staff/staff.vue b/pages/staff/staff.vue index 7961dcc..ec4d0c9 100644 --- a/pages/staff/staff.vue +++ b/pages/staff/staff.vue @@ -248,6 +248,7 @@ export default { tapqh(index) { this.tapindex = index this.infoDatas = [] + this.pageNum = 1 this.getList() } }