...
|
...
|
@@ -589,7 +589,7 @@ |
|
|
</div>
|
|
|
<div class="numberBox">
|
|
|
<div class="input-group spinner">
|
|
|
<input id="numberInput" type="text" class="form-control" value="1" oninput = "value=value.replace(/[^\d]/g,'')" onkeyup="onkeyupNumberInput(event)"/>
|
|
|
<input id="numberInput" type="text" min="1" max="{$data.inventory}" class="form-control" value="1" oninput = "value=value.replace(/[^\d]/g,'')" onkeyup="onkeyupNumberInput(event)"/>
|
|
|
<div class="input-group-btn-vertical">
|
|
|
<button class="btn btn-default" type="button"><img src="__CDN__/assets/store/images/spinner_up.png" alt="img"></button>
|
|
|
<button class="btn btn-default" type="button"><img src="__CDN__/assets/store/images/spinner_down.png" alt="img"></button>
|
...
|
...
|
@@ -873,7 +873,7 @@ |
|
|
" <button class=\"btn addToCart\" onclick=\"addToCart("+goods_id+")\">\n" +
|
|
|
" 加入购物车\n" +
|
|
|
" </button>";
|
|
|
var html2 = "<button class=\"btn buy\" onclick=\"buy()\">\n" +
|
|
|
var html2 = "<button class=\"btn buy\" onclick=\"buyConsult()\">\n" +
|
|
|
" 购买咨询\n" +
|
|
|
" </button>";
|
|
|
var insurance1 = "<div class=\"nsuranceBox\">\n" +
|
...
|
...
|
@@ -886,6 +886,25 @@ |
|
|
evaluateVal({$probability1}, {$probability1}, {$probability2}, {$probability3});//调用此方法显示好评度
|
|
|
initLocation();
|
|
|
});
|
|
|
//购买咨询
|
|
|
function buyConsult(){
|
|
|
$.ajax({
|
|
|
url:"{:url('index/sundry/consult')}",
|
|
|
type:"POST",
|
|
|
data:{"goods_id":goods_id},
|
|
|
async:false,
|
|
|
success:function(res){
|
|
|
if(res.code == 1){
|
|
|
toast('提交成功~');
|
|
|
}else{
|
|
|
toast(res.msg);
|
|
|
}
|
|
|
},
|
|
|
error:function(res){
|
|
|
toast('与服务器断开连接');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//定位当前位置
|
|
|
function initLocation(){
|
...
|
...
|
@@ -964,11 +983,17 @@ |
|
|
//初始化数字框点击事件
|
|
|
function initPinnerClick() {
|
|
|
$('.spinner .btn:first-of-type').on('click', function() {
|
|
|
if($('#numberInput').val() >= $('#inventory').text()){
|
|
|
return false;
|
|
|
}
|
|
|
$('.spinner input').val( parseFloat($('.spinner input').val(), 10) + 1);
|
|
|
var totalPrice = parseFloat($('.spinner input').val()) * parseFloat($('#price').html().split('¥')[1]);
|
|
|
$('#totalPrice').html('¥'+totalPrice.toFixed(2));
|
|
|
});
|
|
|
$('.spinner .btn:last-of-type').on('click', function() {
|
|
|
if($('#numberInput').val() == 1){
|
|
|
return false;
|
|
|
}
|
|
|
if(parseInt($('.spinner input').val()) <= 0){
|
|
|
$('.spinner input').val(0);
|
|
|
}else{
|
...
|
...
|
@@ -989,7 +1014,7 @@ |
|
|
// Netscape/Firefox/Opera
|
|
|
keyCode = e.which
|
|
|
}
|
|
|
$('.spinner input').val(isNaN(parseFloat($('.spinner input').val()))?0:parseFloat($('.spinner input').val()));
|
|
|
$('.spinner input').val(isNaN(parseFloat($('.spinner input').val()))?1:parseFloat($('.spinner input').val()));
|
|
|
$('#totalPrice').html('¥0.00');
|
|
|
if (keyCode>=48&&keyCode<=57 || keyCode>=96&&keyCode<=105 || keyCode==8){
|
|
|
var totalPrice = parseFloat($('.spinner input').val()) * parseFloat($('#price').html().split('¥')[1]);
|
...
|
...
|
@@ -1013,10 +1038,11 @@ |
|
|
|
|
|
//加入购物车
|
|
|
function addToCart(goods_id) {
|
|
|
var number = $('#numberInput').val();
|
|
|
$.ajax({
|
|
|
url:"{:url('index/car/add')}",
|
|
|
type:"POST",
|
|
|
data:{"goods_id":goods_id,"type":1,'province_id':province_id},
|
|
|
data:{"goods_id":goods_id,"number":number,"type":1,'province_id':province_id},
|
|
|
success:function(res){
|
|
|
if(res.code == 1){
|
|
|
toast('操作成功');
|
...
|
...
|
|