|
-
- /**
- * 开票操作
- * @param id
- * @param status
- */
- function makeInvoice(id, status) {
- parent.bootbox.dialog({
- title: '输入发票信息',
- className: 'modal-middle',
- message: '<h5>请输入发票号码</h5><br><p><input type="text" class="form-control " id="invoice_value" placeholder="发票号码" /> </p>',
- buttons: {
- cancel: {
- label: "取消",
- className: 'btn-default'
- },
- sure: {
- label: "确定",
- className: 'btn btn-primary',
- callback: function () {
- if (parent.$("#invoice_value").val().trim() === '') {
- z.showTip('error', '请输入发票号码:');
- return false;
- } else {
- ajaxAction(id, status, parent.$("#invoice_value").val(), 'make-invoice');
- }
- }
- }
- }
- })
- }
-
- /**
- * 邮寄操作
- * @param id
- * @param status
- */
- function post_invoice(id, status) {
- parent.bootbox.dialog({
- title: '输入邮寄信息:',
- className: 'modal-middle',
- 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>' +
- '<input type="text" class="form-control " id="post_num" placeholder="请输入快递单号" /> </p>',
- buttons: {
- cancel: {
- label: "取消",
- className: 'btn-default'
- },
- sure: {
- label: "确定",
- className: 'btn btn-primary',
- callback: function () {
- if (parent.$("#post_company").val().trim() === '') {
- z.showTip('error', '请输入快递公司');
- return false;
- } else if (parent.$("#post_num").val().trim() === '') {
- z.showTip('error', '请输入快递单号');
- return false;
- }
- else {
- var str = parent.$("#post_company").val() + '||' + parent.$("#post_num").val();
- ajaxAction(id, status, str, 'post-invoice');
- }
- }
- }
- }
- })
- }
-
- /**
- * 驳回操作
- * @param id
- * @param status
- */
- function refuse(id, status) {
- parent.bootbox.dialog({
- title: '驳回发票申请',
- className: 'modal-middle',
- message: '<h5>请输入驳回原因:</h5><br><p><input type="text" class="form-control " id="refuse_reason" placeholder="驳回原因" /> </p>',
- buttons: {
- cancel: {
- label: "取消",
- className: 'btn-default'
- },
- sure: {
- label: "确定",
- className: 'btn btn-primary',
- callback: function () {
- if (parent.$("#refuse_reason").val().trim() === '') {
- z.showTip('error', '请输入驳回原因');
- return false;
- } else {
- ajaxAction(id, status, parent.$("#refuse_reason").val(), 'refuse');
- }
- }
- }
- }
- })
- }
-
- /**
- * 发送AJAX请求
- * @param id
- * @param status
- * @param msg
- * @param action
- */
- function ajaxAction(id, status, msg, action) {
- parent.loading();
- $.ajax({
- type: 'POST',
- url: '/hotel/invoice/' + action + '?id=' + id + '&status=' + status + '&msg=' + msg,
- data: {
- _csrf: yii.getCsrfToken()
- },
- dataType: 'json',
- success: function (data) {
- if (data['code'] === 0) {
- z.showTip('success', '操作成功');
- $("#search-button").removeClass('zLoading').click();
- } else {
- if (typeof data['msg'] === 'string')
- z.showTip('error', data['msg']);
- else {
- var str = '';
- $.each(data['msg'], function (k, e) {
- str += e;
- });
- z.showTip('error', str);
- }
- if (data['code'] === 2) {
- $("#search-button").removeClass('zLoading').click();
- }
- }
- parent.closeLoading();
- },
- error: function (e) {
- parent.closeLoading();
- z.showTip('error', '出错了,联系后台管理员');
- }
- })
- }
|