You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

142 rivejä
4.6 KiB

  1. /**
  2. * 开票操作
  3. * @param id
  4. * @param status
  5. */
  6. function makeInvoice(id, status) {
  7. parent.bootbox.dialog({
  8. title: '输入发票信息',
  9. className: 'modal-middle',
  10. message: '<h5>请输入发票号码</h5><br><p><input type="text" class="form-control " id="invoice_value" placeholder="发票号码" /> </p>',
  11. buttons: {
  12. cancel: {
  13. label: "取消",
  14. className: 'btn-default'
  15. },
  16. sure: {
  17. label: "确定",
  18. className: 'btn btn-primary',
  19. callback: function () {
  20. if (parent.$("#invoice_value").val().trim() === '') {
  21. z.showTip('error', '请输入发票号码:');
  22. return false;
  23. } else {
  24. ajaxAction(id, status, parent.$("#invoice_value").val(), 'make-invoice');
  25. }
  26. }
  27. }
  28. }
  29. })
  30. }
  31. /**
  32. * 邮寄操作
  33. * @param id
  34. * @param status
  35. */
  36. function post_invoice(id, status) {
  37. parent.bootbox.dialog({
  38. title: '输入邮寄信息:',
  39. className: 'modal-middle',
  40. message: '<h5>请输入邮寄信息</h5><br><p><select class="form-control" id="post_company" ><option value="1">顺丰到付</option><option value="2">顺丰寄付</option><option value="3">圆通寄付</option></select><br>' +
  41. '<input type="text" class="form-control " id="post_num" placeholder="请输入快递单号" /> </p>',
  42. buttons: {
  43. cancel: {
  44. label: "取消",
  45. className: 'btn-default'
  46. },
  47. sure: {
  48. label: "确定",
  49. className: 'btn btn-primary',
  50. callback: function () {
  51. if (parent.$("#post_company").val().trim() === '') {
  52. z.showTip('error', '请输入快递公司');
  53. return false;
  54. } else if (parent.$("#post_num").val().trim() === '') {
  55. z.showTip('error', '请输入快递单号');
  56. return false;
  57. }
  58. else {
  59. var str = parent.$("#post_company").val() + '||' + parent.$("#post_num").val();
  60. ajaxAction(id, status, str, 'post-invoice');
  61. }
  62. }
  63. }
  64. }
  65. })
  66. }
  67. /**
  68. * 驳回操作
  69. * @param id
  70. * @param status
  71. */
  72. function refuse(id, status) {
  73. parent.bootbox.dialog({
  74. title: '驳回发票申请',
  75. className: 'modal-middle',
  76. message: '<h5>请输入驳回原因:</h5><br><p><input type="text" class="form-control " id="refuse_reason" placeholder="驳回原因" /> </p>',
  77. buttons: {
  78. cancel: {
  79. label: "取消",
  80. className: 'btn-default'
  81. },
  82. sure: {
  83. label: "确定",
  84. className: 'btn btn-primary',
  85. callback: function () {
  86. if (parent.$("#refuse_reason").val().trim() === '') {
  87. z.showTip('error', '请输入驳回原因');
  88. return false;
  89. } else {
  90. ajaxAction(id, status, parent.$("#refuse_reason").val(), 'refuse');
  91. }
  92. }
  93. }
  94. }
  95. })
  96. }
  97. /**
  98. * 发送AJAX请求
  99. * @param id
  100. * @param status
  101. * @param msg
  102. * @param action
  103. */
  104. function ajaxAction(id, status, msg, action) {
  105. parent.loading();
  106. $.ajax({
  107. type: 'POST',
  108. url: '/hotel/invoice/' + action + '?id=' + id + '&status=' + status + '&msg=' + msg,
  109. data: {
  110. _csrf: yii.getCsrfToken()
  111. },
  112. dataType: 'json',
  113. success: function (data) {
  114. if (data['code'] === 0) {
  115. z.showTip('success', '操作成功');
  116. $("#search-button").removeClass('zLoading').click();
  117. } else {
  118. if (typeof data['msg'] === 'string')
  119. z.showTip('error', data['msg']);
  120. else {
  121. var str = '';
  122. $.each(data['msg'], function (k, e) {
  123. str += e;
  124. });
  125. z.showTip('error', str);
  126. }
  127. if (data['code'] === 2) {
  128. $("#search-button").removeClass('zLoading').click();
  129. }
  130. }
  131. parent.closeLoading();
  132. },
  133. error: function (e) {
  134. parent.closeLoading();
  135. z.showTip('error', '出错了,联系后台管理员');
  136. }
  137. })
  138. }