123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- // nova-tourism/pages/my/merchant/good/good-list/index.js
- let Parse = getApp().Parse;
- const company = getApp().globalData.company
- const uid = Parse.User.current()?.id
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- goodList:[]
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- },
- async refersh(){
- let merchant = wx.getStorageSync('merchant')
- if (!merchant) {
- wx.showToast({
- title: '商户有误',
- icon: 'error'
- })
- setTimeout(() => {
- wx.reLaunch({
- url: `/nova-tourism/pages/index/index`
- })
- }, 1000);
- return
- }
- this.getGoods()
- },
- /**获取商品 */
- async getGoods() {
- let {goodList}=this.data
- let store = wx.getStorageSync('store')
- let query = new Parse.Query('ShopGoods')
- query.equalTo('company', company)
- query.notEqualTo('isDeleted', true)
- query.equalTo('shopStore',store?.objectId)
- query.ascending('top')
- query.limit(15)
- query.skip(goodList?.length||0)
- let d = await query.find()
- let list = d?.map(item=>item.toJSON())
- console.log(list)
- this.setData({
- goodList:[...goodList,...(list||[])]
- })
- },
- /** 跳转*/
- tourl(e) {
- const url = e.currentTarget.dataset.url
- wx.navigateTo({
- url: `${url}` // 目标页面的路径
- });
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- this.refersh()
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- this.getGoods()
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|