123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- <template>
- <view class="container clearfix">
- <tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading="true"
- :loadingType="5" />
- <template v-else>
- <view class="shop-content clearfix">
- <view class="tui-supplier-item" v-for="(sup, supIndex) in list" :key="supIndex"
- @click.stop="NavToDetailPage(sup,index)">
- <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>
- </template>
- </view>
- </template>
- <script>
- import { mapState, mapMutations } from 'vuex'
- export default {
- data() {
- return {
- skeletonShow: true,
- list: []
- }
- },
- onLoad(option) {
- },
- methods: {
- async getHomeDataInfo() {
- //初始化首页数据
- try {
- const userInfo = await this.$api.getStorage()
- const res = await this.CommonService.GetHomeDataInfo({ userId: userInfo.userId ? userInfo
- .userId : 0, source: 2 })
- const data = res.data.supplierImage
- this.list = data || [] // 供应商列表
- setTimeout(() => {
- this.skeletonShow = false
- }, 1000)
- } catch (e) {
- //TODO handle the exception
- this.$util.msg(error.msg, 2000)
- }
- },
- //跳转商品详情
- navToDetailPage(pros) {
- this.$api.navigateTo(`/pages/goods/product?id=${pros.productId}`)
- },
- // 链接跳转
- NavToDetailPage(pros) {
- this.$api.navigateTo(`/pages/supplier/user/my-shop?shopId=${pros.linkParam.id}`)
- },
- },
- onShow() {
- this.getHomeDataInfo()
- }
- }
- </script>
- <style lang="scss">
- page {
- background-color: #F7F7F7;
- }
- .shop-content {
- width: 100%;
- height: auto;
- box-sizing: border-box;
- padding: 24rpx 24rpx;
- 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>
|