/** * @brief 检查活动的合法性 * @return string(有错误) or true(处理正确) */ public function checkValid() { if (!$this->id) { return "商品ID不存在"; } $goodsData = $this->type == 'product' ? Api::run('getProductInfo', array('#id#', $this->id)) : Api::run('getGoodsInfo', array('#id#', $this->id)); //库存判断 if (!$goodsData || $this->buy_num <= 0 || $this->buy_num > $goodsData['store_nums']) { return "购买的数量不正确或大于商品的库存量"; } $this->originalGoodsInfo = $goodsData; $this->activePrice = $goodsData['sell_price']; $goods_id = $goodsData['goods_id']; //具体促销活动的合法性判断 switch ($this->promo) { //团购 case "groupon": if (!$this->user_id) { return "参加团购活动请您先登录"; } $regimentRow = Api::run('getRegimentRowById', array("#id#", $this->active_id)); if ($regimentRow) { if ($regimentRow['goods_id'] != $goodsData['goods_id']) { return "该商品没有参与团购活动"; } if ($regimentRow['store_nums'] <= $regimentRow['sum_count']) { return "团购商品已经销售一空"; } //检查次团购订单 $orderDB = new IModel('order as o,order_goods as og'); $orderData = $orderDB->query('o.user_id = ' . $this->user_id . ' and o.type = 1 and active_id = ' . $this->active_id); $hasBugNum = 0; foreach ($orderData as $key => $val) { $orderStatus = Order_class::getOrderStatus($val); if (in_array($orderStatus, array(2, 1, 11))) { return "您参与的该团购订单还没有完成"; } if (in_array($orderStatus, array(3, 4, 6))) { $hasBugNum += $val['goods_nums']; } } //批量购买(薄利多销) if ($regimentRow['limit_min_count'] > 0) { if ($this->buy_num < $regimentRow['limit_min_count']) { return "购买数量必须超过 " . $regimentRow['limit_min_count'] . " 件才能下单"; } } //限制购买(限购,要多人参与) if ($regimentRow['limit_max_count'] > 0) { if ($this->buy_num > $regimentRow['limit_max_count']) { return "购买数量不能超过 " . $regimentRow['limit_min_count'] . " 件"; } if ($hasBugNum + $this->buy_num > $regimentRow['limit_max_count']) { return "此团购为限购活动,您累计购买数量不能超过" . $regimentRow['limit_max_count']; } } if ($this->buy_num > $regimentRow['store_nums']) { return "购买数量超过了团购剩余量"; } $this->activePrice = $regimentRow['regiment_price']; } else { return "当前时间段内不存在此团购活动"; } return true; break; //抢购 //抢购 case "time": $promotionRow = Api::run('getPromotionRowById', array("#id#", $this->active_id)); if ($promotionRow) { if ($promotionRow['condition'] != $goodsData['goods_id']) { return "该商品没有参与抢购活动"; } $memberObj = new IModel('member'); $memberRow = $memberObj->getObj('user_id = ' . $this->user_id, 'group_id'); if ($promotionRow['user_group'] == 'all' || isset($memberRow['group_id']) && stripos(',' . $promotionRow['user_group'] . ',', $memberRow['group_id']) !== false) { $this->activePrice = $promotionRow['award_value']; } else { return "此活动仅限指定的用户组"; } } else { return "不存在此限时抢购活动"; } return true; break; } return "未知促销活动"; }
?> </a> <?php } ?> </span> </div> <div id="admin_left"> <ul class="submenu"></ul> <div id="copyright"></div> </div> <div id="admin_right"> <?php $orderStatus = Order_class::getOrderStatus(array('status' => $status, 'pay_type' => $pay_type, 'distribution_status' => $distribution_status)); ?> <div class="headbar clearfix"> <div class="position">订单<span>></span><span>订单管理</span><span>></span><span>订单查看</span></div> <ul class="tab" name="menu1"> <li id="li_1"><a href="javascript:selectTab('1');" hidefocus="true">基本信息</a></li> <li id="li_2"><a href="javascript:selectTab('2');" hidefocus="true">收退款记录</a></li> <li id="li_3"><a href="javascript:selectTab('3');" hidefocus="true">发货记录</a></li> <li id="li_4"><a href="javascript:selectTab('4');" hidefocus="true">优惠方案</a></li> <li id="li_5"><a href="javascript:selectTab('5');" hidefocus="true">订单备注</a></li> <li id="li_6"><a href="javascript:selectTab('6');" hidefocus="true">订单日志</a></li> <li id="li_7"><a href="javascript:selectTab('7');" hidefocus="true">订单附言</a></li> </ul> </div>
echo isset($item['create_time']) ? $item['create_time'] : ""; ?> "><?php echo isset($item['create_time']) ? $item['create_time'] : ""; ?> </td> <td> <a href="<?php echo IUrl::creatUrl("/order/order_show/id/" . $item['id'] . ""); ?> "><img class="operator" src="<?php echo IUrl::creatUrl("") . "views/" . $this->theme . "/skin/" . $this->skin . "/images/admin/icon_check.gif"; ?> " title="查看" /></a> <?php if (Order_class::getOrderStatus($item) < 3) { ?> <a href="<?php echo IUrl::creatUrl("/order/order_edit/id/" . $item['id'] . ""); ?> "><img class="operator" src="<?php echo IUrl::creatUrl("") . "views/" . $this->theme . "/skin/" . $this->skin . "/images/admin/icon_edit.gif"; ?> " title="编辑"/></a> <?php } ?> <a href="javascript:void(0)" onclick="delModel({link:'<?php echo IUrl::creatUrl("/order/order_del/id/" . $item['id'] . ""); ?> '})" ><img class="operator" src="<?php