57 lines
1.4 KiB
Vue
57 lines
1.4 KiB
Vue
<template>
|
|
<view class="app">
|
|
<view class="cards">
|
|
<view class="item" :style="{background:listcolor[index]}" @tap='goProductList(item)'
|
|
v-for="(item,index) in goodsCategoryList" :key="index">
|
|
<!-- <image src="../../static/sp.png" mode=""></image> -->
|
|
<image :src="item.goodsCatrgoryPicture" mode=""></image>
|
|
<view class="title" style="font-size:42rpx">
|
|
{{item.goodsCategoryName}}
|
|
</view>
|
|
</view>
|
|
<view class="item">
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
<script>
|
|
import {
|
|
goodsCategoryList
|
|
} from '@/api/shopping/shopping.js';
|
|
import baseurl from '@/api/baseurl.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
pageNum: 1,
|
|
pageSize: 999,
|
|
goodsCategoryList: [],
|
|
listcolor: ['#00C176', '#D43953', '#E1AE3C', '#4C7BC9', '#00C176'],
|
|
};
|
|
},
|
|
onLoad(options) {
|
|
this.goodsCategory()
|
|
},
|
|
methods: {
|
|
//跳转到商品列表页面
|
|
goProductList(item) {
|
|
console.log(item)
|
|
uni.navigateTo({
|
|
url: `/pages/ProductList/ProductList?title=${item.goodsCategoryName}&goodsCategoryId=${item.id}`
|
|
})
|
|
},
|
|
//获取商城信息
|
|
goodsCategory() {
|
|
goodsCategoryList(this.pageSize, this.pageNum, ).then(res => {
|
|
res.data.forEach(e => {
|
|
e.goodsCatrgoryPicture = baseurl + e.goodsCatrgoryPicture
|
|
})
|
|
this.goodsCategoryList = res.data
|
|
})
|
|
}
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
</style>
|