diff --git a/package3/seckill/seckillGroup.vue b/package3/seckill/seckillGroup.vue index 348d087..ce23c6c 100644 --- a/package3/seckill/seckillGroup.vue +++ b/package3/seckill/seckillGroup.vue @@ -268,6 +268,7 @@ shopName: item.shopName, shopPhone: item.shopPhone, shopAddress: item.shopAddress, + merchantType: item.merchantType, getAreaId: item.getAreaId, shoArea: item.shoArea, attributeList: item.attributeList, @@ -410,7 +411,8 @@ contactPhone: item.shopPhone, shopPhone: item.shopPhone, shopAddress: item.shopAddress, - shopArea: item.shoArea || item.getAreaId + shopArea: item.shoArea || item.getAreaId, + merchantType: item.merchantType } uni.navigateTo({ url: '/package1/buyFood/buyFood?cart=' + encodeURIComponent(JSON.stringify(cart)) + diff --git a/package3/shop/merchantRegister.vue b/package3/shop/merchantRegister.vue index de5968d..ccd5b5a 100644 --- a/package3/shop/merchantRegister.vue +++ b/package3/shop/merchantRegister.vue @@ -81,15 +81,13 @@ - 所属区域 + 所属校区 - - - - {{ formData.region || '请选择所属区域' }} - - - + + + {{ formData.region || '选择校区' }} + 切换 + @@ -306,6 +304,36 @@ + + + + + + 选择商家经营校区 + 你在哪个校区开店? + 默认选中当前缓存校区,也可以搜索后切换。 + + + + + + + + + + {{item.title}} + + {{isCurrentRegion(item) ? '已选' : '选择'}} + + + 没找到这个校区 + 换个关键词试试,比如学校简称或区域名 + + + + @@ -335,6 +363,8 @@ value: 2, text: '送到楼下' }], + areaKeyword:'', + areaPopupCanClose:false, workerMobile:'', formData: { regionId:'', @@ -380,6 +410,21 @@ }; }, computed:{ + filteredAreaList() { + const keyword = this.areaKeyword.trim().toLowerCase() + if (!keyword) return this.addressList + return this.addressList.filter((item) => { + const source = [ + item.title, + item.text, + item.name, + item.regionName, + item.areaName, + item.shortName + ].filter(Boolean).join(' ').toLowerCase() + return source.indexOf(keyword) > -1 + }) + }, deliveryLocationText(){ let item = this.deliveryLocationList.find(item => item.value == this.formData.shopDeliveryLocation) return item ? item.text : '' @@ -387,9 +432,11 @@ }, onLoad(option) { this.initNavMetrics() + this.initCachedRegion() }, onShow(){ this.initNavMetrics() + this.initCachedRegion() this.getRegionList() this.formData.mobile = uni.getStorageSync('mobile')?uni.getStorageSync('mobile'):'' }, @@ -622,28 +669,78 @@ } this.formData.transferDeliveryDuration = parseInt(this.formData.transferDeliveryDuration || 0) }, + normalizeRegionItem(item) { + item = item || {} + const regionId = item.id || item.value + const regionTitle = item.title || item.text || item.name || item.regionName || item.areaName || '未命名区域' + return Object.assign({}, item, { + id: regionId, + value: regionId, + title: regionTitle, + text: regionTitle + }) + }, + initCachedRegion() { + const areaStorage = uni.getStorageSync('area') + if (!areaStorage) return + try { + let area = JSON.parse(areaStorage) + this.applyRegion(this.normalizeRegionItem(area), false) + } catch (e) {} + }, + applyRegion(region, clearTransfer = true) { + if (!region) return + const normalizedRegion = this.normalizeRegionItem(region) + if (!normalizedRegion.id) return + const isSameRegion = this.formData.regionId == normalizedRegion.id + this.formData.regionId = normalizedRegion.id + this.formData.region = normalizedRegion.title + this.areaPopupCanClose = true + if (!isSameRegion && clearTransfer) { + this.formData.transferAddressId = '' + this.formData.transferAddressName = '' + } + if (!isSameRegion || this.transferAddressList.length == 0) { + this.getTransferAddressList(normalizedRegion.id) + } + }, + isCurrentRegion(item) { + return item && this.formData.regionId && this.formData.regionId == (item.id || item.value) + }, + onClickArea(item) { + const region = this.normalizeRegionItem(item) + this.applyRegion(region) + uni.setStorageSync('area', JSON.stringify(region)) + this.areaKeyword = '' + this.$refs.areaPopup.close() + this.tui.toast('切换成功') + }, + checkArea() { + this.tui.request('/app/shopArea/getByParentId/0', 'get', {}, false, false, true).then((res) => { + if (res.code == 200) { + this.addressList = (Array.isArray(res.result) ? res.result : []).map(item => this.normalizeRegionItem(item)) + this.areaKeyword = '' + this.areaPopupCanClose = !!this.formData.regionId + this.$refs.areaPopup.open() + } else { + this.tui.toast(res.message) + } + }) + }, //获取区域 getRegionList() { let that = this; this.tui.request('/app/shopArea/getByParentId/0', 'get', {}, false, false, true).then((res) => { if (res.code !== 200) return - that.addressList = (Array.isArray(res.result) ? res.result : []).map(item => { - return { - value: item.id, - text: item.title || item.name || item.regionName || item.areaName || '未命名区域' - } - }) + that.addressList = (Array.isArray(res.result) ? res.result : []).map(item => that.normalizeRegionItem(item)) + if (!that.formData.regionId) that.initCachedRegion() }) }, regionChange(e){ const index = e.detail.value const region = this.addressList[index] if (region) { - this.formData.regionId = region.value; - this.formData.region = region.text - this.formData.transferAddressId = '' - this.formData.transferAddressName = '' - this.getTransferAddressList(region.value) + this.applyRegion(region) } }, getTransferAddressList(regionId) { @@ -925,6 +1022,277 @@ color: #9aa7a3; } + .home-popup-layer { + z-index: 1200 !important; + } + + .campus-field { + display: flex; + align-items: center; + justify-content: flex-end; + line-height: normal; + } + + .campus-switch { + position: relative; + z-index: 1; + height: 56rpx; + max-width: 100%; + padding: 0 16rpx 0 22rpx; + box-sizing: border-box; + display: inline-flex; + align-items: center; + border-radius: 999rpx; + background: rgba(255, 255, 255, 0.76); + border: 1rpx solid rgba(255, 255, 255, 0.88); + box-shadow: 0 8rpx 22rpx rgba(18, 52, 46, 0.09); + backdrop-filter: saturate(160%) blur(14rpx); + } + + .campus-switch--form::after { + content: ''; + position: absolute; + left: 18rpx; + right: 18rpx; + bottom: 8rpx; + height: 10rpx; + border-radius: 999rpx; + background: linear-gradient(90deg, rgba(44, 232, 158, 0), rgba(44, 232, 158, 0.46), rgba(44, 232, 158, 0)); + box-shadow: 0 0 16rpx rgba(44, 232, 158, 0.36); + } + + .campus-switch-name { + position: relative; + z-index: 1; + max-width: 300rpx; + color: #004638; + font-size: 28rpx; + font-weight: 900; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + text-shadow: 0 0 10rpx rgba(31, 214, 151, 0.26); + } + + .campus-switch.placeholder .campus-switch-name { + color: #9aa7a3; + text-shadow: none; + } + + .campus-switch-action { + position: relative; + z-index: 1; + flex-shrink: 0; + margin-left: 14rpx; + color: rgba(7, 61, 51, 0.54); + font-size: 22rpx; + font-weight: 800; + } + + .campus-area-popup { + position: relative; + box-sizing: border-box; + width: 650rpx; + min-height: 620rpx; + max-height: 78vh; + overflow: hidden; + padding: 38rpx 30rpx 30rpx; + border: 1rpx solid rgba(255, 255, 255, 0.78); + border-radius: 42rpx; + background: + radial-gradient(circle at 16% 8%, rgba(227, 255, 150, 0.34), rgba(227, 255, 150, 0) 220rpx), + radial-gradient(circle at 92% 18%, rgba(166, 255, 234, 0.44), rgba(166, 255, 234, 0) 260rpx), + rgba(255, 255, 255, 0.92); + box-shadow: 0 30rpx 86rpx rgba(7, 61, 51, 0.18); + backdrop-filter: blur(24rpx); + } + + .area-popup-glow { + position: absolute; + border-radius: 999rpx; + pointer-events: none; + } + + .area-popup-glow-a { + top: -82rpx; + right: -68rpx; + width: 230rpx; + height: 230rpx; + background: rgba(166, 255, 234, 0.46); + filter: blur(10rpx); + } + + .area-popup-glow-b { + left: -56rpx; + bottom: 82rpx; + width: 180rpx; + height: 180rpx; + background: rgba(227, 255, 150, 0.34); + filter: blur(14rpx); + } + + .campus-area-header { + position: relative; + z-index: 1; + text-align: center; + } + + .campus-area-kicker { + display: inline-flex; + align-items: center; + justify-content: center; + height: 44rpx; + padding: 0 22rpx; + border: 1rpx solid rgba(255, 255, 255, 0.82); + border-radius: 999rpx; + background: linear-gradient(90deg, rgba(227, 255, 150, 0.72), rgba(166, 255, 234, 0.72)); + box-shadow: 0 10rpx 26rpx rgba(13, 114, 82, 0.1); + color: #073d33; + font-size: 22rpx; + font-weight: 700; + } + + .campus-area-title { + margin-top: 22rpx; + color: #073d33; + font-size: 38rpx; + font-weight: 900; + line-height: 1.25; + } + + .campus-area-subtitle { + width: 500rpx; + margin: 12rpx auto 0; + color: rgba(7, 61, 51, 0.52); + font-size: 23rpx; + line-height: 1.5; + } + + .campus-area-search { + position: relative; + z-index: 1; + display: flex; + align-items: center; + height: 82rpx; + margin-top: 30rpx; + padding: 0 26rpx; + border: 1rpx solid rgba(7, 61, 51, 0.06); + border-radius: 999rpx; + background: rgba(255, 255, 255, 0.72); + box-shadow: inset 0 1rpx 0 rgba(255, 255, 255, 0.92), 0 14rpx 34rpx rgba(7, 61, 51, 0.08); + } + + .area-search-icon { + margin-right: 14rpx; + color: rgba(7, 61, 51, 0.5); + font-size: 34rpx; + font-weight: 700; + } + + .campus-area-search input { + flex: 1; + height: 82rpx; + color: #073d33; + font-size: 27rpx; + text-align: left; + } + + .area-search-placeholder { + color: rgba(7, 61, 51, 0.34); + } + + .campus-area-list { + position: relative; + z-index: 1; + height: 360rpx; + max-height: 610rpx; + margin-top: 24rpx; + } + + .campus-area-item { + display: flex; + align-items: center; + justify-content: space-between; + min-height: 92rpx; + margin-bottom: 16rpx; + padding: 0 18rpx 0 24rpx; + border: 1rpx solid rgba(255, 255, 255, 0.78); + border-radius: 28rpx; + background: rgba(255, 255, 255, 0.66); + box-shadow: 0 12rpx 30rpx rgba(7, 61, 51, 0.07); + color: #073d33; + } + + .campus-area-item.active { + border-color: rgba(166, 255, 234, 0.9); + background: linear-gradient(135deg, rgba(227, 255, 150, 0.58), rgba(166, 255, 234, 0.48)); + } + + .campus-area-item:active { + transform: scale(0.985); + opacity: 0.9; + } + + .area-item-main { + display: flex; + align-items: center; + min-width: 0; + font-size: 28rpx; + font-weight: 800; + } + + .area-item-main text { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .area-item-dot { + flex-shrink: 0; + width: 16rpx; + height: 16rpx; + margin-right: 16rpx; + border-radius: 50%; + background: linear-gradient(135deg, #e3ff96, #a6ffea); + box-shadow: 0 0 18rpx rgba(13, 114, 82, 0.22); + } + + .area-item-action { + flex-shrink: 0; + height: 50rpx; + margin-left: 18rpx; + padding: 0 22rpx; + border-radius: 999rpx; + background: linear-gradient(90deg, rgba(227, 255, 150, 0.95), rgba(166, 255, 234, 0.95)); + box-shadow: 0 10rpx 24rpx rgba(13, 114, 82, 0.14), 0 0 22rpx rgba(166, 255, 234, 0.42); + color: #073d33; + font-size: 22rpx; + font-weight: 900; + line-height: 50rpx; + } + + .campus-area-item.active .area-item-action { + background: #073d33; + color: #a6ffea; + } + + .campus-area-empty { + padding: 70rpx 0 56rpx; + text-align: center; + } + + .area-empty-title { + color: #073d33; + font-size: 28rpx; + font-weight: 800; + } + + .area-empty-desc { + margin-top: 12rpx; + color: rgba(7, 61, 51, 0.45); + font-size: 23rpx; + } + .code-row, .worker-query { display: flex;