// nova-tourism/components/suggest/index.js let Parse = getApp().Parse; const company = getApp().globalData.company const uid = Parse.User.current()?.id const req = require('../../../utils/request') Component({ /** * 组件的属性列表 */ properties: { store_id:null }, /** * 组件的初始数据 */ data: { gift: [], //望仙礼遇-商品 }, lifetimes: { detached: function () {}, attached: async function () { setTimeout(() => { this.getGift() }, 800); }, }, /** * 组件的方法列表 */ methods: { /** 获取望仙礼遇-商品*/ async getGift() { let { store_id } = this.properties console.log(store_id) let sql = `SELECT good."objectId",good."name",good."price",good."image" FROM "ShopGoods" good WHERE good."company" = '${company}' AND good."isDeleted" IS NOT TRUE AND good."status" IS TRUE AND good."shopStore"='${store_id}' ORDER BY COALESCE(good."isHome", FALSE) DESC, CASE WHEN good."top"= 0 THEN 1 ELSE 0 END, good."top" ASC,good."createdAt" LIMIT 4` let gift = await req.customSQL(sql) || [] console.log(gift) this.setData({ gift }) }, /** 跳转*/ tourl(e) { const url = e.currentTarget.dataset.url wx.navigateTo({ url: `${url}` //目标页面的路径 }); }, } })