微信小店联盟带货小程序

index.js 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // pages/index/index.js
  2. Page({
  3. data: {
  4. bannerList: [
  5. { id: 1, goodsId: 1 },
  6. { id: 2, goodsId: 2 },
  7. { id: 3, goodsId: 3 }
  8. ],
  9. categories: [
  10. { id: 1, name: '手机' },
  11. { id: 2, name: '电脑' },
  12. { id: 3, name: '平板' },
  13. { id: 4, name: '手表' },
  14. { id: 5, name: '耳机' },
  15. { id: 6, name: '相机' },
  16. { id: 7, name: '游戏机' },
  17. { id: 8, name: '配件' }
  18. ],
  19. hotGoods: [
  20. { id: 1, name: 'iPhone 14 Pro Max', price: '9299.00', commission: '186.00' },
  21. { id: 2, name: '华为 Mate60 Pro', price: '8999.00', commission: '180.00' },
  22. { id: 3, name: '小米14 Pro', price: '5999.00', commission: '120.00' }
  23. ],
  24. newGoods: [
  25. { id: 4, name: 'MacBook Pro 14', price: '18999.00', commission: '380.00' },
  26. { id: 5, name: 'iPad Pro 12.9', price: '8999.00', commission: '180.00' },
  27. { id: 6, name: 'Apple Watch Ultra 2', price: '6999.00', commission: '140.00' }
  28. ]
  29. },
  30. onLoad() {
  31. // TODO: 加载数据
  32. },
  33. // 跳转到搜索页面
  34. navigateToSearch() {
  35. wx.navigateTo({
  36. url: '/pages/search/index'
  37. });
  38. },
  39. // 跳转到分类页面
  40. navigateToCategory(e) {
  41. const { id } = e.currentTarget.dataset;
  42. wx.navigateTo({
  43. url: `/pages/category/index?id=${id}`
  44. });
  45. },
  46. // 跳转到商品详情页面
  47. navigateToDetail(e) {
  48. const { id } = e.currentTarget.dataset;
  49. wx.navigateTo({
  50. url: `/pages/goods/detail?id=${id}`
  51. });
  52. }
  53. });