From ded34e37fca5e2e05e17693d2524c3d664ebf017 Mon Sep 17 00:00:00 2001 From: xuxueyang <xuxy@fengyuntec.com> Date: 星期三, 14 八月 2024 11:20:18 +0800 Subject: [PATCH] update 搜索历史 --- pages/home/components/home-category.vue | 42 ++++++++++++++++++++++++++++++++++-------- 1 files changed, 34 insertions(+), 8 deletions(-) diff --git a/pages/home/components/home-category.vue b/pages/home/components/home-category.vue index 1768fea..8ddb38c 100644 --- a/pages/home/components/home-category.vue +++ b/pages/home/components/home-category.vue @@ -1,13 +1,14 @@ <template> <view class="home-category"> <view class="flex"> - <view class="t1">06-03(今日)第一场交易中</view> - <view class="t2">当前在售123435扎</view> + <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"> + <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>{{ item.name || '-' }}</view> </view> </view> </view> @@ -16,16 +17,40 @@ <script> export default { beforeMount() { - for (var i = 0; i < 10; i++) { - this.list.push({ - 'url': 'https://hmy-flower.oss-cn-shanghai.aliyuncs.com/e2/e2ee2fa7cdef458ba748261305edc57435549b9113807b6fbbfd4bfa456334d.png', - 'name': '玫瑰' + 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 }; } @@ -42,6 +67,7 @@ line-height: 40rpx; min-width: 20%; margin-bottom: 28rpx; + .icon { width: 94rpx; height: 94rpx; -- Gitblit v1.9.3