detail.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. var util = require('../../../../utils/util.js');
  2. var api = require('../../../../config/api.js');
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. dialogShow:false,
  9. detailList: [],
  10. showType: 1,
  11. page: 1,
  12. limit: 10,
  13. totalPages: 1,
  14. orderId:'',
  15. actualPrice:''
  16. },
  17. bindKeyInput(e){
  18. this.setData({
  19. actualPrice: e.detail.value
  20. })
  21. },
  22. showEditDialog(e){
  23. let id=e.currentTarget.dataset.id;
  24. let price=e.currentTarget.dataset.price
  25. this.setData({
  26. orderId:id,
  27. actualPrice:price,
  28. dialogShow:true
  29. })
  30. },
  31. onClose(){
  32. this.setData({
  33. dialogShow:false
  34. })
  35. },
  36. editAmount(){
  37. util.request(api.OrderEdit, {
  38. orderId:this.data.orderId,
  39. actualPrice:this.data.actualPrice
  40. }, "POST").then((res)=>{
  41. if (res.errno === 0) {
  42. console.log(res.data);
  43. this.setData({
  44. detailList: [],
  45. page: 1,
  46. limit: 10,
  47. totalPages: 1,
  48. dialogShow:false
  49. });
  50. this.getWaitDetailList();
  51. }
  52. });
  53. },
  54. onTabChange(e){
  55. let showType = e.detail.name;
  56. this.setData({
  57. detailList: [],
  58. page: 1,
  59. limit: 10,
  60. totalPages: 1
  61. });
  62. if(showType=='2'){
  63. this.getDetailList();
  64. }else{
  65. this.getWaitDetailList();
  66. }
  67. },
  68. getWaitDetailList() {
  69. let that = this;
  70. util.request(api. DisCommissionWaitDetail, {
  71. page: that.data.page,
  72. limit: that.data.limit
  73. }).then(function(res) {
  74. if (res.errno === 0) {
  75. console.log(res.data);
  76. that.setData({
  77. detailList: that.data.detailList.concat(res.data.list),
  78. totalPages: res.data.pages
  79. });
  80. }
  81. });
  82. },
  83. getDetailList() {
  84. let that = this;
  85. util.request(api.DisCommissionDetail, {
  86. page: that.data.page,
  87. limit: that.data.limit
  88. }).then(function(res) {
  89. if (res.errno === 0) {
  90. console.log(res.data);
  91. that.setData({
  92. detailList: that.data.detailList.concat(res.data.list),
  93. totalPages: res.data.pages
  94. });
  95. }
  96. });
  97. },
  98. makeCall(e){
  99. wx.makePhoneCall({
  100. phoneNumber: e.currentTarget.dataset.mobile
  101. })
  102. },
  103. /**
  104. * 生命周期函数--监听页面加载
  105. */
  106. onLoad: function (options) {
  107. },
  108. /**
  109. * 生命周期函数--监听页面初次渲染完成
  110. */
  111. onReady: function () {
  112. },
  113. /**
  114. * 生命周期函数--监听页面显示
  115. */
  116. onShow: function () {
  117. // this.getDetailList();
  118. this.getWaitDetailList();
  119. },
  120. /**
  121. * 生命周期函数--监听页面隐藏
  122. */
  123. onHide: function () {
  124. },
  125. /**
  126. * 生命周期函数--监听页面卸载
  127. */
  128. onUnload: function () {
  129. },
  130. /**
  131. * 页面相关事件处理函数--监听用户下拉动作
  132. */
  133. onPullDownRefresh: function () {
  134. },
  135. /**
  136. * 页面上拉触底事件的处理函数
  137. */
  138. onReachBottom: function () {
  139. if (this.data.totalPages > this.data.page) {
  140. this.setData({
  141. page: this.data.page + 1
  142. });
  143. if(this.data.showType=='2'){
  144. this.getWaitDetailList();
  145. }else{
  146. this.getDetailList();
  147. }
  148. } else {
  149. wx.showToast({
  150. title: '没有更多明细了',
  151. icon: 'none',
  152. duration: 2000
  153. });
  154. return false;
  155. }
  156. },
  157. /**
  158. * 用户点击右上角分享
  159. */
  160. onShareAppMessage: function () {
  161. }
  162. })