130 lines
2.9 KiB
Vue
130 lines
2.9 KiB
Vue
<template>
|
|
<view class="page-v4">
|
|
<uni-search-bar placeholder="搜索店铺" @confirm="fetchList" @input="input"></uni-search-bar>
|
|
|
|
<view class="item" v-for="item in list" :key="item">
|
|
<view class="top-box">
|
|
<view class="flex ai-center">
|
|
<image class="logo" :src="item.merchant.avatar" mode="scaleToFill"></image><text>{{item.merchant.name}}</text>
|
|
</view>
|
|
<view class="right flex ai-center" v-if="item.hasNew==1">
|
|
<image class="icon" :src="webUrl+'/20220218213627732423.png'" mode="scaleToFill"></image><text>有上新</text>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="img-box flex">
|
|
<image class="img-item" :src="img.image" mode="scaleToFill" v-for="img in item.productList" :key="img"
|
|
@click="goGoods(img.id)"></image>
|
|
<view class="last-img" @click="goDetail(item.merchant.id,item.merchant.name)" v-if="item.productList.length>0">
|
|
<image class="img-item" :src="item.productList[0].image" mode="scaleToFill"></image>
|
|
<image class="img-item img-mask" :src="webUrl+'/20220218220333915755.png'" mode="scaleToFill"></image>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
fetchShop
|
|
} from "@/api/shop";
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
webUrl: this.$VUE_APP_RESOURCES_URL,
|
|
keyword: "",
|
|
list: []
|
|
}
|
|
},
|
|
onLoad: function() {
|
|
this.fetchList()
|
|
},
|
|
methods: {
|
|
fetchList() {
|
|
fetchShop(this.keyword).then(({
|
|
data
|
|
}) => this.list = data)
|
|
},
|
|
input(value) {
|
|
this.keyword = value
|
|
},
|
|
goDetail(id,name) {
|
|
this.$yrouter.push(`/v4/views/shop/detail?id=${id}&name=${name}`)
|
|
},
|
|
goGoods(id) {
|
|
this.$yrouter.push("/pages/shop/GoodsCon/index?id=" + id)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.uni-searchbar__box {
|
|
margin-bottom: 32rpx;
|
|
border-radius: 44px !important;
|
|
background: rgba(255, 255, 255, 1) !important;
|
|
}
|
|
|
|
.logo {
|
|
width: 48rpx;
|
|
height: 48rpx;
|
|
border-radius: 50%;
|
|
margin-right: 12rpx;
|
|
}
|
|
|
|
.icon {
|
|
width: 20rpx;
|
|
height: 20rpx;
|
|
margin-right: 4rpx;
|
|
}
|
|
|
|
.img-item {
|
|
width: 140rpx;
|
|
height: 140rpx;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
.item {
|
|
margin: 0 32rpx 24rpx;
|
|
background: #fff;
|
|
border-radius: 4px;
|
|
|
|
.top-box {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 12rpx 16rpx;
|
|
border-bottom: 1rpx solid #EFEFEF;
|
|
font-size: 28rpx;
|
|
font-weight: bold;
|
|
color: #333333;
|
|
}
|
|
|
|
.right {
|
|
font-size: 20rpx;
|
|
color: #FD685D;
|
|
}
|
|
|
|
.img-box {
|
|
padding: 12rpx 18rpx 16rpx;
|
|
|
|
.img-item {
|
|
vertical-align: middle;
|
|
margin-right: 20rpx;
|
|
}
|
|
|
|
.last-img {
|
|
position: relative;
|
|
|
|
.img-mask {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
</style>
|