|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="{dede:global name='cfg_soft_lang'/}">
- <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
- <title>订单号{dede:var.carts.orders_id/}-购物车-<?php echo $cfg_webname; ?></title>
- <link rel="stylesheet" href="{dede:global.cfg_cmsurl/}/static/web/css/bootstrap.min.css">
- <link rel="stylesheet" href="{dede:global.cfg_cmsurl/}/static/web/font/css/font-awesome.min.css">
- <link rel="stylesheet" href="{dede:global.cfg_cmsurl/}/static/web/css/style.css">
- <script src="{dede:global.cfg_cmsurl/}/static/web/js/jquery.min.js"></script>
- </head>
- <body>
- <?php pasterTempletDiy('header.htm');?>
- <div class="container">
- <div class="sp-title">
- <h2>购物车</h2>
- </div>
- <div id="errorChickCookie" class="clear center mt1" style="font-style:inherit;color:#545b62;font-weight:normal;padding:10px 0;text-align:center">
- </div>
- <div class="buycar">
- <h3>我的购物车 - <em id="carId">{dede:var.carts.orders_id/}</em>订单号</h3>
- <form id="form1" name="form1" method="post" action="posttocar.php">
- <input id="dopost" name="do" type="hidden" value="del">
- <table width="100%" cellpadding="0" cellspacing="0" class="table trlist">
- <thead>
- <tr>
- <td colspan="6">商品列表</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <th>选择</th>
- <th>编号</th>
- <th>名称</th>
- <th>数量</th>
- <th>单价(元)</th>
- <th>操作</th>
- </tr>
- {dede:array.Items}
- <tr>
- <td><input type="checkbox" name="ids[]" value="{dede:value.id/}"></td>
- <td>{dede:value.id/}</td>
- <td><a href="view.php?aid={dede:value.id/}" target="_bank">{dede:value.title/}</a></td>
- <td>
- <input name="buynum{dede:value.id/}" type="text" id="buynum{dede:value.id/}" value="{dede:value.buynum/}" size="5" maxlength="5">
- <small>{dede:value.units/}</small>
- </td>
- <td>{dede:value.price/}</td>
- <td><a href="posttocar.php?do=del&ids={dede:value.id/}">删除</a></td>
- </tr>
- {/dede:array}
- </tbody>
- <tfoot>
- <tr>
- <td colspan="6" align="right">
- <div style="float:left">共 <span class="text-danger">{dede:var.carts.cart_count/}</span> 件商品,合计: <span class='text-danger'>{dede:var.carts.price_count/}</span> 元</div>
- <div style="float:right">
- <!--<input type="button" value="打印购物车" class="btn-2" onclick="printPage(1)"/>-->
- <input type="button" value="更新订单号" class="btn btn-success btn-sm" onClick="makeCarId()">
- <input type="button" value="删除已选定" class="btn btn-success btn-sm" onClick="DelPost()">
- <input type="button" value="清空" onClick="if(confirm('确定清空购物车中的商品吗')){ location='posttocar.php?do=clear' }" class="btn btn-success btn-sm">
- <input onclick="ChangePost()" type="button" value="更新数量" class="btn btn-success btn-sm">
- <input type="button" value="下一步" onclick="location='carbuyaction.php'" class="btn btn-success btn-sm">
- </div>
- </td>
- </tr>
- </tfoot>
- </table>
- </form>
- </div>
- </div>
- <?php pasterTempletDiy('footer.htm');?>
- <!--购物车列表操作javascript请不要随意改动-->
- <script>
- //遍历checkbox使之全选中,或反选
- function CheckAll() {
- for (var i = 0; i < document.form1.elements.length; i++) {
- var e = document.form1.elements[i];
- e.checked == true ? e.checked = false : e.checked = true;
- }
- }
- //改变表单dopost值为:update,后submit提交表单
- function ChangePost() {
- CheckAll();
- document.getElementById("dopost").value = 'update';
- document.form1.submit();
- }
- //改变表单dopost值为:del,后submit提交表单
- function DelPost() {
- document.getElementById("dopost").value = 'del';
- document.form1.submit();
- }
- //AJAX产生一个新的订单编号
- function makeCarId() {
- $.ajax({
- type: "POST",
- url: "car.php",
- data: "dopost=makeid",
- dataType: 'text',
- success: function(result) {
- $("#carId").html(result);
- }
- });
- }
- //Print Page
- function printPage(oper) {
- if (oper < 10) {
- bdhtml = window.document.body.innerHTML; //获取当前页的html代码
- sprnstr = "<!--startprint" + oper + "-->"; //设置打印开始区域
- eprnstr = "<!--endprint" + oper + "-->"; //设置打印结束区域
- prnhtml = bdhtml.substring(bdhtml.indexOf(sprnstr) + 18); //从开始代码向后取html
- prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr)); //从结束代码向前取html
- window.document.body.innerHTML = prnhtml;
- window.print();
- window.document.body.innerHTML = bdhtml;
- } else {
- window.print();
- }
- }
- </script>
- <script>
- if (!navigator.cookieEnabled) {
- $('#errorChickCookie').html('您浏览器的 cookie 功能被禁用,请启用此功能');
- $('.buycar').hide();
- }
- </script>
- </body>
- </html>
|