本人新手,想要做到输入采购数量后运费自动更新,所以在采购数量的input中使用了oninput="searchFreight()",但是测试的时候发现没有反应,请问是什么原因呢?
<div class="pe-box">
<input type="text"
oninput="searchFreight()"
class="ui-input goodsCount"
placeholder="至少采购10吨以上"
data-bind="value:caigouTon"
id="goodsCount"
name="goodsCount"
style="width: 150px;" />
<span class="pe-n">吨</span>
</div>
</div>
//运费查询
function searchFreight(){
hsFramework.getJSON(urls.host+'actualStuffMall/query/queryTransportFee.do',{
goodsCount:this.caigouTon(),
deliveryPortId:deliveryPortId,
fromProvinceId:fromProvinceId,
fromCityId:fromCityId,
fromAreaId:fromAreaId,
fromStreetId:fromStreetId,
toProvinceId:vm.provinceId(),
toCityId:vm.cityId(),
toAreaId:vm.countyId(),
toStreetId:vm.streetId(),
toCommunityId:vm.communityId()
},function (data) {
var body = data.body;
var feePrice = body.feePrice;
var startPrice = body.startPrice;
var c;
if(feePrice==null){
// document.getElementById(".tips").style.visibility="hidden";//隐藏
c="收货地址不在配送范围之内,您仍可继续下单,后续将有交易员和您线下沟通其他配送方式。"
}else{
// document.getElementById(".tips").style.visibility="visible";//显示
c = '运费: '+feePrice+'元/吨(起步价:'+startPrice+'元)';
}
vm.feePrice(c);
});
}