29 lines
588 B
JavaScript
29 lines
588 B
JavaScript
const { listGroupBuys } = require('../../api/groupBuyApi')
|
|
|
|
Page({
|
|
data: {
|
|
loading: false,
|
|
groupBuys: []
|
|
},
|
|
|
|
onLoad() {
|
|
this.load()
|
|
},
|
|
|
|
onShow() {
|
|
this.load()
|
|
},
|
|
|
|
load() {
|
|
this.setData({ loading: true })
|
|
listGroupBuys()
|
|
.then((groupBuys) => this.setData({ groupBuys: groupBuys || [] }))
|
|
.catch((error) => wx.showToast({ title: error.message, icon: 'none' }))
|
|
.finally(() => this.setData({ loading: false }))
|
|
},
|
|
|
|
goDetail(event) {
|
|
wx.navigateTo({ url: '/pages/group-buy/detail?id=' + event.currentTarget.dataset.id })
|
|
}
|
|
})
|