wangfukang 1 month ago
parent
commit
fce5dd32e9
  1. 88
      pages/index/index.vue

88
pages/index/index.vue

@ -61,7 +61,10 @@
<text v-if="item.status == 2">跑腿状态 · 等待接单</text> <text v-if="item.status == 2">跑腿状态 · 等待接单</text>
<text v-if="item.status == 10">拼团订单 · 待成团</text> <text v-if="item.status == 10">拼团订单 · 待成团</text>
<text v-if="item.status == 3 && item.deliveryType == 1">外卖配送 · 骑手已接单</text> <text v-if="item.status == 3 && item.deliveryType == 1">外卖配送 · 骑手已接单</text>
<text v-if="item.status == 3 && item.deliveryType == 2">到店消费 · 等你核销</text> <block v-if="item.status == 3 && item.deliveryType == 2">
<text class="store-consume-status-tag">到店消费</text>
<text> · 等你核销</text>
</block>
<text v-if="item.status == 4 && item.deliveryType == 1">外卖配送 · 已取货</text> <text v-if="item.status == 4 && item.deliveryType == 1">外卖配送 · 已取货</text>
<text v-if="item.status == 5">订单任务完成啦</text> <text v-if="item.status == 5">订单任务完成啦</text>
<text v-if="item.status == 7">退款状态 · 等商家确认</text> <text v-if="item.status == 7">退款状态 · 等商家确认</text>
@ -430,7 +433,7 @@
<home-group-pending <home-group-pending
ref="homeGroupPending" ref="homeGroupPending"
:embedded="true" :embedded="true"
:sticky-top="navBarHeight + 46" :sticky-top="socialPendingStickyTop"
:sticky-active="lastScrollTop > stickyTrigger" :sticky-active="lastScrollTop > stickyTrigger"
/> />
</view> </view>
@ -558,7 +561,7 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<tab-bar v-if="isTabBarVisible" ref="tabBar" :width="width" @tab-index="changeIndex" :currentIndex="currentIndex" :socialMode="isSocialArea"></tab-bar> <tab-bar v-if="isTabBarVisible" ref="tabBar" :width="width" @tab-index="changeIndex" :currentIndex="currentIndex" :socialMode="isSocialArea" :socialDeliveryEnabled="socialDeliveryEnabled"></tab-bar>
</view> </view>
</template> </template>
<script> <script>
@ -693,6 +696,7 @@
}], }],
areaName: '', areaName: '',
areaKind: 1, areaKind: 1,
expressErrandEnabled: 1,
gaoxiaoList:[{ gaoxiaoList:[{
title:'拼团搭子哪里找', title:'拼团搭子哪里找',
content:'隔壁宿舍全是宝!' content:'隔壁宿舍全是宝!'
@ -832,6 +836,9 @@
isSocialArea() { isSocialArea() {
return Number(this.areaKind) === 2 return Number(this.areaKind) === 2
}, },
socialDeliveryEnabled() {
return !this.isSocialArea || Number(this.expressErrandEnabled) !== 0
},
displayGaoxiaoList() { displayGaoxiaoList() {
return this.isSocialArea ? this.socialGaoxiaoList : this.gaoxiaoList return this.isSocialArea ? this.socialGaoxiaoList : this.gaoxiaoList
}, },
@ -840,12 +847,21 @@
}, },
stickyCoverHeight() { stickyCoverHeight() {
const nav = Number(this.navBarHeight) || 0 const nav = Number(this.navBarHeight) || 0
// 社会区域覆盖「标题+标签+搜索」高度即可,避免大块空白
if (this.isSocialArea) { if (this.isSocialArea) {
return nav + 220 const chromeToSearchBottom = uni.upx2px ? uni.upx2px(242) : 121
return this.socialPendingStickyTop + chromeToSearchBottom
} }
return nav + 220 return nav + 220
}, },
socialPendingStickyTop() {
const nav = Number(this.navBarHeight) || 0
const menuTop = Number(this.menuButtonInfo && this.menuButtonInfo.top) || 0
const menuHeight = Number(this.menuButtonInfo && this.menuButtonInfo.height) || 0
const capsuleBottom = menuTop && menuHeight ? menuTop + menuHeight : 0
const compactOffset = uni.upx2px ? uni.upx2px(60) : 15
const baseTop = capsuleBottom ? Math.max(nav + 12, capsuleBottom) : nav + 30
return Math.max(0, baseTop - compactOffset)
},
filteredAreaList() { filteredAreaList() {
const keyword = this.areaKeyword.trim().toLowerCase() const keyword = this.areaKeyword.trim().toLowerCase()
if (!keyword) return this.areaList if (!keyword) return this.areaList
@ -1186,7 +1202,7 @@
query.select('#socialPendingBox').boundingClientRect(rect => { query.select('#socialPendingBox').boundingClientRect(rect => {
if (rect) { if (rect) {
this.menuListOffsetTop = rect.top + (this._scrollTopRaw || 0); this.menuListOffsetTop = rect.top + (this._scrollTopRaw || 0);
this.stickyTrigger = Math.max(200, this.menuListOffsetTop - this.navBarHeight - 46); this.stickyTrigger = Math.max(200, this.menuListOffsetTop - this.socialPendingStickyTop);
} }
}).exec(); }).exec();
return; return;
@ -1249,9 +1265,6 @@
let area = JSON.parse(uni.getStorageSync('area')) let area = JSON.parse(uni.getStorageSync('area'))
this.areaName = area.title this.areaName = area.title
this.syncAreaKind(area) this.syncAreaKind(area)
if (this.isSocialArea && this.currentIndex === 1) {
this.currentIndex = 0
}
if (uni.getStorageSync('waimaiData')) { if (uni.getStorageSync('waimaiData')) {
this.waimailistData = [] this.waimailistData = []
let waimailist = uni.getStorageSync('waimaiData') let waimailist = uni.getStorageSync('waimaiData')
@ -1284,6 +1297,7 @@
this.getShopArea(); this.getShopArea();
if (this.isSocialArea) { if (this.isSocialArea) {
this.refreshHomeGroupPending() this.refreshHomeGroupPending()
this.refreshSocialExpressSetting()
} }
} }
// 计算导航栏高度用于sticky offset:statusBarHeight + 40px内容区 // 计算导航栏高度用于sticky offset:statusBarHeight + 40px内容区
@ -2048,9 +2062,6 @@
this.suggestedArea = null this.suggestedArea = null
this.searchForm.regionId = item.id this.searchForm.regionId = item.id
this.resetDeliveryQuery() this.resetDeliveryQuery()
if (this.isSocialArea && this.currentIndex === 1) {
this.currentIndex = 0
}
this.getDelivery(); this.getDelivery();
this.getShopArea(); this.getShopArea();
if (this.isSocialArea) { if (this.isSocialArea) {
@ -2100,6 +2111,44 @@
} }
const kind = area ? Number(area.areaKind) : 1 const kind = area ? Number(area.areaKind) : 1
this.areaKind = kind === 2 ? 2 : 1 this.areaKind = kind === 2 ? 2 : 1
this.expressErrandEnabled = this.resolveExpressErrandEnabled(area)
this.leaveClosedSocialDeliveryTab()
},
resolveExpressErrandEnabled(area) {
if (!area || Number(area.areaKind) !== 2) return 1
if (area.expressErrandEnabled === undefined || area.expressErrandEnabled === null || area.expressErrandEnabled === '') {
return 1
}
return Number(area.expressErrandEnabled) === 0 ? 0 : 1
},
leaveClosedSocialDeliveryTab() {
if (this.isSocialArea && !this.socialDeliveryEnabled && this.currentIndex === 1) {
this.currentIndex = 0
}
},
refreshSocialExpressSetting() {
if (!this.isSocialArea) return
const regionId = this.searchForm.regionId
if (!regionId) return
this.tui.request('/app/shopArea/getByParentId/0', 'GET', {}, false, true).then((res) => {
if (!(res.code == 200 || res.success) || !Array.isArray(res.result)) return
const current = res.result.find(item => item && String(item.id) === String(regionId))
if (!current) return
let cached = {}
try {
const raw = uni.getStorageSync('area')
cached = raw ? (typeof raw === 'string' ? JSON.parse(raw) : raw) : {}
} catch (e) {
cached = {}
}
const nextArea = Object.assign({}, cached, current)
uni.setStorageSync('area', JSON.stringify(nextArea))
const prevEnabled = Number(this.expressErrandEnabled)
this.syncAreaKind(nextArea)
if (prevEnabled !== Number(this.expressErrandEnabled)) {
this.refreshHomeGroupPending()
}
}).catch(() => {})
}, },
refreshHomeGroupPending() { refreshHomeGroupPending() {
if (!this.isSocialArea) return if (!this.isSocialArea) return
@ -2344,7 +2393,7 @@
let that = this; let that = this;
this.isTabBarVisible = true this.isTabBarVisible = true
this.lastIndex = this.currentIndex this.lastIndex = this.currentIndex
if (this.isSocialArea && index === 1) { if (index === 1 && !this.socialDeliveryEnabled) {
index = 0 index = 0
} }
if (index != 0) { if (index != 0) {
@ -2925,6 +2974,19 @@
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.store-consume-status-tag {
display: inline-block;
height: 34rpx;
line-height: 34rpx;
padding: 0 12rpx;
border-radius: 34rpx;
background: rgba(219, 255, 157, 0.72);
color: #08735d;
font-size: 18rpx;
font-weight: 900;
vertical-align: middle;
}
.life-progress { .life-progress {
width: 100%; width: 100%;
height: 12rpx; height: 12rpx;

Loading…
Cancel
Save