demo_a.html 8.7 KB
HTTP/1.1 200
Server: nginx/1.14.2
Date: Wed, 11 Aug 2021 10:06:38 GMT
Content-Type: text/html;charset=UTF-8
Connection: keep-alive
Access-Control-Expose-Headers: UAP_accessToken
Cache-Control: no-store
Content-Language: zh-CN
Content-Length: 8660

<style>
    .table-chrgeitem td,
    .table-chrgeitem th {
        padding: .5rem .45rem;
        height: auto;
    }
</style>
<input type="hidden" id="marketFlag" name="marketFlag" value="sy">
<input type="hidden" id="goodsAllocationText" value="无">
<input type="hidden" id="requireItemZeroMsg" value="">
<input type="hidden" id="checkItemAllZero" value="0">
<input type="hidden" id="itemFee" value="交易管理费:¥5.00  检测费:¥3.00  ">
<input type="hidden" id="receivedInWords" value="零元整">
<input type="hidden" id="e" value="">
<input type="hidden" id="ctotal" value="8.00">
<input type="hidden" id="creceivable" value="13.00">
<input type="hidden" id="cdiscount" value="5.00">

<input type="hidden" id="ctotalLong" name="totalMoney" value="800">
<input type="hidden" id="creceivableLong" name="receivable" value="1300">
<input type="hidden" id="ccollectionLong" name="collectionPrice" value="0">
<input type="hidden" id="discountAmountLong" name="discountAmount" value="500">
<input type="hidden" id="handReceivableAmountLong" name="handReceivableAmount" value="0">
<input type="hidden" id="itemReceivableAmountLong" name="itemReceivableAmount" value="1300">
<input type="hidden" id="correctDiscount" name="correctDiscount" value="1">

<table class="table table-hover table-bordered mt-2 table-chrgeitem">
    <tr class="row px-3">
        <th class="col-3">收费项目应收<span id="gz-tag" style="display: none;color: red;">【已更正】</span></th>
        <th class="col-3">收费项目优惠1</th>
        <th class="col-3">收费项目优惠2</th>
        <th class="col-3">收费项目实收</th>
    </tr>
    <input type="hidden" name="billItems" value=''>
    <input type="hidden" name="billItemsDic" value=''>



    <tr class="row px-3">
        <td class="col-3">
            <div class="itemwrap row">
                <div class="col-auto item chargeitem">
                    <div class="form-group">
                        <div class="d-flex align-items-center">
                            <input type="checkbox" name="billItemCheckIds" value="103" data-name="交易管理费"
                                data-req="1" checked readonly onclick="return false">
                            <div class="input-group-prepend">
                                交易管理费:
                            </div>
                            <input type="text" title="" class="form-control fees bold"
                                name="103" maxlength="15" data-old="10.00"
                                data-old-receivable="1000" value="10.00" readonly>
                            <input type="hidden" name="billItems" value='{"discount":500,"id":103,"name":"交易管理费","receivable":1000,"require":1}'>
                        </div>
                    </div>
                </div>
            </div>
        </td>
        <td class="col-3">
            <div class="itemwrap row">


                <div class="col-auto item offeritem red" data-req="1">
                    <div class="form-group">
                        <div class="d-flex align-items-center">

                            <input type="checkbox" name="billItemDicCheckIds" value="105" data-req="1"
                                checked onclick="return false">
                            <div class="input-group-prepend">
                                优惠收费:
                            </div>
                            <input type="text"  class="form-control fees bold"
                                value="-5.00" readonly>
                            <input type="hidden" name="billItemsDic" value='{"discount":0,"id":105,"name":"优惠收费","receivable":500,"require":1}'>
                        </div>
                    </div>
                </div>

            </div>
        </td>
        <td class="col-3">
            <div class="itemwrap row">
                <div class="col-auto item offeritem" >
                <div class="form-group">
                    <div class="d-flex align-items-center">
                        返点的钱 :
                        <input type="text"  class="form-control fees bold"
                            value="0.00" readonly>
                    </div>
                </div>
                </div>
            </div>
        </td>
        <td class="col-3">
                <span class="bold singleRealfee">5.00</span>

        </td>
    </tr>


    <tr class="row px-3">
        <td class="col-3">
            <div class="itemwrap row">
                <div class="col-auto item chargeitem">
                    <div class="form-group">
                        <div class="d-flex align-items-center">
                            <input type="checkbox" name="billItemCheckIds" value="106" data-name="检测费"
                                data-req="1" checked readonly onclick="return false">
                            <div class="input-group-prepend">
                                检测费:
                            </div>
                            <input type="text" title="" class="form-control fees bold"
                                name="106" maxlength="15" data-old="3.00"
                                data-old-receivable="300" value="3.00" readonly>
                            <input type="hidden" name="billItems" value='{"discount":0,"id":106,"name":"检测费","receivable":300,"require":1}'>
                        </div>
                    </div>
                </div>
            </div>
        </td>
        <td class="col-3">
            <div class="itemwrap row">

            </div>
        </td>
        <td class="col-3">
            <div class="itemwrap row">
                <div class="col-auto item offeritem" >
                </div>
            </div>
        </td>
        <td class="col-3">
                <span class="bold singleRealfee">3.00</span>

        </td>
    </tr>




