123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- // pages/invoice/myInvoice/myInvoice.js
- const app = getApp();
- const api = app.api;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- orderQueryStatus:0, //0全部 1待提交 2进行中 3已完成
- orderList:[],
- orderStatus:{
- 0:'待提交',
- 1:'审核未通过',
- 2:'已提交',
- 3:'待支付',
- 4:'待确认支付',
- 5:'开票中',
- 6:'已寄出',
- 7:'完成',
- 99:'关闭'
- },
- waitStatus:{
- 0:"审核未通过",
- 1:"确认支付",
- 2:"服务费开票"
- },
- checkListIndex:0,
- isShowPaySure:false,
- payName:"",
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- this.getData();
- },
- changeTab(e){
- console.log(e);
- const {index}=e.currentTarget.dataset;
- //console.log(index)
- this.setData({
- orderQueryStatus: parseInt(index)
- });
- this.getData();
- },
- getData(){
- const {orderQueryStatus}=this.data;
- app.post(api.queryOrderInvoiceBuy,{
- orderQueryStatus:orderQueryStatus
- }).then(res=>{
- console.log(res);
- this.setData({
- orderList:res.data
- })
- })
- },
- itemHandler(e){
- const {status,index}=e.currentTarget.dataset;
- const {orderList}=this.data;
- if(status==0||status==1){
- wx.setStorageSync('invoiceInfo',orderList[index]);
- wx.navigateTo({
- url:`/pages/invoice/contract/contract?invoiceOrderId=${orderList[index].invoiceOrderId}&invoiceId=${orderList[index].invoiceId||''}`
- })
- }else{
- wx.navigateTo({
- url:`/pages/invoice/invoiceDetail/invoiceDetail?invoiceOrderId=${orderList[index].invoiceOrderId}&invoiceId=${orderList[index].invoiceId}`
- })
- }
- },
- /**
- * 显示确认支付弹框
- * **/
- showPaySure(e){
- const {index}=e.currentTarget.dataset;
- this.setData({
- isShowPaySure:true,
- checkListIndex:index
- });
- },
- /**
- * 隐藏确认支付弹框
- * **/
- hidePaySure(e){
- this.setData({
- isShowPaySure:false
- });
- },
- /**
- *支付发票
- * **/
- saveStateData(e){
- //console.log(e);
- // const {invoiceorderid}=e.currentTarget.dataset;
- const {payName,checkListIndex,orderList}=this.data;
- let invoiceOrderId=orderList[checkListIndex].invoiceOrderId;
- if(!payName){
- wx.showToast({
- icon:'none',
- title:'请输入付款方姓名'
- })
- return false
- }
- app.post(api.updateInvoiceOrder,{
- invoiceOrderId:invoiceOrderId,
- orderStatus:4, // 3:'待支付', 4:'已支付',
- payName:payName
- }).then(res=>{
- wx.showToast({
- title:"支付成功,请等待审核",
- duration:2000,
- });
- this.setData({
- payName:"",
- isShowPaySure:false
- })
- this.getData();
- });
- },
- /**
- *
- * */
- serveInvoice(e){
- const {orderList}=this.data;
- const {index}=e.currentTarget.dataset;
- wx.setStorageSync('invoiceInfo',orderList[index]);
- wx.navigateTo({
- url:`/pages/invoice/editServiceInvoice/editServiceInvoice?id=${orderList[index].invoiceOrderId}&invoiceId=${orderList[index].invoiceId}`
- })
- },
- changeInput(e){
- console.log(e);
- const id = e.currentTarget.id;
- const value = e.detail.value;
- this.setData({
- [id]: value
- });
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|