$(document).on('ready ajaxComplete',函数()

时间:2018-12-17 05:56:32

标签: javascript

canvas {
  position: fixed;
  top:50%;
  left:-20px;
  height:100px;
  width:100px;
}


ul {
    position: absolute;
    z-index: 2;
}
$(document).on('ready ajaxComplete', function () {
    $("input.quantity_product_order").keyup(function () {
		cms_load_infor_order();
	});
});

function addOptionValue() {
	html  ='<tr><td>SP00030</td><td><input style="max-height: 22px;" type="text" class="txtNumber form-control quantity_product_order text-center" value="1" /> </td> <td class="text-center price-order">60,000</td>          <td style="display: none;" class="text-center price-order-hide">60000</td>       <td class="text-center total-money">60,000</td>      <td class="text-center"><i class="fa fa-trash-o del-pro-order"></i></td>   </tr>';
		$('#pro_search_append').append(html);

		cms_load_infor_order();
}



function cms_load_infor_order() {
    $total_money = 0;
    $('tbody#pro_search_append tr').each(function () {
        $quantity_product = $(this).find('input.quantity_product_order').val();
        $price = $(this).find('td.price-order-hide').text();
        $total = $price * $quantity_product;
        $total_money += $total;
        $(this).find('td.total-money').text(cms_encode_currency_format($total));
    });
    $('div.total-money').text(cms_encode_currency_format($total_money));

    if ($('input.discount-order').val() == '')
        $discount = 0;
    else
        $discount = cms_decode_currency_format($('input.discount-order').val());

    if ($discount > $total_money) {
        $('input.discount-order').val($total_money);
        $discount = $total_money;
    }

    $total_after_discount = $total_money - $discount;
    $('.total-after-discount').text(cms_encode_currency_format($total_after_discount));
    $('input.customer-pay').val(cms_encode_currency_format($total_after_discount));
    $('div.debt').text(0);
}
function cms_encode_currency_format(obs) {
    return obs.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}

function cms_decode_currency_format(obs) {
    return parseInt(obs.replace(/,/g, ''));
}	

我需要带JavaScript的购物车。

在输入数量_产品_订单中输入数字时,td.total-money将会更改。

但是我的代码不起作用。

请帮助我

越南人

Bácnàongườiviệtnamởtrênđâykhôngạ。 Emcócáijavascriptđangbịlỗimongcácbágiúpemvới。

0 个答案:

没有答案