refund.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. // pages/welfareMall/refund/refund.js
  2. import WelfareMall from '../../../api/welfareMall'
  3. import {getMobileCache, getPhoneNumber as getPhoneNumberSync} from '../../../utils/user'
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. orderSn: '',
  10. orderStatus: null,
  11. orderDetail: null,
  12. },
  13. getModal() {
  14. wx.showModal({
  15. title: '退款说明',
  16. content: '福利社优惠券退款说明,福利社优惠券退款说明,福利社优惠券退款说明,福利社优惠券退款说明,福利社优惠券退款说明,福利社优惠券退款说明',
  17. showCancel: false,//是否显示取消按钮
  18. cancelText:"否",//默认是“取消”
  19. cancelColor:'skyblue',//取消文字的颜色
  20. confirmText:"我知道了",//默认是“确定”
  21. confirmColor: 'black',//确定文字的颜色
  22. success: res => {if (res.cancel) {
  23. //点击取消,默认隐藏弹框
  24. } else {
  25. //点击确定
  26. }
  27. },
  28. fail: function (res) { },//接口调用失败的回调函数
  29. })
  30. },
  31. /**
  32. * 生命周期函数--监听页面加载
  33. */
  34. onLoad: function (options) {
  35. var that = this;
  36. that.orderSn = options.ordersn;
  37. this.setData({
  38. orderSn: options.ordersn,
  39. })
  40. this.getRefundOrderStatus(that.orderSn);
  41. this.getOrder(that.orderSn);
  42. this.data.orderSn = options.ordersn;
  43. },
  44. /**
  45. * 获取订单的退款单状态
  46. */
  47. getRefundOrderStatus: function(data) {
  48. WelfareMall.getRefundOrderStatus({
  49. mobile: getMobileCache(),
  50. orderSn: data,
  51. }).then(res => {
  52. if (res.code == 200) {
  53. this.userOrderStatusView(res.data)
  54. }
  55. }).catch(err => {
  56. console.log(err)
  57. })
  58. },
  59. userOrderStatusView: function(data) {
  60. if (!data) {
  61. console.log("订单状态详情数据为空");
  62. return
  63. }
  64. //对象转换
  65. this.data.orderStatus = data
  66. this.setData({
  67. mobileTop:getMobileCache(),
  68. orderStatus: this.data.orderStatus
  69. })
  70. },
  71. /**
  72. *
  73. * 订单数据
  74. */
  75. getOrder: function(data) {
  76. WelfareMall.getOrder({
  77. mobile: getMobileCache(),
  78. orderSn: data,
  79. }).then(res => {
  80. if (res.code == 200) {
  81. this.userOrderistView(res.data)
  82. }
  83. this.data.lock = false
  84. }).catch(_ => {
  85. console.log(_)
  86. this.data.lock = false
  87. })
  88. },
  89. userOrderistView: function(data) {
  90. if (!data) {
  91. console.log("订单详情数据为空");
  92. return
  93. }
  94. //对象转换
  95. this.data.orderDetail = data
  96. this.setData({
  97. mobileTop:getMobileCache(),
  98. orderDetail: this.data.orderDetail
  99. })
  100. },
  101. /**
  102. * 生命周期函数--监听页面初次渲染完成
  103. */
  104. onReady: function () {
  105. },
  106. /**
  107. * 生命周期函数--监听页面显示
  108. */
  109. onShow: function () {
  110. },
  111. /**
  112. * 生命周期函数--监听页面隐藏
  113. */
  114. onHide: function () {
  115. },
  116. /**
  117. * 生命周期函数--监听页面卸载
  118. */
  119. onUnload: function () {
  120. },
  121. /**
  122. * 页面相关事件处理函数--监听用户下拉动作
  123. */
  124. onPullDownRefresh: function () {
  125. },
  126. /**
  127. * 页面上拉触底事件的处理函数
  128. */
  129. onReachBottom: function () {
  130. },
  131. /**
  132. * 用户点击右上角分享
  133. */
  134. onShareAppMessage: function () {
  135. }
  136. })