diff --git a/components/tab-bar/homeGroupPending.vue b/components/tab-bar/homeGroupPending.vue
index 6ffc96c..719acde 100644
--- a/components/tab-bar/homeGroupPending.vue
+++ b/components/tab-bar/homeGroupPending.vue
@@ -27,14 +27,17 @@
马上拼成更省钱
-
-
+
{{item.label}}
+
+ {{formatBadgeCount(getTabCount(item.countKey))}}
+
-
+
@@ -53,11 +56,30 @@
抢
+
+
+ 取货地址
+
+ {{item.title}}
+
+
+
+ 送货地址
+
+ {{item.title}}
+
+
+ 佣金
+ 刷新
+
-
+
拼
暂时没有待成团
@@ -69,7 +91,8 @@
- {{isStoreScene ? '团' : '饭'}}
+ 到店消费
+ {{isStoreScene ? '团' : '饭'}}
{{item.uiShopName}}
@@ -86,6 +109,7 @@
+ ¥{{item.uiStoreOriginalPrice}}
拼团价
¥{{item.uiGroupPrice}}
@@ -98,12 +122,92 @@
{{item.uiExpireText}}
- {{isStoreScene ? '参与到店团' : '参与拼饭局'}}
+ 立即拼单
+
+
+ 取 {{getAreaData.title}}
+ 送 {{putAreaData.title}}
+ 佣金优先
+ 清空
+
+
+ {{isKuaidiScene ? '递' : '跑'}}
+ 暂时没有可抢订单
+ 可以切换分类或调整筛选条件,新的订单会在这里出现
+
+
+
+ 预约配送
+ 送达时间:{{formatDeliveryTime(item.mustFinishTime)}}
+
+
+
+ ¥{{formatDeliveryAmount(item)}}
+
+
+ {{item.shopName || ''}}
+ 共{{item.allCount ? item.allCount : 0}}件
+
+
+
+ 取
+ {{item.shopAddress || ''}}
+
+
+
+ 送
+ {{item.receiverAddress || ''}}
+
+
+
+
+
+ 超大/超重
+ 包含¥{{item.deliveryFeeMarketplace}}平台奖励佣金
+
+
+ {{getMustFinishWarningText(item)}}
+
+
+
+
+
+
+
+ 向右滑动抢单
+ 继续滑动确认
+ 松手接单
+
+
+ 接
+
+
+
+
+
+
@@ -129,13 +233,22 @@
data() {
return {
scene: 'takeaway',
- tabs: [{
+ groupTabs: [{
label: '饭团',
scene: 'takeaway'
}, {
label: '团购',
scene: 'storeGroup'
}],
+ deliveryTabs: [{
+ label: '快递',
+ scene: 'kuaidi',
+ countKey: 'kuaidiCount'
+ }, {
+ label: '跑腿',
+ scene: 'paotui',
+ countKey: 'paotuiCount'
+ }],
loadStatus: 'more',
totalPages: 1,
query: {
@@ -148,10 +261,71 @@
keyWord: ''
},
groupList: [],
+ deliveryItem: [],
+ deliveryTotalPages: 1,
+ deliveryQueryVersion: 0,
+ deliveryNowTime: Date.now(),
+ deliveryTimer: null,
+ deliveryQuery: {
+ hallOnly: true,
+ status: 0,
+ pageNum: 1,
+ pageSize: 10,
+ getAreaId: '',
+ putAreaId: '',
+ order: '',
+ regionId: '',
+ userId: uni.getStorageSync('id') || '',
+ deliveryType: 2,
+ waimaiData: [],
+ kuaidiData: [],
+ workerId: uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId : ''
+ },
+ kuaidiCount: 0,
+ paotuiCount: 0,
+ expressErrandEnabled: true,
+ getshopArea: [],
+ putshopArea: [],
+ getAreaData: {},
+ putAreaData: {},
+ isgetArea: false,
+ isputArea: false,
+ checkYongjin: false,
+ lastRefreshTime: 0,
+ latitude: 39.909,
+ longitude: 116.39742,
+ swipeOrderLowPerf: false,
+ swipeOrderDefaultStyle: {
+ progress: 'transform: translate3d(0, 0, 0) scaleX(0); transition: transform 0.14s ease-out;',
+ thumb: 'transform: translate3d(0, 0, 0); transition: transform 0.14s ease-out;'
+ },
+ 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
+ },
chromeHeight: 160
}
},
computed: {
+ displayTabs() {
+ return this.embedded && this.expressErrandEnabled ? [...this.groupTabs, ...this.deliveryTabs] : this.groupTabs
+ },
+ isGroupScene() {
+ return this.scene === 'takeaway' || this.scene === 'storeGroup'
+ },
+ isDeliveryScene() {
+ return this.scene === 'kuaidi' || this.scene === 'paotui'
+ },
+ isKuaidiScene() {
+ return this.scene === 'kuaidi'
+ },
isStoreScene() {
return this.scene === 'storeGroup'
},
@@ -176,12 +350,18 @@
}
},
mounted() {
+ this.initSwipeMetrics()
+ this.startDeliveryTimeTimer()
if (this.embedded) {
this.$nextTick(() => {
setTimeout(() => this.measureChrome(), 80)
})
}
},
+ beforeDestroy() {
+ this.stopDeliveryTimeTimer()
+ clearTimeout(this._swipeOrderTapTimer)
+ },
methods: {
measureChrome() {
if (!this.embedded || this.stickyActive) return
@@ -194,11 +374,8 @@
},
init(option) {
this.scene = this.normalizeScene(option && option.scene)
- this.query.merchantType = this.isStoreScene ? 2 : 1
- this.query.keyWord = ''
- this.query.pageNumber = 1
- this.totalPages = 1
- this.groupList = []
+ this.resetGroupQuery()
+ this.resetDeliveryQuery()
this.loadStatus = 'more'
this.initRegion()
this.$nextTick(() => {
@@ -206,12 +383,20 @@
})
},
loadMore() {
+ if (this.isDeliveryScene) {
+ if (this.loadStatus === 'loading' || this.deliveryQuery.pageNum >= this.deliveryTotalPages) return
+ this.deliveryQuery.pageNum += 1
+ this.getDelivery()
+ return
+ }
if (this.loadStatus === 'loading' || this.query.pageNumber >= this.totalPages) return
this.query.pageNumber += 1
this.getGroupList()
},
normalizeScene(scene) {
- return scene === 'storeGroup' ? 'storeGroup' : 'takeaway'
+ if (scene === 'storeGroup') return 'storeGroup'
+ if (this.embedded && this.expressErrandEnabled && (scene === 'kuaidi' || scene === 'paotui')) return scene
+ return 'takeaway'
},
initRegion() {
const area = uni.getStorageSync('area')
@@ -222,32 +407,69 @@
try {
const areaInfo = typeof area === 'string' ? JSON.parse(area) : area
this.query.regionId = areaInfo.id || ''
+ this.deliveryQuery.regionId = areaInfo.id || ''
+ this.expressErrandEnabled = this.resolveExpressErrandEnabled(areaInfo)
} catch (e) {
this.query.regionId = ''
+ this.deliveryQuery.regionId = ''
+ this.expressErrandEnabled = true
}
if (!this.query.regionId) {
this.tui.toast('请先选择区域')
return
}
- this.getGroupList()
+ if (!this.expressErrandEnabled && this.isDeliveryScene) {
+ this.scene = 'takeaway'
+ }
+ if (!this.expressErrandEnabled) {
+ this.kuaidiCount = 0
+ this.paotuiCount = 0
+ }
+ this.deliveryQuery.userId = uni.getStorageSync('id') || this.deliveryQuery.userId || ''
+ this.deliveryQuery.workerId = uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId : ''
+ if (this.expressErrandEnabled) {
+ this.getShopArea()
+ this.applyDeliverySceneQuery()
+ }
+ if (this.isDeliveryScene) {
+ this.getDelivery()
+ } else {
+ this.getGroupList()
+ if (this.embedded && this.expressErrandEnabled) {
+ this.getDelivery(true)
+ }
+ }
},
searchGroup() {
+ if (!this.isGroupScene) return
this.query.pageNumber = 1
this.totalPages = 1
- this.groupList = []
this.getGroupList()
},
switchScene(scene) {
const nextScene = this.normalizeScene(scene)
- if (this.scene === nextScene) return
+ if (this.scene === nextScene) {
+ if (this.embedded && this.expressErrandEnabled && this.isGroupScene) {
+ this.getDelivery(true)
+ }
+ return
+ }
this.scene = nextScene
- this.query.merchantType = this.isStoreScene ? 2 : 1
- this.query.keyWord = ''
- this.query.pageNumber = 1
- this.totalPages = 1
- this.groupList = []
this.loadStatus = 'more'
- this.getGroupList()
+ if (this.isDeliveryScene) {
+ this.resetDeliveryQuery(true)
+ this.applyDeliverySceneQuery()
+ this.getDelivery()
+ } else {
+ this.resetGroupQuery(true)
+ this.getGroupList()
+ if (this.embedded && this.expressErrandEnabled) {
+ this.getDelivery(true)
+ }
+ }
+ this.$nextTick(() => {
+ setTimeout(() => this.measureChrome(), 80)
+ })
},
getGroupList() {
if (!this.query.regionId) return
@@ -271,6 +493,350 @@
this.loadStatus = 'nomore'
})
},
+ getDelivery(countsOnly = false) {
+ if (!this.expressErrandEnabled) return
+ if (!this.deliveryQuery.regionId) return
+ const requestVersion = this.deliveryQueryVersion
+ const requestPageNum = this.deliveryQuery.pageNum
+ const requestForm = {
+ ...this.deliveryQuery,
+ userId: uni.getStorageSync('id') || this.deliveryQuery.userId || '',
+ workerId: uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId : '',
+ waimaiData: [...(this.deliveryQuery.waimaiData || [])],
+ kuaidiData: [...(this.deliveryQuery.kuaidiData || [])]
+ }
+ if (!countsOnly) {
+ this.loadStatus = 'loading'
+ }
+ this.tui.request('/mall/delivery/page', 'POST', requestForm, false, false).then((res) => {
+ if (requestVersion !== this.deliveryQueryVersion) return
+ if (res.code == 200) {
+ const result = res.result || {}
+ this.applyDeliveryCounts(result.orderCount || [])
+ if (countsOnly) return
+ const records = this.normalizeDeliveryRecords(result.records, requestPageNum)
+ if (requestPageNum === 1) {
+ this.deliveryItem = records
+ } else {
+ this.deliveryItem = [...this.deliveryItem, ...records]
+ }
+ this.deliveryTotalPages = result.pages || result.totalPages || 1
+ this.loadStatus = this.deliveryQuery.pageNum >= this.deliveryTotalPages ? 'nomore' : 'more'
+ } else {
+ if (!countsOnly) this.loadStatus = 'nomore'
+ this.tui.toast(res.message)
+ }
+ }).catch(() => {
+ if (!countsOnly) this.loadStatus = 'nomore'
+ })
+ },
+ applyDeliveryCounts(orderCount) {
+ this.kuaidiCount = 0
+ this.paotuiCount = 0
+ if (!Array.isArray(orderCount)) return
+ orderCount.forEach((item) => {
+ if (item.deliveryType == 2) {
+ this.kuaidiCount = Number(item.orderCount) || 0
+ } else if (item.deliveryType == 3) {
+ this.paotuiCount = Number(item.orderCount) || 0
+ }
+ })
+ },
+ 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)
+ }
+ })
+ },
+ resetGroupQuery(keepList = false) {
+ this.query.merchantType = this.isStoreScene ? 2 : 1
+ this.query.keyWord = ''
+ this.query.pageNumber = 1
+ this.totalPages = 1
+ if (!keepList) {
+ this.groupList = []
+ }
+ },
+ resetDeliveryQuery(keepList = false) {
+ this.deliveryQueryVersion++
+ this.deliveryQuery.pageNum = 1
+ this.deliveryTotalPages = 1
+ if (!keepList) {
+ this.deliveryItem = []
+ }
+ this.resetSwipeOrder()
+ },
+ applyDeliverySceneQuery() {
+ this.deliveryQuery.deliveryType = this.isKuaidiScene ? 2 : 3
+ this.deliveryQuery.waimaiData = []
+ this.deliveryQuery.kuaidiData = this.isKuaidiScene ? this.getCachedRouteData('kuaidiData') : []
+ },
+ getCachedRouteData(key) {
+ const cached = uni.getStorageSync(key)
+ if (!Array.isArray(cached)) return []
+ return cached.map(item => ({
+ getAreaId: item.getAreaId,
+ putAreaId: item.putAreaId
+ }))
+ },
+ resolveExpressErrandEnabled(areaInfo) {
+ if (!areaInfo || Number(areaInfo.areaKind) !== 2) return true
+ if (areaInfo.expressErrandEnabled === undefined || areaInfo.expressErrandEnabled === null || areaInfo.expressErrandEnabled === '') {
+ return true
+ }
+ return Number(areaInfo.expressErrandEnabled) !== 0
+ },
+ getShopArea() {
+ if (!this.deliveryQuery.regionId) return
+ this.tui.request('/app/shopArea/getByParentId/' + this.deliveryQuery.regionId, 'GET', {}, false, true).then((res) => {
+ if (res.code == 200) {
+ this.getshopArea = res.result || []
+ this.putshopArea = res.result || []
+ } else {
+ this.tui.toast(res.message)
+ }
+ }).catch(() => {})
+ },
+ searchDelivery(type, value) {
+ if (type === 'shuaxin') {
+ const now = Date.now()
+ const refreshInterval = 10 * 1000
+ const diff = now - this.lastRefreshTime
+ if (diff < refreshInterval) {
+ this.tui.toast(Math.ceil((refreshInterval - diff) / 1000) + '秒后再刷新')
+ return
+ }
+ this.lastRefreshTime = now
+ }
+ if (type === 'getarea') {
+ if (this.deliveryQuery.getAreaId === value.id) {
+ this.deliveryQuery.getAreaId = ''
+ this.getAreaData = {}
+ } else {
+ this.deliveryQuery.getAreaId = value.id
+ this.getAreaData = value
+ }
+ this.isgetArea = false
+ } else if (type === 'putarea') {
+ if (this.deliveryQuery.putAreaId === value.id) {
+ this.deliveryQuery.putAreaId = ''
+ this.putAreaData = {}
+ } else {
+ this.deliveryQuery.putAreaId = value.id
+ this.putAreaData = value
+ }
+ this.isputArea = false
+ } else if (type === 'yongjin') {
+ this.checkYongjin = !this.checkYongjin
+ this.deliveryQuery.order = this.checkYongjin ? 'deliveryFee' : ''
+ } else if (type === 'delgetarea') {
+ this.deliveryQuery.getAreaId = ''
+ this.getAreaData = {}
+ } else if (type === 'delputarea') {
+ this.deliveryQuery.putAreaId = ''
+ this.putAreaData = {}
+ } else if (type === 'delyongjin') {
+ this.checkYongjin = false
+ this.deliveryQuery.order = ''
+ }
+ this.resetDeliveryQuery(true)
+ this.applyDeliverySceneQuery()
+ this.getDelivery()
+ },
+ clearDeliveryFilter() {
+ this.getAreaData = {}
+ this.putAreaData = {}
+ this.checkYongjin = false
+ this.deliveryQuery.getAreaId = ''
+ this.deliveryQuery.putAreaId = ''
+ this.deliveryQuery.order = ''
+ this.resetDeliveryQuery(true)
+ this.applyDeliverySceneQuery()
+ this.getDelivery()
+ },
+ checkAdd() {
+ this.isgetArea = !this.isgetArea
+ this.isputArea = false
+ },
+ checkAdd1() {
+ this.isputArea = !this.isputArea
+ this.isgetArea = false
+ },
+ initSwipeMetrics() {
+ const info = uni.getSystemInfoSync ? uni.getSystemInfoSync() : {}
+ this.swipeOrderBaseWidth = (info.windowWidth || 375) * 0.86
+ this.swipeOrderThumbWidth = uni.upx2px ? uni.upx2px(82) : 41
+ const iosVersionMatch = info.platform === 'ios' && info.system ? String(info.system).match(/\d+/) : null
+ const iosMajorVersion = iosVersionMatch ? Number(iosVersionMatch[0]) : 0
+ this.swipeOrderLowPerf = iosMajorVersion >= 26
+ this.swipeOrderFrameGap = info.platform === 'ios' ? (this.swipeOrderLowPerf ? 36 : 24) : 16
+ this.swipeOrderProgressStep = info.platform === 'ios' ? (this.swipeOrderLowPerf ? 4 : 2) : 1
+ },
+ startDeliveryTimeTimer() {
+ this.deliveryNowTime = Date.now()
+ if (this.deliveryTimer) return
+ this.deliveryTimer = setInterval(() => {
+ this.deliveryNowTime = Date.now()
+ }, 60 * 1000)
+ },
+ stopDeliveryTimeTimer() {
+ if (!this.deliveryTimer) return
+ clearInterval(this.deliveryTimer)
+ this.deliveryTimer = null
+ },
+ startSwipeOrder(event, item, index) {
+ if (!item || item.id === undefined || item.id === null) return
+ if (!requireLoginToCurrentPage()) return
+ const touch = event.touches && event.touches[0]
+ if (!touch) return
+ 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('#pending-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))
+ 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 (!requireLoginToCurrentPage()) {
+ 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.acceptDeliveryOrder(item, index)
+ return
+ }
+ this.resetSwipeOrder()
+ },
+ resetSwipeOrder() {
+ this._swipeOrderProgress = 0
+ this._swipeOrderLastRenderTime = 0
+ clearTimeout(this._swipeOrderTapTimer)
+ 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;'
+ },
+ noop() {},
+ acceptDeliveryOrder(item, index) {
+ if (!requireLoginToCurrentPage()) {
+ this.resetSwipeOrder()
+ return
+ }
+ const worker = uni.getStorageSync('worker')
+ const area = uni.getStorageSync('area')
+ let areaInfo = {}
+ try {
+ areaInfo = typeof area === 'string' ? JSON.parse(area) : (area || {})
+ } catch (e) {
+ areaInfo = {}
+ }
+ const data = {
+ groupId: item.groupId ? item.groupId : '',
+ deliveryId: item.id,
+ workerId: worker ? worker.workerId : '',
+ workerPhone: worker ? worker.mobile : '',
+ workerName: worker ? worker.workerName : '',
+ regionId: areaInfo.id || this.deliveryQuery.regionId,
+ geolocation: this.latitude + ',' + this.longitude
+ }
+ this.tui.request('/mall/delivery/accept', 'POST', data, false, true).then((res) => {
+ if (res.code == 200) {
+ this.resetSwipeOrder()
+ if (!worker && res.result != null) {
+ uni.setStorageSync('worker', res.result)
+ }
+ this.tui.toast(res.message || '接单成功', 2000)
+ this.deliveryItem.splice(index, 1)
+ this.decreaseDeliveryCount(item.deliveryType)
+ const workerId = uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId : (res.result && res.result.workerId)
+ if (workerId) {
+ setTimeout(() => this.updateWorkerLocation(workerId), 2000)
+ }
+ } else {
+ this.resetSwipeOrder()
+ this.tui.toast(res.message)
+ }
+ }).catch(() => {
+ this.resetSwipeOrder()
+ })
+ },
+ decreaseDeliveryCount(deliveryType) {
+ if (deliveryType == 2) {
+ this.kuaidiCount = Math.max(0, (Number(this.kuaidiCount) || 0) - 1)
+ } else if (deliveryType == 3) {
+ this.paotuiCount = Math.max(0, (Number(this.paotuiCount) || 0) - 1)
+ }
+ },
+ updateWorkerLocation(workerId) {
+ uni.getLocation({
+ type: 'gcj02',
+ isHighAccuracy: true,
+ success: (res) => {
+ this.latitude = res.latitude
+ this.longitude = res.longitude
+ this.tui.request('/worker/admin/editLocation', 'POST', {
+ workerId,
+ geolocation: this.latitude + ',' + this.longitude
+ }, false, false, true).catch(() => {})
+ },
+ fail: () => {}
+ })
+ },
joinGroup(item) {
if (!requireLoginToCurrentPage()) return
const shopItem = item.shopItem || {}
@@ -307,6 +873,7 @@
uiTargetMembers: item.targetMembers || 2,
uiCurrentMembers: item.currentMembers || 0,
uiMissingMembers: this.missingMembers(item),
+ uiStoreOriginalPrice: this.formatOptionalPrice(item.storeOriginalPrice),
uiGroupPrice: this.formatPrice(item.groupPrice),
uiExpireText: this.formatExpireText(item),
uiProgressStyle: this.buildProgressStyle(item)
@@ -319,6 +886,68 @@
const shopItem = item.shopItem || {}
return shopItem.shopTypeTitle || (shopItem.shopTakeaway && shopItem.shopTakeaway.type) || (this.isStoreScene ? '团购' : '美食')
},
+ isStoreConsumeOnly(shopItem) {
+ return shopItem && shopItem.storeConsumeOnly == 1
+ },
+ getTabCount(countKey) {
+ return Number(this[countKey] || 0)
+ },
+ formatBadgeCount(count) {
+ const value = Number(count) || 0
+ return value > 99 ? '99+' : value
+ },
+ formatDeliveryAmount(item) {
+ const deliveryFee = Number(item && item.deliveryFee || 0)
+ const marketplaceFee = Number(item && item.deliveryFeeMarketplace || 0)
+ return (deliveryFee + marketplaceFee).toFixed(2)
+ },
+ formatDeliveryTime(value) {
+ if (!value) return ''
+ const date = new Date(value)
+ if (isNaN(date.getTime())) return value
+ const hour = String(date.getHours()).padStart(2, '0')
+ const minute = String(date.getMinutes()).padStart(2, '0')
+ return hour + ':' + minute
+ },
+ shouldShowReceiverPhoneIcon(item) {
+ return !!(item && item.workerId)
+ },
+ makeCall(phone) {
+ if (!phone) return
+ uni.makePhoneCall({
+ phoneNumber: phone
+ })
+ },
+ 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()
+ }
+ return new Date(timeText.replace(/-/g, '/')).getTime()
+ },
+ 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 '已经临近用户要求送达时间,为避免纠纷,建议和用户沟通是否继续接单配送。'
+ },
missingMembers(item) {
const target = Number(item.targetMembers || 2)
const current = Number(item.currentMembers || 0)
@@ -334,6 +963,10 @@
const num = Number(price || 0)
return num ? num.toFixed(2) : '--'
},
+ formatOptionalPrice(price) {
+ const num = Number(price || 0)
+ return num ? num.toFixed(2) : ''
+ },
formatExpireText(item) {
if (!item.expireTime) return '24小时内成团'
const expire = new Date(item.expireTime).getTime()
@@ -374,6 +1007,14 @@
padding-right: 0;
}
+ .pending-page--embedded .pending-chrome--sticky {
+ padding-top: 0;
+ }
+
+ .pending-page--embedded .pending-chrome--sticky .earn-guide {
+ margin-top: 0;
+ }
+
.pending-page--embedded .list-wrap {
width: 100%;
}
@@ -602,6 +1243,28 @@
font-weight: 900;
line-height: 60rpx;
text-align: center;
+ position: relative;
+ }
+
+ .tab-card--four .tab-item {
+ font-size: 25rpx;
+ }
+
+ .tab-badge {
+ position: absolute;
+ top: -6rpx;
+ right: 12rpx;
+ min-width: 30rpx;
+ height: 30rpx;
+ padding: 0 8rpx;
+ border-radius: 999rpx;
+ background: linear-gradient(135deg, #ff8a1f 0%, #ff3f5f 100%);
+ border: 3rpx solid rgba(255, 255, 255, 0.96);
+ color: #fff;
+ font-size: 18rpx;
+ font-weight: 900;
+ line-height: 24rpx;
+ box-sizing: border-box;
}
.tab-item-active {
@@ -757,6 +1420,68 @@
animation: heatParticle 3.2s ease-in-out infinite;
}
+ .delivery-toolbar {
+ width: 100%;
+ margin: 18rpx auto 0;
+ display: flex;
+ align-items: center;
+ gap: 10rpx;
+ position: relative;
+ z-index: 4;
+ }
+
+ .delivery-filter {
+ flex: 1;
+ min-width: 0;
+ height: 60rpx;
+ padding: 0 10rpx;
+ border-radius: 20rpx;
+ background: rgba(255, 255, 255, 0.86);
+ border: 1rpx solid rgba(166, 255, 234, 0.48);
+ box-shadow: 0 10rpx 22rpx rgba(20, 115, 88, 0.08);
+ color: #40534d;
+ font-size: 22rpx;
+ font-weight: 800;
+ line-height: 60rpx;
+ text-align: center;
+ box-sizing: border-box;
+ position: relative;
+ }
+
+ .delivery-filter--small {
+ flex: 0 0 86rpx;
+ }
+
+ .delivery-filter--active {
+ background: linear-gradient(135deg, rgba(255, 247, 215, 0.95), rgba(166, 255, 234, 0.72));
+ border-color: rgba(255, 188, 119, 0.72);
+ }
+
+ .delivery-filter-options {
+ width: 220rpx;
+ max-height: 320rpx;
+ overflow: scroll;
+ position: absolute;
+ top: 70rpx;
+ left: 0;
+ z-index: 20;
+ border-radius: 22rpx;
+ background: rgba(0, 35, 28, 0.9);
+ color: #fff;
+ box-shadow: 0 16rpx 34rpx rgba(0, 35, 28, 0.16);
+ }
+
+ .delivery-filter-option {
+ min-height: 60rpx;
+ padding: 0 16rpx;
+ line-height: 60rpx;
+ font-size: 22rpx;
+ border-bottom: 1rpx solid rgba(255, 255, 255, 0.12);
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+
.heat-dot-a {
left: 28rpx;
top: 18rpx;
@@ -770,11 +1495,45 @@
.list-wrap {
width: 94%;
+ min-height: 720rpx;
margin: 0 auto;
position: relative;
z-index: 1;
}
+ .delivery-list-wrap {
+ width: 100%;
+ }
+
+ .delivery-active-filters {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ padding: 0 6rpx 8rpx;
+ }
+
+ .delivery-filter-tag,
+ .delivery-filter-clear {
+ height: 40rpx;
+ margin: 0 12rpx 12rpx 0;
+ padding: 0 18rpx;
+ border-radius: 999rpx;
+ background: rgba(166, 255, 234, 0.62);
+ color: #08735d;
+ font-size: 22rpx;
+ font-weight: 800;
+ line-height: 40rpx;
+ max-width: 300rpx;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+
+ .delivery-filter-clear {
+ background: rgba(0, 191, 255, 0.08);
+ color: #00A8D8;
+ }
+
.empty-card,
.group-card {
border-radius: 34rpx;
@@ -886,6 +1645,27 @@
top: 10rpx;
}
+ .scene-mark--with-store {
+ top: auto;
+ bottom: 10rpx;
+ }
+
+ .shop-img-store-badge {
+ position: absolute;
+ left: 1rpx;
+ top: 1rpx;
+ z-index: 2;
+ height: 36rpx;
+ line-height: 36rpx;
+ padding: 0 12rpx;
+ border-radius: 999rpx;
+ background: rgba(255, 255, 255, 0.94);
+ color: #ff5b37;
+ font-size: 19rpx;
+ font-weight: 900;
+ box-shadow: 0 8rpx 16rpx rgba(255, 83, 42, 0.18);
+ }
+
.shop-info {
flex: 1;
min-width: 0;
@@ -981,6 +1761,18 @@
font-weight: 900;
}
+ .origin-price {
+ margin-right: 10rpx;
+ color: rgba(0, 35, 28, 0.42);
+ font-size: 22rpx;
+ font-weight: 800;
+ text-decoration: line-through;
+ }
+
+ .store-scene .origin-price {
+ color: rgba(84, 43, 22, 0.42);
+ }
+
.price {
color: #f0441f;
font-size: 30rpx;
@@ -1055,6 +1847,329 @@
box-shadow: 0 12rpx 24rpx rgba(255, 126, 39, 0.24);
}
+ .empty-delivery {
+ width: 98%;
+ min-height: 620rpx;
+ margin: 24rpx auto 0;
+ padding: 54rpx 36rpx;
+ box-sizing: border-box;
+ border-radius: 36rpx;
+ border: 1rpx solid rgba(166, 255, 234, 0.5);
+ background:
+ radial-gradient(circle at 78% 8%, rgba(255, 216, 168, 0.28) 0, rgba(255, 216, 168, 0) 150rpx),
+ linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 255, 251, 0.96) 100%);
+ box-shadow: 0 16rpx 38rpx rgba(0, 35, 28, 0.06);
+ text-align: center;
+ }
+
+ .empty-delivery-icon {
+ width: 104rpx;
+ height: 104rpx;
+ margin: 0 auto 22rpx;
+ border-radius: 36rpx;
+ background: linear-gradient(135deg, #fff7d7 0%, #a6ffea 100%);
+ color: #125e50;
+ font-size: 32rpx;
+ font-weight: 900;
+ line-height: 104rpx;
+ box-shadow: 0 14rpx 26rpx rgba(0, 35, 28, 0.08);
+ }
+
+ .empty-delivery-title {
+ color: #243f38;
+ font-size: 30rpx;
+ font-weight: 900;
+ }
+
+ .empty-delivery-desc {
+ width: 88%;
+ margin: 14rpx auto 0;
+ color: #74817d;
+ font-size: 24rpx;
+ line-height: 38rpx;
+ }
+
+ .delivery-card {
+ width: 98%;
+ margin: 22rpx auto 0;
+ border-radius: 34rpx;
+ background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(253, 255, 250, 0.96) 100%);
+ border: 1rpx solid rgba(255, 255, 255, 0.86);
+ box-shadow: 0 16rpx 38rpx rgba(0, 35, 28, 0.06);
+ overflow: hidden;
+ position: relative;
+ }
+
+ .delivery-time-row {
+ display: flex;
+ align-items: center;
+ margin: 20rpx 0 20rpx 20rpx;
+ }
+
+ .appointment-delivery-tag {
+ height: 48rpx;
+ margin-right: 12rpx;
+ padding: 0 16rpx;
+ border-radius: 14rpx;
+ background: linear-gradient(135deg, #ff8f1f 0%, #ff6a3d 100%);
+ color: #fff;
+ font-size: 22rpx;
+ font-weight: 800;
+ line-height: 48rpx;
+ box-shadow: 0 8rpx 18rpx rgba(255, 106, 61, 0.16);
+ }
+
+ .delivery-time {
+ min-width: 242rpx;
+ height: 48rpx;
+ padding: 0 14rpx;
+ border-radius: 14rpx;
+ background: rgba(166, 255, 234, 0.42);
+ color: #125e50;
+ font-size: 24rpx;
+ font-weight: 700;
+ line-height: 48rpx;
+ }
+
+ .delivery-order-box {
+ width: 95%;
+ margin: 0 auto;
+ border-radius: 32rpx;
+ border: 1rpx solid rgba(166, 255, 234, 0.78);
+ background: rgba(255, 255, 255, 0.74);
+ box-shadow: inset 0 0 0 1rpx rgba(255, 255, 255, 0.7);
+ position: relative;
+ }
+
+ .delivery-fee-tag {
+ width: 94rpx;
+ height: 74rpx;
+ position: absolute;
+ right: 10rpx;
+ top: -58rpx;
+ border-radius: 26rpx 26rpx 20rpx 20rpx;
+ background: linear-gradient(135deg, #d9ff8c, #75e8c9);
+ color: #173f36;
+ font-size: 23rpx;
+ font-weight: 900;
+ line-height: 74rpx;
+ text-align: center;
+ box-shadow: 0 12rpx 24rpx rgba(20, 115, 88, 0.14);
+ }
+
+ .delivery-fee-tag--3 {
+ background: linear-gradient(135deg, #ffe08c, #ff9675);
+ color: #63351d;
+ }
+
+ .delivery-shop-row {
+ min-height: 70rpx;
+ padding: 12rpx 118rpx 8rpx 28rpx;
+ box-sizing: border-box;
+ display: flex;
+ align-items: flex-start;
+ }
+
+ .delivery-shop-name {
+ flex: 1;
+ min-width: 0;
+ font-weight: 800;
+ line-height: 38rpx;
+ word-break: break-all;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ }
+
+ .delivery-goods-count {
+ flex-shrink: 0;
+ padding-left: 30rpx;
+ font-size: 24rpx;
+ font-weight: 800;
+ line-height: 38rpx;
+ color: #40534d;
+ }
+
+ .delivery-route {
+ width: 95%;
+ margin: 0 auto 18rpx;
+ font-size: 24rpx;
+ }
+
+ .delivery-route-row {
+ display: flex;
+ align-items: flex-start;
+ margin-top: 12rpx;
+ }
+
+ .delivery-route-icon {
+ width: 44rpx;
+ height: 44rpx;
+ margin-right: 12rpx;
+ border-radius: 50%;
+ background: linear-gradient(135deg, #e3ff96, #a6ffea);
+ color: #08735d;
+ font-size: 20rpx;
+ font-weight: 900;
+ line-height: 44rpx;
+ text-align: center;
+ flex-shrink: 0;
+ }
+
+ .delivery-route-icon--to {
+ background: rgba(209, 206, 255, 1);
+ color: #4e4a96;
+ }
+
+ .delivery-route-text {
+ flex: 1;
+ min-width: 0;
+ color: #40534d;
+ line-height: 44rpx;
+ word-break: break-all;
+ }
+
+ .delivery-phone {
+ width: 55rpx;
+ height: 55rpx;
+ margin-left: 12rpx;
+ flex-shrink: 0;
+ }
+
+ .delivery-commission,
+ .delivery-remark {
+ width: 95%;
+ margin: 20rpx auto;
+ color: #40534d;
+ font-size: 24rpx;
+ line-height: 42rpx;
+ }
+
+ .delivery-commission {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ }
+
+ .delivery-big-tag {
+ height: 30rpx;
+ line-height: 30rpx;
+ padding: 0 10rpx;
+ background: rgba(255, 117, 88, 1);
+ color: #fff;
+ border-radius: 10rpx;
+ font-size: 20rpx;
+ font-weight: 800;
+ }
+
+ .delivery-time-warning {
+ width: 95%;
+ margin: 20rpx auto 0;
+ padding: 18rpx 20rpx;
+ box-sizing: border-box;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ background: rgba(255, 117, 88, 0.08);
+ border: 1rpx solid rgba(255, 117, 88, 0.18);
+ border-radius: 20rpx;
+ color: rgba(255, 57, 57, 1);
+ font-size: 24rpx;
+ line-height: 36rpx;
+ }
+
+ .delivery-time-warning-text {
+ flex: 1;
+ padding-right: 18rpx;
+ }
+
+ .delivery-time-warning-phone {
+ width: 55rpx;
+ height: 55rpx;
+ flex-shrink: 0;
+ }
+
+ .dispatch-action-box {
+ width: 95%;
+ margin: 20rpx auto 24rpx;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ }
+
+ .qiangdan-btn {
+ width: 100%;
+ height: 100rpx;
+ border-radius: 999rpx;
+ background: linear-gradient(135deg, rgba(246, 255, 252, 0.98) 0%, rgba(235, 255, 249, 0.96) 100%);
+ border: 1rpx solid rgba(166, 255, 234, 0.72);
+ box-shadow: inset 0 0 0 1rpx rgba(255, 255, 255, 0.72), 0 12rpx 26rpx rgba(0, 35, 28, 0.06);
+ position: relative;
+ overflow: hidden;
+ touch-action: pan-y;
+ }
+
+ .qiangdan-btn--swiping {
+ box-shadow: inset 0 0 0 1rpx rgba(255, 255, 255, 0.62), 0 6rpx 14rpx rgba(0, 35, 28, 0.04);
+ }
+
+ .qiangdan-btn--swiping .qiangdan-progress {
+ background: rgba(108, 226, 202, 0.52);
+ }
+
+ .qiangdan-btn--low-perf,
+ .qiangdan-btn--low-perf .qiangdan-thumb {
+ box-shadow: none;
+ }
+
+ .qiangdan-progress {
+ width: 100%;
+ height: 100%;
+ border-radius: 999rpx;
+ background: linear-gradient(90deg, rgba(166, 255, 234, 0.42) 0%, rgba(108, 226, 202, 0.78) 100%);
+ transform: translate3d(0, 0, 0) scaleX(0);
+ transform-origin: left center;
+ will-change: transform;
+ backface-visibility: hidden;
+ }
+
+ .qiangdan-text {
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ top: 0;
+ left: 0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ color: #2a665b;
+ font-size: 28rpx;
+ font-weight: 900;
+ letter-spacing: 2rpx;
+ }
+
+ .qiangdan-thumb {
+ width: 82rpx;
+ height: 82rpx;
+ border-radius: 50%;
+ position: absolute;
+ left: 0;
+ top: 9rpx;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: rgba(255, 255, 255, 0.96);
+ border: 1rpx solid rgba(166, 255, 234, 0.9);
+ box-shadow: 0 10rpx 22rpx rgba(0, 35, 28, 0.12);
+ color: #1b7a69;
+ font-size: 28rpx;
+ font-weight: 900;
+ will-change: transform;
+ backface-visibility: hidden;
+ }
+
@keyframes seckillEntrySweep {
0% {
left: -220rpx;
diff --git a/components/tab-bar/tab-bar.vue b/components/tab-bar/tab-bar.vue
index 518ac9d..2b14c60 100644
--- a/components/tab-bar/tab-bar.vue
+++ b/components/tab-bar/tab-bar.vue
@@ -43,7 +43,6 @@
}, {
tabName: '配送',
pageIndex: 1,
- hideInSocial: true,
tabIcon: '/static/images/tabbar/peisong1.png',
tabIconSelect: '/static/images/tabbar/peisong.png',
isCheck: false,
@@ -95,13 +94,17 @@
socialMode: {
type: Boolean,
default: false
+ },
+ socialDeliveryEnabled: {
+ type: Boolean,
+ default: true
}
},
computed: {
displayTabs() {
if (!this.socialMode) return this.tabList
return this.tabList
- .filter((item) => !item.hideInSocial)
+ .filter((item) => this.socialDeliveryEnabled || item.pageIndex !== 1)
.map((item) => {
if (item.pageIndex === 2) {
return Object.assign({}, item, { tabName: '同城圈' })
@@ -117,6 +120,9 @@
},
socialMode() {
this.syncTabCheck(this.currentIndex)
+ },
+ socialDeliveryEnabled() {
+ this.syncTabCheck(this.currentIndex)
}
},
mounted() {
@@ -141,6 +147,9 @@
const token = uni.getStorageSync('hiver_token')
return !!(token && typeof token === 'string' && token.trim() && token !== 'null' && token !== 'undefined')
},
+ shouldRequestDeliveryCounts() {
+ return !this.socialMode || this.socialDeliveryEnabled
+ },
goLogin(index) {
const redirectKey = 'login_redirect_' + Date.now()
uni.setStorageSync(redirectKey, '/pages/index/index?tabIndex=' + index)
@@ -233,7 +242,7 @@
uni.$emit('campusUnreadChange', result)
}
}).catch(() => {}))
- if(worker){
+ if(worker && this.shouldRequestDeliveryCounts()){
const area = uni.getStorageSync('area') ? JSON.parse(uni.getStorageSync('area')) : {}
tasks.push(this.tui.request("/mall/delivery/countOrderByStatus", "POST", {workerId:worker.workerId,regionId:area.id}, false, true).then((res) => {
if (res.code == 200) {