refundList.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. const app = getApp()
  2. const util = require("../../../utils/jmsUtil.js");
  3. const api = require('../../../api/jms.js');
  4. import moment from 'moment'
  5. Page({
  6. data: {
  7. ticketList:[],
  8. totalPages:'',
  9. page:1,
  10. listQuery:{
  11. status:'1',
  12. },
  13. selectVisible:false,
  14. columns:[],
  15. selectType:1,
  16. statusList:[
  17. {
  18. text:'全部',
  19. value:'0'
  20. },
  21. {
  22. text:'待审核',
  23. value:'1'
  24. },
  25. {
  26. text:'审核通过',
  27. value:'2'
  28. },
  29. {
  30. text:'审核未通过',
  31. value:'4'
  32. },
  33. {
  34. text:'退款成功',
  35. value:'3'
  36. },
  37. ],
  38. statusDesc: {
  39. 0: "",
  40. 1: "待审核",
  41. 2: "审核通过",
  42. 3: "退款成功",
  43. 4: "审核未通过",
  44. 5:"退款失败"
  45. },
  46. typeTag: ["", "primary","success","success", "warning", "warning"],
  47. levelMap: {
  48. 0: "无",
  49. 1: "一般",
  50. 2: "严重",
  51. 3: "非常严重",
  52. },
  53. },
  54. /**
  55. * 生命周期函数--监听页面加载
  56. */
  57. onLoad: function (options) {
  58. this.getTicketList();
  59. },
  60. /**
  61. * 生命周期函数--监听页面显示
  62. */
  63. onShow: function () {
  64. },
  65. showPicker(e){
  66. let type=e.currentTarget.dataset.type;
  67. this.setData({
  68. selectType:type,
  69. columns:type==1?this.data.statusList:this.data.levelList,
  70. selectVisible:true,
  71. });
  72. },
  73. onPickerConfirm(e){
  74. console.log(e);
  75. if(this.data.selectType==1){
  76. this.setData({
  77. 'listQuery.statusVal':e.detail.value.text,
  78. 'listQuery.status':e.detail.value.value,
  79. });
  80. }else{
  81. this.setData({
  82. 'listQuery.levelVal':e.detail.value.text,
  83. 'listQuery.level':e.detail.value.value,
  84. });
  85. }
  86. this.setData({
  87. selectVisible:false,
  88. page:1,
  89. ticketList:[]
  90. });
  91. this.getTicketList();
  92. },
  93. onPickerCancel(){
  94. this.setData({
  95. selectVisible:false
  96. });
  97. },
  98. goDetail(e){
  99. let id=e.currentTarget.dataset.id;
  100. let orderId=e.currentTarget.dataset.orderid;
  101. let info=e.currentTarget.dataset.info;
  102. app.globalData.refundDetail=info;
  103. wx.navigateTo({
  104. url: '/pages/refund/refundDetail/refundDetail?id='+id+"&orderId="+orderId
  105. });
  106. },
  107. /**
  108. * 生命周期函数--监听页面初次渲染完成
  109. */
  110. onReady: function () {
  111. },
  112. onReachBottom() {
  113. if (this.data.totalPages > this.data.page) {
  114. this.setData({
  115. page: this.data.page + 1
  116. });
  117. this.getTicketList();
  118. } else if (this.data.ticketList.length > 0) {
  119. wx.showToast({
  120. title: '没有更多工单了',
  121. icon: 'none',
  122. duration: 2000
  123. });
  124. return false;
  125. }
  126. },
  127. onChange(e){
  128. this.setData({
  129. 'listQuery.status':e.detail.name,
  130. 'listQuery.page':1,
  131. ticketList:[]
  132. });
  133. this.getTicketList();
  134. },
  135. getTicketList(){
  136. util.request(api.GetAfterSaleList, {
  137. pageNo: this.data.page,
  138. pageSize: 10,
  139. status:this.data.listQuery.status,
  140. }, 'POST').then(res=>{
  141. if (res.errno == 0) {
  142. this.setData({
  143. totalPages:Math.ceil(res.data.total/10),
  144. ticketList:this.data.ticketList.concat(res.data.list)
  145. });
  146. }else{
  147. wx.showToast({
  148. title: res.errmsg,
  149. icon:'none'
  150. })
  151. }
  152. });
  153. },
  154. /**
  155. * 用户点击右上角分享
  156. */
  157. onShareAppMessage: function () {
  158. },
  159. })