diff --git a/components/tab-bar/delivery.vue b/components/tab-bar/delivery.vue index 1af08b9..4ed1ca7 100644 --- a/components/tab-bar/delivery.vue +++ b/components/tab-bar/delivery.vue @@ -35,16 +35,22 @@ - - + + 饭团 - + 快递 - + 跑腿 @@ -64,7 +70,7 @@ - + {{item.numberCode.length>14 ?'多订单':item.numberCode}} @@ -73,10 +79,12 @@ style="height: 40rpx;line-height: 40rpx;background: rgba(255, 233, 89, 1);padding: 0 16rpx;border-radius: 40rpx;margin: 14rpx 20rpx 0 0;"> 外卖 - + 代取快递 - + 代跑腿 @@ -98,14 +106,16 @@ 取件码{{item.getCodes}} - + 手机尾号:{{item.phoneNumber}} - + - + {{item.receiverName}} - + {{item.receiverAddress}} @@ -163,10 +173,10 @@ - + - + 配送佣金 @@ -175,7 +185,8 @@ - ¥{{item.deliveryFee}} (包含¥{{item.deliveryFeeMarketplace}}平台佣金) + ¥{{item.deliveryFee}} (包含¥{{item.deliveryFeeMarketplace}}平台佣金) @@ -187,13 +198,19 @@ - + - - + + @@ -201,7 +218,8 @@ - + 设置指派单规则 @@ -214,14 +232,17 @@ 外卖规则 - + 全选 - - + + + @@ -249,14 +270,17 @@ 跑腿规则 - + 全选 - - + + + @@ -299,20 +323,41 @@ - - - - - 订单详情 + + + + + 商品详情 + 请核对商品规格和数量 - - {{item.productName}} {{item.specs}} * {{item.quantity}} + + + + + + + + {{item1.productName}} + + + 规格 + {{item1.specs | delNode}} + + + + x{{item1.quantity}} + 数量 + + + + + 暂无商品详情 - + - + @@ -321,31 +366,31 @@ export default { data() { return { - isOnLine:1, - bigImg:'', + isOnLine: 1, + bigImg: '', zhipaiCheck: false, tab1Checked: 'daiqu', menuButtonInfo: {}, isArea: false, latitude: 39.909, // 默认纬度,可以设为用户当前位置或配送员位置 longitude: 116.39742, // 默认经度 - productData:{}, - searchForm:{ + productData: {}, + searchForm: { status: 1, - pageNum:1, + pageNum: 1, pageSize: 10, - order:'', - regionId:'', + order: '', + regionId: '', deliveryType: null, workerId: uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId : '' }, waimaRuleList: [], - tab1Checked1:'', - pageData:[], - deliveryItem:[], - deliveryItem1:[], + tab1Checked1: '', + pageData: [], + deliveryItem: [], + deliveryItem1: [], selectRuleList: [], - totalPages:1, + totalPages: 1, paotuiRuleList: [], lineStatus: [{ title: '上线', @@ -371,23 +416,40 @@ this.getDelivery(); }, filters: { - formatHourMinute(value) { - if (!value) return ''; - - const date = new Date(value); - - // 获取日 (getDate),并补齐0 - const day = String(date.getDate()).padStart(2, '0'); - - // 获取小时 (getHours),并补齐0 - const hour = String(date.getHours()).padStart(2, '0'); - - // 获取分钟 (getMinutes),并补齐0 - const minute = String(date.getMinutes()).padStart(2, '0'); - - // 拼接格式:日-日-时:分 - return `${day}日${hour}:${minute}`; - } + formatHourMinute(value) { + if (!value) return ''; + + const date = new Date(value); + + // 获取日 (getDate),并补齐0 + const day = String(date.getDate()).padStart(2, '0'); + + // 获取小时 (getHours),并补齐0 + const hour = String(date.getHours()).padStart(2, '0'); + + // 获取分钟 (getMinutes),并补齐0 + const minute = String(date.getMinutes()).padStart(2, '0'); + + // 拼接格式:日-日-时:分 + return `${day}日${hour}:${minute}`; + }, + delNode(data) { + // 1. 统一转为字符串 + let str; + if (typeof data === 'object' && data !== null) { + // 对象或数组 → JSON 字符串 + str = JSON.stringify(data); + } else if (typeof data === 'string') { + str = data; + } else { + // 其他类型(数字、布尔等)先转字符串 + str = String(data); + } + + // 2. 删除所有大括号 { } 和双引号 " + const result = str.replace(/[{}"]/g, ''); + return result; + } }, methods: { init() { @@ -398,29 +460,32 @@ console.log("配送初始化") this.menuButtonInfo = uni.getMenuButtonBoundingClientRect() this.isOnLine = uni.getStorageSync('worker').isOnLine - if(uni.getStorageSync('area')){ + if (uni.getStorageSync('area')) { this.searchForm.regionId = JSON.parse(uni.getStorageSync('area')).id; } - if(uni.getStorageSync('worker')){ + if (uni.getStorageSync('worker')) { this.searchForm.workerId = uni.getStorageSync('worker').workerId } this.$forceUpdate() this.getDelivery() - + }, // 获取用户位置 getUserLocation(item) { let that = this; uni.getLocation({ type: 'gcj02', - isHighAccuracy:true, + isHighAccuracy: true, success: (res) => { console.log('位置', res) that.latitude = res.latitude; that.longitude = res.longitude; - - that.tui.request('/worker/admin/editLocation', "POST", {workerId:item.workerId,geolocation:that.latitude + ',' + that.longitude}, false, false,true).then((res) => { - + + that.tui.request('/worker/admin/editLocation', "POST", { + workerId: item.workerId, + geolocation: that.latitude + ',' + that.longitude + }, false, false, true).then((res) => { + }).catch((res) => {}); }, fail: (err) => { @@ -428,23 +493,23 @@ } }); }, - onReachPage(){ + onReachPage() { console.log("11111") if (this.searchForm.pageNum >= this.totalPages) return; this.searchForm.pageNum++; this.getDelivery(); }, - chooseType(type){ - if(this.tab1Checked1 == type){ + chooseType(type) { + if (this.tab1Checked1 == type) { this.tab1Checked1 = '' this.searchForm.deliveryType = null - }else{ + } else { this.tab1Checked1 = type; - if(type == 'fantuan'){ + if (type == 'fantuan') { this.searchForm.deliveryType = 1 - }else if(type == 'kuaidi'){ + } else if (type == 'kuaidi') { this.searchForm.deliveryType = 2 - }else if(type == 'paotui'){ + } else if (type == 'paotui') { this.searchForm.deliveryType = 3 } } @@ -453,33 +518,33 @@ this.$forceUpdate(); }, shouldNotify(mustFinishTimeStr) { - // 直接解析 ISO 8601 格式的时间字符串(自动处理时区偏移) - const targetTime = new Date(mustFinishTimeStr); - // 校验解析是否成功 - if (isNaN(targetTime.getTime())) { - throw new Error('Invalid date format: ' + mustFinishTimeStr); - } - - const currentTime = new Date(); - const diffMs = targetTime - currentTime; // 毫秒差,正数表示未来,负数表示已过 - - // 超过目标时间(diffMs <= 0)或 剩余时间不到10分钟(0 < diffMs < 600000) - return diffMs <= 0 || diffMs < 10 * 60 * 1000; + // 直接解析 ISO 8601 格式的时间字符串(自动处理时区偏移) + const targetTime = new Date(mustFinishTimeStr); + // 校验解析是否成功 + if (isNaN(targetTime.getTime())) { + throw new Error('Invalid date format: ' + mustFinishTimeStr); + } + + const currentTime = new Date(); + const diffMs = targetTime - currentTime; // 毫秒差,正数表示未来,负数表示已过 + + // 超过目标时间(diffMs <= 0)或 剩余时间不到10分钟(0 < diffMs < 600000) + return diffMs <= 0 || diffMs < 10 * 60 * 1000; }, - getDelivery(){ + getDelivery() { let that = this - console.log('1111',uni.getStorageSync('worker')) + console.log('1111', uni.getStorageSync('worker')) this.tui.request("/mall/delivery/pagebyworker", "POST", this.searchForm, false, false).then((res) => { that.loadStatus = 'nomore'; if (res.code == 200) { - if(this.searchForm.status == 1){ + if (this.searchForm.status == 1) { if (that.searchForm.pageNum == 1) { that.deliveryItem1 = res.result.records; } else { that.deliveryItem1 = [...that.deliveryItem1, ...res.result.records] } that.pageData = that.deliveryItem1 - }else{ + } else { if (that.searchForm.pageNum == 1) { that.deliveryItem = res.result.records; } else { @@ -487,11 +552,11 @@ } that.pageData = that.deliveryItem } - + that.totalPages = res.result.pages; // pages = 总页数 that.$forceUpdate(); } else { - that.tui.toast(res.message,1000); + that.tui.toast(res.message, 1000); return; } uni.hideLoading(); @@ -505,23 +570,23 @@ zhipaiChange(e) { this.zhipaiCheck = e.detail.value }, - checkVoucher(index,type) { - if (type == 'waimai'){ + checkVoucher(index, type) { + if (type == 'waimai') { this.waimaRuleList[index].isChecked = !this.waimaRuleList[index].isChecked - }else{ + } else { this.paotuiRuleList[index].isChecked = !this.paotuiRuleList[index].isChecked } }, - productDetail(item){ + productDetail(item) { this.productData = item.goodsList; this.$refs.productPopup.open() }, - buchong(){ + buchong() { this.$refs.carPopup.close() uni.navigateTo({ - url:'/package1/myCenter/partTimeJobRegister' + url: '/package1/myCenter/partTimeJobRegister' }) - + }, selectRule(item) { //TODO 这里应该改成 复选,选中的遍历再放进来 @@ -533,26 +598,26 @@ this.selectRuleList = [] this.waimaiData = [] this.kuaidiData = [] - for(let i=0;i { @@ -569,9 +634,9 @@ let worker = uni.getStorageSync('worker') || {}; // 避免取不到时出错 worker.getPushOrder = that.zhipaiCheck ? 1 : 0; uni.setStorageSync('worker', worker); - uni.setStorageSync('waimaiData',that.waimaiData) - uni.setStorageSync('kuaidiData',that.kuaidiData) - if(that.zhipaiCheck == false){ + uni.setStorageSync('waimaiData', that.waimaiData) + uni.setStorageSync('kuaidiData', that.kuaidiData) + if (that.zhipaiCheck == false) { uni.removeStorageSync('waimaiData') uni.removeStorageSync('kuaidiData') } @@ -589,20 +654,20 @@ uni.hideLoading(); }); }, - allCheck(type){ + allCheck(type) { let data = [] - if(type=='waimai'){ + if (type == 'waimai') { data = this.waimaRuleList - }else{ + } else { data = this.paotuiRuleList } - for(let i=0;i item.orderType == 0); @@ -624,10 +689,10 @@ if (paotuiList.length > 0) { that.paotuiRuleList = paotuiList; } - + that.$forceUpdate(); } - this.zhipaiCheck = uni.getStorageSync('worker').getPushOrder==1?true:false + this.zhipaiCheck = uni.getStorageSync('worker').getPushOrder == 1 ? true : false /* if(uni.getStorageSync('waimaiData')){ let waimaiData = uni.getStorageSync('waimaiData') for(let i=0;i {}) @@ -668,32 +733,36 @@ checkArea() { this.isArea = !this.isArea }, - changeStatus(index,item,status){ + changeStatus(index, item, status) { let regionId = JSON.parse(uni.getStorageSync('area')).id let url = '' - if(status == 2){ + if (status == 2) { url = "/mall/delivery/pickup" - }else if(status == 3){ + } else if (status == 3) { url = "/mall/delivery/complete" - }else if(status == 1){ + } else if (status == 1) { url = "/mall/delivery/arriveShop" } let that = this - + this.getUserLocation(item) - that.tui.request(url, "POST", {regionId:regionId,deliveryId:item.id,workerId:item.workerId}, false, true).then((res) => { + that.tui.request(url, "POST", { + regionId: regionId, + deliveryId: item.id, + workerId: item.workerId + }, false, true).then((res) => { if (res.code == 200) { - if(status == 2 || status == 3){ + if (status == 2 || status == 3) { that.pageData.splice(index, 1) - }else{ + } else { that.pageData[index].arriveTime = "qq" } - that.tui.toast(res.message,200); + that.tui.toast(res.message, 200); /* that.searchForm.pageNum = 1 that.getDelivery() */ that.$forceUpdate(); } else { - that.tui.toast(res.message,200); + that.tui.toast(res.message, 200); return; } uni.hideLoading(); @@ -701,22 +770,22 @@ }, checkTab1(type) { this.tab1Checked = type - if(type == 'daiqu'){ + if (type == 'daiqu') { this.searchForm.status = 1 - }else{ + } else { this.searchForm.status = 2 } this.searchForm.pageNum = 1 this.getDelivery() }, - makeCall(phone){ + makeCall(phone) { uni.makePhoneCall({ phoneNumber: phone }); }, changeOnline(value) { let url = '' - if(this.isOnLine == value){ + if (this.isOnLine == value) { if (value == 0) { url = '/worker/offLine' value = 1 @@ -724,14 +793,14 @@ url = '/worker/onLine' value = 0 } - }else{ + } else { if (value == 0) { url = '/worker/offLine' } else { url = '/worker/onLine' } } - + this.tui.request(url, "POST", { id: uni.getStorageSync('worker').workerId }, false, true).then((res) => { @@ -740,9 +809,9 @@ worker.isOnLine = value; this.isOnLine = value uni.setStorageSync('worker', worker); - this.tui.toast(res.message,1000) + this.tui.toast(res.message, 1000) } else { - this.tui.toast(res.message,1000) + this.tui.toast(res.message, 1000) } }) @@ -759,7 +828,7 @@ if (res.code == 200) { } else { - this.tui.toast(res.message,1000) + this.tui.toast(res.message, 1000) } }) @@ -772,7 +841,7 @@ } - \ No newline at end of file diff --git a/components/tab-bar/tab-bar.vue b/components/tab-bar/tab-bar.vue index 41f60b3..12caf49 100644 --- a/components/tab-bar/tab-bar.vue +++ b/components/tab-bar/tab-bar.vue @@ -197,7 +197,7 @@ background: rgba(255, 255, 255, 1); margin: 0 auto; display: flex; - z-index: 9; + z-index: 998; border-top: 1px solid #eee; border-top-left-radius: 60rpx; border-top-right-radius: 60rpx;