diff --git a/package2/group/groupBuyList.vue b/package2/group/groupBuyList.vue index 74e9ce0..3edfb9d 100644 --- a/package2/group/groupBuyList.vue +++ b/package2/group/groupBuyList.vue @@ -106,11 +106,11 @@ - - + + - 休息中 - 营业时间 {{getBusinessHoursText(item)}} + {{getShopClosedTitle(item)}} + 营业时间 {{getBusinessHoursText(item)}} @@ -555,9 +555,9 @@ this.searchForm.pageNumber = 1 this.getShopList() }, - buyingye() { + buyingye(item) { uni.showToast({ - title: '店铺不在营业时间!', + title: this.getShopStatus(item) == 2 ? '店铺暂停营业' : '店铺不在营业时间!', icon: 'none' }); }, @@ -815,6 +815,19 @@ getDineInText(item) { return item && item.supportDineIn == 1 ? '可堂食' : '无堂食' }, + getShopStatus(item) { + const status = Number(item && item.status) + return isNaN(status) ? 1 : status + }, + isShopUnavailable(item) { + return this.getShopStatus(item) != 1 + }, + getShopClosedTitle(item) { + return this.getShopStatus(item) == 2 ? '暂停营业' : '休息中' + }, + shouldShowBusinessHours(item) { + return this.getShopStatus(item) != 2 && !!this.getBusinessHoursText(item) + }, openKitchen(item) { if (!this.hasOpenKitchenVideo(item)) { this.tui.toast('暂无明厨亮灶') @@ -903,8 +916,8 @@ goDetail(type, item) { console.log('数据',item) if (type == 'shop') { - if (item && item.status != 1) { - this.buyingye() + if (item && this.isShopUnavailable(item)) { + this.buyingye(item) return } if (!requireLoginToCurrentPage()) return diff --git a/package2/group/studentStoreList.vue b/package2/group/studentStoreList.vue index 3d8d551..c034673 100644 --- a/package2/group/studentStoreList.vue +++ b/package2/group/studentStoreList.vue @@ -80,12 +80,12 @@ {{emptySubText}} - - + - 休息中 - 营业时间 {{getBusinessHoursText(item)}} + {{getShopClosedTitle(item)}} + 营业时间 {{getBusinessHoursText(item)}} @@ -598,15 +598,15 @@ checkArea() { this.isArea = !this.isArea }, - buyingye() { + buyingye(item) { uni.showToast({ - title: '店铺暂不营业,晚点再来逛', + title: this.getShopStatus(item) == 2 ? '店铺暂停营业' : '店铺暂不营业,晚点再来逛', icon: 'none' }) }, goShop(item) { - if (item && item.status != 1) { - this.buyingye() + if (item && this.isShopUnavailable(item)) { + this.buyingye(item) return } if (!requireLoginToCurrentPage()) return @@ -625,6 +625,19 @@ if (item.shopTakeaway && item.shopTakeaway.type) return item.shopTakeaway.type return this.isSocialArea ? '同城生活' : '校园生活' }, + getShopStatus(item) { + const status = Number(item && item.status) + return isNaN(status) ? 1 : status + }, + isShopUnavailable(item) { + return this.getShopStatus(item) != 1 + }, + getShopClosedTitle(item) { + return this.getShopStatus(item) == 2 ? '暂停营业' : '休息中' + }, + shouldShowBusinessHours(item) { + return this.getShopStatus(item) != 2 && !!this.getBusinessHoursText(item) + }, formatShopItem(item, index) { const heatPercent = this.getHeatPercent(item, index) return {