Esempio n. 1
0
 public function edit()
 {
     $id = intval($_REQUEST['id']);
     $order = $id ? $this->dao->find($id) : '';
     $do = $_REQUEST['do'];
     $this->assign('do', $do);
     $this->assign('id', $id);
     if ($order['shipping_status'] && $do != 'status') {
         $this->assign('dialog', '1');
         $this->assign('waitSecond', 2);
         $this->assign('jumpUrl', 1);
         $this->error(L('order_shippinged_no_edit'));
     }
     if ($_REQUEST['dosubmit']) {
         switch ($do) {
             case 'data':
                 $modle = M('Order_data');
                 if ($_GET['delete']) {
                     $data_id = intval($_GET['data_id']);
                     $modle->delete($data_id);
                 } else {
                     foreach ($_POST['data_id'] as $key => $r) {
                         $data = array();
                         $data['id'] = $r;
                         $data['product_price'] = $_POST['product_price'][$key];
                         $data['number'] = $_POST['number'][$key];
                         $data['price'] = $data['product_price'] * $data['number'];
                         $modle->save($data);
                     }
                 }
                 $_POST = order_count($order);
             case 'money':
                 $order['discount'] = $_POST['discount'];
                 $_POST = order_count($order);
                 break;
             case 'payment':
                 $order['pay_id'] = $_POST['pay_id'];
                 $_POST = order_count($order);
                 break;
             case 'shipping':
                 $order['shipping_id'] = $_POST['shipping_id'];
                 $order['insure'] = $_POST['insure_' . $order['shipping_id']] ? 1 : 0;
                 $_POST = order_count($order);
                 break;
             case 'status':
                 $order[$_POST['type']] = $_POST['value'];
                 if ($_POST['type'] == 'status' && $_POST['value'] == 2) {
                     $order['confirm_time'] = time();
                 } elseif ($_POST['type'] == 'shipping_status' && $_POST['value'] == 1) {
                     $order['shipping_time'] = time();
                 } elseif ($_POST['type'] == 'pay_status' && $_POST['value'] == 2) {
                     $order['pay_time'] = time();
                 } elseif ($_POST['type'] == 'shipping_status' && $_POST['value'] == 2) {
                     $order['accept_time'] = time();
                 }
                 if (false !== $this->dao->save($order)) {
                     die(json_encode(array('msg' => L('do_ok'))));
                 } else {
                     die(json_encode(array('msg' => L('do_error'))));
                 }
                 break;
         }
         if (false === $this->dao->create()) {
             $this->error($this->dao->getError());
         }
         if (false !== $this->dao->save()) {
             $this->assign('dialog', '1');
             $jumpUrl = U(MODULE_NAME . '/show?id=' . $_REQUEST['id']);
             $this->assign('jumpUrl', $jumpUrl);
             $this->success(L('edit_ok'));
         } else {
             $this->error(L('do_error'));
         }
         exit;
     }
     switch ($do) {
         case 'address':
             $Area = M('Area')->getField('id,name');
             $this->assign('Area', $Area);
             break;
         case 'payment':
             $payment = M('Payment')->field('id,pay_code,pay_name,pay_fee,pay_fee_type,pay_desc,is_cod,is_online')->where("status=1")->select();
             $this->assign('payment', $payment);
             break;
         case 'data':
             $order_data = M('Order_data')->where("order_id='{$order[id]}'")->select();
             $this->assign('order_data', $order_data);
             break;
         case 'shipping':
             $shipping = M('Shipping')->where("status=1")->select();
             $this->assign('shipping', $shipping);
             break;
     }
     $this->assign('order', $order);
     $this->display();
 }
Esempio n. 2
0
                        </ol>
                    </div>
                </div>
                <!-- /.row -->
                <!-- /.row -->
                <div class="row">
                            <div class="col-lg-4 col-md-6">
                        <div class="panel panel-yellow">
                            <div class="panel-heading">
                                <div class="row">
                                    <div class="col-xs-3">
                                        <i class="fa fa-shopping-cart fa-5x"></i>
                                    </div>
                                    <div class="col-xs-9 text-right">
                                        <div class="huge"><?php 
echo order_count();
?>
</div>
                                        <div>New Orders!</div>
                                    </div>
                                </div>
                            </div>
                            <a href="?orders">
                                <div class="panel-footer">
                                    <span class="pull-left">View Details</span>
                                    <span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
                                    <div class="clearfix"></div>
                                </div>
                            </a>
                        </div>
                    </div>