Esempio n. 1
0
 public function detail($order_id)
 {
     //检查登录
     $this->_login();
     $smarty = get_smarty();
     $this->_orderleft($smarty);
     //取出订单信息
     $order_info = OrderInfo::getOrderInfoByOrderId($order_id);
     if (!$order_info) {
         //不存在该订单,返回到全部订单列表页
         $url = url('admin', 'adminorder::all');
         header('Location:' . $url);
         throw new Exception('exit');
     }
     //取出商品信息
     $order_id = $order_info['order_id'];
     $goods_list = OrderGoodsInfo::getOrderGoodsInfoByOrderId($order_id);
     //获取省份列表
     $province_list = RegionM::getProvinces();
     $smarty->assign('province', $province_list);
     //获取市
     $city_list = RegionM::getCitys($order_info['province']);
     $smarty->assign('city', $city_list);
     //获取区列表
     $district_list = RegionM::getDistricts($order_info['city']);
     $smarty->assign('district', $district_list);
     //ajax获取城市列表地址
     $addr_get_city_url = url('region', 'region::getcitys');
     $smarty->assign('addr_get_city_url', $addr_get_city_url);
     //ajax获取地区列表地址
     $addr_get_dist_url = url('region', 'region::getdistricts');
     $smarty->assign('addr_get_dist_url', $addr_get_dist_url);
     //发货连接
     $change_shipping_url = url('admin', 'adminorder::changeshipping', $order_id);
     $smarty->assign("change_shipping_url", $change_shipping_url);
     $smarty->assign("order_info", $order_info);
     $smarty->assign("goods_list", $goods_list);
     $smarty->assign("edit_detail_url", url('admin', 'adminorder::edit', $order_id));
     //修改订单信息链接
     $smarty->display('admin/order/order_info.html');
 }
Esempio n. 2
0
 public static function plusStock($uid = null, $order_id = null)
 {
     if (!$order_id || !$uid) {
         return false;
     }
     $order_id = (int) $order_id;
     //获取商品信息
     if ($uid) {
         $goods_list_info = OrderGoodsInfo::getUserOrderGoodsInfoByOrderId($uid, $order_id);
     } else {
         $goods_list_info = OrderGoodsInfo::getOrderGoodsInfoByOrderId($uid, $order_id);
     }
     foreach ($goods_list_info as $key => $value) {
         $goods_id = $value['goods_id'];
         $goods_num = $value['goods_num'];
         //获取库存
         $goods_info = AdminGoodsM::getGoodsInfoByGoodsId($goods_id);
         if ($goods_info['goods_num'] !== false) {
             $data['goods_num'] = $goods_info['goods_num'] + $goods_num;
             $where['goods_id'] = $goods_id;
             AdminGoodsM::update($data, $where);
         }
     }
     return true;
 }