幼教产品B2B生态平台小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

212 lines
4.2 KiB

12 months ago
<template>
<view :class="[{oh: !per}]">
<view class="page">
<view class="search-wrap">
<uni-search-bar class="search" radius="30" placeholder="请输入" v-model="keyword" clearButton="auto" cancelButton="none" @confirm="searchConfirm" />
<view>
<uni-icons type="notification" size="20"></uni-icons>
</view>
</view>
<view class="banner">
<image class="pic" src="@/static/image/index/banner.png" mode="widthFix"></image>
</view>
<view class="block">
<view class="title-wrap">
<view class="title">爆款推荐</view>
</view>
<image class="pic" src="@/static/image/info-bg.jpg" mode="widthFix"></image>
</view>
<view class="block">
<view class="title">活动速递</view>
<ul class="tab">
<li v-for="(tab, i) in tabs" :class="{active: curTab === tab.id}" @click="tabChange(tab)">{{ tab.name }}</li>
</ul>
<view class="list">
<view v-for="(item, i) in hotProducts" :key="i" class="item" @click="toDetail(item)">
<image class="pic" src="@/static/image/info-bg.jpg"></image>
<view class="texts">
<view class="name ell">{{ item.productName }}</view>
<view class="des ell">{{ item.tagsName }}</view>
<view class="meta">{{ item.marketUnitPrice }}/</view>
</view>
</view>
</view>
</view>
</view>
<view v-if="!per" class="per-mask">功能升级中敬请期待...</view>
</view>
</template>
<script>
import { getUserRolesPermissionMenu } from '@/apis/modules/user.js'
import { tagsList, listOfGoods, shoppingCartList } from '@/apis/modules/product.js'
import { getTeamsByAccountId } from '@/apis/modules/client.js'
export default {
data() {
return {
per: true, // 是否有权限
teamId: uni.getStorageSync('teamId') || '',
list: [],
keyword: '',
tags: [],
hotProducts: [],
offcialProducts: [],
total: 0,
curTab: 0,
tabs: [
{
name: '全部',
id: 0
},
{
name: '论坛',
id: 1
}
],
}
},
onShow() {
this.keyword = ''
this.per = true
this.getProducts()
},
methods: {
// 初始化权限
initRole() {
if (!uni.getStorageSync('auth').includes('首页')) {
this.per = false
}
this.getProducts()
},
// 产品
getProducts() {
// 热销产品
listOfGoods({
pageNum: 1,
pageSize: 5,
sort: 1,
isShelves: 0,
hotTag: 1
}).then(({ page }) => {
page.records.forEach(e => {
e.productIntroduction = this.$util.removeTag(e.productIntroduction)
})
this.hotProducts = page.records
}).catch(e => {})
},
// 模糊查询回调
searchConfirm(e) {
e.value && this.$util.to(`/order/products/products?keyword=${e.value}`)
},
// 跳转学习详情
toDetail(item) {
this.$util.to('/order/activityDetail/activityDetail?id=' + item.mallId)
},
// tab切换
tabChange(tab) {
this.curTab = tab.id
// this.initList()
},
}
}
</script>
<style scoped lang="scss">
.page {
position: relative;
box-sizing: border-box;
background-color: #fff;
border-top-left-radius: 16px;
border-top-right-radius: 16px;
}
.banner {
position: relative;
.pic {
width: 100%;
}
}
.search-wrap {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 10rpx;
.search {
flex: 1;
}
}
.all {
font-size: 24rpx;
border-radius: 20px;
}
.block {
margin: 20rpx 0;
.title-wrap {
display: flex;
justify-content: space-between;
margin-bottom: 34rpx;
}
.title {
display: inline-flex;
align-items: center;
font-size: 28rpx;
font-weight: 600;
color: #333;
}
}
.list {
.item {
display: flex;
align-items: center;
margin-bottom: 28rpx;
}
.pic {
width: 220rpx;
height: 140rpx;
margin-right: 20rpx;
border-radius: 8px;
}
.texts {
width: calc(100% - 240rpx);
}
.name {
font-size: 28rpx;
font-weight: 600;
color: #333;
}
.des {
margin: 10rpx 0;
font-size: 22rpx;
color: #666;
}
.meta {
display: flex;
align-items: center;
font-size: 24rpx;
color: #2E2D31;
.icon {
width: 32rpx;
height: 32rpx;
margin-right: 12rpx;
}
text {
width: 330rpx;
}
}
}
.plus {
bottom: 140rpx;
right: 60rpx;
.icon {
width: 106rpx;
}
.uni-badge {
font-size: 32rpx;
}
}
</style>