123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299 |
- <template>
- <view class="supplier-content clearfix">
- <view class="tui-group-title">
- <view class="tui-group-name">优质供应商</view>
- <view class="tui-group-tabs">采美正品联盟 质量保证</view>
- <view class="tui-group-r" @click="handleMoreShop">
- <text>更多</text> <text class="iconfont icon-xiayibu"></text>
- </view>
- </view>
- <view class="swiper-goods-box">
- <swiper class="tui-shop-swiper" circular @change="swiperChange" :indicator-dots="false" :autoplay="true"
- :interval="8000" :duration="500">
- <swiper-item v-for="(supplier, index) in supplierList" :key="index">
- <view class="tui-supplier-list">
- <view class="tui-supplier-item" v-for="(sup, supIndex) in supplier" :key="supIndex"
- @click="NavToDetailPage(sup)">
- <view class="tui-shop-top">
- <view class="tui-top-logo">
- <image :src="sup.image" mode=""></image>
- </view>
- <view class="tui-top-name">
- <text>{{ sup.supplierName }}</text>
- </view>
- </view>
- <view class="tui-shop-mid">
- <view class="tui-mid-item" v-for="(pros, prIndex) in sup.products" :key="prIndex" @click.stop="navToDetailPage(pros)">
- <image :src="pros.mainImage" mode=""></image>
- </view>
- </view>
- <view class="tui-shop-bot">
- <view class="tui-bot-btn">
- 进店<text class="iconfont icon-xiayibu"></text>
- </view>
- </view>
- </view>
- </view>
- </swiper-item>
- </swiper>
- <view class="swiper__dots-box">
- <view v-for="(item, idx) in supplierList" :key="idx"
- :class="[idx === current ? 'swiper__dots-long' : 'none']" :data-index="current"
- class="swiper__dots-item"></view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: 'supplierList',
- props: {
- supplierObj: {
- type: Array
- }
- },
- data() {
- return {
- current: 0,
- supplierList: []
- }
- },
- created() {
- this.initData(this.supplierObj)
- },
- methods: {
- initData(data) {
- this.supplierList = this.handleCheckedList(data)
- console.log('supplierList', this.supplierList)
- },
- // 处理供应商列表
- handleCheckedList(arr) {
- if (!Array.isArray(arr)) return []
- let newArr = [],
- a = []
- let indexNum = 4
- arr.map((item, index) => {
- if (index !== 0 && index % indexNum === 0) {
- newArr.push(a)
- a = []
- a.push(item)
- } else a.push(item)
- if (arr.length === (index + 1)) {
- newArr.push(a)
- }
- })
- return newArr
- },
- //跳转店铺
- NavToDetailPage(item) {
- this.$api.navigateTo(`/pages/supplier/user/my-shop?shopId=${item.linkParam.id}`)
- },
- //跳转商品详情
- navToDetailPage(pros) {
- this.$api.navigateTo(`/pages/goods/product?id=${pros.productId}`)
- },
- handleMoreShop() {
- this.$api.navigateTo('/pages/goods/goods-shop-list')
- },
- swiperChange(e) { //切换
- this.current = e.detail.current
- }
- }
- }
- </script>
- <style lang="scss">
- .supplier-content {
- background-color: #F7F7F7;
- width: 100%;
- height: auto;
- box-sizing: border-box;
- padding: 0 24rpx;
- }
- .tui-group-title {
- width: 100%;
- display: flex;
- justify-content: flex-start;
- align-items: center;
- height: 100rpx;
- box-sizing: border-box;
- position: relative;
- .tui-group-name {
- font-size: $font-size-36;
- font-weight: bold;
- color: #333333;
- }
- .tui-group-tabs {
- height: 100rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-left: 20rpx;
- font-size: $font-size-24;
- line-height: 100rpx;
- color: #999999;
- }
- .tui-group-r {
- width: 100rpx;
- height: 100rpx;
- line-height: 100rpx;
- font-size: $font-size-24;
- color: #999999;
- text-align: right;
- position: absolute;
- right: 0;
- top: 0;
- }
- }
- .swiper-goods-box {
- width: 100%;
- height: 960rpx;
- position: relative;
- .swiper__dots-box {
- position: absolute;
- bottom: 0;
- left: 0;
- right: 0;
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- flex: 1;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- .swiper__dots-item {
- width: 10rpx;
- height: 10rpx;
- border-radius: 100%;
- margin-left: 6px;
- background-color: #FFFFFF;
- }
- .swiper__dots-long {
- width: 35rpx;
- height: 10rpx;
- border-radius: 6rpx;
- background-color: #FF5B00;
- transition: all 0.4s;
- }
- }
- .tui-shop-swiper {
- width: 100%;
- height: 920rpx;
- }
- .tui-supplier-list {
- padding: 0;
- width: 100%;
- height: 100%;
- display: flex;
- justify-content: flex-start;
- flex-wrap: wrap;
- .tui-supplier-item {
- display: flex;
- width: 339rpx;
- height: 448rpx;
- flex-direction: column;
- align-items: center;
- border-radius: 16rpx;
- margin: 0 20rpx 20rpx 0;
- box-sizing: border-box;
- padding: 24rpx 0;
- background-color: #FFFFFF;
- &:nth-child(2n) {
- margin-right: 0;
- }
- .tui-shop-top {
- width: 100%;
- display: flex;
- flex-direction: column;
- align-items: center;
- .tui-top-logo {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 219rpx;
- height: 96rpx;
- background-color: #ffffff;
- border-radius: 8rpx;
- image {
- width: 219rpx;
- height: 96rpx;
- }
- }
- .tui-top-name {
- justify-content: center;
- font-size: 30rpx;
- line-height: 80rpx;
- color: #1bc0de;
- }
- }
- .tui-shop-mid {
- width: 100%;
- height: 95rpx;
- display: flex;
- justify-content: flex-start;
- align-items: center;
- box-sizing: border-box;
- margin: 20rpx 0;
- padding: 0 10rpx;
- .tui-mid-item {
- width: 95rpx;
- height: 95rpx;
- border-radius: 8rpx;
- overflow: hidden;
- margin: 0 5rpx;
- box-sizing: border-box;
- border: 1px solid #e1e1e1;
- image {
- width: 95rpx;
- height: 95rpx;
- }
- }
- }
- .tui-shop-bot {
- width: 100%;
- height: 54rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- margin-top: 20rpx;
- .tui-bot-btn {
- justify-content: center;
- align-items: center;
- font-size: 28rpx;
- line-height: 52rpx;
- color: #333333;
- padding: 0 30rpx;
- border: 1px solid #999999;
- border-radius: 30rpx;
- .iconfont {
- font-size: 24rpx;
- }
- }
- }
- }
- }
- }
- </style>
|