Beispiel #1
0
 /**
  * 申请退款
  */
 function act_applyRefund()
 {
     $id = isset($_POST['orderId']) ? trim($_POST['orderId']) : '';
     $ostatus = isset($_POST['orderStatus']) ? trim($_POST['orderStatus']) : '';
     $otype = isset($_POST['orderType']) ? trim($_POST['orderType']) : '';
     if ($id == '') {
         self::$errCode = 1;
         self::$errMsg = '参数非法!';
         return FALSE;
     }
     $refundedInfo = self::act_getRefundedSum($id);
     //var_dump($refundedInfo);
     //print_r($refundedInfo);
     $totalSum = $refundedInfo['totalSum'];
     $refundedSum = $refundedInfo['refundSum'];
     //var_dump($refundedSum);
     if ($refundedSum != 0 && $refundedSum >= $totalSum) {
         self::$errCode = 02;
         self::$errMsg = '该订单累计申请退款金额已达订单金额,不可再申请!';
         return FALSE;
     }
     $StatusMenuAct = new StatusMenuAct();
     $tableName = $StatusMenuAct->act_getOrderNameByStatus($ostatus, $otype);
     $orderInfo = OrderRefundModel::getOrderInfo($tableName, $id);
     //$orderObj  = new OrderRefundModel();
     //$orderInfo = OrderRefundModel::getTNameList($table, $field, $where);
     if (!$orderInfo) {
         $orderInfo['refundedSum'] = $refundedSum;
     }
     //var_dump($orderInfo); exit;
     self::$errCode = OrderRefundModel::$errCode;
     self::$errMsg = OrderRefundModel::$errMsg;
     return $orderInfo;
 }
Beispiel #2
0
 public function act_showOrderList($ostatus, $otype, $where)
 {
     $StatusMenuAct = new StatusMenuAct();
     $tableName = $StatusMenuAct->act_getOrderNameByStatus($ostatus, $otype);
     $data = OrderindexModel::showOrderList($tableName, $where);
     self::$errCode = OrderindexModel::$errCode;
     self::$errMsg = OrderindexModel::$errMsg;
     return $data;
 }
