diff --git a/App.vue b/App.vue index 56576cd..858352a 100644 --- a/App.vue +++ b/App.vue @@ -3,7 +3,7 @@ export default { onLaunch(options) { uni.hideTabBar() const Pages = options.path; - this.updatePosition() + // 白名单 const WHITE = [ "pages/login/login", @@ -35,38 +35,45 @@ export default { }, onShow() { + this.timer=setInterval(()=>{ + this.updatePosition() + },10000) - + }, + data(){ + return { + timer:null, + } }, methods: { updatePosition() { const userInfo = uni.getStorageSync("userinfo"); - console.log(333333,this.$store.state.dataType) - // if (this.$store.state.dataType == 4) { - // uni.getLocation({ - // type: 'wgs84', - // success: (res) => { - let query = { - id: userInfo.user_id, - // "addressLon": res.longitude, - // "addressLat": res.latitude - "addressLon": 120.4732160947301, - "addressLat": 36.17767397801995 - } - // this.$u.api.updatePosition(query).then(res => { + if (this.$store.state.dataType == 4) { + uni.getLocation({ + type: 'wgs84', + success: (res) => { + let query = { + id: userInfo.user_id, + // "addressLon": res.longitude, + // "addressLat": res.latitude + "addressLon": 120.4732160947301, + "addressLat": 36.17767397801995 + } + this.$u.api.updatePosition(query).then(res => { - // }) - // }, - // fail: (err) => { - // this.error = err; - // console.error('定位失败:', err); - // } - // }); + }) + }, + fail: (err) => { + this.error = err; + console.error('定位失败:', err); + } + }); - // } + } }, }, - onHide: function () { + onHide () { + clearInterval(this.timer); console.log("App Hide"); }, }; diff --git a/pages/home/components/swiperRepair.vue b/pages/home/components/swiperRepair.vue index 7003a58..02f23f1 100644 --- a/pages/home/components/swiperRepair.vue +++ b/pages/home/components/swiperRepair.vue @@ -49,7 +49,7 @@ export default { current: 1, //页数 size: 20, //条数 dataType: this.dataTypes,//数据权限 - statusSearch: '1,2,3,4,6,20,7',//状态5报错 + statusSearch: '201,401,402,301,403,202,104',//状态5报错 } this.$u.api.getWorkOrderRecords(query).then(res => { if (res.code == 200) { diff --git a/pages/order/location.vue b/pages/order/location.vue index a845741..a5f3434 100644 --- a/pages/order/location.vue +++ b/pages/order/location.vue @@ -42,42 +42,44 @@ export default { latitude: 36.146504,//蓝色点的位置---自己当前的位置 纬度 longitude: 120.486065, //自己当 前位置的经度 display: 'always', - markers: [{ - id: 1, - latitude: 36.146504,//门店图片点的 纬度 - longitude: 120.486065,//经度 - iconPath: '/static/images/position/destination.png',//目的地 - label: { - content: '标记133', - }, - callout: { - content: '20', - color: '#fff', - fontSize: 14, - borderRadius: 4, - bgColor: '#2B73FF', - display: 'ALWAYS', - padding: 3, - anchorY: 5 - } - }, - { - id: 2, - latitude: 35.146504,//门店图片点的 纬度 - longitude: 116.486065,//经度 - iconPath: '/static/images/position/weixiu.png',//维修人员 - display: 'ALWAYS', - callout: { - content: '标记25', - color: '#ffffff', - fontSize: 14, - borderRadius: 4, - bgColor: '#3cc51f', - display: "ALWAYS", - }, + markers: [ + // { + // id: 1, + // latitude: 36.146504,//门店图片点的 纬度 + // longitude: 120.486065,//经度 + // iconPath: '/static/images/position/destination.png',//目的地 + // label: { + // content: '标记133', + // }, + // callout: { + // content: '20', + // color: '#fff', + // fontSize: 14, + // borderRadius: 4, + // bgColor: '#2B73FF', + // display: 'ALWAYS', + // padding: 3, + // anchorY: 5 + // } + // }, + // { + // id: 2, + // latitude: 35.146504,//门店图片点的 纬度 + // longitude: 116.486065,//经度 + // iconPath: '/static/images/position/weixiu.png',//维修人员 + // display: 'ALWAYS', + // callout: { + // content: '标记25', + // color: '#ffffff', + // fontSize: 14, + // borderRadius: 4, + // bgColor: '#3cc51f', + // display: "ALWAYS", + // }, - }], + // } + ], userLat: null,//维修人员维度 userLon: null,//维修人员经度 userId: null,//维修人员id @@ -129,30 +131,17 @@ export default { } this.$u.api.getPosition(query).then(res => { if (res.code == 200) { - if (res.data == '') { - + + if (Object.keys(res.data).length === 0) { + uni.showToast({ title: "正在获取维修人员的位置信息,请稍后再进行查看!", icon: "none" }); } else { this.markers[1].latitude = data.split(',')[0] this.markers[1].longitude = data.split(',')[1] + + this.getDistances(this.markers[1].latitude, this.markers[1].longitude, this.markers[0].latitude, this.markers[0].longitude) } } }) - - // uni.getLocation({ - // type: 'wgs84', - // success: (res) => { - // this.latitude = res.latitude//当前位置 - // this.longitude = res.longitude - // this.markers[1].latitude = this.latitude + 20//配送员位置 可调接口实时获取并且赋值 - // this.markers[1].longitude = this.longitude + 20 - // console.log('定位成功:', res,this.markers); - - // }, - // fail: (err) => { - // this.error = err; - // console.error('定位失败:', err); - // } - // }); }, getUserInfo() { this.$u.api.getUserInfo().then(res => { @@ -160,8 +149,8 @@ export default { this.userInfo = res.data this.markers[0].latitude = res.data.addressLat this.markers[0].longitude = res.data.addressLon - - this.getDistances(this.markers[1].latitude, this.markers[1].longitude, this.markers[0].latitude, this.markers[0].longitude) + this.getLocation() + } }).catch(err => { @@ -171,7 +160,7 @@ export default { mounted() { this.getUserInfo() - this.getLocation() + }, }; diff --git a/pages/submission/sendOrders.vue b/pages/submission/sendOrders.vue index 4b7362e..97c36e9 100644 --- a/pages/submission/sendOrders.vue +++ b/pages/submission/sendOrders.vue @@ -139,9 +139,7 @@ 型号:{{ item.xh }} 数量:{{ item.goodsNum }} 单位:{{ item.unit }} - 价格:{{ ((dataTypes == 3 && detailForm.status == - 3) || (dataTypes == 1 && detailForm.status == - 4)) ? item.materialPrice : (item.purchasePrice * item.goodsNum) }} + 价格:{{ item.materialPrice}} 0) { this.detailForm.materials.forEach(item => { + item.materialPrice=item.materialPrice data = data + item.materialPrice item.goodsNum = item.materialCount item.name = item.materialName @@ -493,6 +493,12 @@ export default { this.deviceData.repairPerson = this.detailForm.deviceId this.deviceData.name = this.detailForm.deviceName } + if(this.detailForm.status == 401){ + this.deviceData.repairPerson = '' + this.deviceData.name = '' + } + + this.getDeviceList() } @@ -616,6 +622,9 @@ export default { uni.showToast({ title: "申领数量不能为0", icon: "none" }); return false } + selected.forEach(item=>{ + item.materialPrice = item.goodsNum*item.purchasePrice + }) this.sendOrder.materialsData = JSON.parse(JSON.stringify(selected)) this.aterialShow = false }, @@ -630,7 +639,7 @@ export default { if (this.sendOrder.materialsData.length > 0) { this.goodsTableData.forEach(i => { this.sendOrder.materialsData.forEach(v => { - if (i.id == v.id) { + if (i.inventoryId == v.inventoryId) { i.checked = true } }) @@ -697,7 +706,7 @@ export default { brand: item.brand,//品牌 xh: item.xh,//型号 rule: item.rule,//参数 - materialPrice: item.goodsNum * item.unifiedQuotation, + materialPrice: item.materialPrice, materialCount: item.goodsNum,//领用数量 orderId: this.detailForm.id, }) @@ -894,6 +903,7 @@ export default { let query={ current:1, size:9999, + limsId:this.detailForm.reportUnit, } this.$u.api.getDeviceList(query).then(res => { if (res.code == 200) {