Inheritance: extends BaseService
 /**
  * Create a resource
  *
  * @param  mixed $data
  * @return ApiProblem|mixed
  */
 public function create($data)
 {
     $result = $this->service->create($data);
     if ($result == 'error') {
         return new ApiProblem(405, 'Error processing order');
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  * CheckoutService constructor.
  * @param array $config
  */
 public function __construct(array $config)
 {
     parent::__construct($config);
     $orderDetail = new OrderDetailService($config);
     $orderCustomer = new OrderCustomerService($config);
     $orderProducts = new OrderProductsService($config);
     $order = new OrderService($config);
     $order->setOrderDetail($orderDetail);
     $order->setOrderCustomer($orderCustomer);
     $order->setOrderProducts($orderProducts);
     $this->setOrder($order);
 }
Exemplo n.º 3
0
 function action_order()
 {
     session_start();
     $model = $_SESSION['basket'];
     $login = $_SESSION["login"];
     if (!is_null($_SESSION["login"])) {
         $account = AccountService::GetByName($login, true);
         $order = OrderHelper::PopulateOrderFromBasketViewModel($model, $account->account_id);
         $order = OrderService::Create($order);
         $products = $model->products;
         for ($i = 0; $i < count($products); $i++) {
             for ($j = 0; $j < $model->counts[$i]; $j++) {
                 $orderlist = new OrderList();
                 $orderlist->order_id = $order->order_id;
                 $orderlist->product_id = $products[$i]->Id;
                 OrderListService::Create($orderlist);
             }
         }
         $_SESSION['basket'] = null;
         EmailService::SendNewOrderMessage($account, $order->order_id, $model->SumPrice());
         $data = $order->order_id;
         $this->view->generate('Order_view.php', 'template_view.php', $data);
     } else {
         header('Location: /Account/login');
     }
 }
Exemplo n.º 4
0
 /**
  * Fetch all or a subset of resources
  *
  * @param  array $params
  * @return ApiProblem|mixed
  */
 public function fetchAll($params = array())
 {
     if (!$this->userService->isSalesMan()) {
         return new ApiProblem(415, 'Only admin can see all orders.');
     }
     return $this->orderService->fetchAll();
 }
Exemplo n.º 5
0
 public static function getBookingno()
 {
     $booking_no = OrderService::createOrderno();
     $booking_count = MemberBooking::find()->where(['booking_no' => $booking_no])->count();
     if ($booking_count > 0) {
         return OrderService::getBookingno();
     } else {
         return $booking_no;
     }
 }
Exemplo n.º 6
0
 public function action_NewStatus()
 {
     PermissionHelper::Verification('Editor');
     $name = $_POST['InputStatus'];
     $order_id = $_POST['id'];
     $order = OrderService::GetById($order_id);
     $oldStatus = $order->statusorder_id;
     $order->statusorder_id = StatusService::GetByName($name)->statusorder_id;
     OrderService::Save($order);
     header("Location: /Order/Item?id=" . $oldStatus);
 }
 public function execute()
 {
     $orderId = $this->getParam('order_id');
     if (isset($orderId)) {
         if (!OrderService::singleton()->complete($orderId, $_SESSION['user_id'])) {
             $this->setError('', $GLOBALS['err']->get_all());
             return;
         }
         $this->setSuccess();
     }
 }
Exemplo n.º 8
0
 function action_order()
 {
     session_start();
     $login = $_SESSION["login"];
     if (!is_null($login)) {
         $model = OrderHelper::PopulateOrderDetailViewModelList(OrderService::GetByAccountId(AccountService::GetByName($login, true)->account_id));
         $this->view->generate('/Account/order_view.php', 'template_view.php', $model);
     } else {
         header("Location: /Product/");
     }
 }
 public function execute()
 {
     $orderId = $this->getParam('order_id');
     if (isset($orderId)) {
         if (!OrderService::singleton()->cancel($orderId, $_SESSION['user_id'])) {
             $this->setError('', $GLOBALS['err']->get_all());
             return;
         }
         $oneOrderInfo = OrderService::singleton()->getOneOrderInfoById($_SESSION['user_id'], $orderId);
         $this->setSuccess(array('order' => $oneOrderInfo));
     }
 }
Exemplo n.º 10
0
 public function actionInfo()
 {
     $this->pageTitle = Yii::app()->name . '-' . "我的保证金";
     $ID = Yii::app()->request->getParam('id');
     $cashinfo = CashdepositService::cashgetcash($ID);
     if ($cashinfo->Item == '2') {
         $model = OrderreturnService::nogetreturn($cashinfo->BusinessNO);
         if (!$model) {
             $this->redirect(array('index'));
         }
         $returnaddress = OrderService::getreturnship($model->ID);
         $this->render('returninfo', array('data' => $model, 'cashinfo' => $cashinfo, 'returnaddress' => $returnaddress));
     }
 }
Exemplo n.º 11
0
 public function actionOrderinfo2()
 {
     $this->pageTitle = Yii::app()->name . '-' . "退款单详情";
     $model = ReturnorderService::getorderinfo();
     if (!$model) {
         $this->redirect(array('index'));
     }
     $ID = Yii::app()->request->getParam('ID');
     $ReturnNO = PapReturnOrder::model()->findByPk($ID);
     $reuslt = self::getcomplaininfo($ReturnNO['ReturnNO']);
     if ($model->Type == 1) {
         $this->render('orderinfon2', array('data' => $model, 'reuslt' => $reuslt));
     } elseif ($model->Type == 2) {
         $returnaddress = OrderService::getreturnship($ID);
         $this->render('orderinfo2', array('data' => $model, 'reuslt' => $reuslt, 'returnaddress' => $returnaddress));
     }
 }
Exemplo n.º 12
0
 public function actionOrderinfo2()
 {
     $this->pageTitle = Yii::app()->name . '-' . "退款单详情";
     $model = OrderreturnService::papgetreturn();
     if (!$model) {
         $this->redirect(array('index'));
     }
     $models = new JpdReceiveAddress();
     $organID = Yii::app()->user->getOrganID();
     $firstaddress = JpdReceiveAddress::model()->findAll('OrganID=:organID and State=:State order by CreateTime DESC', array(':organID' => $organID, ':State' => '370000'));
     $address = JpdReceiveAddress::model()->findAll('OrganID=:organID and State!=:State order by CreateTime DESC', array(':organID' => $organID, ':State' => '370000'));
     $address = array_merge($firstaddress, $address);
     $ID = Yii::app()->request->getParam('ID');
     $ReturnNO = PapReturnOrder::model()->findByPk($ID);
     $reuslt = self::getcomplaininfo($ReturnNO['ReturnNO']);
     if ($model->Type == 1) {
         $this->render('orderinfos2', array('data' => $model, 'reuslt' => $reuslt, 'model' => $models));
     } elseif ($model->Type == 2) {
         $returnaddress = OrderService::getreturnship($ID);
         $this->render('orderinfo2', array('data' => $model, 'reuslt' => $reuslt, 'address' => $address, 'model' => $models, 'returnaddress' => $returnaddress));
     }
 }
Exemplo n.º 13
0
/*
 * @auther lion
 * @date 2013-2-4
 */
require_once 'class/order_service.class.php';
require_once 'class/order.class.php';
require_once 'class/sub_pages.class.php';
require_once 'class/code_names.class.php';
if (isset($_GET["p"])) {
    $pageCurrent = $_GET["p"];
} else {
    $pageCurrent = 1;
}
//每页显示的条数
$page_size = 10;
$order_service = new OrderService();
//总条目数
//每次显示的页数
$sub_pages = 10;
$url = "index.php?mod=order&action=ls&p=";
if (isset($_GET["keywords"])) {
    $keywords = trim($_GET["keywords"]);
    if (!empty($keywords)) {
        $array_order = $order_service->listAllByKeywords($pageCurrent, $page_size, $keywords);
        $nums = $order_service->getListRowsByKeywords($keywords);
        $url = "index.php?mod=order&action=ls&keywords={$keywords}&p=";
    } else {
        $array_order = $order_service->listAll($pageCurrent, $page_size);
        $nums = $order_service->getListRows();
    }
} else {
require_once 'class/supplier.class.php';
require_once 'class/supplier_service.class.php';
require_once 'class/order_goods.class.php';
require_once 'class/order_service.class.php';
require_once 'class/code_names.class.php';
$supplier_service = new SupplierService();
$array_supplier = $supplier_service->getAll();
$order = unserialize($_SESSION['order']);
$id = $order->id;
$order_number = $order->order_number;
$supplier_id = $order->supplier_id;
$status = $order->status;
$note = $order->note;
unset($_SESSION["order"]);
$_SESSION['id'] = $id;
$order_service = new OrderService();
$array_order_goods = $order_service->getGoodsByOrderId($id);
?>
<h3>修改采购单</h3>
<hr class="bs-docs-separator">
<div class="div-form ">
<form class="form-horizontal" action="./index.php?mod=order&action=edit_post" method="post"> 

       <div class="control-group">
    <label class="control-label" for="order_number">订单编号</label>
    <div class="controls">
      <input type="text" id="order_number" placeholder="" name="order_number" readonly/>
    </div>
    </div>
           <div class="control-group">
    <label class="control-label" for="supplier_id">供应商</label>
Exemplo n.º 15
0
	text-align: center; 
	text-decoration: none; 
	font-weight: bold;
	background-color: #404040; 
	border: 1px solid #fff; 
	color: #fff; 
	font-size:12px; 
	cursor: pointer;
}
</style>
</head>
<body>
<?php 
global $order;
$orderId = $_GET["order_id"];
$service = new OrderService();
$sql = "select *, (round(o.order_subtotal + ( o.order_gst * o.order_subtotal /100 ),2)) AS order_grandtotal from `order` o,customer c where o.order_customer_id = c.customer_id and o.order_id='" . $orderId . "'";
$orows = $service->GetRows($sql);
if (count($orows) != 0) {
    $order = $orows[0];
}
?>
<div id="content" class="float_r">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td>
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						
						<td style="width:5px" valign="bottom" class="navigation">&nbsp;
							
Exemplo n.º 16
0
                    require_once './order_view_datail.php';
                } else {
                    header("Location: ./index.php?mod=order&action=ls");
                }
            } else {
                header("Location: ./index.php?mod=order&action=ls");
            }
            break;
        case 'detail_post':
            $order_id = $_POST['order_id'];
            if (isset($_POST['goods_id'])) {
                $goods_id = $_POST['goods_id'];
                $goods_number = $_POST['goods_number'];
                print_r($goods_id);
                print_r($goods_number);
                require_once './class/order_service.class.php';
                $order_service = new OrderService();
                foreach ($goods_id as $id => $goods_id) {
                    $order_goods_id = $order_service->addGoodsInOrder($goods_id, $goods_number[$id], 0, $order_id);
                    $log_service->addLog("insert", "订单产品", $order_goods_id);
                    header("Location: ./index.php?mod=order&action=detail&did=" . $order_id);
                }
            } else {
                header("Location: ./index.php?mod=order&action=detail&did=" . $order_id);
            }
        default:
            break;
    }
} else {
    header("Location: ./index.php?mod=order&action=ls");
}
Exemplo n.º 17
0
<script type="text/javascript" >
	function select_order(value){
		window.location.href = "MyOrder.php?orderAction="+value;
	}
