huwhois 4 years ago
parent
commit
da04bc19e1

+ 28 - 1
application/index/controller/Commission.php

36
        }
36
        }
37
        $this->assign('c_type', $c_type);
37
        $this->assign('c_type', $c_type);
38
38
39
    
40
        $company = new Company();
39
        $company = new Company();
41
        $data_company = $company->listByName();
40
        $data_company = $company->listByName();
42
        // var_dump($data_company);
41
        // var_dump($data_company);
70
        $initbalance = $data2['initial_balance'];
69
        $initbalance = $data2['initial_balance'];
71
        echo json_encode(['code'=>0, 'data'=>$perbalance + $initbalance]);
70
        echo json_encode(['code'=>0, 'data'=>$perbalance + $initbalance]);
72
    }
71
    }
72
73
    public function save()
74
    {
75
        $id = $this->params['id'];
76
        if ($id!=0) {
77
            $res = $this->model->updateById($this->params);
78
        } else {
79
            unset($this->params['id']);
80
            $res = $this->model->save($this->params);
81
        }
82
        if ($res===false) {
83
            echo json_encode(['code' => 1, "msg"=>$this->model->lastErrorMsg()]);
84
        } else {
85
            echo json_encode(['code' => 0, "msg"=>"操作成功"]);
86
        }
87
    }
88
89
    public function delete()
90
    {
91
        $params = escapeString($_POST);
92
        $id = $params['id'];
93
        $res = $this->model->deleteById($id);
94
        if ($res===false) {
95
            echo json_encode(['code' => 1, "msg"=>$this->model->lastErrorMsg()]);
96
        } else {
97
            echo json_encode(['code' => 0, "msg"=>"操作成功"]);
98
        }
99
    }
73
}
100
}

+ 37 - 82
application/index/view/commission/input.php

373
// 更新dataFrom
373
// 更新dataFrom
374
function updateDataFrom() {
374
function updateDataFrom() {
375
    dataForm.shipping = Number($("#shipping").val());
375
    dataForm.shipping = Number($("#shipping").val());
376
    dataForm.agency = Number($("#agency").val());
376
    // 更新实收金额 
377
    // 更新实收金额 
377
    var receive_money = Number($("#receive_money").val());
378
    var receive_money = Number($("#receive_money").val());
378
    dataForm.receive_money = receive_money;
379
    dataForm.receive_money = receive_money;
391
    updateTepi();
392
    updateTepi();
392
})
393
})
393
394
395
function tcType(bj) {
396
    dataForm.type = bj;
397
    if (bj != 0) {
398
        $('#yiban').removeClass('active');
399
        $('#tepi').addClass('active');
400
    } else {
401
        $('#tepi').removeClass('active');
402
        $('#yiban').addClass('active');
403
    }
404
}
405
394
// 合同基准价
406
// 合同基准价
395
function updateBaseValue() {
407
function updateBaseValue() {
396
    var amount = $("#amount").val();
408
    var amount = $("#amount").val();
441
    }
453
    }
442
}
454
}
443
455
444
function tcType(bj) {
445
    dataForm.type = bj;
446
    if (bj != 0) {
447
        $('#yiban').removeClass('active');
448
        $('#tepi').addClass('active');
456
function doSave() {
457
    dataForm.id = $('#id').val();
458
    dataForm.month = $('#month').val();
459
    type = $('input[name="type"]:checked').val();
460
    if (type != 0) {
461
        dataForm.base_price = Number($('#base_price2').val());
449
    } else {
462
    } else {
450
        $('#tepi').removeClass('active');
451
        $('#yiban').addClass('active');
463
        dataForm.base_price = Number($('#base_price').val());
452
    }
464
    }
465
    $.ajax({
466
        url: "/index/seller/save",
467
        type: "POST",
468
        data: dataFrom,
469
        dataType: 'json',
470
        success: function(res) {
471
            if (res.code == 0) {
472
                dataForm.id = 0;
473
                $('#id').val(0)
474
                $('#myModal').modal('hide');
475
                $("#market-form")[0].reset();
476
                window.location.reload();
477
            } else {
478
                alert(res.msg);
479
            }
480
            return false;
481
        }
482
    });
453
}
483
}
454
484
455
456
function updatecahce() {
485
function updatecahce() {
457
    window.location.href = "/index/index/index";
486
    window.location.href = "/index/index/index";
458
}
487
}
462
    $("#market-form")[0].reset();
491
    $("#market-form")[0].reset();
463
    $('#company').selectpicker('deselectAll');
492
    $('#company').selectpicker('deselectAll');
464
}
493
}
465
466
467
    $("#tj").click(function() {
468
        // dataForm.id = $("#id").val();
469
        // dataForm.month = $("#month").val();
470
        // dataForm.company = $("#company").val();
471
        // dataForm.contract_no = $("#contract_no").val();
472
        // dataForm.goods_category = $("#goods_category").val();
473
        // dataForm.goods_type = $("#goods_type").val();
474
        // dataForm.amount = $("#amount").val();
475
        // dataForm.price = $("#price").val();
476
        // dataForm.contract_value = $("#contract_value").val();
477
        // dataForm.receive_money = $("#receive_money").val();
478
        // dataForm.period_balance = $("#period_balance").val();
479
        // dataForm.actual_money = $("#actual_money").val();
480
        // dataForm.agency = $("#agency").val();
481
        // dataForm.base_price = $("#base_price").val();
482
        // dataForm.base_value = $("#base_value").val();
483
        // dataForm.shipping = $("#shipping").val();
484
        // dataForm.project = $("#project").val();
485
        // dataForm.current_balance = $("#current_balance").val();
486
        // dataForm.total_profit = $("#total_profit").val();
487
        // dataForm.seller = $("#seller").val();
488
        // dataForm.remark = $("#remark").val();
489
490
        // var data = $("#market-form").serializeArray();
491
492
        type = $('input[name="type"]:checked').val();
493
        if (type != 0) {
494
            base_price = Number($('#base_price2').val());
495
        } else {
496
            base_price = Number($('#base_price').val());
497
        }
498
        // console.log(type)
499
        // console.log(base_price)
500
        var data = {
501
            'id': $('#id').val(),
502
            'month': $('#month').val(),
503
            'company': $('#company').val(),
504
            'contract_no': $('#contract_no').val(),
505
            'goods_category': $('#goods_category').val(),
506
            'goods_type': $('#goods_type').val(),
507
            'amount': $('#amount').val(),
508
            'price': $('#price').val(),
509
            'contract_value': $('#amount').val() * $('#price').val(),
510
            'receive_money': $('#receive_money').val(),
511
            'period_balance': $('#period_balance').val(),
512
            'agency': $('#agency').val(),
513
            'base_price': base_price,
514
            'shipping': Number($('#shipping').val()),
515
            'project': Number($('#project').val()),
516
            'type': type,
517
            'seller': $('#seller').val()
518
        }
519
520
        $.ajax({
521
            url: "/domarket.php?action=save",
522
            type: "POST",
523
            data: data,
524
            dataType: 'json',
525
            success: function(res) {
526
                if (res.code == 0) {
527
                    dataForm.id = 0;
528
                    $('#id').val(0)
529
                    $('#myModal').modal('hide');
530
                    $("#market-form")[0].reset();
531
                    window.location.reload();
532
                } else {
533
                    alert(res.msg);
534
                }
535
                return false;
536
            }
537
        });
538
    });
539
</script>
494
</script>