promotion-order.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. var app = getApp();
  2. // pages/promotion-order/promotion-order.js
  3. Page({
  4. data: {
  5. url: app.globalData.urlImages,
  6. currentTab:"",
  7. hiddens:true,
  8. icondui:0,
  9. icondui2: 0,
  10. alloeder: ['全部订单', '已评价', '已发货'],
  11. allOrder:"全部订单",
  12. promoter:"推广粉丝",
  13. promoterList: [],
  14. orderlist:[],
  15. orderconut:'',
  16. ordermoney:''
  17. },
  18. /**
  19. * 生命周期函数--监听页面加载
  20. */
  21. onLoad: function (options) {
  22. app.setBarColor();
  23. app.setUserInfo();
  24. var header = {
  25. 'content-type': 'application/x-www-form-urlencoded',
  26. };
  27. this.orderlist();
  28. this.extension(header);
  29. this.orderlistmoney();
  30. },
  31. extension: function (header){
  32. var that = this;
  33. wx.request({
  34. url: app.globalData.url + '/routine/auth_api/get_spread_list?uid=' + app.globalData.uid,
  35. method: 'POST',
  36. header: header,
  37. success: function (res) {
  38. // console.log(res.data.data);
  39. if (res.data.code==200){
  40. that.setData({
  41. promoterList: res.data.data.list
  42. })
  43. }else{
  44. that.setData({
  45. promoterList: []
  46. })
  47. }
  48. }
  49. });
  50. },
  51. spread: function () {
  52. wx.navigateTo({
  53. url: '../../pages/spread/spread',
  54. success: function (res) { },
  55. fail: function (res) { },
  56. complete: function (res) { },
  57. })
  58. },
  59. ordertap:function(e){
  60. var currentTab = e.target.dataset.index;
  61. this.setData({
  62. currentTab:currentTab,
  63. hiddens:false
  64. })
  65. console.log(this.data.currentTab)
  66. },
  67. icondui:function(e){
  68. var that=this;
  69. var icondui = e.target.dataset.ider;
  70. that.setData({
  71. icondui: icondui,
  72. hiddens: true,
  73. allOrder: that.data.alloeder[icondui],
  74. currentTab: -1
  75. })
  76. that.orderlist();
  77. this.orderlistmoney();
  78. },
  79. icondui2:function(e){
  80. var that = this;
  81. var icondui2 = e.target.dataset.ider;
  82. var promoterLists = that.data.promoterList;
  83. var len = promoterLists.length;
  84. for (var index in promoterLists){
  85. if (promoterLists[index]['uid'] == icondui2){
  86. var promoter = promoterLists[index]['nickname'];
  87. }
  88. }
  89. that.setData({
  90. icondui2: icondui2,
  91. hiddens: true,
  92. promoter: promoter,
  93. currentTab: -1
  94. })
  95. that.orderlist();
  96. },
  97. zhaoguan:function(e){
  98. this.setData({
  99. hiddens: true,
  100. currentTab: -1
  101. })
  102. },
  103. orderlist: function (){
  104. var header = {
  105. 'content-type': 'application/x-www-form-urlencoded',
  106. };
  107. var that = this;
  108. var icondui = that.data.icondui;
  109. var icondui2 = that.data.icondui2;
  110. wx.request({
  111. url: app.globalData.url + '/routine/auth_api/subordinateOrderlist?uid=' + app.globalData.uid,
  112. data: { uid: icondui2, status: icondui},
  113. method: 'POST',
  114. header: header,
  115. success: function (res) {
  116. if (res.data.code==200){
  117. that.setData({
  118. orderlist: res.data.data
  119. })
  120. }else{
  121. that.setData({
  122. orderlist: []
  123. })
  124. }
  125. }
  126. })
  127. },
  128. orderlistmoney: function () {
  129. var that = this;
  130. wx.request({
  131. url: app.globalData.url + '/routine/auth_api/subordinateOrderlistmoney?uid=' + app.globalData.uid,
  132. data: { status: that.data.icondui},
  133. method: 'POST',
  134. success: function (res) {
  135. if (res.data.code == 200) {
  136. that.setData({
  137. ordermoney: res.data.data.sum,
  138. orderconut: res.data.data.cont
  139. })
  140. } else {
  141. that.setData({
  142. ordermoney:'',
  143. orderconut:''
  144. })
  145. }
  146. }
  147. })
  148. }
  149. })