</script>
</head>
<body>
<?php 
global $customer;
global $orders;
global $order;
global $orderItems;
global $order_id;
$customer = $_SESSION["customer"];
$custId = $customer->CustId;
$oService = new OrderService();
$sql = "select o.*,(round(o.order_subtotal + ( o.order_gst * o.order_subtotal /100 ),2)) AS order_grandtotal\n\t\t from `order` o where o.order_customer_id = '" . $custId . "' order by o.order_id desc";
$orders = $oService->GetRows($sql);
if (isset($_GET["orderAction"])) {
    $order_id = $_GET["orderAction"];
} else {
    if ($orders) {
        $order_id = $orders[0]["order_id"];
    }
}
if ($order_id) {
    $itemService = new OrderItemService();
    $sql = "select o.*, round((o.item_quantity*o.item_price),2) as item_subtotal,h.hat_title from order_item o,hat h where o.item_hat_id=h.hat_id and item_order_id='" . $order_id . "'";
    $orderItems = $itemService->GetRows($sql);
}
?>
Exemplo n.º 18
0
 /**
  *    改变订单状态
  *
  *    @author    Garbin
  *    @param     int $order_id
  *    @param     array  $notify_result
  *    @return    void
  */
 function _change_order_status($order_id, $notify_result)
 {
     /* 响应通知 */
     //JporderService::respondNotify($order_id, $notify_result);
     OrderService::respondNotify($order_id, $notify_result);
 }
