receiptExtend.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. $(function() {
  2. $('button[node-qmk="tm"]').click(function(){
  3. var id=$(this).attr('data');
  4. $('#'+id).attr('value',$('#'+id).attr('data-tm'));
  5. });
  6. $('a[receiptWasteDetail]').click(function(){
  7. var ridKey=$(this).attr('data');
  8. var url="/ajaxGetReceiptDetailByJson";
  9. $.ajax({
  10. url:url,
  11. type: "post",
  12. cache: false,
  13. dataType: "json",
  14. data: {
  15. ridKey:ridKey
  16. },
  17. global: true,
  18. success: function(data){
  19. if(data.status==1){
  20. $('#ridKey').val(data.detail.ridKey);
  21. $("#receiptTrainType").hide();
  22. $("#receiptType").show();
  23. $("#receiptTrainPrice").hide();
  24. $("#receiptPrice").show();
  25. $("#paymentAuthCode").val('');
  26. $("#receiptPrice").html('¥'+Math.abs(data.detail.sum).toFixed(2));
  27. if(data.detail.Rtype==0){
  28. $("#Rtype").html('报销单');
  29. $("#receiptType").html('<span class="colRed">支出</span>');
  30. }else if(data.detail.Rtype==1){
  31. if(data.detail.isBK==0){
  32. $("#Rtype").html('借款');
  33. $("#receiptType").html('<span class="colRed">支出</span>');
  34. }else if(data.detail.isBK==1){
  35. $("#Rtype").html('借款(报销)');
  36. var rsum =Math.abs((data.detail.sum-data.detail.loanSum));
  37. $("#receiptPrice").html('¥'+rsum.toFixed(2));
  38. if(rsum>=0){
  39. $("#receiptType").html('<span class="colGreen">收入</span>');
  40. }else{
  41. $("#receiptType").html('<span class="colRed">支出</span>');
  42. }
  43. }
  44. }else if(data.detail.Rtype==2){
  45. $("#Rtype").html('对公汇款');
  46. $("#receiptType").html('<span class="colRed">支出</span>');
  47. //-------------------------------------------------------------
  48. }else if(data.detail.Rtype==3){
  49. $("#Rtype").html('培训班费用');
  50. if(data.detail.payment>=0){
  51. $("#receiptType").html('<span class="colGreen">收入</span>');
  52. }else{
  53. $("#receiptType").html('<span class="colRed">支出</span>');
  54. }
  55. $("#receiptPrice").html('¥'+Math.abs(data.detail.payment).toFixed(2));
  56. $("#paymentAuthCode").val(data.detail.paymentAuthCode);
  57. // $("#receiptTrainType").show();
  58. // $("#receiptType").hide();
  59. // $("#receiptTrainPrice").show();
  60. // $("#receiptPrice").hide();
  61. }
  62. if(data.detail.status==2){
  63. $("#status").html('审批中');
  64. }else if(data.detail.status==1 || data.detail.status==6){
  65. $("#status").html('执行中');
  66. }
  67. data.detail.amount=Math.abs(data.detail.amount);
  68. $("#sum").html('¥'+data.detail.sum);
  69. if(data.detail.amount!=null){
  70. if(data.detail.isBK==1){
  71. $("#amount").html('¥'+rsum.toFixed(2));
  72. }else{
  73. $("#amount").html('¥'+data.detail.amount.toFixed(2));
  74. }
  75. }else{
  76. $("#amount").html('¥0');
  77. }
  78. }
  79. },
  80. error:function(err){
  81. }
  82. });
  83. });
  84. })