wangfukang 3 weeks ago
parent
commit
91dea41434
  1. 4
      package3/seckill/seckillGroup.vue
  2. 406
      package3/shop/merchantRegister.vue

4
package3/seckill/seckillGroup.vue

@ -268,6 +268,7 @@
shopName: item.shopName, shopName: item.shopName,
shopPhone: item.shopPhone, shopPhone: item.shopPhone,
shopAddress: item.shopAddress, shopAddress: item.shopAddress,
merchantType: item.merchantType,
getAreaId: item.getAreaId, getAreaId: item.getAreaId,
shoArea: item.shoArea, shoArea: item.shoArea,
attributeList: item.attributeList, attributeList: item.attributeList,
@ -410,7 +411,8 @@
contactPhone: item.shopPhone, contactPhone: item.shopPhone,
shopPhone: item.shopPhone, shopPhone: item.shopPhone,
shopAddress: item.shopAddress, shopAddress: item.shopAddress,
shopArea: item.shoArea || item.getAreaId shopArea: item.shoArea || item.getAreaId,
merchantType: item.merchantType
} }
uni.navigateTo({ uni.navigateTo({
url: '/package1/buyFood/buyFood?cart=' + encodeURIComponent(JSON.stringify(cart)) + url: '/package1/buyFood/buyFood?cart=' + encodeURIComponent(JSON.stringify(cart)) +

406
package3/shop/merchantRegister.vue

@ -81,15 +81,13 @@
</view> </view>
<view class="value"> <view class="value">
<view class="name"> <view class="name">
所属区 所属
</view> </view>
<view class="text" style="text-align: right;"> <view class="text campus-field" @tap.stop="checkArea">
<picker :range="addressList" range-key="text" @change="regionChange"> <view class="campus-switch campus-switch--form" :class="{ placeholder: !formData.region }">
<view class="picker-text" :class="{ placeholder: !formData.region }"> <text class="campus-switch-name">{{ formData.region || '选择校区' }}</text>
{{ formData.region || '请选择所属区域' }} <text class="campus-switch-action">切换</text>
<uni-icons type="bottom" size="14" color="#999"></uni-icons> </view>
</view>
</picker>
</view> </view>
</view> </view>
</view> </view>
@ -306,6 +304,36 @@
<button @tap.stop="submit()">保存</button> <button @tap.stop="submit()">保存</button>
</view> </view>
<uni-popup ref="areaPopup" class="home-popup-layer" :is-mask-click="areaPopupCanClose" background-color="transparent">
<view class="campus-area-popup">
<view class="area-popup-glow area-popup-glow-a"></view>
<view class="area-popup-glow area-popup-glow-b"></view>
<view class="campus-area-header">
<view class="campus-area-kicker">选择商家经营校区</view>
<view class="campus-area-title">你在哪个校区开店</view>
<view class="campus-area-subtitle">默认选中当前缓存校区也可以搜索后切换</view>
</view>
<view class="campus-area-search">
<text class="area-search-icon"></text>
<input v-model="areaKeyword" confirm-type="search" placeholder="搜索学校 / 校区 / 区域"
placeholder-class="area-search-placeholder" />
</view>
<scroll-view scroll-y class="campus-area-list">
<view class="campus-area-item" :class="{ active: isCurrentRegion(item) }"
v-for="(item,index) in filteredAreaList" :key="index" @tap="onClickArea(item)">
<view class="area-item-main">
<view class="area-item-dot"></view>
<text>{{item.title}}</text>
</view>
<view class="area-item-action">{{isCurrentRegion(item) ? '已选' : '选择'}}</view>
</view>
<view class="campus-area-empty" v-if="filteredAreaList.length === 0">
<view class="area-empty-title">没找到这个校区</view>
<view class="area-empty-desc">换个关键词试试比如学校简称或区域名</view>
</view>
</scroll-view>
</view>
</uni-popup>
<common-loading /> <common-loading />
</view> </view>
@ -335,6 +363,8 @@
value: 2, value: 2,
text: '送到楼下' text: '送到楼下'
}], }],
areaKeyword:'',
areaPopupCanClose:false,
workerMobile:'', workerMobile:'',
formData: { formData: {
regionId:'', regionId:'',
@ -380,6 +410,21 @@
}; };
}, },
computed:{ 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(){ deliveryLocationText(){
let item = this.deliveryLocationList.find(item => item.value == this.formData.shopDeliveryLocation) let item = this.deliveryLocationList.find(item => item.value == this.formData.shopDeliveryLocation)
return item ? item.text : '' return item ? item.text : ''
@ -387,9 +432,11 @@
}, },
onLoad(option) { onLoad(option) {
this.initNavMetrics() this.initNavMetrics()
this.initCachedRegion()
}, },
onShow(){ onShow(){
this.initNavMetrics() this.initNavMetrics()
this.initCachedRegion()
this.getRegionList() this.getRegionList()
this.formData.mobile = uni.getStorageSync('mobile')?uni.getStorageSync('mobile'):'' this.formData.mobile = uni.getStorageSync('mobile')?uni.getStorageSync('mobile'):''
}, },
@ -622,28 +669,78 @@
} }
this.formData.transferDeliveryDuration = parseInt(this.formData.transferDeliveryDuration || 0) 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() { getRegionList() {
let that = this; let that = this;
this.tui.request('/app/shopArea/getByParentId/0', 'get', {}, false, false, true).then((res) => { this.tui.request('/app/shopArea/getByParentId/0', 'get', {}, false, false, true).then((res) => {
if (res.code !== 200) return if (res.code !== 200) return
that.addressList = (Array.isArray(res.result) ? res.result : []).map(item => { that.addressList = (Array.isArray(res.result) ? res.result : []).map(item => that.normalizeRegionItem(item))
return { if (!that.formData.regionId) that.initCachedRegion()
value: item.id,
text: item.title || item.name || item.regionName || item.areaName || '未命名区域'
}
})
}) })
}, },
regionChange(e){ regionChange(e){
const index = e.detail.value const index = e.detail.value
const region = this.addressList[index] const region = this.addressList[index]
if (region) { if (region) {
this.formData.regionId = region.value; this.applyRegion(region)
this.formData.region = region.text
this.formData.transferAddressId = ''
this.formData.transferAddressName = ''
this.getTransferAddressList(region.value)
} }
}, },
getTransferAddressList(regionId) { getTransferAddressList(regionId) {
@ -925,6 +1022,277 @@
color: #9aa7a3; 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, .code-row,
.worker-query { .worker-query {
display: flex; display: flex;

Loading…
Cancel
Save