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.
hezhiying/pages/qianggou/productList.vue

229 lines
4.1 KiB

1 year ago
<template>
<view class="page">
1 year ago
<navbar :title="'抢购列表'" :isCenter="true" :back="true" @onBack="backHandle"></navbar>
1 year ago
<u-sticky bgColor="#fff">
<u-tabs
@click="getPage"
:activeStyle="{
color: '#9F751F',
fontWeight: 'bold',
background:'#eaeaea',
transform: 'scale(1.05)'
}"
:inactiveStyle="{
color: '#9F751F',
transform: 'scale(1)'
}"
:list="pagesList"></u-tabs>
</u-sticky>
<view class="refresh" @click="refrenshHandle">
刷新
</view>
<view class="recommend-info">
<view class="goods-list">
1 year ago
<view class="list" v-for="(item,index) in goodsList" :key="index">
<view class="" @click="onSkip(item)">
<view class="pictrue">
<image :src="item.image" mode="heightFix"></image>
</view>
<view class="title-tag">
{{item.name}}
</view>
<view class="price-info">
<view class="user-price">
<text class="min"></text>
<text class="max">{{item.price}}</text>
</view>
1 year ago
</view>
1 year ago
</view>
<view class="shouqing" v-if="item.status=='hidden'">
<image src="../../static/image/shouqin.png" mode="widthFix"></image>
<text>已售罄</text>
1 year ago
</view>
</view>
</view>
</view>
</view>
</template>
<script>
1 year ago
import navbar from '@/components/navbar.vue'
1 year ago
import {getGoodsList} from '@/common/api.js'
export default {
data(){
return{
goodsList:[],
total:0,
pagesList: [],
page:1,
limit:10,
1 year ago
warehouse_id:null,
1 year ago
}
},
1 year ago
components:{navbar},
1 year ago
methods:{
refrenshHandle(){
uni.redirectTo({
url: '/pages/qianggou/productList?page='+this.page //写你的路径
});
},
1 year ago
backHandle(){
uni.switchTab({
url:"/pages/qianggou/qianggou"
})
},
1 year ago
getGoodsList(){
this.pagesList=[]
1 year ago
getGoodsList({page:this.page,limit:10,warehouse_id:this.warehouse_id}).then(res=>{
1 year ago
this.goodsList = res.data.data;
this.total = res.data.total;
for(let i=0;i<Math.ceil(this.total/10);i++){
this.pagesList.push({
name:`${i+1}`
})
}
})
},
getPage(val){
this.page=val.index+1;
this.getGoodsList()
},
onSkip(item){
uni.navigateTo({
url:'/pages/qianggou/productDetails?id='+item.id
})
}
},
onReady() {
},
1 year ago
onLoad(option) {
this.warehouse_id = option.id
1 year ago
this.getGoodsList()
1 year ago
1 year ago
},
1 year ago
onShow() {
// this.getGoodsList()
},
1 year ago
onPageScroll(e){
},
onReachBottom(){
console.log(12333);
},
};
</script>
<style scoped lang="scss">
.page{
padding-bottom: 100rpx;
position: relative;
}
// 9F751F
.refresh{
color:rgb(77, 154, 94);
padding:20rpx;
text-align: right;
position: fixed;
top:90rpx;
right:0;
z-index:9999;
}
::v-deep .u-tabs{
margin-right:100rpx;
}
::v-deep .u-tabs__wrapper__nav__line{
display: none;
}
::v-deep .u-tabs__wrapper__nav__item__text{
font-size: 15px;
height: 100%;
color: #606266;
display: flex;
align-items: center;
padding: 0 10px;
}
.recommend-info{
width: 100%;
background-color: #f2f2f2;
1 year ago
margin-top:110rpx;
1 year ago
.goods-list{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: 0 30rpx;
1 year ago
1 year ago
.list{
width: 49%;
height: 480rpx;
margin-bottom: 20rpx;
background-color: #FFFFFF;
border-radius: 10rpx;
overflow: hidden;
1 year ago
position: relative;
.shouqing{
height:100%;
width:100%;
background-color: rgba(0,0,0,0.7);
position: absolute;
top:0;
left:0;
z-index:9;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
image{
width:45%;
height:auto;
}
text{
color:#ffffff;
font-size:25rpx;
}
}
1 year ago
.pictrue{
display: flex;
justify-content: center;
width: 100%;
image{
height: 350rpx;
}
}
.title-tag{
padding: 20rpx;
}
.price-info{
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
padding: 0 20rpx;
.user-price{
display: flex;
align-items: center;
text{
color: $price-clor;
}
.min{
font-size: 24rpx;
}
.max{
font-size: 32rpx;
}
}
}
}
}
}
</style>