Files
LinHelp/miniapp/miniprogram/pages/second-hand/index.js
2026-07-07 16:38:13 +08:00

38 lines
761 B
JavaScript

const { listSecondGoods } = require('../../api/secondGoodsApi')
Page({
data: {
loading: false,
goods: []
},
onLoad() {
this.load()
},
onShow() {
this.load()
},
load() {
this.setData({ loading: true })
listSecondGoods()
.then((goods) => this.setData({ goods: goods || [] }))
.catch((error) => wx.showToast({ title: error.message, icon: 'none' }))
.finally(() => this.setData({ loading: false }))
},
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 })
}
})