xuxueyang
2024-07-30 1fb44496929548b4f07b37796d506dedc494d44a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<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/browse/history/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.level_columns[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: {
            toDetail(item) {
                if (item.status == 'UP') {
 
                } else {
                    this.$message.showToast('已失效,无法查看详情')
                    return
                }
                uni.navigateTo({
                    url: `/sub_pages/customer/trade/detail?id=${item.id}`
                })
            },
            async submitShopping(dto) {
                //提交到购物车中
                // this.$message.showLoading()
                await this.$store.dispatch('submitShopping', dto);
                // this.$message.hideLoading()
            },
            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>
 
<template>
    <view class="page-collect " style="background: #E1F0E7;">
        <view style="padding-bottom: 0rpx;" class="p20">
            <view class="search-container flex">
                <view class="flex1 input">
                    <u-input placeholder="请输入花名" v-model="query.name">
                        <template slot="suffix">
                            <uni-icons color="#20613D" type="search" size="24" @click="refreshList"></uni-icons>
                        </template>
                    </u-input>
                </view>
            </view>
            <view class="component-filter-container p10">
                <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>
        </view>
 
        <no-data v-if="!list||list.length===0" style="width: 100%;"></no-data>
 
 
        <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 flex" v-for="(dto,index) of list" :key="index"
                @click.stop="toDetail(dto)">
                <image class="img img100 br-4 m-r-10" :src="dto.url||dto.cover"></image>
                <view class="flex1">
                    <view class="flex">
                        <view class="title">
                            <span class="m-r-5" style="display: inline-block;"
                                v-if="dto.categoryStr">{{dto.categoryStr||''}}</span>
                            <span v-if="dto.levelStr" class="m-r-5"
                                style="display: inline-block;">{{ dto.levelStr || '' }}</span>
                            {{ dto.name || '-' }}
                        </view>
                        <view class="price m-l-a m-r-0">
                            ¥{{ dto.price || '-' }}/扎
                        </view>
                    </view>
                    <view class="flex">
                        <view class="desc m-t-12 flex">
                            <view class="m-r-15">剩余:{{ dto.stock || 0 }}</view>
                            <view class="m-r-15">颜色:{{ dto.color || '-' }}</view>
                        </view>
                        <view class="button-icons flex m-l-a m-r-0 m-t-20" v-if="dto.status=='UP'">
                            <view class="m-r-0 gwc" @click.stop="submitShopping(dto)">
                                + 购物车
                            </view>
                        </view>
                    </view>
                </view>
 
            </view>
 
        </view>
    </view>
</template>
 
<style lang="scss" scoped>
    .page-collect {
        min-height: 99vh;
        
        .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;
            }
        }
        .trade-list-container {
            min-height: calc(100vh - 300rpx);
            overflow-y: scroll;
            border-top-right-radius: 40rpx;
            border-top-left-radius: 40rpx;
            padding: 20rpx;
            
        }
        .trade-info-container {
            background-color: #fff;
            border-radius: 20rpx;
            margin-bottom: 20rpx;
            padding: 20rpx;
            overflow: hidden;
            
            overflow-y: scroll;
 
            .img {
                width: 124rpx;
                height: 124rpx;
            }
 
            .title {
                font-weight: 600;
                font-size: 28rpx;
 
                color: #000000;
                line-height: 40rpx;
 
                .level {
                    color: #20613D;
                }
            }
 
            .price {
                font-weight: 400;
                font-size: 28rpx;
                color: #CF0000;
                line-height: 40rpx;
            }
 
            .desc {
                font-weight: 400;
                font-size: 24rpx;
                color: #666666;
                line-height: 34rpx;
            }
 
 
            .button-icons {
                //position: absolute;
                //z-index: 10;
                line-height: 40rpx;
 
                .curnums {
                    margin-left: 10rpx;
                    margin-right: 10rpx;
                }
            }
 
            .gwc {
                width: 168rpx;
                height: 48rpx;
                border-radius: 30rpx;
                border: 2rpx solid #20613D;
                font-size: 24rpx;
                color: #20613D;
                line-height: 48rpx;
                text-align: center;
            }
 
        }
 
    }
</style>