Beispiel #3
0
 public function act_index()
 {
     $id = $_REQUEST['orderid'];
     $ostatus = $_REQUEST['ostatus'];
     $otype = $_REQUEST['otype'];
     $storeId = 1;
     $where = ' WHERE da.is_delete = 0 AND da.storeId = ' . $storeId . ' AND da.orderStatus = ' . $ostatus;
     if ($otype != '') {
         $where .= ' AND da.orderType	= ' . $otype;
     }
     $where .= ' AND da.id	= ' . $id;
     $StatusMenuAct = new StatusMenuAct();
     $tableName = $StatusMenuAct->act_getOrderNameByStatus($ostatus, $otype);
     $orderlist = OrderindexModel::showSearchOrderList($tableName, $where);
     $data['order'] = $orderlist[$id];
     //var_dump($orderlist); exit;
     /*$price	=	array();
     		$data['order']	=	OrderModifyModel::index($$tableName,$where);
     		foreach($data['order'] as $k => $v){
     			$data['order'][$k]['ordersTime']	=	date("Y-m-d H:i:s",$v['ordersTime']);
     			$data['order'][$k]['paymentTime']	=	date("Y-m-d H:i:s",$v['paymentTime']);
     			if($data['order'][$k]['createdTime'] != ''){
     				$data['order'][$k]['createdTime']	=	date("Y-m-d H:i:s",$v['createdTime']);
     			}
     			$goodinfo	=	GoodsModel::getSkuinfo($v['sku']);
     			$data['order'][$k]['price']			=	$goodinfo['goods_cost'];
     		}
     		$data['combinePackageMessage']	=	'';
     		
     		switch($data['order'][0]['combinePackage']){
     			case 0:
     				$data['combinePackageMessage']	=	'正常订单(未合并包裹)';
     				break;
     			case 1:
     				$result	=	OmAvailableModel::getTNameList(' `om_records_combinePackage` ',' * ',' WHERE main_order_id = "'.$data['order'][0]['id'].'"');
     				$data['combinePackageMessage']	.=	'该订单是合并包裹'.$result[0]['main_order_id'].'的一部分';
     				break;
     			case 2:
     				$result	=	OmAvailableModel::getTNameList(' `om_records_combinePackage` ',' * ',' WHERE split_order_id = "'.$data['order'][0]['id'].'"');
     				$data['combinePackageMessage']	.=	'该订单是合并包裹'.$result[0]['main_order_id'].'的一部分';
     				break;
     			default:
     				break;
     		}
     
     		$data['isSplitMessage']	=	'';
     
     		switch($data['order'][0]['isSplit']){
     			case 0:
     				$data['isSplitMessage']	=	'正常订单(未拆分)';
     				break;
     			case 1:
     				$result	=	OmAvailableModel::getTNameList(' `om_records_splitOrder` ',' * ',' WHERE main_order_id = "'.$data['order'][0]['id'].'"');
     				$data['isSplitMessage']	.=	'该订单拆分成'.count($result).'个订单';
     				break;
     			case 2:
     				$result	=	OmAvailableModel::getTNameList(' `om_records_combinePackage` ',' * ',' WHERE split_order_id = "'.$data['order'][0]['id'].'"');
     				$result	=	OmAvailableModel::getTNameList(' `om_records_combinePackage` ',' * ',' WHERE main_order_id = "'.$result[0]['main_order_id'].'"');
     				$data['isSplitMessage']	.=	'该订单与'.count($result).'个订单由订单'.$result[0]['main_order_id'].'拆分而来';
     				break;
     			default:
     				break;
     		}*/
     //$data['transport']	=	CommonModel::getCarrierList();
     //$data['materials']	=	GoodsModel::getMaterInfo();
     $data['operationLog'] = OmAvailableModel::getTNameList('`om_order_log`', ' * ', ' WHERE omOrderId = ' . $id);
     if (empty($data['operationLog'])) {
         $data['operationLog'] = array(array('note' => '暂无操作日志', 'createdTime' => ''));
     } else {
         foreach ($data['operationLog'] as $k => $v) {
             $data['operationLog'][$k]['createdTime'] = date("Y-m-d H:i:s", $v['createdTime']);
         }
     }
     //$data['currency'] = OmAvailableModel :: getTNameList('om_currency',' * ',' WHERE 1');
     //var_dump($data); exit;
     self::$errCode = OrderindexModel::$errCode;
     self::$errMsg = OrderindexModel::$errMsg;
     return $data;
 }
