const _Http = getApp().globalData.http; Component({ properties: { list: { type: Array }, hidePrice: { type: Number } }, options: { addGlobalClass: true }, methods: { toDetail(e) { const { item } = e.currentTarget.dataset; wx.navigateTo({ url: `/packageA/market/detail?params=${JSON.stringify({ sa_itemgroupid:item.sa_itemgroupid, sa_brandid:item.sa_brandid })}`, }) }, buyMore(e) { const item = e.currentTarget.dataset.item.item[0]; const item1 = e.currentTarget.dataset.item; wx.showModal({ title: '提示', content: `是否确定将“${item.itemname}”加入到购物车`, complete: (res) => { if (res.confirm) _Http.basic({ "id": 20220924095102, "content": { sa_brandid: item1.sa_brandid, "itemid": item.itemid, //货品id "qty": item.orderminqty, //数量 itemno: item.itemno, //货品编号 tradefield: item1.tradefield, width: item.width, length: item.length }, }).then(res => { console.log("加入购物车", res) wx.showToast({ title: res.msg == '成功' ? '加入成功' : res.msg, icon: "none" }); if (res.msg == '成功') getApp().globalData.getCollectCount().then(badge => this.setData({ badge })) }) } }) }, } })