public function index() { if (!is_login()) { $this->error("您还没有登陆", U("User/login")); } if (IS_POST) { $id = I('post.id', 0, 'intval'); //获取id if (!is_numeric($id)) { $this->error('ID错误!'); } $info = M("shoplist")->find($id); $postnum = I('post.num'); if (!is_numeric($postnum)) { $this->error('数量错误!'); } if ($postnum < 1) { $this->error('无效数量!'); } $num = $info['num']; //获取num $price = $info['price']; //获取价格 $goodid = $info['goodid']; //获取goodid $parameters = $info['parameters']; $Exchange = D("Exchange"); $Exchange->create(); $Exchange->create_time = NOW_TIME; $Exchange->total = $num * $price; $Exchange->goodid = $goodid; $Exchange->status = 1; $Exchange->parameters = $parameters; $Exchange->add(); addUserLog('申请换货,商品名称' . get_good_name($goodid) . '参数' . $parameters, is_login()); $data['status'] = -4; //更改商品的售后信息 $shop = M("shoplist"); if ($shop->where("id='{$id}'")->save($data)) { $this->success('申请成功', U("center/index")); } else { $this->error('申请失败,或重复操作'); } } else { $id = I('get.id', 0, 'intval'); //获取id $msg = "Tips,提交换货单"; $this->meta_title = '填写换货单'; $detail = M("shoplist")->find($id); $this->assign('list', $detail); $this->assign('msg', $msg); $this->display(); } }
public function index() { if (!is_login()) { $this->error("您还没有登陆", U("User/login")); } $listid = I('get.id', 0, 'intval'); $shoplist = M('shoplist'); $list = $shoplist->find($listid); //没有评论过 if ($list["iscomment"] == 1) { $this->assign('comment', $list); $title = get_good_name($list["goodid"]); $this->meta_title = '评价商品_' . $title; $this->display(); } else { $this->error('商品评价过'); } }
public function index($cellphone = '') { $reserve = M('reserve'); $cellphone = I('post.phone'); $goodid = I('post.goodid'); $map['cellphone'] = $cellphone; $map['goodid'] = $goodid; $info = $reserve->where($map)->find(); if (empty($info)) { $data['cellphone'] = $cellphone; $data['create_time'] = NOW_TIME; $data['status'] = 1; $data['goodid'] = $goodid; $data['title'] = get_good_name($goodid); $reserve->add($data); $data['info'] = '预约成功!'; } else { $data['status'] = -1; $data['info'] = '您已经预约过了!'; } $this->ajaxreturn($data); }
public function index() { if (is_login()) { $listid = I('get.id'); $shoplist = M('shoplist'); $list = $shoplist->find($listid); //没有评论过 if ($list["iscomment"] == 1) { /* 热词调用*/ $hotsearch = R("Index/getHotsearch"); $this->assign('hotsearch', $hotsearch); /* 购物车调用*/ $cart = R("Shopcart/usercart"); $this->assign('usercart', $cart); if (!session('user_auth')) { $usercart = $_SESSION['cart']; $this->assign('usercart', $usercart); } /* 底部分类调用*/ $menulist = R('Service/AllMenu'); $this->assign('footermenu', $menulist); /* 左侧分类列表*/ $mlist = R('Index/menulist'); $this->assign('categoryq', $mlist); /** * 控制器必须!**/ $this->assign('comment', $list); $title = get_good_name($list["goodid"]); $this->meta_title = '评价商品_' . $title; $this->display(); } else { $this->error('商品评价过'); } } else { $this->redirect('User/login'); } }
public function addgood($id) { $tag = htmlspecialchars($_POST['tag']); $num = 1; $id = htmlspecialchars($_POST['id']); $price = get_good_price($id); if (!isset($_SESSION['cart'])) { $_SESSION['cart'] = array(); } $item = array(); //如果该商品已存在则直接加其数量 if (isset($_SESSION['cart'][$id])) { $_SESSION['cart'][$id]['num'] += $num; $item['id'] = $id; $item['price'] = $price; $item['num'] = $_SESSION['cart'][$id]['num']; $_SESSION['cart'][$id] = $item; $exsit = "1"; } else { $item['id'] = $id; $item['price'] = $price; $item['num'] = $num; $_SESSION['cart'][$id] = $item; $exsit = "0"; } $data['status'] = 1; $data['price'] = get_good_price($id); $coverid = get_cover_id($id); $data['src'] = get_good_img($coverid); $data['title'] = get_good_name($id); //登录用户,处理详情页ajaxt提交的数据保存到数据库 if (is_login()) { $table = D("shopcart"); $data['goodid'] = $id; $data['num'] = $num; $member = D("member"); $uid = $member->uid(); $data['uid'] = $uid; $pnum = M("shopcart")->where("goodid='{$id}'and uid='{$uid}'")->getField("num"); if ($pnum) { $exsit = "1"; $data['num'] = $pnum + $num; $table->where("goodid='{$id}'and uid='{$uid}'")->save($data); } else { $data['num'] = $num; $table->add($data); $exsit = "0"; } $data['sql'] = 'sql'; $data['num'] = M("shopcart")->where("goodid='{$id}'and uid='{$uid}'")->getField("num"); $data['msg'] = '添加成功'; $data['exsit'] = $exsit; $this->ajaxReturn($data); } else { $data['exsit'] = $exsit; $data['num'] = $item['num']; $data['msg'] = '添加成功'; $this->ajaxReturn($data); } }
$mod = $i % 2; ++$i; ?> <tr> <td align="center"><?php echo $vo["goodid"]; ?> </td> <td><A href="<?php echo U('Home/Article/detail?id=' . $vo['goodid']); ?> " > <img src="<?php echo get_cover(get_cover_id($vo["goodid"]), 'path'); ?> " width="40" height="40"/><?php echo get_good_name($vo["goodid"]); ?> </A></td> <td align="center"> <span class="weight"><?php echo get_weight($vo["goodid"]); ?> </span>g</td> <td align="center"><?php echo get_good_price($vo["goodid"]); ?> </td> <td align="center"><?php echo $vo["num"]; ?> </td>
?> _self<?php } ?> "><?php echo $nav["title"]; ?> </a> </li><?php } } } } else { echo ""; } ?> </ul> </div> <!-- /菜单 --> <!-- 主体 --> <div class="commom_wrapper"> <!-- Contents --> <div class="ml_content"> <div class="goodlist-main">
++$i; ?> <tr> <td><input class="ids row-selected" type="checkbox" name="id[]" value="<?php echo $order["id"]; ?> "></td> <td><?php echo $order["id"]; ?> </td> <td><a title="编辑" href="<?php echo U('edit?id=' . $order['id'] . '&pid=' . $pid); ?> "><?php echo get_good_name($order["goodid"]); ?> </a></td> <td><?php echo $order["total"]; ?> </td> <td><?php echo $order["status"]; ?> </td> <td><?php echo date('Y-m-d H:i:s', $order["create_time"]); ?> </td>
public function index() { if (!is_login()) { $this->error("您还没有登陆", U("User/login")); } if (IS_POST) { $id = I('post.id', 0, 'intval'); //获取id if (!is_numeric($id)) { $this->error('ID错误!'); } $info = M("shoplist")->find($id); $postnum = I('post.num'); if (!is_numeric($postnum)) { $this->error('数量错误!'); } if ($postnum < 1) { $this->error('无效数量!'); } $num = $info['num']; //获取num $price = $info['price']; //获取价格 $goodid = $info['goodid']; //获取goodid $parameters = $info['parameters']; if ($postnum > $num) { $this->error('超出购买数量'); } else { //保存信息到退货表 $back = D("backlist"); $back->create(); //Create方法创建的数据对象是保存在内存,并没有实际写入到数据库,直到使用add或者save 方法才会真正写入数据库 $back->create_time = NOW_TIME; $back->status = 1; $back->goodid = $goodid; $back->total = $num * $price; $back->parameters = $parameters; $result = $back->add(); addUserLog('申请退货,商品名称' . get_good_name($goodid) . '参数' . $parameters, is_login()); //更改商品的售后信息 $data['status'] = 4; $shop = M("shoplist"); $add = $shop->where("id='{$id}'")->save($data); if ($add) { $this->success('提交成功', U("center/index")); } else { $this->error('申请失败', U("center/index")); } } } else { $this->meta_title = '提交退货单'; $id = I('get.id', 0, 'intval'); //获取id if (!is_numeric($id)) { $this->error('ID错误!'); } $msg = "Tips,提交退货单"; $detail = M("shoplist")->find($id); //获取购物清单 $this->assign('list', $detail); //获取物品id $this->assign('id', $id); $this->assign('msg', $msg); $this->display(); } }
</tr> </thead> </tbody> <tr> <td align="center"><?php echo $info["goodid"]; ?> </td> <td><A href="<?php echo U('Home:Article/detail?id=' . $vo['goodid']); ?> " > <img src="<?php echo get_cover(get_cover_id($info["goodid"]), 'path'); ?> " width="40" height="40"/><?php echo get_good_name($info["goodid"]); ?> </A></td> <td align="center"> <span class="weight"><?php echo get_weight($info["goodid"]); ?> </span>g</td> <td align="center"><?php echo get_good_price($info["goodid"]); ?> </td> <td align="center"><?php echo $info["num"]; ?> </td>
echo U('Article/detail?id=' . $info['id']); ?> &pic=<?php echo C('DOMAIN'); echo get_cover($info["cover_id"], 'path'); ?> " data-item="tencent" class="J_vivo_share"> <img alt="腾讯微博" src="/b2c/Public/Home/images/icon_tencent_weibo.jpg" app="b2c"> </a> <a target="_blank" title="分享到人人网" href="http://widget.renren.com/dialog/share?resourceUrl=<?php echo C('DOMAIN'); echo U('Article/detail?id=' . $info['id']); ?> ;srcUrl=<?php echo C('DOMAIN'); ?> &title=<?php echo $info["title"]; ?> 。(来自<?php echo C('SITENAME'); ?> )&pic=<?php echo C('DOMAIN'); echo get_cover($info["cover_id"], 'path'); ?> " data-item="renren" class="J_vivo_share"> <img alt="人人网" src="/b2c/Public/Home/images/icon_renrenwang.jpg" app="b2c"> </a> </span></p> </div> <!-- 商品参数 结束-->
/** * 添加商品 添加商品 未用到 * param int $id 商品主键 * int $num 购物数量 */ public function addgood($id) { $tag = $_POST['tag']; $num = 1; $id = $_POST['id']; $price = get_good_price($id); if (!isset($_SESSION['cart'])) { $_SESSION['cart'] = array(); } $item = array(); //如果该商品已存在则直接加其数量 if (isset($_SESSION['cart'][$id])) { $_SESSION['cart'][$id]['num'] += $num; $item['id'] = $id; $item['price'] = $price; $item['num'] = $_SESSION['cart'][$id]['num']; $_SESSION['cart'][$id] = $item; $exsit = "1"; } else { $item['id'] = $id; $item['price'] = $price; $item['num'] = $num; $_SESSION['cart'][$id] = $item; $exsit = "0"; } $data['status'] = 1; $data['price'] = get_good_price($id); $coverid = get_cover_id($id); $data['src'] = get_good_img($coverid); $data['title'] = get_good_name($id); $data['exsit'] = $exsit; $data['num'] = $item['num']; $data['msg'] = '添加成功'; $this->ajaxReturn($data); }
<div class="wrapper"> <div class="main"><div class="main_nav"><a rel="nofollow" href="<?php echo U("index/index"); ?> ">首页</a>><p class="red fwb">帮助中心</p></div><div class="main_center"><div class="center_left"> <dl><dt><a rel="nofollow">购物流程</a></dt> <dd><a rel="nofollow" href='javascript:vod(0);'>支付宝支付</a></dd> <dd><a rel="nofollow" href='javascript:vod(0);'>发票说明</dd><dd><a rel="nofollow" href='javascript:vod(0);'>优惠券说明</a></dd></dl> <dl class="last"><dt><a rel="nofollow">配送方式</a></dt><dd><a href='javascript:vod(0);'>配送方式</a></dd><dd><a rel="nofollow" href='javascript:vod(0);'>配送费用</a></dd><dd><a rel="nofollow" href='javascript:vod(0);'>签收须知</a></dd></dl></div><div class="center_right" style="display: none;"><div class="center_right_loading"></div></div><div id="memberCenter" style="display: block;"><!-- 个人中心 初始状态 start --> <div class="center_right" id="MemberCenterCtrl" style="display: block;"> <span class="red" style="display: block;text-align:center;margin:20px 0 20px 37px;font-weight:bold;padding:10px;font-size:17px;"><?php echo get_good_name($id); ?> </span> <form method="post" name="myform" class="payform"> <div class="pay"> <?php echo get_docoment_content($id); ?> </form> <script>function delcommon(event) { //获取事件源 event = event ? event : window.event;