Files
2026-07-14 16:04:51 +08:00

47 lines
918 B
JavaScript

const { listSecondGoods } = require('../../api/secondGoodsApi')
Page({
data: {
loading: false,
keyword: '',
goods: []
},
onLoad() {
this.load()
},
onShow() {
this.load()
},
load() {
this.setData({ loading: true })
listSecondGoods(null, this.data.keyword)
.then((goods) => this.setData({ goods: goods || [] }))
.catch((error) => wx.showToast({ title: error.message, icon: 'none' }))
.finally(() => this.setData({ loading: false }))
},
onKeywordInput(event) {
this.setData({ keyword: event.detail.value })
},
search() {
this.load()
},
goCreate() {
wx.navigateTo({ url: '/pages/second-hand/create' })
},
callSeller(event) {
const phone = event.currentTarget.dataset.phone
if (!phone) {
wx.showToast({ title: '暂无电话', icon: 'none' })
return
}
wx.makePhoneCall({ phoneNumber: phone })
}
})