/** * 显示评价信息 * GET /rate * * @return Response */ public function getList() { // $rates = array(); if (Input::has('shopID')) { $shopID = base64_decode(Input::get('shopID')); if (0 == strcmp($shopID, ALL_SHOPS_FALG)) { $headerShop = (object) array("wy_shop_id" => base64_encode(ALL_SHOPS_FALG), "wy_shop_name" => ALL_SHOPS); return View::make('admin.manage.rate.rate', compact('headerShop', 'rates'))->withAll(Lang::get('messages.10015')); } else { $headerShop = AuthController::checkShop($shopID); if (empty($headerShop)) { return View::make('admin.manage.rate.rate', compact('headerShop', 'rates'))->withError(Lang::get('errormessages.-10045')); } else { $shop = Shop::where('wy_shop_id', $shopID)->first(array('wy_comprehensive_evaluation', 'wy_service_score', 'wy_goods_score')); $rates = Rate::where('wy_shop_id', $shopID)->orderBy('wy_time', 'desc')->paginate(PERPAGE_COUNT_10, array('wy_comment_id', 'wy_main_order_id', 'wy_user_phone', 'wy_time', 'wy_content')); foreach ($rates as $index => $rate) { $rate->wy_comment_id = base64_encode($rate->wy_comment_id); $mainOrder = MainOrder::where('wy_main_order_id', $rate->wy_main_order_id)->first(array('wy_order_number')); if (!empty($mainOrder)) { $rate->wy_order_number = $mainOrder->wy_order_number; } else { $rate->wy_order_number = Lang::get('errormessages.-10058'); } $rate->wy_main_order_id = base64_encode($rate->wy_main_order_id); } return View::make('admin.manage.rate.rate', compact('headerShop', 'shop', 'rates')); } } } else { return View::make('admin.manage.rate.rate', compact('rates'))->withError(Lang::get('errormessages.-10045')); } }
public function getListInfo() { $shopID = base64_decode(Input::get('shopID')); $mainOrderID = base64_decode(Input::get('mainOrderID')); $disableChange = DEFAULT_0; $headerShop = AuthController::checkShop($shopID); if (!empty($headerShop)) { $mainOrder = MainOrder::where('wy_main_order_id', $mainOrderID)->where('wy_shop_id', $shopID)->first(array('wy_main_order_id', 'wy_shop_id', 'wy_order_number', 'wy_recv_name', 'wy_recv_addr', 'wy_recv_phone', 'wy_consumption_money', 'wy_actual_money', 'wy_order_state', 'wy_order_state_flow', 'wy_generate_time', 'wy_confirm_time', 'wy_send_time', 'wy_arrive_time', 'wy_reminder_flag', 'wy_reminder_count', 'wy_reminder_time', 'wy_refuse_time', 'wy_cancel_time', 'wy_user_note')); if (!empty($mainOrder)) { $orderStatus = Dictionary::where('wy_dic_id', DIC_ORDER_STATUS)->where('wy_dic_item_id', $mainOrder->wy_order_state)->first(array('wy_dic_value')); $mainOrder->wy_order_state_name = $orderStatus->wy_dic_value; $reminderFlag = Dictionary::where('wy_dic_id', DIC_REMINDER_FLAG)->where('wy_dic_item_id', $mainOrder->wy_reminder_flag)->first(array('wy_dic_value')); $mainOrder->wy_reminder_flag_name = $reminderFlag->wy_dic_value; $subOrders = MainOrder::find($mainOrder->wy_main_order_id)->subOrders()->get(array('wy_goods_id', 'wy_goods_name', 'wy_goods_unit_price', 'wy_goods_amount', 'wy_goods_total_price')); $mainOrder->subOrders = $subOrders; $mainOrder->wy_shop_name = $headerShop->wy_shop_name; $mainOrder->wy_shop_id = base64_encode($mainOrder->wy_shop_id); $mainOrder->wy_main_order_id = base64_encode($mainOrder->wy_main_order_id); //订单流的处理 $orderStatFlows = str_split($mainOrder->wy_order_state_flow); return View::make('admin.template.order.orderdetail', compact('headerShop', 'disableChange', 'mainOrder', 'orderStatFlows')); } else { return View::make('admin.template.order.orderdetail', compact('headerShop', 'disableChange'))->withError(Lang::get('errormessages.-10068')); } } else { return View::make('admin.template.order.orderdetail', compact('disableChange'))->withError(Lang::get('errormessages.-10068')); } }
protected function getSingleTradeInfo($shopID, &$totalTurnover, &$totalOrderCount, &$newOrderCount) { $date = Carbon::now()->toDateString(); $totalTurnover = MainOrder::where('wy_shop_id', $shopID)->where('wy_order_state', ORDER_STATE_4)->whereRaw('date(wy_generate_time) = ?', array($date))->sum('wy_actual_money'); $totalTurnover = round($totalTurnover, 2); $totalOrderCount = MainOrder::where('wy_shop_id', $shopID)->whereRaw('date(wy_generate_time) = ?', array($date))->count(); $newOrderCount = MainOrder::where('wy_shop_id', $shopID)->where('wy_order_state', ORDER_STATE_1)->whereRaw('date(wy_generate_time) = ?', array($date))->count(); }
public function getBizReportList() { $mainOrders = array(); $conditions = ""; $params = array(); $dates = array(); $shopID = base64_decode(Input::get('shop_id')); if (Request::ajax()) { if (0 == strcmp($shopID, ALL_SHOPS_FALG)) { $userID = Auth::id(); $shops = Shop::where('wy_shopkeeper', $userID)->where('wy_audit_state', SHOP_AUDIT_STATUS_4)->get(array('wy_shop_id')); $shopIDs = array(); foreach ($shops as $index => $shop) { array_push($shopIDs, $shop->wy_shop_id); } if (!empty($shopIDs)) { $this->getStatisticsConditions($conditions, $params, $dates, false); if (!empty($conditions) && !empty($params)) { $mainOrders = MainOrder::whereIn('wy_shop_id', $shopIDs)->whereRaw($conditions, $params)->orderBy('wy_generate_time')->paginate(PERPAGE_COUNT_10, array('wy_main_order_id', 'wy_shop_id', 'wy_order_number', 'wy_recv_name', 'wy_generate_time', 'wy_actual_money', 'wy_order_state', 'wy_reminder_flag')); foreach ($mainOrders as $index => $mainOrder) { $orderStatus = Dictionary::where('wy_dic_id', DIC_ORDER_STATUS)->where('wy_dic_item_id', $mainOrder->wy_order_state)->first(array('wy_dic_value')); $mainOrder->wy_order_state_name = $orderStatus->wy_dic_value; $reminderFlag = Dictionary::where('wy_dic_id', DIC_REMINDER_FLAG)->where('wy_dic_item_id', $mainOrder->wy_reminder_flag)->first(array('wy_dic_value')); $mainOrder->wy_reminder_flag_name = $reminderFlag->wy_dic_value; $shop = Shop::where('wy_shop_id', $mainOrder->wy_shop_id)->first(array('wy_shop_name')); if (!empty($shop)) { $mainOrder->wy_shop_name = $shop->wy_shop_name; } else { $mainOrder->wy_shop_name = $headerShop->wy_shop_name; } $mainOrder->wy_shop_id = base64_encode($mainOrder->wy_shop_id); $mainOrder->wy_main_order_id = base64_encode($mainOrder->wy_main_order_id); } } } else { $mainOrders = Paginator::make(array(), DEFAULT_0, PERPAGE_COUNT_10); } } else { $headerShop = AuthController::checkShop($shopID); if (!empty($headerShop)) { $this->getStatisticsConditions($conditions, $params, $dates, false); if (!empty($conditions) && !empty($params)) { $mainOrders = MainOrder::where('wy_shop_id', $shopID)->whereRaw($conditions, $params)->orderBy('wy_generate_time')->paginate(PERPAGE_COUNT_10, array('wy_main_order_id', 'wy_shop_id', 'wy_order_number', 'wy_recv_name', 'wy_generate_time', 'wy_actual_money', 'wy_order_state', 'wy_reminder_flag')); foreach ($mainOrders as $index => $mainOrder) { $orderStatus = Dictionary::where('wy_dic_id', DIC_ORDER_STATUS)->where('wy_dic_item_id', $mainOrder->wy_order_state)->first(array('wy_dic_value')); $mainOrder->wy_order_state_name = $orderStatus->wy_dic_value; $reminderFlag = Dictionary::where('wy_dic_id', DIC_REMINDER_FLAG)->where('wy_dic_item_id', $mainOrder->wy_reminder_flag)->first(array('wy_dic_value')); $mainOrder->wy_reminder_flag_name = $reminderFlag->wy_dic_value; $mainOrder->wy_shop_name = $headerShop->wy_shop_name; $mainOrder->wy_shop_id = base64_encode($mainOrder->wy_shop_id); $mainOrder->wy_main_order_id = base64_encode($mainOrder->wy_main_order_id); } } } else { $mainOrders = Paginator::make(array(), DEFAULT_0, PERPAGE_COUNT_10); } } } return View::make('admin.report.trade.bizreportlist', compact('mainOrders')); }
/** * 打印订单 * * @return Response */ public function getPrint($shop_id, $main_order_id) { $shopID = base64_decode($shop_id); $headerShop = AuthController::checkShop($shopID); $mainOrderID = base64_decode($main_order_id); if (empty($headerShop)) { App::abort(404); } else { $shop = Shop::where('wy_shop_id', $shopID)->first(); $shop->wy_shop_id = base64_encode($shop->wy_shop_id); $mainOrder = MainOrder::where('wy_shop_id', $shopID)->where('wy_main_order_id', $mainOrderID)->first(); $subOrders = MainOrder::find($mainOrder->wy_main_order_id)->subOrders()->get(array('wy_goods_id', 'wy_goods_name', 'wy_goods_unit_price', 'wy_goods_amount', 'wy_goods_total_price')); $goodsTotalAmout = MainOrder::find($mainOrder->wy_main_order_id)->subOrders()->sum('wy_goods_amount'); $mainOrder->goodsTotalAmout = $goodsTotalAmout; $mainOrder->subOrders = $subOrders; $mainOrder->wy_shop_id = base64_encode($mainOrder->wy_shop_id); $mainOrder->wy_main_order_id = base64_encode($mainOrder->wy_main_order_id); return View::make('admin.print.print', compact('mainOrder', 'shop')); } }