NurseStationApp/pages/ProductList/ProductList.vue
2022-10-20 19:39:57 +08:00

109 lines
2.0 KiB
Vue

<template>
<view class="app">
<view class="productlist">
<view class="item" @tap='goCommodityDetails(item)' v-for="(item,index) in goodsList" :key="index">
<image :src="item.goodsPictureUrl" mode=""></image>
<view class="title">
{{item.goodsName}} 1{{item.goodsUnit}}
</view>
<view class="price">
{{item.goodsPrice}}
</view>
</view>
</view>
</view>
</template>
<script>
import {
goodsList
} from '@/api/ProductList/ProductList.js';
import baseurl from '@/api/baseurl.js'
export default {
data() {
return {
title: '医路优品', //导航栏标题
pageNum: 1,
pageSize: 999,
goodsCategoryId:"",
goodsList:[],
};
},
onReady() {
//更改导航栏文字
uni.setNavigationBarTitle({
title: this.title,
});
},
onLoad(options) {
//获取传值
console.log(options)
this.title = options.title
this.goodsCategoryId = options.goodsCategoryId
this.goodsListinfo()
},
methods: {
// 查询商品列表
goodsListinfo(){
goodsList(this.patientId).then(res => {
res.data.forEach(e => {
e.goodsPictureUrl = baseurl + e.goodsPictureUrl
})
this.goodsList = res.data
console.log(this.goodsCategoryList)
})
},
//跳转详情页
goCommodityDetails() {
uni.navigateTo({
url: '/pages/CommodityDetails/CommodityDetails'
})
},
},
}
</script>
<style lang="scss">
.app {
.productlist {
width: 100%;
margin: 0 auto;
padding: 40rpx 0 0 0;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
.item {
width: 45%;
background: #FFFFFF;
border-radius: 25rpx;
padding-bottom: 10rpx;
box-shadow: 0px 4rpx 8rpx 4rpx rgba(199, 200, 202, 0.8);
margin-bottom: 40rpx;
.price {
font-size: 42rpx;
color: #D43953;
line-height: 79rpx;
padding-left: 20rpx;
}
.title {
font-size: 39rpx;
color: #000000;
line-height: 69rpx;
padding-left: 20rpx;
}
image {
width: 100%;
height: 340rpx;
}
}
}
}
</style>