wangfukang 2 weeks ago
parent
commit
5cc16c32c2
  1. 10
      package2/group/groupBuyList.vue
  2. 159
      package2/group/groupBuySingle.vue
  3. 4
      package2/group/groupPendingList.vue
  4. 6
      package2/group/studentStoreList.vue
  5. 4
      package2/login/login.vue

10
package2/group/groupBuyList.vue

@ -206,6 +206,7 @@
<script>
import { buildHomeSharePath } from '@/utils/sharePath.js'
import { hasLogin, requireLoginToCurrentPage } from '@/utils/authRedirect.js'
const SHARE_TARGET_PATH = '/package2/group/groupBuyList'
const GROUP_META_CACHE_TTL = 5 * 60 * 1000
@ -475,6 +476,7 @@
return !!(cache && cache.time && Date.now() - cache.time < GROUP_META_CACHE_TTL)
},
scheduleGroupMetaLoad() {
if (!hasLogin()) return
clearTimeout(this._groupMetaTimer)
this._groupMetaTimer = setTimeout(() => {
this.getEatType()
@ -482,6 +484,7 @@
}, 300)
},
getEatType() {
if (!hasLogin()) return
const cache = uni.getStorageSync(GROUP_EAT_TYPE_CACHE_KEY)
if (this.isFreshCache(cache)) {
this.applyEatTypeList(cache.list || [])
@ -521,6 +524,7 @@
}
},
getShopArea() {
if (!hasLogin()) return
const regionId = JSON.parse(uni.getStorageSync('area')).id
const cacheKey = GROUP_SHOP_AREA_CACHE_PREFIX + regionId
const cache = uni.getStorageSync(cacheKey)
@ -552,6 +556,7 @@
}).catch((res) => {})
},
getOnlineWorkerCountByCanteenArea() {
if (!hasLogin()) return
let that = this
that.tui.request("/worker/getOnlineWorkerByArea", "GET", {
parentId: JSON.parse(uni.getStorageSync('area')).id
@ -596,9 +601,11 @@
that.judgeBusinessStatus()
that.isArea = false
if (that.searchForm.pageNumber == 1) {
if (hasLogin()) {
that.scheduleGroupMetaLoad()
that.scheduleOnlineWorkerCountLoad()
}
}
} else {
that.tui.toast(res.message);
return
@ -751,6 +758,7 @@
goDetail(type, item) {
console.log('数据',item)
if (type == 'shop') {
if (!requireLoginToCurrentPage()) return
uni.navigateTo({
url: '/package2/group/groupBuySingle?type=shop&item=' + encodeURIComponent(JSON.stringify(item))
})
@ -765,12 +773,14 @@
this.goSearch()
}
} else {
if (!requireLoginToCurrentPage()) return
uni.navigateTo({
url: '/package2/group/groupBuySingle?type=product&item=' + encodeURIComponent(JSON.stringify(item))
})
}
},
goPendingGroup() {
if (!requireLoginToCurrentPage()) return
uni.navigateTo({
url: '/package2/group/groupPendingList?scene=takeaway'
})

159
package2/group/groupBuySingle.vue

@ -181,7 +181,7 @@
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/f7227759d693497a8beab87ff437a875.png" alt="" />
<view class="weipincheng">+</view>
</view>
<view class="pintuan-right-cha">
<view class="pintuan-right-cha" @tap.stop="openOrderWait(item)">
<text style="color: red;">{{item.minGroupCount}}</text>拼成
</view>
</view>
@ -487,7 +487,10 @@
<template v-if="!groupId">
<view class="pintuan2 group-face-btn" @tap.stop="submitPintuan(true)">
<uni-icons type="help" size="20" @tap.stop="openMianRemark"></uni-icons>
<view class="group-face-copy">
<text class="group-face-text">面对面团</text>
<text class="group-face-sub">只能分享好友成团</text>
</view>
</view>
<view class="pintuan2 group-submit-btn" @tap.stop="submitPintuan(false)">
{{isStoreGroupOrder ? '发起到店团' : '发起拼团'}}{{selectedGroupRule && selectedGroupRule.groupPrice ? parseFloat(selectedGroupRule.groupPriceAndMore).toFixed(2) : '0.00'}}
@ -516,7 +519,7 @@
<view class="join-popup-main">快来加入拼团吧</view>
<view class="join-popup-sub">选一支快成团的队伍马上省</view>
</view>
<scroll-view scroll-y style="max-height: 50vh;">
<scroll-view class="join-team-scroll" scroll-y :show-scrollbar="false">
<template>
<!-- 占位假数据展示 -->
<view class="">
@ -543,8 +546,15 @@
</view>
</view>
</template>
<view style="width: 100%;height: 160rpx;"></view>
</scroll-view>
<view class="join-popup-footer">
<view class="join-rule-check" @tap.stop="toggleWaitRuleKnown">
<view :class="autoWaitRuleKnown ? 'radio-check join-rule-icon' : 'radio-no-check join-rule-icon'">
<uni-icons v-if="autoWaitRuleKnown" type="checkmarkempty" size="12"></uni-icons>
</view>
<text>我已知晓参团规则后续不再自动弹出</text>
</view>
</view>
</view>
</uni-popup>
@ -840,6 +850,7 @@
productItem: [],
tuanzhangOrder: {},
cartItems: [],
regionMismatchRedirecting: false,
moreBuyData: [],
vModelValue: 0,
currentItem: {},
@ -894,7 +905,9 @@
freeOrderAmount: '0.00',
pendingFreeOrderAutoPay: false,
popupPageStyle: '',
bottomPopupOpenCount: 0
bottomPopupOpenCount: 0,
autoWaitRuleKnown: false,
hasAutoOpenedWaitPopup: false
}
},
components: {
@ -971,6 +984,7 @@
}
},
onLoad(option) {
this.initWaitRuleKnown();
this.type = option.type;
this.orderScene = option.orderScene || '';
this.rememberShareTarget(option || {});
@ -1006,6 +1020,7 @@
}
}
if (this.shopItem && this.shopItem.id) {
if (!this.ensureShopInCurrentRegion(this.shopItem)) return;
this.getCategory(this.shopItem.id);
this.getProduct('');
} else if (option.shopId) {
@ -1015,6 +1030,7 @@
}
},
onShow() {
if (this.regionMismatchRedirecting) return;
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect();
this.fetchCoupons();
// (menuButton)
@ -1060,7 +1076,32 @@
targetPath += '&orderScene=' + encodeURIComponent(option.orderScene);
}
uni.setStorageSync('authPendingTargetPath', targetPath);
uni.setStorageSync('pendingShareTargetPath', targetPath);
uni.removeStorageSync('pendingShareTargetPath');
},
getWaitRuleKnownKey() {
return 'groupBuySingleWaitRuleKnown';
},
initWaitRuleKnown() {
this.autoWaitRuleKnown = uni.getStorageSync(this.getWaitRuleKnownKey()) == 1;
},
toggleWaitRuleKnown() {
this.autoWaitRuleKnown = !this.autoWaitRuleKnown;
if (this.autoWaitRuleKnown) {
uni.setStorageSync(this.getWaitRuleKnownKey(), 1);
} else {
uni.removeStorageSync(this.getWaitRuleKnownKey());
}
},
tryAutoOpenOrderWait() {
if (this.groupId || this.hasAutoOpenedWaitPopup || this.autoWaitRuleKnown) return;
if (!Array.isArray(this.orderListWait) || this.orderListWait.length == 0) return;
this.chooseWaitType = false;
this.hasAutoOpenedWaitPopup = true;
this.$nextTick(() => {
if (this.$refs.pintuanGroupPopup) {
this.$refs.pintuanGroupPopup.open('bottom');
}
});
},
getCurrentRegionId() {
let area = uni.getStorageSync('area');
@ -1072,6 +1113,45 @@
return '';
}
},
normalizeRegionId(value) {
return value === undefined || value === null ? '' : String(value).trim();
},
getShopRegionId(shopItem) {
if (!shopItem) return '';
return this.normalizeRegionId(shopItem.regionId || shopItem.shopRegionId || shopItem.region);
},
ensureShopInCurrentRegion(shopItem) {
const currentRegionId = this.normalizeRegionId(this.getCurrentRegionId());
const shopRegionId = this.getShopRegionId(shopItem);
if (!currentRegionId || !shopRegionId || currentRegionId === shopRegionId) return true;
this.regionMismatchRedirecting = true;
this.clearShareRedirectCache();
uni.showModal({
title: '提示',
content: '当前商家不在本校区范围,请切换校区后下单',
showCancel: false,
confirmText: '我知道了',
success: () => {
this.backHome();
},
fail: () => {
this.backHome();
}
});
return false;
},
clearShareRedirectCache() {
uni.removeStorageSync('authPendingTargetPath');
uni.removeStorageSync('pendingShareTargetPath');
},
backHome() {
uni.switchTab({
url: '/pages/index/index',
fail: () => {
uni.reLaunch({ url: '/pages/index/index' });
}
});
},
parseRouteItem(item) {
if (item == null || item === '') return null;
try {
@ -1153,6 +1233,7 @@
return;
}
this.shopItem = this.normalizeShopDeliveryFields(shopRes.result);
if (!this.ensureShopInCurrentRegion(this.shopItem)) return;
if (this.shopItem.products) {
this.shopRecommend = this.shopItem.products;
for (let i = 0; i < this.shopRecommend.length; i++) {
@ -1472,13 +1553,14 @@
});
},
openOrderWait(item) {
if(this.orderListWait != null && this.orderListWait.length == 0){
const waitList = item && item != '' ? item.orderListWait : this.orderListWait;
if (!Array.isArray(waitList) || waitList.length == 0) {
return;
}
this.chooseWaitType = false
if (item != '') {
this.chooseWaitType = true
this.orderListWait = item.orderListWait
this.orderListWait = waitList
this.currentItem = item;
// Parse specifications
@ -1572,7 +1654,7 @@
}, false, false).then((res) => {
that.loadStatus = 'nomore';
if (res.code == 200) {
that.orderListWait = res.result;
that.orderListWait = Array.isArray(res.result) ? res.result : [];
for (let i = 0; i < that.productItem.length; i++) {
that.productItem[i].orderListWait = []
if (that.orderListWait != null && that.orderListWait.length > 0) {
@ -1592,6 +1674,7 @@
}
that.$forceUpdate();
that.tryAutoOpenOrderWait();
} else {
that.tui.toast(res.message);
return;
@ -1757,6 +1840,7 @@
}
},
submitAddToCart() {
if (!requireLoginToCurrentPage()) return;
let specChoices = {};
for (let spec of this.parsedSpecs) {
specChoices[spec.name] = spec.canbuy === 1 ? spec.selected[0] : spec.selected;
@ -2354,9 +2438,7 @@
if (pages.length > 1) {
uni.navigateBack();
} else {
uni.switchTab({
url: '/pages/index/index'
});
this.backHome();
}
}
}
@ -3933,6 +4015,21 @@
line-height: 1;
}
.group-face-copy {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 6rpx;
}
.group-face-sub {
color: rgba(21, 58, 53, 0.72);
font-size: 20rpx;
font-weight: 700;
line-height: 1;
}
@keyframes checkoutTextShine {
0%,
@ -4138,6 +4235,46 @@
overflow: hidden;
}
.join-team-popup {
height: 820rpx;
max-height: 82vh;
display: flex;
flex-direction: column;
overflow: hidden;
padding-bottom: 0;
box-sizing: border-box;
}
.join-team-scroll {
flex: 1;
min-height: 0;
padding: 0 0 16rpx;
box-sizing: border-box;
}
.join-popup-footer {
flex-shrink: 0;
padding: 18rpx 20rpx 22rpx;
margin: 4rpx -20rpx 0;
background: rgba(246, 255, 251, 0.96);
border-top: 1rpx solid rgba(166, 255, 234, 0.45);
}
.join-rule-check {
display: flex;
align-items: center;
justify-content: center;
color: #52615d;
font-size: 24rpx;
font-weight: 700;
line-height: 34rpx;
}
.join-rule-icon {
flex-shrink: 0;
margin-right: 12rpx;
}
.group-order-popup .popup-product-card {
padding: 14rpx 18rpx;
margin-bottom: 10rpx;

4
package2/group/groupPendingList.vue

@ -88,6 +88,8 @@
</template>
<script>
import { requireLoginToCurrentPage } from '@/utils/authRedirect.js'
export default {
data() {
return {
@ -195,6 +197,7 @@
})
},
joinGroup(item) {
if (!requireLoginToCurrentPage()) return
const shopItem = item.shopItem || {}
if (!shopItem.id) {
this.tui.toast('商家信息缺失,暂时无法参团')
@ -210,6 +213,7 @@
})
},
goSeckillGroup() {
if (!requireLoginToCurrentPage()) return
uni.navigateTo({
url: '/package3/seckill/seckillGroup'
})

6
package2/group/studentStoreList.vue

@ -141,6 +141,7 @@
<script>
import { buildHomeSharePath } from '@/utils/sharePath.js'
import { hasLogin, requireLoginToCurrentPage } from '@/utils/authRedirect.js'
const SHARE_TARGET_PATH = '/package2/group/studentStoreList'
@ -337,10 +338,13 @@
this.tui.toast('请先选择区域')
return
}
if (hasLogin()) {
this.getShopArea()
}
this.getShopList()
},
getShopArea() {
if (!hasLogin()) return
this.tui.request('/app/shopArea/getByParentId/' + this.searchForm.regionId, 'GET', {}, false, true).then((res) => {
if (res.code == 200) {
this.shopArea = Array.isArray(res.result) ? res.result : []
@ -489,11 +493,13 @@
})
},
goShop(item) {
if (!requireLoginToCurrentPage()) return
uni.navigateTo({
url: '/package2/group/groupBuySingle?type=shop&orderScene=storeGroup&item=' + encodeURIComponent(JSON.stringify(item))
})
},
goPendingGroup() {
if (!requireLoginToCurrentPage()) return
uni.navigateTo({
url: '/package2/group/groupPendingList?scene=storeGroup'
})

4
package2/login/login.vue

@ -468,7 +468,7 @@
.bubble-c {
top: 640rpx;
right: 30rpx;
right: 20rpx;
animation-delay: -4s;
}
@ -602,7 +602,7 @@
.sticker-phone {
left: 4rpx;
top: 140rpx;
top: 60rpx;
transform: rotate(-6deg);
}

Loading…
Cancel
Save