Exemplo n.º 19
0
Arquivo: list.php Projeto: zwq/unpei
</div>
                    </li> 
                <?php 
    }
    ?>
            </ul>
            <?php 
    //endif;
    ?>
            <div class="float_l goods_show" style="height:<?php 
    echo $count > 1 ? $count * 135 + 1 : $count * 135;
    ?>
px;min-height:135px">
                <div class="goods_show1 float_l"><div class="price m_top20">
                        <?php 
    $promo = OrderService::getHuodong($data->ID);
    if (!empty($promo) && $promo['Amount'] != 0) {
        ?>
                        <s  style="color:#eb7616">¥<?php 
        echo $data->GoodsAmount;
        ?>
</s><br>
                        <span><?php 
        if (!empty($promo['CouponSn'])) {
            echo "<span class='pt10' style='color:#0164c1;font-size:12px'>(优惠券" . $promo['Amount'] . "元)</span><br>";
        } else {
            if (!empty($promo['PromoID'])) {
                echo "<span class='pt10' style='color:#0164c1;font-size:12px'>(活动减免" . $promo['Amount'] . "元)</span>";
            }
        }
        ?>
Exemplo n.º 20
0
 public static function activedecre($actparam)
 {
     $organID = Yii::app()->user->getOrganID();
     //判断当前机构是否在活动参与对象范围内
     $data = self::activeorgan();
     //如果在
     if (in_array($organID, $data)) {
         //获取开启的优惠活动
         $act = self::active();
         $params = array();
         $act_arr = array();
         $payment = !empty($actparam['payment']) ? $actparam['payment'] + 1 : '2';
         //            $in_day=OrderService::is_inday($act['LastTime']);
         $in_day = OrderService::is_inday(time());
         //判断日期是否为当天 支付方式哪一种 则为参与活动
         if (!empty($act) && is_array($act) && ($act['Payment'] == $payment || $act['Payment'] == 1) && $in_day == 1) {
             $params['PromoID'] = intval($act['ID']);
             $params['TotalAmount'] = $actparam['total'];
             $params['CouponAmount'] = $actparam['coupon'];
             $params['Type'] = $act['Type'];
             switch ($act['Type']) {
                 case 1:
                     //满减送
                     $act = self::decre($params);
                     break;
                 case 2:
                     //每满减
                     $act = self::pperdecre($params);
                     break;
                 case 3:
                     //满送优惠券
                     $act = self::coupondecre($params);
                     break;
             }
         } else {
             $act = array();
         }
     }
     return $act;
 }
Exemplo n.º 21
0
                    <?php 
$this->widget('zii.widgets.jui.CJuiDatePicker', array('language' => 'zh_cn', 'name' => 'end', 'options' => array('dateFormat' => 'yy-mm-dd'), 'htmlOptions' => array('style' => 'width:90px;', 'class' => 'input')));
?>
  
                </p>
                <p align="center">
                    <input type="button" value="查 询" class="submit m_left" id="searchquotationlistbutton">
                </p>

            </form>
        </div>
        <div class="tab-bd-con order" style=" padding-left: 0px;"> 
            <?php 
$params['OrganID'] = Yii::app()->user->getOrganID();
$params['pageSize'] = 4;
$this->widget('widgets.default.WGridView', array('dataProvider' => OrderService::getOrderlist($params), 'columns' => array(array('name' => '序号', 'value' => '$this->grid->dataProvider->pagination->currentPage*$this->grid->dataProvider->pagination->pageSize + $row+1', 'headerHtmlOptions' => array('width' => '30px')), array('name' => '订单编号', 'value' => '$data[OrderSN]', 'headerHtmlOptions' => array('width' => '80px')), array('name' => '卖家名称', 'type' => 'raw', 'value' => '$data[SellerName]'), array('name' => '总金额', 'value' => '¥.$data[RealPrice]', 'headerHtmlOptions' => array('width' => '50px')), array('class' => 'CButtonColumn', 'header' => '详情', 'headerHtmlOptions' => array('width' => '30px'), 'template' => '{view}', 'buttons' => array('view' => array('label' => '详情', 'url' => 'Yii::app()->createUrl("/pap/orderreview/detail",array("orderid"=>$data->ID))'))))));
?>
            <div><a class="more" href="<?php 
echo Yii::app()->createUrl("pap/orderreview/index");
?>
">查看更多</a></div>
        </div>

    </div>
</div>
<script>

    //搜索
    $("#searchinquirybutton").click(function(){
        var startdate=$("#startdate").val();
        var enddate=$("#enddate").val();
Exemplo n.º 22
0
 public function actionChangeOrder()
 {
     $ID = Yii::app()->request->getParam('order');
     if ($_POST['idArr'] && isset($_POST['amountArr']) && $_POST['ID'] && $_POST['payment']) {
         $res = OrderService::changeOrder($_POST);
         echo json_encode($res);
         exit;
     }
     $cond = "((t.Payment=1 and t.Status=1 and ISNULL(t.AlipayTN)) or (t.Payment=2 and t.Status=2))";
     $criteria = new CDbCriteria();
     $organID = Yii::app()->user->getOrganID();
     $criteria->condition = "t.BuyerID={$organID} and t.IsDelete=0 and {$cond}";
     $model = PapOrder::model()->findByPk($ID, $criteria);
     if (!$model) {
         $this->redirect(array('index'));
     }
     foreach ($model->goodsinfo as $v) {
         $v = self::getVersionGoods($v);
     }
     //var_dump($model);die;
     $this->pageTitle = Yii::app()->name . ' - ' . "修改订单";
     $this->render('changeorder', array('data' => $model));
 }
Exemplo n.º 23
0
 public function actionUpdateProductCheckInventory()
 {
     $this->setauth();
     //检查有无权限
     $p_db = Yii::app()->p_db;
     $code = isset($_POST['code']) ? $_POST['code'] : '';
     $name = isset($_POST['name']) ? $_POST['name'] : '';
     $status = isset($_POST['status']) ? $_POST['status'] : '';
     $inventory_old = isset($_POST['inventory_old']) ? $_POST['inventory_old'] : '';
     $inventory = isset($_POST['inventory']) ? $_POST['inventory'] : '';
     $time = date('Y-m-d H:i:s', time());
     $this_user_name = Yii::app()->user->name;
     $flag = 0;
     if ($code != '') {
         $transaction = $p_db->beginTransaction();
         try {
             $check_code = OrderService::createOrderno();
             //新增盘点记录
             $sql = "INSERT INTO `vcos_product_check` (check_code,check_time,check_type,check_people) VALUES ('{$check_code}','{$time}','{$status[0]}','{$this_user_name}')";
             Yii::app()->p_db->createCommand($sql)->execute();
             for ($i = 0; $i < count($code); $i++) {
                 $sql = "INSERT INTO `vcos_product_check_detail` (check_code,product_name,inventory_num,check_num,product_code) VALUES ('{$check_code}','{$name[$i]}','{$inventory_old[$i]}','{$inventory[$i]}','{$code[$i]}')";
                 Yii::app()->p_db->createCommand($sql)->execute();
                 $sql = "UPDATE `vcos_product` SET inventory_num='{$inventory[$i]}' WHERE product_code='{$code[$i]}'";
                 Yii::app()->p_db->createCommand($sql)->execute();
             }
             $transaction->commit();
             $flag = 1;
         } catch (Exception $e) {
             $transaction->rollBack();
             $flag = 0;
         }
     }
     if ($flag == 1) {
         Helper::show_message(yii::t('vcos', '提交成功。'), Yii::app()->createUrl("Product/product_check"));
     } else {
         Helper::show_message(yii::t('vcos', '提交失败。'), Yii::app()->createUrl("Product/product_check"));
     }
 }
Exemplo n.º 24
0
require_once 'class/supplier_service.class.php';
require_once 'class/order_goods.class.php';
require_once 'class/order_service.class.php';
require_once 'class/code_names.class.php';
$supplier_service = new SupplierService();
$order = unserialize($_SESSION['order']);
$id = $order->id;
$order_number = $order->order_number;
$supplier_id = $order->supplier_id;
$supplier = $supplier_service->getSupplierById($supplier_id);
$supplier_name = $supplier->supplier_name;
$status = $order->status;
$note = $order->note;
unset($_SESSION["order"]);
$_SESSION['id'] = $id;
$order_service = new OrderService();
$array_order_goods = $order_service->getGoodsByOrderId($id);
?>
<div class="span12" style="margin-left: auto;margin-right: auto;">
<h3 style="float:left">采购单信息</h3>
<div style="float:right;margin-top:12px">
<a class='btn btn-primary' href='./index.php?mod=order&action=edit_get&eid=<?php 
echo $id;
?>
'>修改</a>
<a class="btn" href="javascript:history.go(-1);">返回</a>
</div>
<table class="table table-bordered table-hover ">
<thead >
<tr><th colspan="4">基本信息</th>
Exemplo n.º 25
0
 /**
  * 创建未付款订单
  * $order参数:一维数组,存放订单基本信息,
  * 包括卖家ID,卖家机构名称,收货地址ID,商品总价,以及订单总金额;
  * $address参数:一维数组,存放订单收货地址信息,
  * 包括订单ID,收货人信息,邮编,手机,固话,省,市,区,详细地址和添加时间
  * $goodsList参数:二维数组,存放订单商品信息,
  * 包括商品ID,商品编号,商品OE号,商品名称,标准名称,品牌,单价,促销价,数量以及商品总价。
  * @param type $result:eg array("order"=>array(),"address"=>array(),"goodsList"=> array())
  */
 public static function create($result)
 {
     //添加订单基本信息
     $model = new PapOrder();
     if ($result['order']['BuyerID']) {
         $result['order']['OrganID'] = $result['order']['BuyerID'];
     } else {
         $result['order']['OrganID'] = Yii::app()->user->getOrganID();
     }
     $model->attributes = $result["order"];
     $model->save();
     $orderId = $model->ID;
     // $model = PapOrder::model()->findByPk(557);
     if ($orderId) {
         $key = $model['Status'];
         //待付款提醒发给修理厂
         if ($key == 1) {
             $params = array('OrganID' => $result['order']['BuyerID'], 'OrganType' => 3, 'HandleID' => $orderId);
             $params['type'] = array('name' => 'DD', 'key' => $key);
             RemindService::sendRemind($params);
         }
         //发送待付款、待发货提醒给经销商
         $params = array('OrganID' => $result['order']['SellerID'], 'OrganType' => 2, 'HandleID' => $orderId);
         $params['type'] = array('name' => 'DD', 'key' => $key);
         RemindService::sendRemind($params);
         //            //生成订单发送邮件
         if (Yii::app()->Params['sendEmail']['send']) {
             self::createSendEmail($result);
         }
         //添加订单收货地址
         unset($model);
         $model = new PapOrderAddress();
         // $model->OrderID = $orderId;
         $result['address']['OrderID'] = $orderId;
         $model->attributes = $result["address"];
         Yii::app()->papdb->createCommand()->insert('pap_order_address', $result['address']);
         // $model->save();
     }
     foreach ($result["goodsList"] as $list) {
         //添加订单商品信息
         $list["OrderID"] = $orderId;
         unset($model);
         if (is_array($list)) {
             //判断商品是否已经添加
             $model = PapOrderGoods::model()->findByAttributes(array("OrderID" => $orderId, "GoodsID" => $list["GoodsID"]));
             //没有添加则添加,有则累加商品(数量、物流费及总价)
             if (empty($model) && !isset($model)) {
                 $model = new PapOrderGoods();
                 $b = self::UgoodsSalesByGoodsID($list["GoodsID"], $list["Quantity"]);
             } else {
                 $list["Quantity"] = $model['Quantity'] + $list["Quantity"];
                 $list["ShipCost"] = $model['ShipCost'] + $list["ShipCost"];
                 $list["GoodsAmount"] = $model['ProPrice'] ? $model['ProPrice'] + $list["GoodsAmount"] : $model['Price'] + $list["GoodsAmount"];
                 // 修改商品表的销售数量
                 $b = self::UgoodsSalesByGoodsID($list["GoodsID"], $list["Quantity"]);
             }
         } else {
             return false;
         }
         $model->attributes = $list;
         $res = Yii::app()->papdb->createCommand()->insert('pap_order_goods', $list);
         //$model->save();
     }
     //插入机构活动记录表
     //        if (!empty($result['order']['PromoID'])) {
     //            $times = self::insert_promotion_times($result);
     //        }
     if (!empty($result['order']['PromoID'])) {
         OrderService::insert_active_times();
     }
     //优惠活动添加记录
     if (in_array($result['order']['Type'], array(1, 2))) {
         $promotion_order = array('OrderID' => $orderId, 'PromoID' => $result['order']['PromoID'], 'Amount' => $result['order']['DecrTotal'], 'CreateTime' => time(), 'SellerID' => $result['order']['SellerID']);
         //插入优惠活动订单表
         self::insert_promotion_order($promotion_order);
     }
     if (isset($result['order']['UseCouponID']) && !empty($result['order']['UseCouponID'])) {
         //使用优惠券更新使用状态
         self::update_coupon_status($result['order']['UseCouponID']);
         $promotion_order = array('OrderID' => $orderId, 'CouponID' => $result['order']['UseCouponID'], 'Amount' => $result['order']['DecrTotal'], 'CreateTime' => time(), 'SellerID' => $result['order']['SellerID']);
         //插入优惠活动订单表
         self::insert_promotion_order($promotion_order);
     }
     return $orderId;
 }
Exemplo n.º 26
0
            <?php 
}
?>
            <div style="height:26px; float: right;margin-top:0px;">
                    <p class="form-row">
                        <a href="<?php 
echo Yii::app()->createUrl("pap/orderreview/index");
?>
" style="margin: 20px;font-size: 13px;color: #eb4800;">返回订单列表</a>
                    </p>
            </div>
        </div>
    </div>
</div>
   <?php 
$times = OrderService::is_current_date();
if ($_GET['lottid'] && $_GET['promoid'] && $times['Num'] == 1 && !isset(Yii::app()->session['first'])) {
    // &&$times['Num']==1
    // &&!isset(Yii::app()->session['first'])
    Yii::app()->session['first'] = 1;
    echo $this->renderPartial('active', array('promoid' => $promoid));
}
//添加收货地址
$this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'pay', 'options' => array('width' => 480, 'height' => 280, 'autoOpen' => false, 'resizable' => false, 'modal' => true, 'overlay' => array('backgroundColor' => '#000', 'opacity' => '0.5'))));
$this->renderPartial('paymessage');
$this->endWidget('zii.widgets.jui.CJuiDialog');
?>
 

