detail.js 978 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. loading: true
  5. },
  6. onLoad(options) {
  7. console.log(options)
  8. if (options.id) this.setData({
  9. sa_itemgroupid: options.id
  10. })
  11. this.getDetail()
  12. },
  13. getDetail() {
  14. _Http.basic({
  15. "id": "20220926142403",
  16. "content": {
  17. "sa_itemgroupid": this.data.sa_itemgroupid
  18. }
  19. }).then(res => {
  20. console.log("商品详情", res)
  21. if (res.msg != '成功') return wx.showToast({
  22. title: res.msg,
  23. icon: "none"
  24. })
  25. this.setData({
  26. detail: res.data[0],
  27. loading: false
  28. })
  29. })
  30. },
  31. /* 加入购物车 */
  32. storage() {
  33. _Http.basic({
  34. "id": "20220926142403",
  35. "content": {
  36. "sa_itemgroupid": this.data.sa_itemgroupid
  37. }
  38. }).then(res => {
  39. console.log(res)
  40. if (res.msg != '成功') return wx.showToast({
  41. title: res.msg,
  42. icon: "none"
  43. })
  44. })
  45. },
  46. onReady() {
  47. }
  48. })