feat: add resident miniapp MVP
This commit is contained in:
@@ -1 +1,37 @@
|
||||
Page({})
|
||||
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 })
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user