123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443 |
- <template>
- <mobile-frame :frameStyle="frameStyle" @toPath="toPath">
- <scroll-view class="scrollView" scroll-with-animation :scroll-into-view="topItem" scroll-y="true" @scroll="handleScroll">
- <view class="main" id="top">
- <view class="zero one">
- <input type="text" placeholder="搜索商品" @tap="toCommon('pagesHome/market/search')" placeholder-class="placss">
- </view>
- <view class="zero two">
- <swiper class="swiper" circular :indicator-dots="true" indicator-color="#ffffff" indicator-active-color="#FB1438" :autoplay="true" :interval="3000" :duration="1000">
- <swiper-item class="list" v-for="(item,index) in bannerList" :key="index">
- <image class="image" :src="item.url" mode=""></image>
- </swiper-item>
- </swiper>
- </view>
- <view class="zero thr">
- <view class="list" v-for="(item,index) in btnList" :key="index" @tap="toCommon(item.route)">
- <image class="image" :src="item.url" mode=""></image>
- <view class="textOver name">
- {{item.name}}
- </view>
- </view>
- </view>
- <view class="zero four">
- <view class="recomList" v-for="(item,index) in recomList" :key="index">
- <view class="list" v-for="(tag,indexs) in item.list" :key="indexs">
- <view class="title">
- <text>{{tag.title||' '}}</text>
- </view>
- <image class="image" :src="tag.url" mode=""></image>
- <view class="textOver name">
- {{tag.name}}
- </view>
- </view>
- </view>
- </view>
- <view class="zero five">
- <view class="list" v-for="(item,index) in marketList" :key="index">
- <image class="image" :src="item.url" mode=""></image>
- <view class="name">
- {{item.name}}
- </view>
- <view class="other">
- <view class="money">
- <text>¥</text><text>{{item.money}}</text>
- </view>
- <view class="btn">
- <button type="default" size="mini">购买</button>
- </view>
- </view>
- </view>
- </view>
- </view>
- </scroll-view>
- <view class="backTop" v-if="isShow==true">
- <text @click="backTop" class="iconfont icon-fanhuidingbu"></text>
- </view>
- </mobile-frame>
- </template>
- <script>
- export default {
- data() {
- return {
- frameStyle: {
- useBar: true
- },
- bannerList: [ // 轮播图
- {
- url: require('@/static/test.png')
- },
- {
- url: require('@/static/test.png')
- },
- {
- url: require('@/static/test.png')
- },
- {
- url: require('@/static/test.png')
- },
- ],
- btnList: [ //功能按钮
- {
- name: '商品分类',
- url: require('@/static/logo.png'),
- route: 'pagesHome/market/type'
- },
- {
- name: '首农专区',
- url: require('@/static/logo.png'),
- route: ''
- },
- {
- name: '地方特产',
- url: require('@/static/logo.png'),
- route: ''
- },
- {
- name: '进口食品',
- url: require('@/static/logo.png'),
- route: ''
- },
- {
- name: '扶贫专区',
- url: require('@/static/logo.png'),
- route: ''
- },
- {
- name: '自提门店',
- url: require('@/static/logo.png'),
- route: ''
- },
- {
- name: '点到优选',
- url: require('@/static/logo.png'),
- route: ''
- },
- {
- name: '活动专区',
- url: require('@/static/logo.png'),
- route: ''
- },
- {
- name: '兑换中心',
- url: require('@/static/logo.png'),
- route: ''
- },
- {
- name: '员工中心',
- url: require('@/static/logo.png'),
- route: ''
- },
- ],
- recomList: [ //推荐好物
- {
- list: [ //商品
- {
- title: '新品上架',
- url: require('@/static/test.png'),
- name: '商品名称'
- },
- {
- title: '',
- url: require('@/static/test.png'),
- name: '商品名称'
- },
- ]
- },
- {
- list: [ //商品
- {
- title: '发现好货',
- url: require('@/static/test.png'),
- name: '商品名称'
- },
- {
- title: '热销爆款',
- url: require('@/static/test.png'),
- name: '商品名称'
- },
- ]
- },
- {
- list: [ //商品
- {
- title: '首农精选',
- url: require('@/static/test.png'),
- name: '商品名称'
- },
- {
- title: '居家常备',
- url: require('@/static/test.png'),
- name: '商品名称'
- },
- ]
- },
- {
- list: [ //商品
- {
- title: '人气单品',
- url: require('@/static/test.png'),
- name: '商品名称'
- },
- {
- title: '夏季畅销',
- url: require('@/static/test.png'),
- name: '商品名称'
- },
- ]
- }
- ],
- marketList: [ //商品列表
- {
- url: require('@/static/test.png'),
- name: '商品名称',
- money: 10
- },
- {
- url: require('@/static/test.png'),
- name: '商品名称',
- money: 10
- },
- {
- url: require('@/static/test.png'),
- name: '商品名称',
- money: 10
- },
- {
- url: require('@/static/test.png'),
- name: '商品名称',
- money: 10
- },
- {
- url: require('@/static/test.png'),
- name: '商品名称',
- money: 10
- },
- ],
- // 是否显示返回顶部
- isShow: false,
- topItem: ''
- };
- },
- onShow: function() {},
- methods: {
- // 公共跳转
- toCommon(e) {
- uni.navigateTo({
- url: `/${e}`
- })
- },
- toPath(e) {
- if (e && e.route) uni.redirectTo({
- url: `/${e.route}`
- })
- },
- // 计算高度
- handleScroll(e) {
- const that = this;
- let scrollTop = e.detail.scrollTop;
- that.isShow = scrollTop > 500;
- that.topItem = '';
- },
- // 返回顶部
- backTop() {
- const that = this;
- that.topItem = 'top'
- }
- }
- }
- </script>
- <style lang="scss">
- .scrollView {
- height: 100vh;
- }
- .main {
- padding: 2vw;
- .zero {
- margin: 0 0 2vw 0;
- }
- .one {
- background-color: var(--fFB1Color);
- border-radius: 20px;
- padding: 0 2vw;
- input {
- font-size: var(--font15Size);
- color: var(--fffColor);
- border-radius: 14px;
- width: 100%;
- padding: 1.5vw 0;
- }
- .placss {
- color: var(--fffColor);
- }
- }
- .two {
- swiper {
- height: 50vw;
- border-radius: 5px;
- }
- .list {
- border-radius: 5px;
- .image {
- width: 100%;
- height: 100%;
- border-radius: 5px;
- }
- }
- }
- .thr {
- display: flex;
- flex-direction: row;
- justify-content: space-around;
- flex-wrap: wrap;
- .list {
- width: 17vw;
- text-align: center;
- margin: 0 0 2vw 0;
- .image {
- width: 100%;
- height: 16vw;
- margin: 0 0 1vw 0;
- }
- .name {
- font-size: var(--font13Size);
- }
- }
- }
- .four {
- display: flex;
- flex-direction: row;
- justify-content: space-around;
- flex-wrap: wrap;
- background-color: var(--f2Color);
- padding: 2vw 0 0 0;
- .recomList {
- display: flex;
- flex-direction: row;
- justify-content: space-around;
- width: 41vw;
- margin: 0 0 2vw 0;
- padding: 2vw;
- border-radius: 10px;
- background-image: linear-gradient(to bottom, rgba(250, 216, 213, 1) 5%, rgba(255, 255, 255, 1) 22%);
- .list {
- width: 20vw;
- text-align: center;
- .title {
- text-align: center;
- font-weight: bold;
- font-size: var(--font15Size);
- ;
- margin: 0 0 1vw 0;
- }
- .image {
- width: 18vw;
- height: 20vw;
- margin: 0 0 1vw 0;
- }
- .name {
- width: 17vw;
- font-size: var(--font12Size);
- ;
- border: 1px solid var(--fFB1Color);
- border-radius: 25px;
- padding: 0 1vw;
- text-align: center;
- }
- }
- }
- }
- .five {
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- background-color: var(--f2Color);
- padding: 2vw 0 0 0;
- .list {
- width: 40vw;
- background-color: var(--fffColor);
- padding: 2vw;
- margin: 0 2vw 2vw 2vw;
- border-radius: 10px;
- .image {
- width: 100%;
- height: 35vw;
- }
- .name {
- font-size: var(--font14Size);
- margin: 0 0 1vw 0;
- }
- .other {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- .money {
- color: var(--fFB1Color);
- text:nth-child(1) {
- font-size: var(--font12Size);
- }
- }
- .btn {
- button {
- color: var(--fffColor);
- background-color: var(--fFB1Color);
- padding: 5px 2vw;
- font-size: var(--font14Size);
- line-height: 1;
- border-radius: 90px;
- }
- }
- }
- }
- .list:nth-child(2n) {
- margin: 0 0 2vw 2vw;
- }
- }
- }
- .backTop {
- position: fixed;
- bottom: 20vw;
- right: 5vw;
- text {
- font-size: 30px;
- background-color: #0000005f;
- border-radius: 90px;
- }
- }
- </style>
|