myRelease.vue
5.2 KB
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
<template>
<view class="">
<u-sticky bgColor="#fff">
<u-tabs :list="list2" lineColor="#FED000" :scrollable="false" @click="toggle"></u-tabs>
</u-sticky>
<u-empty
marginTop="251"
mode="list"
text="暂无数据"
v-if="!list.length"
>
</u-empty>
<view class="misslist" v-if="list.length">
<custom-waterfalls-flow :isSend="1" :value="list" :columnSpace="1.5" :seat="2" @edit="edit" @del="del" @wapperClick="wapperClick" @imageClick="wapperClick">
<template v-slot:default="item">
<view class="item">
<view class="title">{{item.name}}</view>
<view class="desc">所属分类 {{item.sort.name}}</view>
<view class="desc flexA">
{{item.seller_name}}
<view class="money">
<text style="font-size: 20rpx;">¥</text>{{item.price}}
</view>
</view>
</view>
</template>
</custom-waterfalls-flow>
</view>
<u-modal :show="showDel" :showCancelButton="true" @confirm="delPro" @cancel="showDel=false" content='您是否删除此物品'></u-modal>
</view>
</template>
<script>
var that
import { myProduct ,delProduct} from '@/api/mine.js'
import {toa} from '@/utils/toast.js'
export default {
data() {
return {
list2: [{
name: '全部',
}, {
name: '售卖中',
}, {
name: '已售出'
}],
list: [],
// [ {
// image: 'https://via.placeholder.com/200x500.png/ff0000',
// title: '比特币',
// desc: '所属分类:1 文博收藏品'
// }, {
// image: 'https://via.placeholder.com/200x300.png/9400D3',
// title: '我是标题4',
// desc: '描述描述描述描述描述描述描述描述4'
// },
// {
// image: 'https://via.placeholder.com/100x240.png/B0E0E6',
// title: '我是标题5',
// desc: '描述描述描述描述描述描述描述描述5'
// },
// {
// image: 'https://via.placeholder.com/140x280.png/7FFFAA',
// title: '我是标题6',
// desc: '描述描述描述描述描述描述描述描述6'
// },
// {
// image: 'https://via.placeholder.com/40x60.png/EEE8AA',
// title: '我是标题7',
// desc: '描述描述描述描述描述描述描述描述7'
// }
// ]
page:1,
num:15,
idx:0,
delId:'',
showDel:false
}
},
onLoad() {
that = this
this.myProduct()
let URL=window.location.href
this.$wxH5Share.get_jssdk("发布",URL)
},
methods: {
async myProduct(f){
console.log(f);
try {
toa.loading('加载中')
const res = await myProduct(this.idx,this.page,this.num)
toa.hideLoading()
this.lastPage = res.list.last_page
res.list.data.forEach(it=>it.image = it.images_preview[0])
this.list = f?res.list.data :this.list.concat(res.list.data)
console.log('myProduct', res,this.list)
// 保存数据
} catch (err) {
uni.showToast({ title:err,icon:'none' })
console.log('myProduct', err)
}
},
edit(e){
console.log('edit',e);
uni.navigateTo({
url:'/pages/index/send?id=' + e.id
})
console.log('跳转');
},
del(e){
this.delId = e.id
this.showDel = true
console.log('del',e);
},
wapperClick(item) {
uni.navigateTo({
url:'/pages/index/detail?id='+item.id
})
console.log('单项点击事件', item)
},
toggle(e){
this.idx = e.index
this.list = []
this.page = 1
this.myProduct(1)
console.log(e);
},
async delPro(){
try {
const res = await delProduct(this.delId)
console.log('delProduct', res)
setTimeout(()=>{
toa.success('删除成功')
},200)
this.page = 1
this.showDel = false
this.list = []
this.myProduct(1)
// 保存数据
} catch (err) {
uni.showToast({ title:err,icon:'none' })
console.log('delProduct', err)
}
}
},
// 触底触发
onReachBottom() {
if(this.page >= this.lastPage) return
this.page=this.page+1
this.myProduct()
// this.getForum()
// this.list = this.list.concat(this.list)
},
}
</script>
<style lang="less">
page {
background: #f6f6f6;
}
.misslist {
padding: 32rpx 30rpx;
// margin-top: 24rpx;
}
.u-sticky {
top: 0 !important;
}
.item {
padding: 24rpx;
padding-bottom: 0;
.title {
color: rgba(0,0,0,0.9);
font-size: 26rpx;
font-weight: 700;
}
.desc {
justify-content: space-between;
color: rgba(0,0,0,0.6);
font-size: 24rpx;
.money {
color: #F85317;
font-size: 32rpx;
font-weight: 700;
}
}
.bot {
display: flex;
justify-content: flex-end;
image {
width: 40rpx;
height: 40rpx;
}
}
}
.topState {
z-index: 1;
position: absolute;
left: 0;
top: 0;
width: 132rpx;
height: 56rpx;
border-radius: 12rpx 0 24rpx 0;
opacity: 1;
background: rgba(254,208,0,1);
}
.Sale {
}
.Sold {
background: rgba(218,218,218,1);
color: rgba(0,0,0,0.9);
font-size: 26rpx;
}
</style>