bond.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // pages/mine/wxml/bond/bond.js
  2. const app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. array: [],
  9. prodUrl:app.globalData.prodUrl
  10. },
  11. bond: function(e) {
  12. //console.log(e)
  13. var _this = this;
  14. wx.showModal({
  15. title: '提示',
  16. content: '确定退还保证金',
  17. success: function(res) {
  18. if (res.confirm) {
  19. //console.log('用户点击确定')
  20. wx.request({
  21. url: app.globalData.prodUrl + 'web-pm/wx/pm/initiate_refund',
  22. header: {
  23. 'ydw-token': wx.getStorageSync('key').ydw_token
  24. },
  25. data:{
  26. item_kid: e.target.dataset.pm_item_id
  27. },
  28. success: function(data) {
  29. //console.log(data)
  30. _this.onLoad()
  31. }
  32. });
  33. } else if (res.cancel) {
  34. //console.log('用户点击取消')
  35. }
  36. }
  37. })
  38. },
  39. /**
  40. * 生命周期函数--监听页面加载
  41. */
  42. onLoad: function(options) {
  43. var _this = this;
  44. //console.log(wx.getStorageSync('key').ydw_token)
  45. wx.request({
  46. url: app.globalData.prodUrl + 'web-pm/wx/pm/list_refund',
  47. header: {
  48. 'ydw-token': wx.getStorageSync('key').ydw_token
  49. },
  50. success: function (data) {
  51. //console.log(data)
  52. _this.setData({
  53. array: data.data.data
  54. })
  55. },
  56. });
  57. },
  58. /**
  59. * 生命周期函数--监听页面初次渲染完成
  60. */
  61. onReady: function() {
  62. },
  63. /**
  64. * 生命周期函数--监听页面显示
  65. */
  66. onShow: function() {
  67. },
  68. /**
  69. * 生命周期函数--监听页面隐藏
  70. */
  71. onHide: function() {
  72. },
  73. /**
  74. * 生命周期函数--监听页面卸载
  75. */
  76. onUnload: function() {
  77. },
  78. /**
  79. * 页面相关事件处理函数--监听用户下拉动作
  80. */
  81. onPullDownRefresh: function() {
  82. },
  83. /**
  84. * 页面上拉触底事件的处理函数
  85. */
  86. onReachBottom: function() {
  87. }
  88. })