orderPaySn.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. const getReq = require('./../../config.js').getReq
  2. let appInstance = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. order_info:{},
  9. defaultAddress: null
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad: function (options) {
  15. let pay_sn = options.pay_sn;
  16. this.getDatas(pay_sn);
  17. },
  18. getDatas(pay_sn) {
  19. let self = this;
  20. wx.showLoading({
  21. title: '加载中',
  22. })
  23. getReq({
  24. act: 'member_order',
  25. op: 'pay_info',
  26. pay_sn: pay_sn
  27. }, function (res) {
  28. wx.hideLoading();
  29. if (res.code == 200) {
  30. console.log(res);
  31. self.setData({
  32. defaultAddress:{
  33. mob_phone: res.datas.order.reciver_info.mob_phone,
  34. true_name: res.datas.order.reciver_info.reciver_name,
  35. area_info: res.datas.order.reciver_info.area,
  36. address: res.datas.order.reciver_info.street
  37. },
  38. order_info: res.datas.order.order_info
  39. });
  40. }
  41. else {
  42. wx.showToast({
  43. icon: 'none',
  44. title: res.message,
  45. duration: 2000
  46. })
  47. }
  48. })
  49. },
  50. getGoodsList(summary, goods_list) {
  51. let newGoodsList = []
  52. goods_list.map((item, index) => {
  53. summary.filter((list, key) => {
  54. if (item.goods_id == list.goods_id) {
  55. let goods_item = list
  56. goods_item.goods_num = item.goods_num
  57. newGoodsList.push(goods_item)
  58. return true
  59. }
  60. })
  61. })
  62. return newGoodsList
  63. },
  64. /**
  65. * 生命周期函数--监听页面初次渲染完成
  66. */
  67. onReady: function () {
  68. },
  69. /**
  70. * 生命周期函数--监听页面显示
  71. */
  72. onShow: function () {
  73. if (!this.data.firstLoad) {
  74. let defaultAddress = appInstance.globalData.defaultAddress
  75. this.setData({
  76. defaultAddress
  77. })
  78. }
  79. },
  80. /**
  81. * 生命周期函数--监听页面隐藏
  82. */
  83. onHide: function () {
  84. },
  85. /**
  86. * 生命周期函数--监听页面卸载
  87. */
  88. onUnload: function () {
  89. },
  90. /**
  91. * 页面相关事件处理函数--监听用户下拉动作
  92. */
  93. onPullDownRefresh: function () {
  94. },
  95. /**
  96. * 页面上拉触底事件的处理函数
  97. */
  98. onReachBottom: function () {
  99. }
  100. })