幼教产品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.

377 lines
9.0 KiB

12 months ago
<template>
<view class="wrap">
11 months ago
<view class="top">
10 months ago
<view class="name-wrap">
10 months ago
<image v-if="form.logoUrl" class="icon logo" :src="form.logoUrl"></image>
<image v-else class="icon" :src="Common.shopIcon"></image>
10 months ago
<view class="name ell2">{{ form.classificationName }}</view>
</view>
11 months ago
<view v-if="form.slogan" class="slogan">{{ form.slogan }}</view>
11 months ago
<view class="star" @click.stop="collect">
<uni-icons class="star-icon" color="#ffcf47" :type="collectInfo.whetherAttention ? 'star-filled' : 'star'" size="25"></uni-icons>
{{ collectInfo.whetherAttention ? '取消关注' : '关注' }}
</view>
12 months ago
</view>
11 months ago
<ul class="tab">
<li :class="{active: curTab === 0}" @click="tabChange(0)">主页</li>
<li :class="{active: curTab === 1}" @click="tabChange(1)">商品</li>
</ul>
<view v-if="!curTab" class="detail">
<view class="title">公司简介</view>
<uni-swiper-dot v-if="desPics.length" class="pics" :info="desPics" :current="curPic" mode="round" :dots-styles="dotsStyles">
<swiper class="swiper-box" autoplay @change="picChange">
<swiper-item v-for="(item ,i) in desPics" :key="i">
<image class="pic" :src="item"></image>
</swiper-item>
</swiper>
</uni-swiper-dot>
10 months ago
<view class="des">{{ form.briefIntroduction || '暂无数据' }}</view>
11 months ago
<view class="title">联系我们</view>
11 months ago
<view class="info address">
11 months ago
<image class="icon" src="http://124.71.79.122/images/miniProgram/address.png" mode="widthFix" />
11 months ago
地址{{ form.address || '' }}
11 months ago
</view>
<view class="info">
11 months ago
<image class="icon" src="http://124.71.79.122/images/miniProgram/tel.png" mode="widthFix" />
11 months ago
联系电话{{ form.phone || '' }}
11 months ago
</view>
<view class="qrcodes">
<view v-if="form.qrCodeOneUrl" class="qrcode">
<image class="pic" :src="form.qrCodeOneUrl" />
<view class="text">{{ form.qrCodeOneName }}</view>
</view>
<view v-if="form.qrCodeTwoUrl" class="qrcode">
<image class="pic" :src="form.qrCodeTwoUrl" />
<view class="text">{{ form.qrCodeTwoName }}</view>
</view>
<view v-if="form.qrCodeThreeUrl" class="qrcode">
<image class="pic" :src="form.qrCodeThreeUrl" />
<view class="text">{{ form.qrCodeThreeName }}</view>
</view>
11 months ago
</view>
12 months ago
</view>
11 months ago
<view v-else-if="goods.length" class="list">
10 months ago
<view v-for="(item, i) in goods" :key="i" class="item" @click="toGoods(item)">
11 months ago
<image class="pic" :src="item.pic"></image>
<view class="texts">
<view class="name">{{ item.prodName }}</view>
10 months ago
<view class="prices">
<text class="price">{{ item.price ? '¥' + item.price : '面议' }}</text>
<text v-if="item.oriPrice" class="ori">{{ item.oriPrice }}</text>
</view>
11 months ago
</view>
</view>
</view>
10 months ago
10 months ago
<view class="order-btn" @click="toOrder">
10 months ago
<image class="icon" src="http://124.71.79.122/images/miniProgram/order.png" mode="widthFix"></image>
<view class="text">我想采购</view>
</view>
<order ref="order" />
12 months ago
</view>
</template>
<script>
11 months ago
import { collect, cancelCollection } from '@/apis/modules/supplier.js'
11 months ago
import { queryTeamInfo } from '@/apis/modules/user.js'
11 months ago
import { page } from '@/apis/modules/goods.js'
import Common from '@/config/common'
12 months ago
export default {
data() {
return {
11 months ago
Common,
11 months ago
teamId: '',
11 months ago
accountId: '',
12 months ago
curTab: 0,
form: {
11 months ago
collectionInformation: {
whetherAttention: 0
},
11 months ago
classificationName: '',
11 months ago
slogan: '',
11 months ago
briefIntroduction: '',
address: '',
phone: ''
12 months ago
},
11 months ago
desPics: [],
curPic: 0,
12 months ago
dotsStyles: {
backgroundColor: 'rgba(83, 200, 249,0.3)',
border: '1px rgba(83, 200, 249,0.3) solid',
color: '#fff',
11 months ago
selectedBackgroundColor: 'rgba(255, 255, 249,0.9)',
selectedBorder: '1px rgba(251, 251, 251,0.9) solid'
12 months ago
},
mpStyle: {
p: 'font-size: 25rpx !important;font-family: Microsoft Yahei !important;font-weight: 400 !important;color: #333 !important;',
span: 'font-size: 25rpx !important;font-family: Microsoft Yahei !important;font-weight: 400 !important;color: #333 !important;'
11 months ago
},
reachBottom: 0, // 是否是上拉加载。0->否,1->是,-1->加载完所有数据
status: 'more', // 上拉加载状态 more|loading|noMore
goods: [],
page: 1,
pageSize: 5,
total: 0,
11 months ago
submiting: false,
collectInfo: {},
11 months ago
}
},
// 下拉刷新
onPullDownRefresh() {
this.initList()
setTimeout(() => {
uni.stopPullDownRefresh()
}, 1500)
},
// 上拉加载
onReachBottom() {
if (this.reachBottom >= 0) {
this.reachBottom = 1
this.status = 'loading'
this.getList()
12 months ago
}
},
onShow() {
const pages = getCurrentPages()
const { options } = pages[pages.length - 1]
11 months ago
this.teamId = options.teamId
11 months ago
this.accountId = options.accountId
10 months ago
this.page = 1
12 months ago
this.getInfo()
11 months ago
this.getGoods()
12 months ago
},
methods: {
// 获取详情
11 months ago
async getInfo() {
12 months ago
uni.showLoading({
title: '加载中'
})
11 months ago
const res = await queryTeamInfo({
teamId: this.teamId
12 months ago
})
11 months ago
const data = res.teamInfo
if (data) {
// 处理描述图片
if (data.pictureUrl) {
this.desPics = data.pictureUrl.split(',')
}
}
11 months ago
this.collectInfo = res.collectionInformation
11 months ago
this.form = data
11 months ago
uni.hideLoading()
12 months ago
},
11 months ago
// 描述图片切换
picChange(e) {
this.curPic = e.detail.current;
},
11 months ago
// 获取商品列表
async getGoods() {
const res = await page({
status: 1,
current: this.page,
shopId: this.teamId,
})
const list = res.page.records
10 months ago
list.forEach(e => {
if (e.pic) e.pic = e.pic.split(',')[0]
})
11 months ago
this.goods = this.reachBottom > 0 ? [...this.goods, ...list] : list
this.page++ // 每次获取了数据后page+1
const noMore = this.goods.length === res.page.total // 是否加载完所有数据
this.status = noMore ? 'noMore' : 'more' // 加载完了则设置为noMore
this.reachBottom = noMore ? -1 : 0 // 加载完了则设置为-1
},
12 months ago
// tab切换
tabChange(id) {
this.curTab = id
},
11 months ago
// 关注
async collect() {
if (this.submiting) return false
this.submiting = true
if (this.collectInfo.whetherAttention) {
const that = this
uni.showModal({
title: '提示',
content: '确定要取消关注吗?',
async success(res) {
if (res.confirm) {
await cancelCollection(that.collectInfo.attentionId)
that.submiting = false
that.$util.sucMsg('取消关注成功')
that.getInfo()
}
}
})
} else {
const res = await collect({
supplierAccountId: this.accountId
})
this.submiting = false
this.getInfo()
}
},
10 months ago
// 跳转商品详情
toGoods(item) {
this.$util.to(`/other/goodsDetail/goodsDetail?prodId=${item.prodId}`)
},
// 我想采购
toOrder() {
const el = this.$refs.order
el.remarks = ''
el.getGoods(this.teamId)
el.$refs.popup.open()
},
12 months ago
}
}
</script>
<style scoped lang="scss">
11 months ago
.title {
margin-bottom: 20rpx;
font-size: 30rpx;
font-weight: 600;
color: #333;
12 months ago
}
11 months ago
.top {
11 months ago
position: relative;
10 months ago
display: flex;
flex-direction: column;
justify-content: center;
11 months ago
min-height: 300rpx;
padding: 40rpx;
background: url(http://124.71.79.122/images/miniProgram/supplier-bg.jpg) 0 0/100% 100% no-repeat;
box-sizing: border-box;
10 months ago
.name-wrap {
display: flex;
align-items: center;
}
11 months ago
.name {
11 months ago
font-size: 38rpx;
11 months ago
font-weight: 600;
11 months ago
color: #000;
11 months ago
}
10 months ago
.icon {
width: 80rpx;
min-width: 80rpx;
height: 80rpx;
margin-right: 20rpx;
border-radius: 50%;
object-fit: cover;
}
11 months ago
.logo {
10 months ago
width: 120rpx;
min-width: 120rpx;
height: 120rpx;
12 months ago
}
11 months ago
.slogan {
margin-top: 40rpx;
12 months ago
font-size: 28rpx;
color: #333;
}
11 months ago
.star {
display: flex;
justify-content: flex-end;
align-items: center;
margin-top: 20rpx;
font-size: 28rpx;
color: #333;
.star-icon {
margin-right: 10rpx;
}
}
12 months ago
}
.detail {
11 months ago
padding: 40rpx;
background-color: #fff;
11 months ago
.pics {
margin: 20rpx 0;
10 months ago
swiper, .pic {
11 months ago
width: 100%;
10 months ago
height: 500rpx;
11 months ago
}
}
.des {
11 months ago
margin: 20rpx 0 50rpx;
11 months ago
font-size: 26rpx;
line-height: 1.6;
}
12 months ago
}
11 months ago
.info {
display: flex;
10 months ago
align-items: center;
10 months ago
font-size: 26rpx;
11 months ago
color: #333;
&.address {
margin: 30rpx 0 20rpx;
}
.icon {
10 months ago
width: 30rpx;
min-width: 30rpx;
11 months ago
margin-right: 10rpx;
}
}
.qrcodes {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 50rpx;
text-align: center;
.pic {
width: 200rpx;
height: 200rpx;
}
.text {
margin-top: 20rpx;
font-size: 24rpx;
color: #333;
}
}
12 months ago
.list {
display: flex;
flex-wrap: wrap;
padding: 0 10rpx;
.item {
width: calc((100% - 40rpx) / 2);
margin: 20rpx 10rpx;
background-color: #fff;
border-radius: 8px;
overflow: hidden;
}
.pic {
width: 100%;
height: 200rpx;
11 months ago
object-fit: cover;
12 months ago
}
.texts {
padding: 20rpx;
}
.name {
margin-bottom: 10rpx;
font-size: 30rpx;
font-weight: 600;
}
10 months ago
.prices {
display: flex;
justify-content: space-between;
}
12 months ago
.price {
10 months ago
font-size: 34rpx;
12 months ago
color: #ff0047;
}
10 months ago
.ori {
10 months ago
font-size: 24rpx;
10 months ago
text-decoration: line-through;
color: #666;
10 months ago
}
}
12 months ago
</style>