<template>
|
<view class="page-collect">
|
<view class="search-container m-t-12 flex">
|
<view class="flex1 input">
|
<u-input placeholder="请输入花名" v-model="query.name">
|
<template slot="suffix">
|
<uni-icons color="#20613D" type="search" size="24" @tap="refreshList"></uni-icons>
|
</template>
|
</u-input>
|
</view>
|
</view>
|
<view class="component-filter-container">
|
<view class="flex1" @click.stop="order_show=true">
|
{{ this.query.columnStr || '排序' }}
|
<image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image>
|
</view>
|
<view class="flex1" @click.stop="level_show=true">
|
{{ this.query.levelStr || '级别' }}
|
<image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"
|
></image>
|
</view>
|
</view>
|
|
<u-picker :show="level_show" @confirm="select_level" keyName="label" :columns="level_columns"
|
@cancel="level_show=false"></u-picker>
|
<u-picker :show="order_show" @confirm="select_order" keyName="label" :columns="order_columns"
|
@cancel="order_show=false"></u-picker>
|
|
<view class="trade-list-container">
|
<view class="trade-info-container" v-for="(dto,index) of list" :key="index">
|
<view class="title">
|
<view class="level m-r-15">{{ dto.levelStr || '-' }}级</view>
|
<view class="">
|
{{ dto.name || '-' }}
|
</view>
|
</view>
|
<view class="desc m-t-12">
|
<view class="m-r-15">已售:{{ dto.sales || 0 }}</view>
|
<view class="m-r-15">剩余:{{ dto.stock || 0 }}</view>
|
<view class=" ">{{ dto.unit || '-' }}支/扎</view>
|
</view>
|
<view class="flex m-t-12">
|
<view class="price m-r-a">
|
<span class="num">{{ dto.price || '-' }}</span>
|
元/扎
|
</view>
|
<view class="m-l-a m-r-15">
|
<image src="../../../static/common/icon-kf.png" class="icon-kf m-l-15 img100"></image>
|
|
</view>
|
<view class="m-r-0 gwc" @click="submitShopping(dto)">
|
+ 购物车
|
</view>
|
</view>
|
</view>
|
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
async onPullDownRefresh() {
|
await this.refreshList()
|
uni.stopPullDownRefresh()
|
},
|
data() {
|
return {
|
query: {
|
name: '',
|
levelStr: '',
|
level: '',
|
column: '',
|
columnStr: '',
|
},
|
level_show: false,
|
level_columns: [[]],
|
|
order_show: false,
|
order_columns: [[]]
|
}
|
},
|
onLoad() {
|
this.listApi = '/api/collect/list'
|
this.getList()
|
|
this.$http.request('get', '/api/code/value', {
|
params: {
|
type: 'FLOWER_LEVEL'
|
}
|
}).then(res => {
|
var data = res.data
|
this.level_columns = [data || []]
|
this.columns_levels[0].unshift({
|
label: '全部',
|
value: ''
|
})
|
})
|
|
this.$http.request('get', '/api/code/value', {
|
params: {
|
type: 'FLOWER_ORDER_BY'
|
}
|
}).then(res => {
|
var data = res.data
|
this.order_columns = [data || []]
|
this.order_columns[0].unshift({
|
label: '默认',
|
value: ''
|
})
|
})
|
},
|
methods: {
|
select_level(e) {
|
this.level_show = false
|
this.query.levelStr = e.value[0].label
|
this.query.level = e.value[0].value
|
this.refreshList()
|
|
},
|
select_order(e) {
|
this.order_show = false
|
this.query.columnStr = e.value[0].label
|
this.query.column = e.value[0].value
|
this.refreshList()
|
|
},
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.page-collect {
|
.search-container {
|
display: flex;
|
margin: 12rpx 0rpx 20rpx 0rpx;
|
position: relative;
|
z-index: 1;
|
|
.input {
|
background-color: #fff !important;
|
border-radius: 8rpx;
|
}
|
|
.button {
|
min-width: 120rpx;
|
max-width: 120rpx;
|
margin-left: auto;
|
margin-right: 0rpx;
|
text-align: right;
|
line-height: 70rpx !important;
|
}
|
}
|
}
|
|
</style>
|