From 6c8587c366f64e722181f31e31ccf23b2bad4ac9 Mon Sep 17 00:00:00 2001
From: tianyi <13521030702@163.com>
Date: Thu, 23 Jul 2026 18:02:20 +0800
Subject: [PATCH] 1
---
pages/index/index.vue | 17 +-
pages/login/login.vue | 48 +-
pages/shop/shopReturnOrder.vue | 553 ----------------
pages/shop/transferDeliveryOrderList.vue | 4 +-
pages/worker/index.vue | 785 +++++++++++++++++++----
pages/worker/partTimeJobCenter.vue | 15 +
6 files changed, 741 insertions(+), 681 deletions(-)
delete mode 100644 pages/shop/shopReturnOrder.vue
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 02dc904..59005d5 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -280,12 +280,17 @@
this.indexInit()
},
onLoad() {
-
+ if(uni.getStorageSync('peisongyuan')){
+ uni.reLaunch({
+ url: '../worker/index'
+ })
+ return
+ }
},
methods: {
indexInit() {
let that = this
- this.shopConfig = JSON.parse(uni.getStorageSync('area')).shop || {}
+ this.shopConfig = JSON.parse(uni.getStorageSync('area')) || {}
uni.getSystemInfo({
success: function(info) {
@@ -336,8 +341,8 @@
}, false, 'GET', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) {
this.shop = res.result
- this.shop.shopIcon = JSON.parse(uni.getStorageSync('area')).shop.shopIcon
- this.shop.shopName = JSON.parse(uni.getStorageSync('area')).shop.shopName
+ this.shop.shopIcon = JSON.parse(uni.getStorageSync('area')).shopIcon
+ this.shop.shopName = JSON.parse(uni.getStorageSync('area')).shopName
this.businessStatus = res.result.status
} else {
uni.showToast({
@@ -352,10 +357,8 @@
uni.setStorageSync('shopId', item.shop.id)
uni.setStorageSync('shopMerchantType', item.shop.merchantType)
uni.setStorageSync('area', JSON.stringify(item))
- console.log('1111111111111111',uni.getStorageSync('shopMerchantType'))
this.getBusinessStatus()
this.getData()
-
this.$refs.areaPopup.close()
},
//更改营业状态
@@ -417,7 +420,7 @@
url = '/pages/shop/transferDeliveryOrderList'
break;
case 'tui':
- url = '/pages/shop/shopReturnOrder?type=shop'
+ url = '/pages/shop/afterService?type=shop'
break;
case 'zd':
url = '/pages/shop/shopBill'
diff --git a/pages/login/login.vue b/pages/login/login.vue
index 5780476..c639afa 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -58,7 +58,7 @@
-
@@ -329,25 +329,25 @@
uni.getSystemInfo({
success: function (res1) {
that.NB.sendRequest('/auth/chooseShop', {
- shopId: item.shop.id,
+ shopId: item.id,
deviceId:res1.deviceId
}, true, 'POST', 'application/x-www-form-urlencoded').then(res => {
if (res.code == 200) {
uni.setStorageSync('type',item.type)
uni.setStorageSync('warehouseKeeperFlag',item.warehouseKeeperFlag)
- uni.setStorageSync('shopId',item.shop.id)
+ uni.setStorageSync('shopId',item.id)
uni.setStorageSync('shopName',item.shopName)
uni.setStorageSync('storeFlag',item.storeFlag)
uni.setStorageSync('shopIcon',res.result.shopIcon)
uni.setStorageSync('shopAddress',res.result.shopAddress)
uni.setStorageSync('shopRemark',res.result.remark)
- uni.setStorageSync('shopScore',item.shop.shopScore)
- uni.setStorageSync('shopMerchantType', item.shop.merchantType)
+ uni.setStorageSync('shopScore',item.shopScore)
+ uni.setStorageSync('shopMerchantType', item.merchantType)
uni.setStorageSync("shopOwnerPhone", item.shopOwnerPhone)
uni.setStorageSync('schoolShop',res.result.shop)
uni.setStorageSync('schoolShop',res.result.shop)
uni.setStorageSync('shopTakeaway',item.shopTakeaway)
- uni.setStorageSync('attrId',item.shop.attrId)
+ uni.setStorageSync('attrId',item.attrId)
uni.setStorageSync('area',JSON.stringify(item))
uni.setStorageSync("isShop",true)
setTimeout(() => {
@@ -412,17 +412,43 @@
that.NB.sendRequest(url, data, true, 'POST', 'application/x-www-form-urlencoded').then(res => {
if (res.code !== 200) return
- uni.setStorageSync("hiver_token", res.result.accessToken)
+ if (res.result.accessToken) uni.setStorageSync('hiver_token', res.result.accessToken)
+ if (res.result.worker !== undefined) uni.setStorageSync('worker', res.result.worker)
uni.setStorageSync("wayValue", this.wayValue)
uni.setStorageSync("nickname", res.result.user.nickname)
uni.setStorageSync('username',this.mobile)
-
- if (res.result.shopList.length > 1) {
- this.shopList = res.result.shopList;
+ if (res.result.shop !== undefined) uni.setStorageSync('schoolShop', res.result.shop)
+ if (res.result.waimaiData !== undefined) uni.setStorageSync('waimaiData', res.result.waimaiData)
+ if (res.result.kuaidiData !== undefined) uni.setStorageSync('kuaidiData', res.result.kuaidiData)
+ if (res.result.user) {
+ uni.setStorageSync('nickname', res.result.user.nickname)
+ uni.setStorageSync('id', res.result.user.id)
+ uni.setStorageSync('unionid', res.result.user.unionid)
+ uni.setStorageSync('miniProgramOpenid', res.result.user.miniProgramOpenid)
+ uni.setStorageSync('officialAccountOpenid', res.result.user.officialAccountOpenid)
+ if (res.result.user.mobile) {
+ uni.setStorageSync('mobile', res.result.user.mobile)
+ }
+ }
+ // uni.setStorageSync('area',JSON.stringify(item))
+ this.shopList = res.result.shop;
+ let data = {
+ id:res.result.worker.region
+ }
+ uni.setStorageSync('area',JSON.stringify(data))
+ uni.setStorageSync('peisongyuan',this.peisongyuan)
+ if(this.peisongyuan){
+ uni.reLaunch({
+ url: '../worker/index'
+ })
+ return
+ }
+ console.log('111111111111111111111',res)
+ if (this.shopList.length > 1) {
this.toggle("center");
}else{
- this.checkShop(res.result.shopList[0])
+ this.checkShop(this.shopList[0])
}
})
diff --git a/pages/shop/shopReturnOrder.vue b/pages/shop/shopReturnOrder.vue
deleted file mode 100644
index 2d216a3..0000000
--- a/pages/shop/shopReturnOrder.vue
+++ /dev/null
@@ -1,553 +0,0 @@
-
-
-
-
-
-
-
-
- 待退款/售后{{returnCount}}
-
-
-
-
-
-
-
-
- {{'#' + item.mallOrder.numberCode}}
-
-
- {{item.createTime | formatISOTime}}
-
-
-
- {{item.status == 0?'待退款':item.status == 3?'待售后':""}}
-
-
-
-
- 退款原因: {{item.refundTypeStatus == 1?'商家原因':item.refundTypeStatus == 2?'配送原因':item.refundTypeStatus == 3?'商家/配送都有原因(需要退配送费)':item.refundTypeStatus == 4?'平台退款':""}}
-
- 退款类型: {{item.refundType == 1?'退商品':item.refundType == 2?'退配送费':item.refundType == 3?'全额退款':""}}
- 退款金额: ¥{{item.refundAmount}}
-
-
-
-
-
- 查看订单
-
-
-
- 不同意
-
-
- 同意
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 订单-{{item.numberCode}}
-
-
-
-
-
- 订单状态:
-
-
- {{item.status == 0?'待支付':item.status == 2?'待配送员接单':(item.status == 3 && item.deliveryType == 1 && item.shopMakeTime == null) || (item.status == 3 && item.deliveryType == 2 && item.userRequireMake == 1)?'待出餐':(item.status == 3 && item.deliveryType == 1 && item.shopMakeTime != null)?'待取货':(item.status == 3 && item.deliveryType == 2)?'待消费':item.status == 4?'待送达':item.status == 5?'已完成':item.status == 7?'待同意退款':item.status == 8?'已退款':item.status == 6?'已取消':item.status == 11?'售后中':item.status == 12?'已售后':""}}
-
-
-
-
- 订单号:
-
-
- {{item.id}}
-
-
-
-
-
- 订单时间:
-
-
- {{item.createTime | formatISOTime}}
-
-
-
-
-
- 商品信息
-
-
-
- 商品名:{{item1.productName}}
-
-
- X{{item1.quantity}}
-
-
- ¥{{item1.price}}
-
-
-
-
-
- 餐盒费:¥{{item.packageFee}} 配送费:¥{{item.deliveryFee}}
-
-
- 总计:¥{{item.totalAmount}}
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/shop/transferDeliveryOrderList.vue b/pages/shop/transferDeliveryOrderList.vue
index 4939243..62955d3 100644
--- a/pages/shop/transferDeliveryOrderList.vue
+++ b/pages/shop/transferDeliveryOrderList.vue
@@ -69,9 +69,9 @@
this.totalPages = 1
this.list = []
this.loadStatus = 'more'
- this.searchForm.shopId = JSON.parse(uni.getStorageSync('area')).shop.id
+ this.searchForm.shopId = JSON.parse(uni.getStorageSync('area')).id
const area = uni.getStorageSync('area')
- this.searchForm.regionId = area ? JSON.parse(area).shop.regionId : ''
+ this.searchForm.regionId = area ? JSON.parse(area).regionId : ''
this.getList()
},
loadMore() {
diff --git a/pages/worker/index.vue b/pages/worker/index.vue
index fdcc29c..d36ff79 100644
--- a/pages/worker/index.vue
+++ b/pages/worker/index.vue
@@ -204,7 +204,7 @@
-
+
校园
暂时没有可抢订单
可以切换分类或调整筛选条件,新的校园订单会在这里出现
@@ -725,6 +725,7 @@
return {
isOnLine: 1,
bigImg: '',
+ adList:[],
zhipaiCheck: false,
tab1Checked: 'dating',
scrollTop: 0,
@@ -732,17 +733,25 @@
isLoadingPage: false,
scrollViewHeight: 0,
isArea: false,
- latitude: 39.909, // 默认纬度,可以设为用户当前位置或配送员位置
- longitude: 116.39742, // 默认经度
+ latitude: 39.909,
+ longitude: 116.39742,
searchForm: {
- status: 1,
+ hallOnly: true,
+ status: 0,
pageNum: 1,
- pageSize: 10,
+ pageSize:10,
+ getAreaId: '',
+ putAreaId: '',
+ paths: ['home_top', 'home_center_left_top', 'home_center_left_bottom', 'home_center_right_top',
+ 'home_center_right_bottom'
+ ],
order: '',
- returnOrderLast: 1,
regionId: '',
- deliveryType: null,
- workerId: uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId : ''
+ userId: uni.getStorageSync('id') || '',
+ deliveryType: 1,
+ waimaiData: [],
+ workerId: uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId : '',
+ kuaidiData: []
},
menuButtonInfo: {
top: 44
@@ -825,7 +834,7 @@
}
},
onShow() {
- this.runHomeInit()
+ this.indexInit()
if (this.pendingTabIndex !== null) {
const tabIndex = this.pendingTabIndex
const shouldShowDeliveryRuleConfirm = this.pendingDeliveryRuleConfirm && tabIndex == 1
@@ -890,73 +899,32 @@
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 `${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;
},
delPlus(data){
if (data.endsWith("+")) {
- data = data.slice(0, -1); // 删除最后一个字符
+ data = data.slice(0, -1);
}
return data;
}
},
methods: {
- init() {
- if (!this.ensureLogin()) return
-
- let worker = uni.getStorageSync('worker')
- if (worker == '' || worker == undefined || worker == null) {
- uni.showToast({
- title: '您还没有注册兼职',
- icon: 'none'
- });
- return
- }
- this.isOnLine = uni.getStorageSync('worker').isOnLine
- this.zhipaiCheck = uni.getStorageSync('worker').getPushOrder == 1 ? true : false
- if (uni.getStorageSync('area')) {
- this.searchForm.regionId = JSON.parse(uni.getStorageSync('area')).id;
- }
- if (uni.getStorageSync('worker')) {
- this.searchForm.workerId = uni.getStorageSync('worker').workerId
- }
- this.$forceUpdate()
- this.loadWorkerRules()
- this.getDelivery()
- this.$nextTick(() => {
- this.measureScrollView()
- })
-
- },
getPickupPictures(item) {
const pictures = item && item.getPictures
if (!pictures) return []
@@ -976,22 +944,6 @@
}
return []
},
- runHomeInit() {
- // 保证首页数据实时:每次显示首页都重新初始化数据。
- this.indexInit()
- this.$nextTick(() => {
- this.refreshDaimaiStickyPosition()
- })
- },
- refreshDaimaiStickyPosition() {
- const query = uni.createSelectorQuery().in(this);
- query.select('#menuList').boundingClientRect(rect => {
- if (rect) {
- this.menuListOffsetTop = rect.top + (this._scrollTopRaw || 0);
- this.stickyTrigger = Math.max(360, this.menuListOffsetTop - this.navBarHeight - 46);
- }
- }).exec();
- },
goMyCenter(){
uni.navigateTo({
url: '/pages/worker/partTimeJobCenter'
@@ -1071,27 +1023,16 @@
&& Date.now() - Number(cacheItem.savedAt || 0) < HOME_AD_IMAGE_CACHE_TTL
&& this.isSavedFileExists(cacheItem.path))
},
- //获取用户当前未完成订单
- getUserOrders() {
- let that = this
- this.NB.sendRequest("/mall/order/getOrdersByUserId/" + uni.getStorageSync('id'), {}, true, 'GET', 'application/x-www-form-urlencoded').then(res => {
- if (res.code == 200) {
- if (res.result != null) {
- that.orderLists = res.result
- that.$forceUpdate()
- }
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- });
- return
- }
- uni.hideLoading()
- })
- },
indexInit() {
+
let that = this
+ if (!this.ensureLogin()) return
+ this.isOnLine = uni.getStorageSync('worker').isOnLine
+ this.zhipaiCheck = uni.getStorageSync('worker').getPushOrder == 1 ? true : false
+ this.loadWorkerRules()
+ this.$nextTick(() => {
+ this.measureScrollView()
+ })
uni.getSystemInfo({
success: function(info) {
that.width = info.screenWidth * 2;
@@ -1104,9 +1045,7 @@
that.searchForm.workerId = uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId : ''
// 获取用户当前位置
// this.getUserLocation();
- if(uni.getStorageSync('hiver_token')){
- this.getUserOrders();
- }
+
if (!uni.getStorageSync('area')) {
this.checkArea()
} else {
@@ -1143,10 +1082,9 @@
}
this.searchForm.waimaiData = this.waimailistData;
this.searchForm.kuaidiData = [];
- this.getDelivery();
+ this.getDaTing();
this.getShopArea();
}
- // 计算导航栏高度用于sticky offset:statusBarHeight + 40px内容区
const info = uni.getSystemInfoSync();
this.navBarHeight = info.statusBarHeight;
this.swipeOrderBaseWidth = info.windowWidth * 0.86;
@@ -1307,7 +1245,7 @@
this.searchForm.order = ''
}
this.resetDeliveryQuery()
- this.getDelivery();
+ this.getDaTing();
},
clearCheck() {
this.checkYongjin = false
@@ -1317,7 +1255,7 @@
this.searchForm.putAreaId = ""
this.searchForm.order = ""
this.resetDeliveryQuery()
- this.getDelivery()
+ this.getDaTing()
this.$forceUpdate()
},
resetDeliveryQuery() {
@@ -1350,14 +1288,12 @@
if (!uni.getStorageSync('worker') && res.result != null) {
this.$refs.tishiPopup.open()
uni.setStorageSync('worker', res.result)
- that.$refs.tabBar.indexWorkerCount ++
}else{
if(res.message == '接单成功'){
uni.showToast({
title: res.message,
icon: 'none'
});
- that.$refs.tabBar.indexWorkerCount ++
}else{
uni.showToast({
title: res.message,
@@ -1624,23 +1560,73 @@
}
this.searchForm.pageNum = 1
this.scrollToTop()
- this.getDelivery()
+ this.getDaTing()
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)
+ const diffMs = targetTime - currentTime;
return diffMs <= 0 || diffMs < 10 * 60 * 1000;
},
+ getDaTing() {
+ let that = this
+ const requestVersion = that.deliveryQueryVersion
+ const requestPageNum = that.searchForm.pageNum
+ const requestForm = {
+ ...that.searchForm,
+ waimaiData: [...(that.searchForm.waimaiData || [])],
+ kuaidiData: [...(that.searchForm.kuaidiData || [])]
+ }
+ that.waimaiCount = 0
+ that.kuaidiCount = 0
+ that.paotuiCount = 0
+ that.zhipaiCount = 0
+ that.adList = []
+ that.searchForm.userId = uni.getStorageSync('id') || that.searchForm.userId || ''
+ requestForm.userId = that.searchForm.userId
+ this.NB.sendRequest("/mall/delivery/page", requestForm, true, 'POST', 'application/json').then(res => {
+ if (requestVersion !== that.deliveryQueryVersion) return
+ that.loadStatus = 'nomore';
+ if (res.code == 200) {
+
+ const records = that.normalizeDeliveryRecords(res.result.records, requestPageNum)
+ if (requestPageNum == 1) {
+ that.deliveryItem = records;
+ } else {
+ that.deliveryItem = [...that.deliveryItem, ...records]
+ }
+ if (res.result.orderCount != null && res.result.orderCount.length > 0) {
+ for (let i = 0; i < res.result.orderCount.length; i++) {
+ if (res.result.orderCount[i].deliveryType == 1) {
+ that.waimaiCount = res.result.orderCount[i].orderCount
+ } else if (res.result.orderCount[i].deliveryType == 2) {
+ that.kuaidiCount = res.result.orderCount[i].orderCount
+ } else if (res.result.orderCount[i].deliveryType == 3) {
+ that.paotuiCount = res.result.orderCount[i].orderCount
+ }
+ }
+ }else{
+ that.waimaiCount = 0
+ that.kuaidiCount = 0
+ that.paotuiCount = 0
+ }
+
+ if (res.result.zhipaiCount != undefined && res.result.zhipaiCount != null) {
+ that.zhipaiCount = res.result.zhipaiCount
+ }
+ that.totalPages = res.result.pages; // pages = 总页数
+ that.$forceUpdate();
+ } else {
+ that.tui.toast(res.message);
+ return;
+ }
+ uni.hideLoading();
+ })
+ },
getDelivery() {
if (!this.ensureLogin()) return
let that = this
@@ -1663,7 +1649,7 @@
that.pageData = that.deliveryItem
}
- that.totalPages = res.result.pages; // pages = 总页数
+ that.totalPages = res.result.pages;
that.$forceUpdate();
} else {
uni.showToast({
@@ -1708,7 +1694,7 @@
this.searchForm.waimaiData = [];
this.searchForm.kuaidiData = [];
}
- this.getDelivery()
+ this.getDaTing()
this.$nextTick(() => {
this.scrollToDaimaiPanel()
})
@@ -1784,7 +1770,7 @@
getPushOrder: this.zhipaiCheck ? 1 : 0
}, true, 'POST', 'application/x-www-form-urlencoded').then(res => {
if (res.code == 200) {
- let worker = uni.getStorageSync('worker') || {}; // 避免取不到时出错
+ let worker = uni.getStorageSync('worker') || {};
worker.getPushOrder = that.zhipaiCheck ? 1 : 0;
uni.setStorageSync('worker', worker);
uni.setStorageSync('waimaiData', that.waimaiData)
@@ -1843,7 +1829,7 @@
})
},
checkArea() {
- this.NB.sendRequest("/app/shopArea/getByParentId/0", {}, true, 'POST', 'application/x-www-form-urlencoded').then(res => {
+ this.NB.sendRequest("/app/shopArea/getByParentId/0", {}, true, 'get', 'application/x-www-form-urlencoded').then(res => {
if (res.code == 200) {
this.areaList = res.result
this.areaKeyword = ''
@@ -2085,7 +2071,12 @@
}
this.searchForm.pageNum = 1
this.scrollToTop()
- this.getDelivery()
+ if(type == 'dating'){
+ this.getDaTing()
+ }else{
+ this.getDelivery()
+ }
+
},
refreshCurrentTab() {
@@ -2175,7 +2166,7 @@
id: worker.workerId
}, true, 'POST', 'application/x-www-form-urlencoded').then(res => {
if (res.code == 200) {
- let worker = uni.getStorageSync('worker') || {}; // 避免取不到时出错
+ let worker = uni.getStorageSync('worker') || {};
worker.isOnLine = value;
this.isOnLine = value
uni.setStorageSync('worker', worker);
@@ -2193,6 +2184,584 @@
})
this.isArea = !this.isArea
this.$forceUpdate()
+ },
+ setTabBarVisible(visible) {
+ this.isTabBarVisible = visible
+ },
+ showDeliveryRuleEditedConfirm() {
+ this.$nextTick(() => {
+ setTimeout(() => {
+ if (this.$refs.deLiveryPage && this.$refs.deLiveryPage.showRuleEditedConfirm) {
+ this.$refs.deLiveryPage.showRuleEditedConfirm()
+ }
+ }, 300)
+ })
+ },
+ normalizeShareTargetPath(value) {
+ return normalizeShareTargetPath(value)
+ },
+ resolveShareTargetPath(value) {
+ let targetPath = String(value || '')
+ if (targetPath.indexOf('/pages/index/index') === 0 || targetPath.indexOf('pages/index/index') === 0) {
+ const queryIndex = targetPath.indexOf('?')
+ if (queryIndex !== -1) {
+ const query = targetPath.slice(queryIndex + 1).split('&')
+ for (let i = 0; i < query.length; i++) {
+ const pair = query[i].split('=')
+ if (pair[0] === 'targetPath') {
+ targetPath = pair.slice(1).join('=')
+ break
+ }
+ }
+ }
+ }
+ return this.normalizeShareTargetPath(targetPath)
+ },
+ openShareTargetIfNeeded() {
+ if (!this.pendingShareTargetPath) {
+ this.pendingShareTargetPath = this.resolveShareTargetPath(uni.getStorageSync('pendingShareTargetPath') || '')
+ if (this.pendingShareTargetPath) {
+ uni.setStorageSync('pendingShareTargetPath', this.pendingShareTargetPath)
+ }
+ }
+ if (!this.pendingShareTargetPath) return false
+ if (!uni.getStorageSync('area')) return true
+ const targetPath = this.pendingShareTargetPath
+ this.pendingShareTargetPath = ''
+ uni.removeStorageSync('pendingShareTargetPath')
+ uni.removeStorageSync('authPendingTargetPath')
+ this.$nextTick(() => {
+ setTimeout(() => {
+ uni.navigateTo({
+ url: targetPath,
+ fail: () => {
+ this.pendingShareTargetPath = targetPath
+ uni.setStorageSync('pendingShareTargetPath', targetPath)
+ uni.redirectTo({
+ url: targetPath,
+ success: () => {
+ uni.removeStorageSync('pendingShareTargetPath')
+ },
+ fail: () => {
+ uni.showToast({
+ title: '进入分享页面失败,请重试',
+ icon: 'none'
+ })
+ }
+ })
+ }
+ })
+ }, 300)
+ })
+ return true
+ },
+ refreshDaimaiStickyPosition() {
+ const query = uni.createSelectorQuery().in(this);
+ query.select('#menuList').boundingClientRect(rect => {
+ if (rect) {
+ this.menuListOffsetTop = rect.top + (this._scrollTopRaw || 0);
+ this.stickyTrigger = Math.max(360, this.menuListOffsetTop - this.navBarHeight - 46);
+ }
+ }).exec();
+ },
+ hasLogin() {
+ const token = uni.getStorageSync('hiver_token')
+ return !!(token && typeof token === 'string' && token.trim() && token !== 'null' && token !== 'undefined')
+ },
+ requireLogin(tabIndex = this.currentIndex) {
+ if (this.hasLogin()) return true
+ const redirectKey = 'login_redirect_' + Date.now()
+ const index = Number(tabIndex)
+ const redirectUrl = '/pages/index/index' + (!isNaN(index) && index > 0 ? '?tabIndex=' + index : '')
+ uni.setStorageSync(redirectKey, redirectUrl)
+ uni.navigateTo({
+ url: '/package2/login/login?redirect=' + redirectKey
+ })
+ return false
+ },
+ // 内部切换方法:带isSwitching保护,防止程序化滚动期间闪回
+ _switchCategory(index) {
+ if (this.isSwitching) return;
+ this.isSwitching = true;
+ this.checkTab(index);
+ // 400ms后解除锁(动画200ms,预留200ms缓冲)
+ setTimeout(() => {
+ this.isSwitching = false;
+ }, 400);
+ },
+ productDetail(item) {
+ if (this._isSwipingOrderTap) {
+ this._isSwipingOrderTap = false
+ return
+ }
+ if (!item || item.deliveryType != 1) return
+ this.productData = item;
+ this.productGoodsList = Array.isArray(item.goodsList) ? item.goodsList : []
+ this.$refs.productPopup.open()
+ },
+ closeProductPopup() {
+ if (this.$refs.productPopup && this.$refs.productPopup.close) {
+ this.$refs.productPopup.close()
+ }
+ this.productData = {}
+ this.productGoodsList = []
+ },
+ getSwipeProgress(item, index) {
+ if (!item) return 0
+ if (this.swipeOrder.id === item.id && this.swipeOrder.index === index) {
+ return this.swipeOrder.progress
+ }
+ return 0
+ },
+ resetDeliveryQuery() {
+ this.deliveryQueryVersion++
+ this.searchForm.pageNum = 1
+ this.totalPages = 1
+ this.deliveryItem = []
+ this.resetSwipeOrder()
+ },
+ normalizeDeliveryRecords(records, pageNum) {
+ if (!Array.isArray(records)) return []
+ return records.filter(item => item && typeof item === 'object').map((item, index) => {
+ return {
+ ...item,
+ deliveryKey: item.id !== undefined && item.id !== null ? String(item.id) : (pageNum + '-' + index)
+ }
+ })
+ },
+ shouldShowReceiverPhoneIcon(item) {
+ return !!(item && item.workerId)
+ },
+ parseDeliveryTime(value) {
+ if (!value) return NaN
+ if (typeof value === 'number') {
+ return String(value).length === 10 ? value * 1000 : value
+ }
+ const timeText = String(value).trim()
+ if (!timeText) return NaN
+ const nativeParsedTime = new Date(timeText).getTime()
+ if (!isNaN(nativeParsedTime)) return nativeParsedTime
+ const timeOnlyMatch = timeText.match(/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/)
+ if (timeOnlyMatch) {
+ const currentDate = new Date(this.deliveryNowTime || Date.now())
+ currentDate.setHours(Number(timeOnlyMatch[1]), Number(timeOnlyMatch[2]), Number(timeOnlyMatch[3] || 0), 0)
+ return currentDate.getTime()
+ }
+ const parsedTime = new Date(timeText.replace(/-/g, '/')).getTime()
+ return parsedTime
+ },
+ isNearMustFinishTime(item) {
+ if (!item || !item.mustFinishTime) return false
+ const mustFinishTime = this.parseDeliveryTime(item.mustFinishTime)
+ if (isNaN(mustFinishTime)) return false
+ return mustFinishTime - this.deliveryNowTime <= 10 * 60 * 1000
+ },
+ getMustFinishWarningText(item) {
+ const mustFinishTime = this.parseDeliveryTime(item && item.mustFinishTime)
+ if (!isNaN(mustFinishTime) && this.deliveryNowTime > mustFinishTime) {
+ return '已超过用户要求送达时间,为避免纠纷,建议和用户沟通是否继续接单配送'
+ }
+ return '已经临近用户要求送达时间,为避免纠纷,建议和用户沟通是否继续接单配送。'
+ },
+ startDeliveryTimeTimer() {
+ this.deliveryNowTime = Date.now()
+ if (this.deliveryTimer) return
+ this.deliveryTimer = setInterval(() => {
+ this.deliveryNowTime = Date.now()
+ }, 60 * 1000)
+ },
+ isSwipeOrderActive(item, index) {
+ if (!item) return false
+ return this.swipeOrder.id === item.id && this.swipeOrder.index === index && this.swipeOrder.progress > 0
+ },
+ //滑动开始
+ startSwipeOrder(event, item, index) {
+ if (!item || item.id === undefined || item.id === null) return
+ if (!this.requireLogin(0)) return
+ const touch = event.touches && event.touches[0]
+ if (!touch) return
+ this._isSwipingOrderTap = false
+ this._swipeOrderProgress = 0
+ this._swipeOrderLastRenderTime = 0
+ this.swipeOrder = {
+ id: item.id,
+ index,
+ startX: touch.clientX,
+ startProgress: 0,
+ progress: 0,
+ progressStyle: 'transform: translate3d(0, 0, 0) scaleX(0); transition: none;',
+ thumbStyle: 'transform: translate3d(0, 0, 0); transition: none;',
+ trackWidth: this.swipeOrderBaseWidth || 0,
+ confirmed: false
+ }
+ this.$nextTick(() => {
+ uni.createSelectorQuery().in(this).select('#swipe-order-' + item.id).boundingClientRect((rect) => {
+ if (rect && this.swipeOrder.id === item.id && this.swipeOrder.index === index) {
+ this.swipeOrder.trackWidth = rect.width
+ }
+ }).exec()
+ })
+ },
+ moveSwipeOrder(event) {
+ const touch = event.touches && event.touches[0]
+ if (!touch || this.swipeOrder.id === '') return
+ const trackWidth = this.swipeOrder.trackWidth || this.swipeOrderBaseWidth || 1
+ const deltaX = Math.max(0, touch.clientX - this.swipeOrder.startX)
+ const progress = Math.min(100, Math.round(deltaX / (trackWidth * 0.72) * 100))
+ if (progress > 3) {
+ this._isSwipingOrderTap = true
+ }
+ this._swipeOrderProgress = progress
+ const now = Date.now()
+ const frameGap = this.swipeOrderFrameGap || 16
+ const progressStep = this.swipeOrderProgressStep || 1
+ if (now - (this._swipeOrderLastRenderTime || 0) < frameGap &&
+ Math.abs(progress - this.swipeOrder.progress) < progressStep &&
+ progress < 92) {
+ return
+ }
+ this._swipeOrderLastRenderTime = now
+ this.setSwipeOrderProgress(progress)
+ },
+ //滑动结束
+ endSwipeOrder(item, index) {
+ if (!this.requireLogin(0)) {
+ this.resetSwipeOrder()
+ return
+ }
+ if (this.swipeOrder.id !== item.id || this.swipeOrder.index !== index) return
+ const progress = this._swipeOrderProgress !== undefined ? this._swipeOrderProgress : this.swipeOrder.progress
+ if (progress >= 92 && !this.swipeOrder.confirmed) {
+ this.swipeOrder.confirmed = true
+ this.setSwipeOrderProgress(100)
+ this.getOrder(item, index)
+ return
+ }
+ this.resetSwipeOrder()
+ },
+ resetSwipeOrder() {
+ this._swipeOrderProgress = 0
+ this._swipeOrderLastRenderTime = 0
+ clearTimeout(this._swipeOrderTapTimer)
+ this._swipeOrderTapTimer = setTimeout(() => {
+ this._isSwipingOrderTap = false
+ }, 300)
+ this.swipeOrder = {
+ id: '',
+ index: -1,
+ startX: 0,
+ startProgress: 0,
+ progress: 0,
+ progressStyle: 'transform: translate3d(0, 0, 0) scaleX(0); transition: none;',
+ thumbStyle: 'transform: translate3d(0, 0, 0); transition: none;',
+ trackWidth: 0,
+ confirmed: false
+ }
+ },
+ setSwipeOrderProgress(progress) {
+ if (this.swipeOrder.progress === progress) return
+ const trackWidth = this.swipeOrder.trackWidth || this.swipeOrderBaseWidth || 0
+ const thumbWidth = this.swipeOrderThumbWidth || 0
+ const thumbOffset = Math.max(0, trackWidth - thumbWidth) * progress / 100
+ this.swipeOrder.progress = progress
+ this.swipeOrder.progressStyle = 'transform: translate3d(0, 0, 0) scaleX(' + (progress / 100) + '); transition: none;'
+ this.swipeOrder.thumbStyle = 'transform: translate3d(' + thumbOffset + 'px, 0, 0); transition: none;'
+ },
+ normalizeAdImageUrl(url) {
+ if (!url) return ''
+ let normalized = String(url).trim()
+ while (normalized.endsWith(',')) {
+ normalized = normalized.slice(0, -1)
+ }
+ return normalized
+ },
+ getHomeAdImageCache() {
+ const cache = uni.getStorageSync(HOME_AD_IMAGE_CACHE_KEY)
+ return cache && typeof cache === 'object' ? cache : {}
+ },
+ saveHomeAdImageCache(cache) {
+ uni.setStorageSync(HOME_AD_IMAGE_CACHE_KEY, cache)
+ },
+ isSavedFileExists(filePath) {
+ if (!filePath || filePath.indexOf('__tmp__') !== -1) return false
+ try {
+ const fs = (uni.getFileSystemManager && uni.getFileSystemManager())
+ || (typeof wx !== 'undefined' && wx.getFileSystemManager ? wx.getFileSystemManager() : null)
+ if (fs && fs.accessSync) {
+ fs.accessSync(filePath)
+ return true
+ }
+ } catch (e) {
+ return false
+ }
+ return true
+ },
+ isHomeAdImageCacheValid(cacheItem) {
+ return !!(cacheItem
+ && Date.now() - Number(cacheItem.savedAt || 0) < HOME_AD_IMAGE_CACHE_TTL
+ && this.isSavedFileExists(cacheItem.path))
+ },
+
+ cacheHomeMenuIcon(key, imageUrl) {
+ if (homeAdImageDownloading[imageUrl]) return
+ homeAdImageDownloading[imageUrl] = true
+ uni.downloadFile({
+ url: imageUrl,
+ success: (downloadRes) => {
+ if (downloadRes.statusCode !== 200 || !downloadRes.tempFilePath) {
+ this.homeMenuIconImages[key] = imageUrl
+ delete homeAdImageDownloading[imageUrl]
+ return
+ }
+ uni.saveFile({
+ tempFilePath: downloadRes.tempFilePath,
+ success: (saveRes) => {
+ const cache = this.getHomeAdImageCache()
+ const oldCacheItem = cache[imageUrl]
+ if (oldCacheItem && oldCacheItem.path && oldCacheItem.path !== saveRes.savedFilePath) {
+ uni.removeSavedFile({
+ filePath: oldCacheItem.path,
+ fail: () => {}
+ })
+ }
+ cache[imageUrl] = {
+ path: saveRes.savedFilePath,
+ savedAt: Date.now()
+ }
+ this.saveHomeAdImageCache(cache)
+ this.homeMenuIconImages[key] = saveRes.savedFilePath
+ },
+ fail: () => {
+ this.homeMenuIconImages[key] = imageUrl
+ },
+ complete: () => {
+ delete homeAdImageDownloading[imageUrl]
+ }
+ })
+ },
+ fail: () => {
+ this.homeMenuIconImages[key] = imageUrl
+ delete homeAdImageDownloading[imageUrl]
+ },
+ complete: (downloadRes) => {
+ if (!downloadRes || downloadRes.statusCode !== 200) {
+ this.homeMenuIconImages[key] = imageUrl
+ delete homeAdImageDownloading[imageUrl]
+ }
+ }
+ })
+ },
+ cacheHomeAdImage(imageUrl) {
+ if (homeAdImageDownloading[imageUrl]) return
+ homeAdImageDownloading[imageUrl] = true
+ uni.downloadFile({
+ url: imageUrl,
+ success: (downloadRes) => {
+ if (downloadRes.statusCode !== 200 || !downloadRes.tempFilePath) {
+ this.replaceAdImageWithCache(imageUrl, imageUrl)
+ delete homeAdImageDownloading[imageUrl]
+ return
+ }
+ uni.saveFile({
+ tempFilePath: downloadRes.tempFilePath,
+ success: (saveRes) => {
+ const cache = this.getHomeAdImageCache()
+ const oldCacheItem = cache[imageUrl]
+ if (oldCacheItem && oldCacheItem.path && oldCacheItem.path !== saveRes.savedFilePath) {
+ uni.removeSavedFile({
+ filePath: oldCacheItem.path,
+ fail: () => {}
+ })
+ }
+ cache[imageUrl] = {
+ path: saveRes.savedFilePath,
+ savedAt: Date.now()
+ }
+ this.saveHomeAdImageCache(cache)
+ this.replaceAdImageWithCache(imageUrl, saveRes.savedFilePath)
+ },
+ fail: () => {
+ this.replaceAdImageWithCache(imageUrl, imageUrl)
+ },
+ complete: () => {
+ delete homeAdImageDownloading[imageUrl]
+ }
+ })
+ },
+ fail: () => {
+ delete homeAdImageDownloading[imageUrl]
+ },
+ complete: (downloadRes) => {
+ if (!downloadRes || downloadRes.statusCode !== 200) {
+ this.replaceAdImageWithCache(imageUrl, imageUrl)
+ delete homeAdImageDownloading[imageUrl]
+ }
+ }
+ })
+ },
+ replaceAdImageWithCache(imageUrl, filePath) {
+ const replace = (list) => {
+ (list || []).forEach((item) => {
+ if (item.adImage === imageUrl) {
+ item.adDisplayImage = filePath
+ }
+ })
+ }
+ replace(this.mallAds)
+ replace(this.adList)
+ this.$forceUpdate()
+ },
+ pruneHomeAdImageCache(cache, activeUrls) {
+ const activeUrlMap = activeUrls.reduce((result, url) => {
+ result[url] = true
+ return result
+ }, {})
+ const now = Date.now()
+ Object.keys(cache).forEach((url) => {
+ const item = cache[url]
+ const isExpired = !this.isHomeAdImageCacheValid(item)
+ if (isExpired && !activeUrlMap[url]) {
+ item && item.path && uni.removeSavedFile({
+ filePath: item.path,
+ fail: () => {}
+ })
+ delete cache[url]
+ }
+ })
+ const urls = Object.keys(cache).sort((a, b) => Number(cache[a].savedAt || now) - Number(cache[b].savedAt || now))
+ while (urls.length > HOME_AD_IMAGE_CACHE_LIMIT) {
+ const url = urls.shift()
+ if (activeUrlMap[url]) {
+ urls.push(url)
+ if (urls.every(itemUrl => activeUrlMap[itemUrl])) break
+ continue
+ }
+ const item = cache[url]
+ item && item.path && uni.removeSavedFile({
+ filePath: item.path,
+ fail: () => {}
+ })
+ delete cache[url]
+ }
+ this.saveHomeAdImageCache(cache)
+ },
+ //广告跳转
+ goAdPage(item) {
+ if (!this.requireLogin(0)) return
+ uni.navigateTo({
+ url: item.linkUrl + item.linkParams
+ })
+ },
+ checkTab(index) {
+ for (let i = 0; i < this.menuList.length; i++) {
+ this.menuList[i].checked = (i === index);
+ }
+ // 重置分页
+ this.searchForm.pageNum = 1;
+ this.pageNum = 1;
+ this.total = 1;
+ this.productItem = [];
+ // this.getProduct(this.menuList[index].id);
+ // 滚动到正确位置:分类栏刚好吸顶在nav-bar下方
+ // menuListOffsetTop - navBarHeight 使分类栏正好在sticky位置,首条商品可见
+ const target = this.menuListOffsetTop - this.navBarHeight;
+ uni.pageScrollTo({
+ scrollTop: target > 0 ? target : 0,
+ duration: 200
+ });
+ },
+ goSeckillGroup() {
+ uni.navigateTo({
+ url: '/package2/seckill/seckillGroup'
+ })
+ },
+ //跳转到子页面
+ goDetail(type) {
+ let url = ''
+ switch (type) {
+ case '1':
+ url = '/package1/runErrand/runErrand'
+ break;
+ case '2':
+ url = '/package2/group/groupBuyList'
+ break;
+ case '3':
+ url = '/package2/group/studentStoreList'
+ break;
+ case '4':
+ url = '/package1/planet/index'
+ break;
+ case '5':
+ url = '/package1/ieBrowser/index'
+ break;
+ }
+ uni.navigateTo({
+ url: url
+ })
+ },
+ //跳转到订单详情
+ goOrderDetail(item) {
+ uni.navigateTo({
+ url: '/package1/order/orderDetail?id=' + item.id
+ });
+ },
+ scrollToDaimaiPanel() {
+ const query = uni.createSelectorQuery().in(this);
+ query.select('#menuList').boundingClientRect(rect => {
+ if (!rect) return;
+ const stickyTop = this.navBarHeight + 46;
+ const target = rect.top + (this._scrollTopRaw || 0) - stickyTop;
+ uni.pageScrollTo({
+ scrollTop: target > 0 ? target : 0,
+ duration: 260
+ });
+ }).exec();
+ },
+ //拨打电话
+ makeCall(phone) {
+ uni.makePhoneCall({
+ phoneNumber: phone
+ });
+ },
+ //筛选条件
+ checkAdd() {
+ this.isgetArea = !this.isgetArea
+ },
+ //筛选条件
+ checkAdd1() {
+ this.isputArea = !this.isputArea
+ },
+ //底部tab切换组件状态改变
+ changeIndex(index) {
+ let that = this;
+ this.isTabBarVisible = true
+ this.lastIndex = this.currentIndex
+ if (index != 0) {
+ this.closeProductPopup()
+ }
+ if(index != 2){
+ this.currentIndex = index
+ }
+
+ switch (index) {
+ case 0:
+ this.runHomeInit()
+ break;
+ case 1:
+ that.$refs.deLiveryPage.init()
+ break;
+ case 2:
+ uni.navigateTo({
+ url: '/package1/tabbar/release'
+ })
+ break;
+ case 3:
+ that.$refs.postListPage.init()
+ break;
+ case 4:
+ that.$refs.myCenterPage.init()
+ break;
+ }
}
}
}
diff --git a/pages/worker/partTimeJobCenter.vue b/pages/worker/partTimeJobCenter.vue
index d0e8cc2..4f6eef6 100644
--- a/pages/worker/partTimeJobCenter.vue
+++ b/pages/worker/partTimeJobCenter.vue
@@ -157,6 +157,14 @@
退款/售后记录
+
@@ -229,6 +237,13 @@
url: '/pages/worker/workerOrderList?today=1'
})
},
+ logOut() {
+ uni.clearStorage()
+ getApp().globalData.userinfo = ''
+ uni.reLaunch({
+ url: '../login/login'
+ })
+ },
goDetail(type, index) {
let url = ''
switch (type) {