fanfan 4 months ago
parent 537dd9eac8
commit 1e1471dbe9
  1. 37
      pages/gamll/index.vue

@ -2,7 +2,8 @@
<view class="park"> <view class="park">
<view class="park-top"> <view class="park-top">
<view class="park-navbar"> <view class="park-navbar">
<u-navbar :is-fixed='false' title="开通商城" :border-bottom="false" :background="backgroundNone"> <!-- :is-fixed='false' -->
<u-navbar title="开通商城" :border-bottom="false" :background="scrollTop?background:backgroundNone">
</u-navbar> </u-navbar>
<view class="box_1"> <view class="box_1">
<image :src="$picUrl+'/static/default-logo.png'" class="image_2" <image :src="$picUrl+'/static/default-logo.png'" class="image_2"
@ -19,7 +20,8 @@
</view> </view>
</view> </view>
</view> </view>
<view class="tab_fix" :style="{ 'border-radius': radius,'padding-top':paddingTo}"> <u-sticky offset-top="142">
<view class="tab_fix" :style="{ 'border-radius': radius}">
<view class="tab_pos"> <view class="tab_pos">
<view class="tab_bg"> <view class="tab_bg">
<view :class="[tabIndex==index ? 'tab_active' : 'tab_a']" v-for="(item,index) in tabbar" <view :class="[tabIndex==index ? 'tab_active' : 'tab_a']" v-for="(item,index) in tabbar"
@ -29,6 +31,7 @@
</view> </view>
</view> </view>
</view> </view>
</u-sticky>
<view class="tab-type"> <view class="tab-type">
<view class="tab-pro" v-for="(item,index) in tabType" :class="index==banIndex?'tab-pro-active':''" <view class="tab-pro" v-for="(item,index) in tabType" :class="index==banIndex?'tab-pro-active':''"
@click="onChageBan(index)" :key="index"> @click="onChageBan(index)" :key="index">
@ -237,7 +240,6 @@
paymentMethods: [], paymentMethods: [],
isClick: true, isClick: true,
radius: '28rpx 0 0 0', radius: '28rpx 0 0 0',
paddingTo: '0rpx',
leftNum: 33.33333, leftNum: 33.33333,
tabbar: ['零售商城', '批发商城'], tabbar: ['零售商城', '批发商城'],
tabIndex: 0, tabIndex: 0,
@ -265,12 +267,10 @@
retail: '', retail: '',
wholesale: '', wholesale: '',
scrollTop: 0, scrollTop: 0,
isAtTop: ''
} }
}, },
onLoad() { onLoad() {
this.retail = uni.getStorageSync('userInfo').retail this.retail = uni.getStorageSync('userInfo').retail
console.log(this.retail)
this.getRetailList() this.getRetailList()
this.getDescribe() this.getDescribe()
uni.$on('appShow', this.solveShowMsg); uni.$on('appShow', this.solveShowMsg);
@ -279,25 +279,22 @@
uni.$off('appShow', this.solveShowMsg); uni.$off('appShow', this.solveShowMsg);
}, },
onShow() { onShow() {
this.checkIfElementIsAtTop()
}, },
onPageScroll(e) { onPageScroll(e) {
this.checkIfElementIsAtTop() this.scrollTop = e.scrollTop > 120 ? true : false
if (this.scrollTop) {
this.radius = '0rpx';
} else {
this.radius = this.tabIndex == 0 ? '28rpx 0 0 0' : '0 28rpx 0 0';
}
}, },
methods: { methods: {
checkIfElementIsAtTop() { checkIfElementIsAtTop() {
const query = uni.createSelectorQuery().in(this); const query = uni.createSelectorQuery().in(this);
query.select('.tab_fix').boundingClientRect(data => { query.select('u-navbar ').boundingClientRect(data => {
if (data) { if (data) {
// top0 console.log(data, 'kkkkkkkkkkkkkkkkk')
this.isAtTop = data.top === 0;
if (this.isAtTop) {
this.radius = '28rpx 0 0 0';
this.paddingTo = '120rpx';
} else {
this.radiu = '0';
this.paddingTo = '0rpx';
}
} }
}).exec(); }).exec();
}, },
@ -719,10 +716,7 @@
.tab_fix { .tab_fix {
overflow: hidden; overflow: hidden;
position: -webkit-sticky; height: 126rpx;
position: sticky;
top: 0;
z-index: 99999;
background: linear-gradient(180deg, rgba(253, 202, 197, 1) 0.42%, rgba(254, 231, 229, 1) 32.99%, rgba(255, 255, 255, 1) 100%); background: linear-gradient(180deg, rgba(253, 202, 197, 1) 0.42%, rgba(254, 231, 229, 1) 32.99%, rgba(255, 255, 255, 1) 100%);
} }
@ -874,6 +868,7 @@
.tab-box { .tab-box {
margin: 10rpx 30rpx 24rpx 30rpx; margin: 10rpx 30rpx 24rpx 30rpx;
overflow: hidden; overflow: hidden;
.tabFavour { .tabFavour {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;

Loading…
Cancel
Save