myInvoice.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. // pages/invoice/myInvoice/myInvoice.js
  2. const app = getApp();
  3. const api = app.api;
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. orderQueryStatus:0, //0全部 1待提交 2进行中 3已完成
  10. orderList:[],
  11. orderStatus:{
  12. 0:'待提交',
  13. 1:'审核未通过',
  14. 2:'已提交',
  15. 3:'待支付',
  16. 4:'待确认支付',
  17. 5:'开票中',
  18. 6:'已寄出',
  19. 7:'完成',
  20. 99:'关闭'
  21. },
  22. waitStatus:{
  23. 0:"审核未通过",
  24. 1:"确认支付",
  25. 2:"服务费开票"
  26. },
  27. checkListIndex:0,
  28. isShowPaySure:false,
  29. payName:"",
  30. },
  31. /**
  32. * 生命周期函数--监听页面加载
  33. */
  34. onLoad: function (options) {
  35. },
  36. /**
  37. * 生命周期函数--监听页面初次渲染完成
  38. */
  39. onReady: function () {
  40. },
  41. /**
  42. * 生命周期函数--监听页面显示
  43. */
  44. onShow: function () {
  45. this.getData();
  46. },
  47. changeTab(e){
  48. console.log(e);
  49. const {index}=e.currentTarget.dataset;
  50. //console.log(index)
  51. this.setData({
  52. orderQueryStatus: parseInt(index)
  53. });
  54. this.getData();
  55. },
  56. getData(){
  57. const {orderQueryStatus}=this.data;
  58. app.post(api.queryOrderInvoiceBuy,{
  59. orderQueryStatus:orderQueryStatus
  60. }).then(res=>{
  61. console.log(res);
  62. this.setData({
  63. orderList:res.data
  64. })
  65. })
  66. },
  67. itemHandler(e){
  68. const {status,index}=e.currentTarget.dataset;
  69. const {orderList}=this.data;
  70. if(status==0||status==1){
  71. wx.setStorageSync('invoiceInfo',orderList[index]);
  72. wx.navigateTo({
  73. url:`/pages/invoice/contract/contract?invoiceOrderId=${orderList[index].invoiceOrderId}&invoiceId=${orderList[index].invoiceId||''}`
  74. })
  75. }else{
  76. wx.navigateTo({
  77. url:`/pages/invoice/invoiceDetail/invoiceDetail?invoiceOrderId=${orderList[index].invoiceOrderId}&invoiceId=${orderList[index].invoiceId}`
  78. })
  79. }
  80. },
  81. /**
  82. * 显示确认支付弹框
  83. * **/
  84. showPaySure(e){
  85. const {index}=e.currentTarget.dataset;
  86. this.setData({
  87. isShowPaySure:true,
  88. checkListIndex:index
  89. });
  90. },
  91. /**
  92. * 隐藏确认支付弹框
  93. * **/
  94. hidePaySure(e){
  95. this.setData({
  96. isShowPaySure:false
  97. });
  98. },
  99. /**
  100. *支付发票
  101. * **/
  102. saveStateData(e){
  103. //console.log(e);
  104. // const {invoiceorderid}=e.currentTarget.dataset;
  105. const {payName,checkListIndex,orderList}=this.data;
  106. let invoiceOrderId=orderList[checkListIndex].invoiceOrderId;
  107. if(!payName){
  108. wx.showToast({
  109. icon:'none',
  110. title:'请输入付款方姓名'
  111. })
  112. return false
  113. }
  114. app.post(api.updateInvoiceOrder,{
  115. invoiceOrderId:invoiceOrderId,
  116. orderStatus:4, // 3:'待支付', 4:'已支付',
  117. payName:payName
  118. }).then(res=>{
  119. wx.showToast({
  120. title:"支付成功,请等待审核",
  121. duration:2000,
  122. });
  123. this.setData({
  124. payName:"",
  125. isShowPaySure:false
  126. })
  127. this.getData();
  128. });
  129. },
  130. /**
  131. *
  132. * */
  133. serveInvoice(e){
  134. const {orderList}=this.data;
  135. const {index}=e.currentTarget.dataset;
  136. wx.setStorageSync('invoiceInfo',orderList[index]);
  137. wx.navigateTo({
  138. url:`/pages/invoice/editServiceInvoice/editServiceInvoice?id=${orderList[index].invoiceOrderId}&invoiceId=${orderList[index].invoiceId}`
  139. })
  140. },
  141. changeInput(e){
  142. console.log(e);
  143. const id = e.currentTarget.id;
  144. const value = e.detail.value;
  145. this.setData({
  146. [id]: value
  147. });
  148. },
  149. /**
  150. * 生命周期函数--监听页面隐藏
  151. */
  152. onHide: function () {
  153. },
  154. /**
  155. * 生命周期函数--监听页面卸载
  156. */
  157. onUnload: function () {
  158. },
  159. /**
  160. * 页面相关事件处理函数--监听用户下拉动作
  161. */
  162. onPullDownRefresh: function () {
  163. },
  164. /**
  165. * 页面上拉触底事件的处理函数
  166. */
  167. onReachBottom: function () {
  168. },
  169. /**
  170. * 用户点击右上角分享
  171. */
  172. onShareAppMessage: function () {
  173. }
  174. })