refundAudit.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. // index.js
  2. // 获取应用实例
  3. const app = getApp();
  4. const util = require('../../../utils/jmsUtil.js');
  5. const api = require('../../../api/jms.js');
  6. import moment from 'moment'
  7. Page({
  8. data: {
  9. isFinish:false,
  10. id:'',
  11. orderId:'',
  12. type:'',
  13. refusalRemark:'',
  14. noUserRemark:'',
  15. },
  16. // 事件处理函数
  17. onLoad(options) {
  18. if(options.id||options.type){
  19. this.setData({
  20. id:options.id,
  21. type:options.type,
  22. orderId:options.orderId
  23. });
  24. }
  25. },
  26. onshow(){
  27. },
  28. bindRrmark1(e){
  29. this.setData({
  30. refusalRemark:e.detail.value
  31. });
  32. },
  33. bindRrmark2(e){
  34. this.setData({
  35. noUserRemark:e.detail.value
  36. });
  37. },
  38. confTap(){
  39. if(this.data.refusalRemark==''){
  40. wx.showToast({
  41. title: '请输入理由!',
  42. icon:'none'
  43. });
  44. return false;
  45. }
  46. if(this.data.rnoUserRemark==''){
  47. wx.showToast({
  48. title: '请输入备注!',
  49. icon:'none'
  50. });
  51. return false;
  52. }
  53. //如果是不通过 不用调用校验接口
  54. if(this.data.type==4){
  55. this.confirmPass();
  56. }else{
  57. wx.showLoading({
  58. title: '加载中',
  59. })
  60. let params={
  61. id:this.data.id,
  62. orderId:this.data.orderId,
  63. amount:app.globalData.refundDetail.amount
  64. }
  65. util.request(api.PreRefundCheck,
  66. params
  67. , 'POST').then(res=>{
  68. wx.hideLoading();
  69. if(res.errno==0){
  70. if (res.data.code == 0) {
  71. this.confirmPass();
  72. }else if(res.data.code==1){
  73. let that=this;
  74. wx.showModal({
  75. title: '',
  76. confirmColor: '#b4282d',
  77. content: res.data.msg,
  78. success: function (res) {
  79. if (res.confirm) {
  80. that.confirmPass();
  81. }
  82. }
  83. })
  84. }else{
  85. wx.showToast({
  86. title: res.data.msg,
  87. icon:'none'
  88. });
  89. }
  90. }else {
  91. wx.showToast({
  92. title: res.errmsg,
  93. icon:'none'
  94. });
  95. }
  96. }).catch(err=>{
  97. wx.hideLoading();
  98. });
  99. }
  100. },
  101. confirmPass(){
  102. wx.showLoading({
  103. title: '提交中',
  104. })
  105. let params={
  106. refusalRemark:this.data.refusalRemark,
  107. id:this.data.id,
  108. orderId:this.data.orderId,
  109. noUserRemark:this.data.noUserRemark,
  110. status:this.data.type
  111. }
  112. util.request(api.RefundisPass,
  113. params
  114. , 'POST').then(res=>{
  115. wx.hideLoading();
  116. if (res.errno == 0) {
  117. this.setData({
  118. isFinish:true,
  119. })
  120. wx.showModal({
  121. title: '提示',
  122. content: '操作成功',
  123. showCancel:false,
  124. complete: (res) => {
  125. if (res.cancel) {
  126. }
  127. if (res.confirm) {
  128. wx.navigateBack({
  129. delta:1
  130. });
  131. }
  132. }
  133. })
  134. }else{
  135. wx.showToast({
  136. title: res.errmsg,
  137. icon:'none'
  138. })
  139. }
  140. }).catch(err=>{
  141. wx.hideLoading();
  142. });
  143. },
  144. })