Init project
This commit is contained in:
@@ -0,0 +1,157 @@
|
||||
<template>
|
||||
<view class="pkg-product-list">
|
||||
<view class="top-box">
|
||||
<view class="search-box flex jc-between ai-center">
|
||||
<input type="text" v-model="keyword" placeholder="搜索商品" placeholder-style="color:#949494" @confirm="search">
|
||||
<image class="icon" :src="webUrl+'/20220903142935869059.png'" mode="scaleToFill" @click="search"></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="list-box">
|
||||
<view class="item flex ai-end" v-for="(item,index) in dataList" :key="index">
|
||||
<view class="img-box">
|
||||
<image class="label" :src="webUrl+'/20221203153744574979.png'" mode="scaleToFill"/>
|
||||
<image class="cover flex-0" :src="item.image" mode="scaleToFill"/>
|
||||
</view>
|
||||
|
||||
<view class="info-box">
|
||||
<view class="title bold one-t">{{item.storeName}}</view>
|
||||
<view class="flex jc-between ai-center">
|
||||
<view class="price bold">¥{{item.price}}</view>
|
||||
<image class="btn" :src="webUrl+'/20221205145730924688.png'" mode="scaleToFill" @click="goGoodsCon(item)"/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getProducts} from "@/api/store";
|
||||
|
||||
export default {
|
||||
name: "scenicSpot",
|
||||
data() {
|
||||
return {
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
dataList: [],
|
||||
page: 1,
|
||||
cityName: "丽江市",
|
||||
keyword: ""
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
let memCityName = uni.getStorageSync("cityName")
|
||||
if (memCityName.length) {
|
||||
this.cityName = memCityName;
|
||||
this.page = 1;
|
||||
this.dataList = [];
|
||||
this.fetchList();
|
||||
// uni.removeStorageSync("cityName")
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
this.page++;
|
||||
this.fetchList();
|
||||
},
|
||||
methods: {
|
||||
search(){
|
||||
this.page=1;
|
||||
this.dataList=[];
|
||||
this.fetchList();
|
||||
},
|
||||
fetchList() {
|
||||
let param = {
|
||||
page: this.page,
|
||||
limit: 10,
|
||||
isTickets: 1,
|
||||
cityName: this.cityName,
|
||||
keyword: this.keyword
|
||||
}
|
||||
getProducts(param).then(({data}) => {
|
||||
for(let i=0;i<data.length;i++){
|
||||
this.dataList.push(data[i])
|
||||
}
|
||||
});
|
||||
},
|
||||
goGoodsCon(item) {
|
||||
this.$yrouter.push({
|
||||
path: "/pages/shop/GoodsCon/index",
|
||||
query: {id: item.id}
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
@import "@/assets/css/product.less";
|
||||
|
||||
.pkg-product-list {
|
||||
.top-box {
|
||||
padding: 16rpx 32rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.list-box {
|
||||
padding: 24rpx 32rpx;
|
||||
|
||||
.item {
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
.img-box {
|
||||
position: relative;
|
||||
|
||||
.label {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: -34rpx;
|
||||
width: 146rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.cover {
|
||||
width: 240rpx;
|
||||
height: 180rpx;
|
||||
border-radius: 8rpx;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
.info-box {
|
||||
width: 100%;
|
||||
height: 150rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 20rpx 16rpx 16rpx 20rpx;
|
||||
border-radius: 0 12rpx 12rpx 0;
|
||||
background: #fff;
|
||||
overflow: hidden;
|
||||
|
||||
.title {
|
||||
margin-bottom: 26rpx;
|
||||
color: #333;
|
||||
font-size: 28rpx;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
|
||||
.price {
|
||||
color: #DA0000;
|
||||
font-size: 32rpx;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 144rpx;
|
||||
height: 48rpx;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.item:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user