| | |
| | | <template> |
| | | <view class="home-category"> |
| | | <view class="flex"> |
| | | <view class="t1">{{today}}(今日)第一场交易中</view> |
| | | <view class="t2">当前在售123435扎</view> |
| | | </view> |
| | | <view class="m-t-12 flex"> |
| | | <view class="item" v-for="(item,index) of list" :key="index" @click.stop="toList(item)"> |
| | | <image class="icon img100" :src="item.url"></image> |
| | | <view>{{ item.name || '-' }}</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="home-category"> |
| | | <view class="flex"> |
| | | <view class="t1">{{today}}(今日)交易中</view> |
| | | <view class="t2">当前在{{tj||0}}售</view> |
| | | <!-- 加了/api/customer/flower/up/stock --> |
| | | </view> |
| | | <view class="m-t-12 flex"> |
| | | <view class="item" v-for="(item,index) of list" :key="index" @click.stop="toList(item)"> |
| | | <image class="icon img100" :src="item.url"></image> |
| | | <view>{{ item.name || '-' }}</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | beforeMount() { |
| | | this.today = this.$util.toDate(new Date()) |
| | | this.$http.request('get', '/api/customer/flower/category/tree', {}).then(res => { |
| | | var data = res.data |
| | | this.list = [] |
| | | var arr = data || [] |
| | | for (let i = 0; i < arr.length && i < 10; i++) { |
| | | this.list.push({ |
| | | id: arr[i].id, |
| | | name: arr[i].name, |
| | | url: arr[i].imageUrl |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | methods: { |
| | | toList(item){ |
| | | uni.navigateTo({ |
| | | url:'/sub_pages/customer/trade/list?categoryId='+item.id |
| | | }) |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | list: [], |
| | | today:'', |
| | | export default { |
| | | beforeMount() { |
| | | this.today = this.$util.toDate(new Date()) |
| | | this.$http.request('get', '/api/customer/flower/category/tree', {}).then(res => { |
| | | var data = res.data |
| | | this.list = [] |
| | | var arr = data || [] |
| | | for (let i = 0; i < arr.length && i < 10; i++) { |
| | | this.list.push({ |
| | | id: arr[i].id, |
| | | name: arr[i].name, |
| | | url: arr[i].imageUrl |
| | | }) |
| | | } |
| | | }) |
| | | this.$http.request('get', '/api/customer/flower/up/stock', {}).then(res => { |
| | | var data = res.data |
| | | this.tj = data || 0 |
| | | }) |
| | | |
| | | }; |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | toList(item) { |
| | | // uni.navigateTo({ |
| | | // url:'/sub_pages/customer/trade/list?categoryId='+item.id |
| | | // }) |
| | | uni.navigateTo({ |
| | | url: '/sub_pages/customer/trade/trade?categoryId=' + item.id |
| | | }) |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | list: [], |
| | | today: '', |
| | | tj: 0 |
| | | |
| | | }; |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | .home-category { |
| | | .item { |
| | | text-align: center; |
| | | font-weight: 400; |
| | | font-size: 28rpx; |
| | | color: #000000; |
| | | line-height: 40rpx; |
| | | min-width: 20%; |
| | | margin-bottom: 28rpx; |
| | | .home-category { |
| | | .item { |
| | | text-align: center; |
| | | font-weight: 400; |
| | | font-size: 28rpx; |
| | | color: #000000; |
| | | line-height: 40rpx; |
| | | min-width: 20%; |
| | | margin-bottom: 28rpx; |
| | | |
| | | .icon { |
| | | width: 94rpx; |
| | | height: 94rpx; |
| | | border-radius: 50%; |
| | | } |
| | | } |
| | | .icon { |
| | | width: 94rpx; |
| | | height: 94rpx; |
| | | border-radius: 50%; |
| | | } |
| | | } |
| | | |
| | | .t1 { |
| | | font-size: 28rpx; |
| | | color: #333333; |
| | | line-height: 50rpx; |
| | | font-weight: 600; |
| | | } |
| | | .t1 { |
| | | font-size: 28rpx; |
| | | color: #333333; |
| | | line-height: 50rpx; |
| | | font-weight: 600; |
| | | } |
| | | |
| | | .t2 { |
| | | margin-left: auto; |
| | | padding: 8rpx; |
| | | font-size: 24rpx; |
| | | color: #5B8C71; |
| | | line-height: 34rpx; |
| | | background: #E1F0E7; |
| | | border-radius: 4rpx; |
| | | } |
| | | } |
| | | .t2 { |
| | | margin-left: auto; |
| | | padding: 8rpx; |
| | | font-size: 24rpx; |
| | | color: #5B8C71; |
| | | line-height: 34rpx; |
| | | background: #E1F0E7; |
| | | border-radius: 4rpx; |
| | | } |
| | | } |
| | | </style> |