Beispiel #4
0
 public static function resendOrder($orderid, $note, $type, $old_ostatus, $old_otype)
 {
     !self::$dbConn ? self::initDB() : NULL;
     BaseModel::begin();
     //开始事务
     //$tableName = 'om_unshipped_order';
     //echo $old_ostatus; echo "<br>";
     //echo $old_otype; echo "<br>";
     $StatusMenuAct = new StatusMenuAct();
     $tableName = $StatusMenuAct->act_getOrderNameByStatus($old_ostatus, $old_otype);
     //echo $tableName;
     if ($type == 1) {
         $updatesql = 'update ' . $tableName . ' set isBuji=1,isCopy=1 where id=' . $orderid . ' and is_delete = 0 and storeId = 1';
     } else {
         $updatesql = 'update ' . $tableName . ' set isCopy=1 where id=' . $orderid . ' and is_delete = 0 and storeId = 1';
     }
     if (!self::$dbConn->query($updatesql)) {
         //更新状态失败
         BaseModel::rollback();
         self::$dbConn->query('SET AUTOCOMMIT=1');
         self::$errCode = '003';
         self::$errMsg = '订单信息不存在,无法复制!';
         return FALSE;
     }
     //产生新订单
     $where = ' WHERE id = ' . $orderid . ' and is_delete = 0 and storeId = 1';
     $orderData = OrderindexModel::showOrderList($tableName, $where);
     $orderDetail = $orderData[$orderid]['orderDetail'];
     if (!$orderDetail) {
         //更新状态失败
         BaseModel::rollback();
         self::$dbConn->query('SET AUTOCOMMIT=1');
         return FALSE;
     }
     $insert_orderDetail = array();
     foreach ($orderDetail as $detail) {
         $insert_orderDetailData = $detail['orderDetailData'];
         unset($insert_orderDetailData['id']);
         $insert_orderDetailExtenData = $detail['orderDetailExtenData'];
         unset($insert_orderDetailExtenData['omOrderdetailId']);
         $insert_orderDetail[] = array('orderDetailData' => $insert_orderDetailData, 'orderDetailExtenData' => $insert_orderDetailExtenData);
     }
     $obj_order_data = $orderData[$orderid]['orderData'];
     if ($obj_order_data['isBuji'] == 2) {
         self::$errCode = '003';
         self::$errMsg = "补寄产生订单不能补寄!";
         BaseModel::rollback();
         self::$dbConn->query('SET AUTOCOMMIT=1');
         return FALSE;
     }
     if ($obj_order_data['isCopy'] == 2) {
         self::$errCode = '003';
         self::$errMsg = "复制产生订单不能复制!";
         BaseModel::rollback();
         self::$dbConn->query('SET AUTOCOMMIT=1');
         return FALSE;
     }
     unset($obj_order_data['id']);
     $orderExtenData = $orderData[$orderid]['orderExtenData'];
     unset($orderExtenData['omOrderId']);
     $orderUserInfoData = $orderData[$orderid]['orderUserInfoData'];
     unset($orderExtenData['omOrderId']);
     if ($type == 1) {
         $obj_order_data['isCopy'] = 2;
         $obj_order_data['actualTotal'] = 0.0;
     } else {
         $obj_order_data['isCopy'] = 2;
         $obj_order_data['isBuji'] = 2;
         $obj_order_data['actualTotal'] = 0.0;
         $obj_order_data['orderStatus'] = C('STATEBUJI');
         $obj_order_data['orderType'] = C('STATEBUJI_DONE');
     }
     $orderNote = array('content ' => $note, 'userId' => $_SESSION['sysUserId'], 'createdTime' => time());
     $insert_orderData = array();
     $insert_orderData = array('orderData' => $obj_order_data, 'orderExtenData' => $orderExtenData, 'orderUserInfoData' => $orderUserInfoData, 'orderDetail' => $insert_orderDetail, 'orderNote' => $orderNote);
     //$orderNote = $orderData['orderNote'];
     //echo $insertsql;
     //var_dump($insert_orderData); exit;
     if ($insertId = OrderAddModel::insertAllOrderRowNoEvent($insert_orderData)) {
         //echo $split_log .= 'insert success!' . "\n"; exit;
         //var_dump($_mainId,$_spitId); exit;
         if (!OrderLogModel::insertOrderLog($insertId, '补寄产生订单')) {
             BaseModel::rollback();
             self::$errCode = '001';
             self::$errMsg = "补寄失败!";
             return false;
         }
         if (!OrderRecordModel::insertSendRecords($orderid, $insertId)) {
             BaseModel::rollback();
             self::$errCode = '002';
             self::$errMsg = "补寄失败添加记录失败!";
             return false;
         }
     } else {
         //$split_log .= '补寄新订单产生失败!' . "\n";
         BaseModel::rollback();
         self::$errCode = '003';
         self::$errMsg = "补寄新订单产生失败";
         return false;
     }
     BaseModel::commit();
     self::$errCode = '200';
     self::$errMsg = "补寄新订单成功!";
     return TRUE;
 }