搜索
系统检测到您的用户名不符合规范:

请问如何让商品价格+运费?已知运费和商品价格

浏览:796 发布日期:2015年11月10日 分类:求助交流
通过JS获取产品价格,现在我在表里加了个运费字段,模板上已经可以获得运费字段,我现在想在结算的时候+上运费,请问应该如何改这个JS标签。。
模板代码 <script>
window.onload=function(){
showDetail('{$shops.id}');
doProduct('{$shops.id}','{$shops.name}','{$shops.old_price}','{$shops.y_price}');
$('#cart').click();
}
</script>

</div>
</dl>
</section>
</section>
</div>
<div id="cart-container" style="display: block;">
<div class="orderlist">
<ul id="cartinfo">
<li class="ccbg2" id="emptyLii">{$shops.name}</li>
</ul>
<if condition="$buy_cnt neq 0">
<ul id="cartinfo">
<li class="ccbg2" id="emptyLii">已选:<span id="totalNum">0</span> 份,共计:<span id="totalPrice">0</span> 元</li>
<li style="display:none"><span id="totalLirun">0</span></li>
</ul>
</if>
这个下面是引用JS的function doProduct (id , name , price,lirun) {
var bgcolor = $('#'+id).children().css('background-color').colorHex().toUpperCase();
if (bgcolor == '#FFFFFF') {
$('#'+id).children().css('background-color','#D00A0A');

var cartMenuN = parseFloat($('#cartN2').html())+1;
$('#totalNum').html( cartMenuN );
$('#cartN2').html( cartMenuN );

var totalPrice = parseFloat($('#totalPrice').html())+ parseFloat(price);
$('#totalPrice').html( totalPrice.toFixed(2) );
var totalLirun = parseFloat($('#totalLirun').html())+ parseFloat(lirun);
$('#totalLirun').html( totalLirun.toFixed(2) );

var weshopId = 'weshop_'+id;
var html = '<li class="ccbg2" id="'+weshopId+'"><div class="orderdish"><span name="title" style="display:none;">'+name+'</span>选择份数:<span class="price" id="v_0" style="display:none;">'+price+'</span><span style="display:none; class="price">元</span></div><div class="orderchange"><a href=javascript:addProductN("'+weshopId+'_'+price+'") class="increase"><b class="ico_increase">加一份</b></a><span class="count" id="num_1_499">1</span><a href=javascript:reduceProductN("'+weshopId+'_'+price+'") class="reduce"><b class="ico_reduce">减一份</b></a></div></li>';

$('#ullist').append(html);
}else{
$('#'+id).children().css('background-color','');

var cartMenuN = parseFloat($('#cartN2').html())-1;
$('#totalNum').html( cartMenuN );
$('#cartN2').html( cartMenuN );

var totalPrice = parseFloat($('#totalPrice').html())- parseFloat(price);
$('#totalPrice').html( totalPrice.toFixed(2) );
var totalLirun = parseFloat($('#totalLirun').html())- parseFloat(lirun);
$('#totalLirun').html( totalLirun.toFixed(2) );

var weshopId = 'weshop_'+id;
$('#'+weshopId).remove();
}
}
最佳答案
评论() 相关
后面还有条评论,
评论支持使用[code][/code]标签添加代码
您需要登录后才可以评论 登录 | 立即注册
收藏
sofeet
积分:326 等级:LV2
热点推荐
(追記) (追記ここまで)
最新更新

我们

合作

网站

信息

ThinkPHP 是一个免费开源的,快速、简单的面向对象的 轻量级PHP开发框架 ,创立于2006年初,遵循Apache2开源协议发布,是为了敏捷WEB应用开发和简化企业应用开发而诞生的。ThinkPHP从诞生以来一直秉承简洁实用的设计原则,在保持出色的性能和至简的代码的同时,也注重易用性。并且拥有众多的原创功能和特性,在社区团队的积极参与下,在易用性、扩展性和性能方面不断优化和改进,已经成长为国内最领先和最具影响力的WEB应用开发框架,众多的典型案例确保可以稳定用于商业以及门户级的开发。

AltStyle によって変換されたページ (->オリジナル) /