1
0

applyRefund.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. var util = require('../../../utils/util.js');
  2. var api = require('../../../config/api.js');
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. refundMoney: '',
  9. orderGoods: [],
  10. orderId: '',
  11. merchOrderSn: ''
  12. },
  13. /**
  14. * 生命周期函数--监听页面加载
  15. */
  16. onLoad: function (options) {
  17. // 页面初始化 options为页面跳转所带来的参数
  18. this.setData({
  19. orderId: options.orderId,
  20. merchOrderSn: options.merchOrderSn,
  21. refundMoney: options.refundMoney
  22. });
  23. },
  24. /**
  25. * 生命周期函数--监听页面初次渲染完成
  26. */
  27. onReady: function () {
  28. },
  29. /**
  30. * 生命周期函数--监听页面显示
  31. */
  32. onShow: function () {
  33. let that = this;
  34. util.request(api.OrderDetail, {
  35. orderId: that.data.orderId
  36. }).then(function (res) {
  37. if (res.errno === 0) {
  38. that.setData({
  39. orderGoods: res.data.orderGoods
  40. });
  41. }
  42. });
  43. },
  44. /**
  45. * 生命周期函数--监听页面隐藏
  46. */
  47. onHide: function () {
  48. },
  49. /**
  50. * 生命周期函数--监听页面卸载
  51. */
  52. onUnload: function () {
  53. },
  54. /**
  55. * 页面相关事件处理函数--监听用户下拉动作
  56. */
  57. onPullDownRefresh: function () {
  58. },
  59. /**
  60. * 页面上拉触底事件的处理函数
  61. */
  62. onReachBottom: function () {
  63. },
  64. /**
  65. * 用户点击右上角分享
  66. */
  67. onShareAppMessage: function () {
  68. },
  69. saveApplyRefund: function (e) {
  70. if (!e.detail.value.refundReason) {
  71. util.showErrorToast('退款原因不能为空');
  72. return false;
  73. }
  74. let that = this; console.log(that.data.merchOrderSn);
  75. util.request(api.saveApplyRefund, {
  76. refundReason: e.detail.value.refundReason,
  77. orderId: that.data.orderId,
  78. merchOrderSn: that.data.merchOrderSn
  79. }, 'POST').then(function (res) {
  80. if (res.errno === 0) {
  81. //成功提示
  82. wx.showModal({
  83. title: '',
  84. content: res.errmsg,
  85. showCancel: false,
  86. success: function (res) {
  87. if (res.confirm) {
  88. wx.navigateTo({
  89. url: '/pages/ucenter/order/order?tabIndex=2'
  90. });
  91. }
  92. }
  93. });
  94. } else {
  95. wx.showModal({
  96. title: '',
  97. content: res.errmsg,
  98. showCancel: false
  99. });
  100. }
  101. });
  102. },
  103. })