</table>









<script>
    $(function () {
        /*    可选项的收费项目才能选择优惠项目  */
        $('#feeitemedit .chargeitem [data-req="-1"]').each(function () {
            //        offeritem所有优惠项目,offeritemReq必填优惠项目
            var offeritem = $(this).closest('tr').find('.offeritem :checkbox');
            var offeritemReq = $(this).closest('tr').find('.offeritem [data-req="1"]');
            if ($(this).is(':checked')) {
                offeritem.not(offeritemReq).attr('disabled', false);
                offeritemReq.prop('checked', true);
            } else {
                offeritem.not(offeritemReq).attr('disabled', true);
                offeritem.prop('checked', false);
            }
        })
        var uItem = $("#updateFeeItems").val();
        if (uItem == 2) {
            $("#gz-tag").show();
        }
    })

    $('#feeitemedit :checkbox').change(function () {
        calculate();
    })
    //    收费项目金额千位分隔符四舍五入显示2位小数.00
    $('#feeitemedit .chargeitem .fees').on('blur', function () {
        var old = $(this).attr("data-old");
        var now = $(this).val();
        //console.log("old:"+old+",new:"+now);
        if (old == now) {
            //没有变动
            //console.log("没有变动old:"+old+",new:"+now);
            return;
        }

        var fees = parseFloat($(this).val().replace(/[^\d\.]/g, ''));
        var feesThousand;
        if (fees === '' || isNaN(fees) || fees < 0) {
            fees = 0
            $(this).val('0.00')
        } else {
            fees = Math.round(fees).toFixed(2);
            feesThousand = fees.replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g, "$1,");
            $(this).val(feesThousand)
        }
        var price = new Number(fees);
        var temp1 = new Number(100);
        var receivable = price.mul(temp1);
        var old = $(this).attr("data-old-receivable");
        if (old == receivable) {
            //没有变动
            //console.log("没有变动old:"+old+",new:"+receivable);
            return;
        }

        var info = $(this).siblings()[0];
        var req = $(info).attr("data-req");
        var dateid = $(info).val();
        var itemName = $(info).attr("data-name");
        var feeItemParamHtml = new Object();
        feeItemParamHtml.id = dateid;
        feeItemParamHtml.name = itemName;
        feeItemParamHtml.require = req;
        feeItemParamHtml.receivable = receivable;
        var result = JSON.stringify(feeItemParamHtml);
        $(this).next().val(result);
        if ($("#correctInfo").val() == 2) {
            $("#updateFeeItems").val(2);
        }
        calculate();
    })


</script>