Init project

This commit is contained in:
lifizer
2023-09-20 21:49:33 +08:00
parent 85a5989c96
commit c9ceac9f37
710 changed files with 125705 additions and 0 deletions
+241
View File
@@ -0,0 +1,241 @@
<template>
<view class="page-v4">
<view class="top-box flex ai-center">
<image class="logo" :src="logo" mode="scaleToFill"></image>
<view>
<view class="main">{{ merchantName }}</view>
<view class="sub">共{{ list.length }}件商品</view>
</view>
<image class="btn-service" :src="webUrl+'/20221008161418239500.png'" @click="goRoom"/>
</view>
<view class="nav-box flex jc-between ai-center">
<text :class="{active:navIndex===index}" v-for="(item,index) in navList" :key="index"
@click="changeNav(index)">{{ item.name }}
</text>
</view>
<view class="list flex flex-wrap">
<view class="item" v-for="item in list" :key="item">
<view class="img-box" @click="goGoods(item.id)">
<image class="main" :src="item.image" mode="scaleToFill"></image>
</view>
<view class="content" @click="goGoods(item.id)">
<view class="base-box">
<view class="title more-t">{{ item.storeName }}</view>
<view class="price flex ai-center">
<!-- <image class="label-vip" :src="webUrl+'/20221118104357701129.png'" mode="scaleToFill"></image> -->
<text>¥{{ item.price }}</text>
</view>
</view>
<view class="cart-box flex ai-center jc-between">
<view class="flex ai-center">
<image class="icon-fire" :src="webUrl+'/20221118092713277343.png'" mode="scaleToFill"></image>
<text>{{ item.sales }}人已购买</text>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
fetchGoods
} from "@/api/shop";
export default {
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
merId: null,
merchantName: "",
list: [],
orderBy: "sortBySort",
logo: "",
navIndex: 0,
navList: [{
key: "sortBySort",
name: "综合排序"
},
{
key: "sortBySales",
name: "销量最高"
},
{
key: "sortByNew",
name: "新品上新"
}, {
key: "sortByPrice",
name: "价格最高"
}
]
}
},
onLoad: function (option) {
this.merId = option.id
this.merchantName = option.name
uni.setNavigationBarTitle({
title: this.merchantName
})
this.getInfo()
},
methods: {
changeNav(index) {
if (this.navIndex === index) return;
this.navIndex = index;
this.orderBy = this.navList[index].key
this.getInfo()
},
getInfo() {
fetchGoods(this.merId, this.orderBy).then(({
data
}) => {
this.list = data;
if (this.list.length > 0) this.logo = this.list[0].merLogo;
})
},
goGoods(id) {
this.$yrouter.push("/pages/shop/GoodsCon/index?id=" + id)
},
goRoom(){
uni.navigateTo({
url: `/pkg_common/views/room?id=${this.merId}`
})
}
}
}
</script>
<style lang="scss">
.top-box {
position: relative;
margin: 30rpx 32rpx 24rpx;
.btn-service {
position: absolute;
top: 30rpx;
right: 0;
width: 144rpx;
height: 44rpx;
}
.logo {
width: 80rpx;
height: 80rpx;
margin-right: 16rpx;
border-radius: 50%;
}
.main {
font-size: 32rpx;
font-weight: bold;
line-height: 48rpx;
color: #333333;
}
.sub {
margin-top: 6rpx;
font-size: 24rpx;
line-height: 34rpx;
color: #9E9E9E;
}
}
.nav-box {
height: 60rpx;
margin: 0 32rpx 12rpx;
padding: 0 32rpx 0 36rpx;
background: #fff;
text {
font-size: 24rpx;
line-height: 34rpx;
color: #9E9E9E;
}
.active {
color: #FD685D;
}
}
.list {
margin: 0 32rpx;
.item:nth-child(2n) {
margin-left: 22rpx;
}
.item {
width: 332rpx;
margin-bottom: 24rpx;
border-radius: 8rpx;
background: #fff;
.img-box {
position: relative;
.main {
width: 332rpx;
height: 332rpx;
border-radius: 8rpx;
}
}
.content {
.base-box {
height: 140rpx;
box-sizing: border-box;
}
.label-vip {
width: 40rpx;
height: 24rpx;
margin-right: 6rpx;
}
.icon-fire {
width: 24rpx;
height: 24rpx;
}
.icon-cart {
width: 48rpx;
height: 48rpx;
}
.title {
margin: 8rpx 4rpx 0 10rpx;
font-size: 26rpx;
font-weight: bold;
line-height: 36rpx;
color: #333333;
}
.price {
padding: 4rpx 10rpx 10rpx;
font-size: 26rpx;
font-weight: bold;
line-height: 38rpx;
color: #ED0F0F;
}
.cart-box {
padding: 8rpx 16rpx 14rpx 18rpx;
border-top: 1rpx solid #EFEFEF;
text {
margin-left: 6rpx;
font-size: 24rpx;
font-weight: bold;
line-height: 34rpx;
color: #8D8D8D;
}
}
}
}
}
</style>
+129
View File
@@ -0,0 +1,129 @@
<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>