car.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // customized/pages/made/car/car.js
  2. let app = getApp();
  3. let host = app.globalData.servsers; // 请求的url
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. carList:[],// 购物车列表数组
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad: function (options) {
  15. },
  16. /**
  17. * 生命周期函数--监听页面初次渲染完成
  18. */
  19. onReady: function () {
  20. },
  21. /**
  22. * 生命周期函数--监听页面显示
  23. */
  24. onShow: function () {
  25. this.getCarlist(this)
  26. },
  27. /**
  28. * 生命周期函数--监听页面隐藏
  29. */
  30. onHide: function () {
  31. },
  32. /**
  33. * 生命周期函数--监听页面卸载
  34. */
  35. onUnload: function () {
  36. },
  37. /**
  38. * 页面相关事件处理函数--监听用户下拉动作
  39. */
  40. onPullDownRefresh: function () {
  41. },
  42. /**
  43. * 页面上拉触底事件的处理函数
  44. */
  45. onReachBottom: function () {
  46. },
  47. /**
  48. * 用户点击右上角分享
  49. */
  50. onShareAppMessage: function () {
  51. },
  52. getCarlist(that){
  53. wx.request({
  54. url: host +'/queryShopCar',
  55. method:'post',
  56. header: {
  57. 'content-type': 'application/x-www-form-urlencoded'
  58. },
  59. data:{
  60. userId: app.globalData.user_id,
  61. },
  62. success:function(res){
  63. console.log('购物车列表数据',res)
  64. }
  65. })
  66. }
  67. })