|  |  |  | 
|---|
|  |  |  | <template> | 
|---|
|  |  |  | <view class="home-category"> | 
|---|
|  |  |  | <view class="flex"> | 
|---|
|  |  |  | <view class="t1">{{today}}(今日)第一场交易中</view> | 
|---|
|  |  |  | <view class="t2">当前在售</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" @click.stop="toList(item)"> | 
|---|
|  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | this.$http.request('get', '/api/customer/flower/up/stock', {}).then(res => { | 
|---|
|  |  |  | var data = res.data | 
|---|
|  |  |  | this.tj = data || 0 | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | init(){ | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | toList(item) { | 
|---|
|  |  |  | // uni.navigateTo({ | 
|---|
|  |  |  | //   url:'/sub_pages/customer/trade/list?categoryId='+item.id | 
|---|
|  |  |  | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | list: [], | 
|---|
|  |  |  | today: '', | 
|---|
|  |  |  | tj: 0 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | } | 
|---|