confirmOrder.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // pages/confirmOrder/confirmOrder.js
  2. const getReq = require('./../../config.js').getReq
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. goods_id: '',
  9. ifcart: '',
  10. num: '',
  11. datas: {}
  12. },
  13. /**
  14. * 生命周期函数--监听页面加载
  15. */
  16. onLoad: function (options) {
  17. let { goods_id, iscart, num } = options
  18. this.setData({
  19. goods_id,
  20. ifcart: iscart,
  21. num
  22. })
  23. this.getDatas(goods_id, iscart, num)
  24. console.log(options)
  25. },
  26. getDatas(goods_id, ifcart, num) {
  27. wx.showLoading({
  28. title: '加载中',
  29. })
  30. var self = this
  31. getReq({
  32. act: 'member_buy',
  33. op: 'step_first',
  34. curpage: 1,
  35. cart_id: `${goods_id}|${num}`,
  36. ifcart,
  37. }, function (res) {
  38. wx.hideLoading()
  39. console.log(res)
  40. if (res.code == 200) {
  41. let datas = res.datas
  42. self.setData({
  43. datas
  44. })
  45. }
  46. else {
  47. wx.showToast({
  48. icon: 'none',
  49. title: res.message,
  50. duration: 2000
  51. })
  52. }
  53. })
  54. },
  55. /**
  56. * 生命周期函数--监听页面初次渲染完成
  57. */
  58. onReady: function () {
  59. },
  60. /**
  61. * 生命周期函数--监听页面显示
  62. */
  63. onShow: function () {
  64. },
  65. /**
  66. * 生命周期函数--监听页面隐藏
  67. */
  68. onHide: function () {
  69. },
  70. /**
  71. * 生命周期函数--监听页面卸载
  72. */
  73. onUnload: function () {
  74. },
  75. /**
  76. * 页面相关事件处理函数--监听用户下拉动作
  77. */
  78. onPullDownRefresh: function () {
  79. },
  80. /**
  81. * 页面上拉触底事件的处理函数
  82. */
  83. onReachBottom: function () {
  84. },
  85. /**
  86. * 用户点击右上角分享
  87. */
  88. onShareAppMessage: function () {
  89. }
  90. })