<script>
    $('.pod').find("input[type=button]").click(function(){
Exemplo n.º 27
0
 $res = BuyGoodsService::mycoupon();
 $coupon = $res->getData();
 if (in_array($organID, $data)) {
     $act = BuyGoodsService::active();
     if (!empty($act) && is_array($act)) {
         //判断当前日期是否在当天
         //$in_day=OrderService::is_inday($act['LastTime']);
         $current_date = OrderService::is_current_date();
         if ($current_date) {
             $curret_time = $current_date['LastTime'];
             $num = $current_date['Num'] + 1;
         } else {
             $curret_time = time();
             $num = 1;
         }
         $in_day = OrderService::is_inday($curret_time);
         //判断当前日期是否在当天 支付方式是哪一种则参与活动
         if (($act['Payment'] == $payment || $act['Payment'] == 1) && $in_day == 1) {
             $params['PromoID'] = intval($act['ID']);
             $params['TotalAmount'] = $counts;
             switch ($act['Type']) {
                 case 1:
                     //满多少减多少
                     $act_res = BuyGoodsService::decre($params);
                     if (!empty($act_res) && is_array($act_res)) {
                         if (!empty($act_res['DecrAmount'])) {
                             echo "<span style='color:#e97816'>参与促销优惠活动:-¥" . $act_res['DecrAmount'] . "<br>(单笔订单满 ¥" . $act_res['MinAmount'] . " 减¥" . $act_res['DecrAmount'] . ")</span>";
                         }
                     }
                     $order_decr = $act_res['DecrAmount'];
                     break;
Exemplo n.º 28
0
 public function actionLott()
 {
     $organID = Yii::app()->user->getOrganID();
     $coupon = BuyGoodsService::get_lott_value();
     $promoid = Yii::app()->request->getParam('promoid');
     if (!empty($coupon) && is_array($coupon)) {
         $minamount = $coupon['MinAmount'];
         $maxamount = $coupon['MaxAmount'];
     }
     $prize = mt_rand($minamount, $maxamount);
     if ($prize) {
         $organID = Yii::app()->user->getOrganID();
         $cou_arr = array('CouponSn' => OrderService::gen_coupon_sn(), 'PromoID' => $promoid, 'OwnerID' => $organID, 'IsUse' => 0, 'CreateTime' => time(), 'Amount' => $prize, 'Valid' => $coupon['Valid']);
         //插入抽奖获得的优惠券金额信息
         BuyGoodsService::insert_coupon_manage($cou_arr);
     }
     echo json_encode($prize);
 }
Exemplo n.º 29
0
 /**
  * Get a Worldpay order
  * @param string $orderCode
  * @return array Worldpay order response
  * */
 public function getOrder($orderCode = false)
 {
     if (empty($orderCode) || !is_string($orderCode)) {
         Error::throwError('ip', Error::$errors['orderInput']['orderCode']);
     }
     $response = OrderService::getOrder($orderCode);
     if (!isset($response["orderCode"])) {
         Error::throwError("apierror");
     }
     return $response;
 }