cart.htm 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. ##tlayout("wap/layout.htm",{head_title:"购物车"}){
  2. <section class="body">
  3. <div class="cart">
  4. ##if(cart_list!=null && cart_list.~size!=0){
  5. <form method="post" action="javascript:void(0)" id="submit_form" style="margin-bottom: 50px;">
  6. ##for(_item in cart_list){
  7. <div class="goods_items">
  8. <div class="goods_items_base">
  9. <div class="goods_items_img" style="background-image:url(${_item.diy_img_url!})"></div>
  10. <div class="goods_items_content">
  11. <h3>${_item.diy_title!}</h3>
  12. <div class="goods_peice_wrap" style="margin: 0px;height: 20px;overflow: hidden;line-height: 20px;">${_item.diy_remark!}</div>
  13. <div class="goods_peice_wrap select_form_wrap">
  14. ${_item.bottle_title!}
  15. <select onchange="changeType(${_item.cart_id!}, this)" class="select_form">
  16. ##for(_type in _item.type_list!){
  17. ##if(_type.id==_item.bottle_type_id){
  18. <option value="${_type.id!}" selected="selected">${_type.title!}|${_type.price!}元</option>
  19. ##}else{
  20. <option value="${_type.id!}">${_type.title!}|${_type.price!}元</option>
  21. ##}
  22. ##}
  23. </select>
  24. </div>
  25. <div class="goods_peice_wrap" style="margin: 0px;">
  26. <span class="price">¥${_item.bottle_price!}</span>
  27. <span class="goods_number">
  28. <div class="jian">
  29. <img src="/wap/image/jian_icon.png" onclick="changeStep(${_item.cart_id!}, 0)" />
  30. </div>
  31. <div class="middle_num">
  32. <input type="text" name="number_${_item.cart_id!}" value="${_item.cart_number!}" onchange="changeNumber(${_item.cart_id!})" />
  33. </div>
  34. <div class="jia">
  35. <img src="/wap/image/jia_icon.png" onclick="changeStep(${_item.cart_id!}, 1)" />
  36. </div>
  37. </span>
  38. </div>
  39. </div>
  40. <div class="del_cart_wrap">
  41. <img src="/wap/image/del_icon.png" onclick="deleteCart(${_item.cart_id!})" />
  42. </div>
  43. </div>
  44. </div>
  45. ##}
  46. <div class="goods_items">
  47. <div class="goods_items_base" style="font-weight: bold;color:red;">
  48. 注意:数量单位为箱,1箱=24瓶
  49. </div>
  50. </div>
  51. </form>
  52. ##}else{
  53. <div class="kong">
  54. <img src="/wap/image/cart_kong_icon.png" class="kong_img" />
  55. <p>购物车为空</p>
  56. <div class="kong_btn_area">
  57. <a href="/wap" class="btn">继续购物</a>
  58. </div>
  59. </div>
  60. ##}
  61. </div>
  62. </section>
  63. ##if(cart_list!=null && cart_list.~size!=0){
  64. <div class="cart_bottom">
  65. <div class="cart_bottom_content">
  66. <span class="total_price">小计:<span class="color_red">¥${subtotal!0}</span></span>
  67. <a href="/wap/shop/ordersMsg" class="go_link">立即购买</a>
  68. </div>
  69. </div>
  70. ##}
  71. <#_wapFooter />
  72. <script>
  73. function deleteCart(id){
  74. $.post("/wap/shop/deleteCart",{id:id},function(data){
  75. if(data.success){
  76. location.reload();
  77. }else{
  78. alert(data.msg);
  79. }
  80. });
  81. }
  82. function changeStep(id, status){
  83. if(status==1){
  84. $("input[name='number_" + id + "']").val($("input[name='number_" + id + "']").val() * 1 + 1);
  85. }else{
  86. if($("input[name='number_" + id + "']").val() * 1 > 1){
  87. $("input[name='number_" + id + "']").val($("input[name='number_" + id + "']").val() * 1 - 1);
  88. }
  89. }
  90. changeNumber(id);
  91. }
  92. function changeNumber(id){
  93. $.post("/wap/shop/changeNumber",{id:id, number:$("input[name='number_" + id + "']").val()},function(data){
  94. if(data.success){
  95. location.reload();
  96. }else{
  97. alert(data.msg);
  98. }
  99. });
  100. }
  101. function changeType(id, object){
  102. $.post("/wap/shop/changeType",{id:id, btid:$(object).val()},function(data){
  103. if(data.success){
  104. location.reload();
  105. }else{
  106. alert(data.msg);
  107. }
  108. });
  109. }
  110. </script>
  111. ##}