示例#1
0
 public static function ucenter_order()
 {
     $siteConfig = new Config('site_config');
     $order_cancel_time = $siteConfig->order_cancel_time !== "" ? intval($siteConfig->order_cancel_time) : 7;
     $order_finish_time = $siteConfig->order_finish_time !== "" ? intval($siteConfig->order_finish_time) : 20;
     $orderModel = new IModel('order');
     $orderCancelData = $order_cancel_time >= 0 ? $orderModel->query(" if_del = 0 and pay_type != 0 and status in(1) and datediff(NOW(),create_time) >= {$order_cancel_time} ", "id,order_no,4 as type_data") : array();
     $orderCreateData = $order_finish_time >= 0 ? $orderModel->query(" if_del = 0 and distribution_status = 1 and status in(1,2) and datediff(NOW(),send_time) >= {$order_finish_time} ", "id,order_no,5 as type_data") : array();
     $resultData = array_merge($orderCreateData, $orderCancelData);
     if ($resultData) {
         foreach ($resultData as $key => $val) {
             $type = $val['type_data'];
             $order_id = $val['id'];
             $order_no = $val['order_no'];
             //oerder表的对象
             $tb_order = new IModel('order');
             $tb_order->setData(array('status' => $type, 'completion_time' => ITime::getDateTime()));
             $tb_order->update('id=' . $order_id);
             //生成订单日志
             $tb_order_log = new IModel('order_log');
             //订单自动完成
             if ($type == '5') {
                 $action = '完成';
                 $note = '订单【' . $order_no . '】完成成功';
                 //完成订单并且进行支付
                 Order_Class::updateOrderStatus($order_no);
                 //增加用户评论商品机会
                 Order_Class::addGoodsCommentChange($order_id);
                 $logObj = new log('db');
                 $logObj->write('operation', array("系统自动", "订单更新为完成", '订单号:' . $order_no));
             } else {
                 $action = '作废';
                 $note = '订单【' . $order_no . '】作废成功';
                 //订单重置取消
                 Order_class::resetOrderProp($order_id);
                 $logObj = new log('db');
                 $logObj->write('operation', array("系统自动", "订单更新为作废", '订单号:' . $order_no));
             }
             $tb_order_log->setData(array('order_id' => $order_id, 'user' => "系统自动", 'action' => $action, 'result' => '成功', 'note' => $note, 'addtime' => ITime::getDateTime()));
             $tb_order_log->add();
         }
     }
 }
示例#2
0
</td>
                <td><?php 
    echo isset($item['accept_name']) ? $item['accept_name'] : "";
    ?>
</td>
                <td><?php 
    echo isset($this->payments[$item['pay_type']]['name']) ? $this->payments[$item['pay_type']]['name'] : "";
    ?>
</td>
                <td>¥<?php 
    echo $item['order_amount'];
    ?>
</td>
                <td>
                	<b class="orange"><?php 
    echo Order_Class::orderStatusText(Order_Class::getOrderStatus($item));
    ?>
</b>
                </td>
            <?php 
}
?>
            </tr>
            <tfoot><tr><td colspan="6" class="t_l"><?php 
echo $queryOrderList->getPageBar();
?>
</td></tr></tfoot>
        </table>
    </div>
</div>
	</div>
示例#3
0
 /**
  * 生成订单
  */
 function cart3()
 {
     $accept_name = IFilter::act(IReq::get('accept_name'));
     $province = IFilter::act(IReq::get('province'), 'int');
     $city = IFilter::act(IReq::get('city'), 'int');
     $area = IFilter::act(IReq::get('area'), 'int');
     $address = IFilter::act(IReq::get('address'));
     $mobile = IFilter::act(IReq::get('mobile'));
     $telphone = IFilter::act(IReq::get('telphone'));
     $zip = IFilter::act(IReq::get('zip'));
     $delivery_id = IFilter::act(IReq::get('delivery_id'), 'int');
     $accept_time = IFilter::act(IReq::get('accept_time'));
     $payment = IFilter::act(IReq::get('payment'), 'int');
     $order_message = IFilter::act(IReq::get('message'));
     $ticket_id = IFilter::act(IReq::get('ticket_id'), 'int');
     $taxes = IFilter::act(IReq::get('taxes'), 'float');
     $insured = IFilter::act(IReq::get('insured'), 'float');
     $tax_title = IFilter::act(IReq::get('tax_title'), 'text');
     $gid = IFilter::act(IReq::get('direct_gid'), 'int');
     $num = IFilter::act(IReq::get('direct_num'), 'int');
     $type = IFilter::act(IReq::get('direct_type'));
     //商品或者货品
     $promo = IFilter::act(IReq::get('direct_promo'));
     $active_id = IFilter::act(IReq::get('direct_active_id'), 'int');
     $takeself = IFilter::act(IReq::get('takeself'), 'int');
     $order_no = Order_Class::createOrderNum();
     $order_type = 0;
     $dataArray = array();
     //pr($_POST);
     //防止表单重复提交
     if (IReq::get('timeKey') != null) {
         if (ISafe::get('timeKey') == IReq::get('timeKey')) {
             IError::show(403, '订单数据不能被重复提交');
             exit;
         } else {
             ISafe::set('timeKey', IReq::get('timeKey'));
         }
     }
     if ($province == 0 || $city == 0 || $area == 0) {
         IError::show(403, '请填写收货地址的省市地区');
     }
     if ($delivery_id == 0) {
         IError::show(403, '请选择配送方式');
     }
     $user_id = $this->user['user_id'] == null ? 0 : $this->user['user_id'];
     //配送方式,判断是否为货到付款
     $deliveryObj = new IModel('delivery');
     $deliveryRow = $deliveryObj->getObj('id = ' . $delivery_id);
     if ($deliveryRow['type'] == 0) {
         if ($payment == 0) {
             IError::show(403, '请选择正确的支付方式');
         }
     } else {
         if ($deliveryRow['type'] == 1) {
             $payment = 0;
         } else {
             if ($deliveryRow['type'] == 2) {
                 if ($takeself == 0) {
                     IError::show(403, '请选择正确的自提点');
                 }
             }
         }
     }
     //如果不是自提方式自动清空自提点
     if ($deliveryRow['type'] != 2) {
         $takeself = 0;
     }
     //计算费用
     $countSumObj = new CountSum($user_id);
     //直接购买商品方式
     if ($type && $gid) {
         //计算$gid商品
         $goodsResult = $countSumObj->direct_count($gid, $type, $num, $promo, $active_id);
     } else {
         //计算购物车中的商品价格$goodsResult
         $goodsResult = $countSumObj->cart_count();
         //清空购物车
         IInterceptor::reg("cart@onFinishAction");
     }
     //判断商品商品是否存在
     if (is_string($goodsResult) || empty($goodsResult['goodsList'])) {
         IError::show(403, '商品数据错误');
         exit;
     }
     //需要选择的地址数
     $need_choose_addr_num = 1;
     if (count($goodsResult['goodsList']) == 1 && $goodsResult['count'] > 1) {
         $need_choose_addr_num = $goodsResult['count'];
     }
     //匹配收获地址
     $address_arr = IFilter::act(IReq::get('radio_address'), 'int');
     if (count($address_arr) != $need_choose_addr_num) {
         IError::show(403, '请选择' . $need_choose_addr_num . '个收货地址');
         exit;
     }
     //加入促销活动
     if ($promo && $active_id) {
         $activeObject = new Active($promo, $active_id, $user_id, $gid, $type, $num);
         $order_type = $activeObject->getOrderType();
     }
     //获取红包减免金额
     if ($ticket_id != '') {
         $memberObj = new IModel('member');
         $memberRow = $memberObj->getObj('user_id = ' . $user_id, 'prop,custom');
         if (ISafe::get('ticket_' . $ticket_id) == $ticket_id || stripos(',' . trim($memberRow['prop'], ',') . ',', ',' . $ticket_id . ',') !== false) {
             $propObj = new IModel('prop');
             $ticketRow = $propObj->getObj('id = ' . $ticket_id . ' and NOW() between start_time and end_time and type = 0 and is_close = 0 and is_userd = 0 and is_send = 1');
             if (!empty($ticketRow)) {
                 $dataArray['prop'] = $ticket_id;
             }
             //锁定红包状态
             $propObj->setData(array('is_close' => 2));
             $propObj->update('id = ' . $ticket_id);
         }
     }
     $paymentObj = new IModel('payment');
     $paymentRow = $paymentObj->getObj('id = ' . $payment, 'type,name');
     $paymentName = $paymentRow['name'];
     $paymentType = $paymentRow['type'];
     //记录seller_id
     $seller_id = 0;
     if ($gid) {
         $goodsObj = new IModel("goods");
         $sell = $goodsObj->getObj("id = " . $gid, 'seller_id');
         if ($sell['seller_id'] > 0) {
             $seller_id = $sell['seller_id'];
         }
     }
     //最终订单金额计算
     $orderData = $countSumObj->countOrderFee($goodsResult['sum'], $goodsResult['final_sum'], $goodsResult['weight'], $province, $delivery_id, $payment, $goodsResult['freeFreight'], $insured, $taxes);
     //生成的订单数据
     $dataArray = array('order_no' => $order_no, 'user_id' => $user_id, 'accept_name' => $accept_name, 'pay_type' => $payment, 'distribution' => $delivery_id, 'postcode' => $zip, 'telphone' => $telphone, 'province' => $province, 'city' => $city, 'area' => $area, 'address' => $address, 'mobile' => $mobile, 'create_time' => ITime::getDateTime(), 'postscript' => $order_message, 'accept_time' => $accept_time, 'exp' => $goodsResult['exp'], 'point' => $goodsResult['point'], 'type' => $order_type, 'prop' => isset($dataArray['prop']) ? $dataArray['prop'] : null, 'payable_amount' => $goodsResult['sum'], 'real_amount' => $goodsResult['final_sum'], 'payable_freight' => $orderData['deliveryOrigPrice'], 'real_freight' => $orderData['deliveryPrice'], 'pay_fee' => $orderData['paymentPrice'], 'invoice' => $taxes ? 1 : 0, 'invoice_title' => $tax_title, 'taxes' => $taxes, 'promotions' => $goodsResult['proReduce'] + $goodsResult['reduce'] + (isset($ticketRow['value']) ? $ticketRow['value'] : 0), 'order_amount' => $orderData['orderAmountPrice'] - (isset($ticketRow['value']) ? $ticketRow['value'] : 0), 'if_insured' => $insured ? 1 : 0, 'insured' => $insured, 'takeself' => $takeself, 'active_id' => $active_id, 'seller_id' => $seller_id, 'address_id' => implode(',', $address_arr));
     $dataArray['order_amount'] = $dataArray['order_amount'] <= 0 ? 0 : $dataArray['order_amount'];
     if ($seller_id) {
         $sellerObj = new IModel('seller');
         $seller = $sellerObj->getObj("id = '{$seller_id}'");
         if ($seller) {
             //商家的预存款不足以扣除订单总价的1.2%
             $nedd = floatval($dataArray['order_amount'] * (1.2 * 0.01));
             if ($seller['balance'] <= 0 || $seller['balance'] < $nedd) {
                 IError::show(403, '商家预存款不足,不能进行购买');
                 exit;
             }
         }
     }
     $orderObj = new IModel('order');
     $orderObj->setData($dataArray);
     $this->order_id = $orderObj->add();
     if ($this->order_id == false) {
         IError::show(403, '订单生成错误');
     }
     /*将订单中的商品插入到order_goods表*/
     $orderInstance = new Order_Class();
     $orderInstance->insertOrderGoods($this->order_id, $goodsResult);
     //记录用户默认习惯的数据
     if (!isset($memberRow['custom'])) {
         $memberObj = new IModel('member');
         $memberRow = $memberObj->getObj('user_id = ' . $user_id, 'custom');
     }
     $memberData = array('custom' => serialize(array('payment' => $payment, 'delivery' => $delivery_id, 'takeself' => $takeself)));
     $memberObj->setData($memberData);
     $memberObj->update('user_id = ' . $user_id);
     //收货地址的处理
     /* if($user_id)
     		{
     			$addressObj = new IModel('address');
     
     			//如果用户之前没有收货地址,那么会自动记录此次的地址信息并且为默认
     			$addressRow = $addressObj->getObj('user_id = '.$user_id);
     			if(empty($addressRow))
     			{
     				$addressData = array('default'=>'1','user_id'=>$user_id,'accept_name'=>$accept_name,'province'=>$province,'city'=>$city,'area'=>$area,'address'=>$address,'zip'=>$zip,'telphone'=>$telphone,'mobile'=>$mobile);
     				$addressObj->setData($addressData);
     				$addressObj->add();
     			}
     			else
     			{
     				//如果用户有收货地址,但是没有设置默认项,那么会自动设置此次地址信息为默认
     				$radio_address = intval(IReq::get('radio_address'));
     				if($radio_address != 0)
     				{
     					$addressDefRow = $addressObj->getObj('user_id = '.$user_id.' and `default` = 1');
     					if(empty($addressDefRow))
     					{
     						$addressData = array('default' => 1);
     						$addressObj->setData($addressData);
     						$addressObj->update('user_id = '.$user_id.' and id = '.$radio_address);
     					}
     				}
     			}
     		} */
     //获取备货时间
     $siteConfigObj = new Config("site_config");
     $site_config = $siteConfigObj->getInfo();
     $this->stockup_time = isset($site_config['stockup_time']) ? $site_config['stockup_time'] : 2;
     //数据渲染
     $this->order_num = $dataArray['order_no'];
     $this->final_sum = $dataArray['order_amount'];
     $this->payment = $paymentName;
     $this->paymentType = $paymentType;
     $this->delivery = $deliveryRow['name'];
     $this->tax_title = $tax_title;
     $this->deliveryType = $deliveryRow['type'];
     //订单金额为0时,订单自动完成
     if ($this->final_sum <= 0) {
         $order_id = Order_Class::updateOrderStatus($dataArray['order_no']);
         if ($order_id) {
             if ($user_id) {
                 $this->redirect('/site/success/message/' . urlencode("订单确认成功,等待发货") . '/?callback=ucenter/order_detail/id/' . $order_id);
             } else {
                 $this->redirect('/site/success/message/' . urlencode("订单确认成功,等待发货"));
             }
         } else {
             IError::show(403, '订单修改失败');
         }
     } else {
         $this->setRenderData($dataArray);
         $this->redirect('cart3');
     }
 }
示例#4
0
 /**
  * @brief 退款申请页面
  */
 public function refunds_update()
 {
     $order_goods_id = IFilter::act(IReq::get('order_goods_id'), 'int');
     $order_id = IFilter::act(IReq::get('order_id'), 'int');
     $user_id = $this->user['user_id'];
     $content = IFilter::act(IReq::get('content'), 'text');
     $message = '请完整填写内容';
     if (!$content) {
         $this->redirect('refunds', false);
         Util::showMessage($message);
     }
     $orderDB = new IModel('order');
     $goodsOrderDB = new IModel('order_goods');
     $orderRow = $orderDB->getObj("id = " . $order_id . " and user_id = " . $user_id);
     //判断订单是否付款
     if ($orderRow && Order_Class::isRefundmentApply($orderRow)) {
         $goodsOrderRow = $goodsOrderDB->getObj('id = ' . $order_goods_id . ' and order_id = ' . $order_id);
         //判断商品是否已经退货
         if ($goodsOrderRow && $goodsOrderRow['is_send'] != 2) {
             $refundsDB = new IModel('refundment_doc');
             //判断是否重复提交申请
             if ($refundsDB->getObj('order_id = ' . $order_id . ' and goods_id = ' . $goodsOrderRow['goods_id'] . ' and product_id = ' . $goodsOrderRow['product_id'] . ' and if_del = 0 and pay_status = 0')) {
                 $message = '您已经对此商品提交了退款申请,请耐心等待';
                 $this->redirect('refunds', false);
                 Util::showMessage($message);
             }
             $updateData = array('order_no' => $orderRow['order_no'], 'order_id' => $order_id, 'user_id' => $user_id, 'amount' => $goodsOrderRow['real_price'] * $goodsOrderRow['goods_nums'], 'time' => ITime::getDateTime(), 'content' => $content, 'goods_id' => $goodsOrderRow['goods_id'], 'product_id' => $goodsOrderRow['product_id']);
             $goodsDB = new IModel('goods');
             $goodsRow = $goodsDB->getObj('id = ' . $goodsOrderRow['goods_id']);
             //属于商户的商品
             if ($goodsRow && $goodsRow['seller_id']) {
                 $updateData['seller_id'] = $goodsRow['seller_id'];
             }
             //写入数据库
             $refundsDB->setData($updateData);
             $refundsDB->add();
             $this->redirect('refunds');
             exit;
         } else {
             $message = '此商品已经做了退款处理,请耐心等待';
         }
     } else {
         $message = '订单未付款';
     }
     $this->redirect('refunds', false);
     Util::showMessage($message);
 }
示例#5
0
 function spec_recycle_restore()
 {
     $id = IReq::get('id');
     if (!empty($id)) {
         $obj = new IModel('spec');
         $obj->setData(array('is_del' => 0));
         $obj->update(Order_Class::getWhere($id));
         $this->redirect('spec_recycle_list');
     } else {
         $this->redirect('spec_recycle_list', false);
         Util::showMessage('请选择要还原的广告位');
     }
 }
示例#6
0
"><?php 
    echo isset($item['accept_name']) ? $item['accept_name'] : "";
    ?>
</td>
					<td><span name="payStatusColor<?php 
    echo isset($item['pay_status']) ? $item['pay_status'] : "";
    ?>
"><?php 
    echo Order_Class::getOrderPayStatusText($item);
    ?>
</span></td>
					<td><span name="disStatusColor<?php 
    echo isset($item['distribution_status']) ? $item['distribution_status'] : "";
    ?>
"><?php 
    echo Order_Class::getOrderDistributionStatusText($item);
    ?>
</span></td>
					<td title="<?php 
    echo isset($item['distribute_name']) ? $item['distribute_name'] : "";
    ?>
"><?php 
    echo isset($item['distribute_name']) ? $item['distribute_name'] : "";
    ?>
</td>
					<td>
						<span class="prt" title="购物清单打印" onclick="window.open('<?php 
    echo IUrl::creatUrl("/order/shop_template/id/" . $item['id'] . "");
    ?>
');">购</span>
						<span class="prt" title="配货单打印" onclick="window.open('<?php 
示例#7
0
    $query->where = "order_id = {$refunds['order_id']} and goods_id = {$refunds['goods_id']} and product_id = {$refunds['product_id']}";
    $items = $query->find();
    foreach ($items as $key => $item) {
        ?>
						<?php 
        $goods = JSON::decode($item['goods_array']);
        ?>
						<?php 
        echo isset($goods['name']) ? $goods['name'] : "";
        ?>
 X <?php 
        echo isset($item['goods_nums']) ? $item['goods_nums'] : "";
        ?>
件
						【<?php 
        echo Order_Class::goodsSendStatus($item['is_send']);
        ?>
】
						<?php 
    }
    ?>
						<?php 
    if ($refunds['seller_id']) {
        ?>
						<a href="<?php 
        echo IUrl::creatUrl("/site/home/id/" . $refunds['seller_id'] . "");
        ?>
" target="_blank"><img src="<?php 
        echo IUrl::creatUrl("") . "views/" . $this->theme . "/skin/" . $this->skin . "/images/admin/seller_ico.png";
        ?>
" /></a>
示例#8
0
$queryRefundmentDocList = Api::run('getRefundmentDocList', $user_id);
?>
	    	<?php 
foreach ($queryRefundmentDocList->find() as $key => $item) {
    ?>
                <tr>
                	<td><?php 
    echo isset($item['order_no']) ? $item['order_no'] : "";
    ?>
</td>
                	<td><?php 
    echo isset($item['time']) ? $item['time'] : "";
    ?>
</td>
                	<td><?php 
    echo Order_Class::refundmentText($item['pay_status']);
    ?>
</td>
                	<td>
                		<?php 
    if ($item['pay_status'] == 0) {
        ?>
<a class="blue" href='javascript:delModel({link:"<?php 
        echo IUrl::creatUrl("/ucenter/refunds_del/id/" . $item['id'] . "");
        ?>
"})'>取消</a>|<?php 
    }
    ?>
                		<a class="blue" href="<?php 
    echo IUrl::creatUrl("/ucenter/refunds_detail/id/" . $item['id'] . "");
    ?>
示例#9
0
 /**
  * 生成订单
  */
 function cart3()
 {
     $accept_name = IFilter::act(IReq::get('accept_name'));
     $province = IFilter::act(IReq::get('province'), 'int');
     $city = IFilter::act(IReq::get('city'), 'int');
     $area = IFilter::act(IReq::get('area'), 'int');
     $address = IFilter::act(IReq::get('address'));
     $mobile = IFilter::act(IReq::get('mobile'));
     $telphone = IFilter::act(IReq::get('telphone'));
     $zip = IFilter::act(IReq::get('zip'));
     $delivery_id = IFilter::act(IReq::get('delivery_id'), 'int');
     $accept_time = IFilter::act(IReq::get('accept_time'));
     $payment = IFilter::act(IReq::get('payment'), 'int');
     $order_message = IFilter::act(IReq::get('message'));
     $ticket_id = IFilter::act(IReq::get('ticket_id'), 'int');
     $taxes = IFilter::act(IReq::get('taxes'), 'int');
     $tax_title = IFilter::act(IReq::get('tax_title'));
     $gid = IFilter::act(IReq::get('direct_gid'), 'int');
     $num = IFilter::act(IReq::get('direct_num'), 'int');
     $type = IFilter::act(IReq::get('direct_type'));
     //商品或者货品
     $promo = IFilter::act(IReq::get('direct_promo'));
     $active_id = IFilter::act(IReq::get('direct_active_id'), 'int');
     $takeself = IFilter::act(IReq::get('takeself'), 'int');
     $ticketUserd = IFilter::act(IReq::get('ticketUserd'), 'int');
     $order_type = 0;
     $dataArray = array();
     //防止表单重复提交
     if (IReq::get('timeKey') != null) {
         if (ISafe::get('timeKey') == IReq::get('timeKey')) {
             IError::show(403, '订单数据不能被重复提交');
             exit;
         } else {
             ISafe::set('timeKey', IReq::get('timeKey'));
         }
     }
     if ($province == 0 || $city == 0 || $area == 0) {
         IError::show(403, '请填写收货地址的省市地区');
     }
     if ($delivery_id == 0) {
         IError::show(403, '请选择配送方式');
     }
     $user_id = $this->user['user_id'] == null ? 0 : $this->user['user_id'];
     //配送方式,判断是否为货到付款
     $deliveryObj = new IModel('delivery');
     $deliveryRow = $deliveryObj->getObj('id = ' . $delivery_id);
     if ($deliveryRow['type'] == 0) {
         if ($payment == 0) {
             IError::show(403, '请选择正确的支付方式');
         }
     } else {
         if ($deliveryRow['type'] == 1) {
             $payment = 0;
         } else {
             if ($deliveryRow['type'] == 2) {
                 if ($takeself == 0) {
                     IError::show(403, '请选择正确的自提点');
                 }
             }
         }
     }
     //如果不是自提方式自动清空自提点
     if ($deliveryRow['type'] != 2) {
         $takeself = 0;
     }
     //计算费用
     $countSumObj = new CountSum($user_id);
     $goodsResult = $countSumObj->cart_count($gid, $type, $num, $promo, $active_id);
     if (!$gid) {
         //清空购物车
         IInterceptor::reg("cart@onFinishAction");
     }
     //判断商品商品是否存在
     if (is_string($goodsResult) || empty($goodsResult['goodsList'])) {
         IError::show(403, '商品数据错误');
         exit;
     }
     //加入促销活动
     if ($promo && $active_id) {
         $activeObject = new Active($promo, $active_id, $user_id, $gid, $type, $num);
         $order_type = $activeObject->getOrderType();
     }
     $paymentObj = new IModel('payment');
     $paymentRow = $paymentObj->getObj('id = ' . $payment, 'type,name');
     $paymentName = $paymentRow['name'];
     $paymentType = $paymentRow['type'];
     //最终订单金额计算
     $orderData = $countSumObj->countOrderFee($goodsResult, $province, $delivery_id, $payment, $taxes, 0, $promo, $active_id);
     if (is_string($orderData)) {
         IError::show(403, $orderData);
         exit;
     }
     //根据商品所属商家不同批量生成订单
     $orderIdArray = array();
     $orderNumArray = array();
     $final_sum = 0;
     foreach ($orderData as $seller_id => $goodsResult) {
         //生成的订单数据
         $dataArray = array('order_no' => Order_Class::createOrderNum(), 'user_id' => $user_id, 'accept_name' => $accept_name, 'pay_type' => $payment, 'distribution' => $delivery_id, 'postcode' => $zip, 'telphone' => $telphone, 'province' => $province, 'city' => $city, 'area' => $area, 'address' => $address, 'mobile' => $mobile, 'create_time' => ITime::getDateTime(), 'postscript' => $order_message, 'accept_time' => $accept_time, 'exp' => $goodsResult['exp'], 'point' => $goodsResult['point'], 'type' => $order_type, 'payable_amount' => $goodsResult['sum'], 'real_amount' => $goodsResult['final_sum'], 'payable_freight' => $goodsResult['deliveryOrigPrice'], 'real_freight' => $goodsResult['deliveryPrice'], 'pay_fee' => $goodsResult['paymentPrice'], 'invoice' => $taxes ? 1 : 0, 'invoice_title' => $tax_title, 'taxes' => $goodsResult['taxPrice'], 'promotions' => $goodsResult['proReduce'] + $goodsResult['reduce'], 'order_amount' => $goodsResult['orderAmountPrice'], 'insured' => $goodsResult['insuredPrice'], 'takeself' => $takeself, 'active_id' => $active_id, 'seller_id' => $seller_id, 'note' => '');
         //获取红包减免金额
         if ($ticket_id && $ticketUserd == $seller_id) {
             $memberObj = new IModel('member');
             $memberRow = $memberObj->getObj('user_id = ' . $user_id, 'prop,custom');
             //游客手动添加或注册用户道具中已有的代金券
             if (ISafe::get('ticket_' . $ticket_id) == $ticket_id || stripos(',' . trim($memberRow['prop'], ',') . ',', ',' . $ticket_id . ',') !== false) {
                 $propObj = new IModel('prop');
                 $ticketRow = $propObj->getObj('id = ' . $ticket_id . ' and NOW() between start_time and end_time and type = 0 and is_close = 0 and is_userd = 0 and is_send = 1');
                 if (!$ticketRow) {
                     IError::show(403, '代金券不可用');
                 }
                 if ($ticketRow['seller_id'] == 0 || $ticketRow['seller_id'] == $seller_id) {
                     $ticketRow['value'] = $ticketRow['value'] >= $goodsResult['final_sum'] ? $goodsResult['final_sum'] : $ticketRow['value'];
                     $dataArray['prop'] = $ticket_id;
                     $dataArray['promotions'] += $ticketRow['value'];
                     $dataArray['order_amount'] -= $ticketRow['value'];
                     $goodsResult['promotion'][] = array("plan" => "代金券", "info" => "使用了¥" . $ticketRow['value'] . "代金券");
                     //锁定红包状态
                     $propObj->setData(array('is_close' => 2));
                     $propObj->update('id = ' . $ticket_id);
                 }
             }
         }
         //促销规则
         if (isset($goodsResult['promotion']) && $goodsResult['promotion']) {
             foreach ($goodsResult['promotion'] as $key => $val) {
                 $dataArray['note'] .= " 【" . $val['info'] . "】 ";
             }
         }
         $dataArray['order_amount'] = $dataArray['order_amount'] <= 0 ? 0 : $dataArray['order_amount'];
         //生成订单插入order表中
         $orderObj = new IModel('order');
         $orderObj->setData($dataArray);
         $order_id = $orderObj->add();
         if ($order_id == false) {
             IError::show(403, '订单生成错误');
         }
         /*将订单中的商品插入到order_goods表*/
         $orderInstance = new Order_Class();
         $orderInstance->insertOrderGoods($order_id, $goodsResult['goodsResult']);
         //订单金额小于等于0直接免单
         if ($dataArray['order_amount'] <= 0) {
             Order_Class::updateOrderStatus($dataArray['order_no']);
         } else {
             $orderIdArray[] = $order_id;
             $orderNumArray[] = $dataArray['order_no'];
             $final_sum += $dataArray['order_amount'];
         }
     }
     //记录用户默认习惯的数据
     if (!isset($memberRow['custom'])) {
         $memberObj = new IModel('member');
         $memberRow = $memberObj->getObj('user_id = ' . $user_id, 'custom');
     }
     $memberData = array('custom' => serialize(array('payment' => $payment, 'delivery' => $delivery_id, 'takeself' => $takeself)));
     $memberObj->setData($memberData);
     $memberObj->update('user_id = ' . $user_id);
     //收货地址的处理
     if ($user_id) {
         $addressObj = new IModel('address');
         $addressDefRow = $addressObj->getObj('user_id = ' . $user_id . ' and `default` = 1');
         if (!$addressDefRow) {
             $radio_address = IFilter::act(IReq::get('radio_address'), 'int');
             $addressObj->setData(array('default' => 1));
             $addressObj->update('user_id = ' . $user_id . ' and id = ' . $radio_address);
         }
     }
     //获取备货时间
     $siteConfigObj = new Config("site_config");
     $site_config = $siteConfigObj->getInfo();
     $this->stockup_time = isset($site_config['stockup_time']) ? $site_config['stockup_time'] : 2;
     //数据渲染
     $this->order_id = join(",", $orderIdArray);
     $this->final_sum = $final_sum;
     $this->order_num = join(",", $orderNumArray);
     $this->payment = $paymentName;
     $this->paymentType = $paymentType;
     $this->delivery = $deliveryRow['name'];
     $this->tax_title = $tax_title;
     $this->deliveryType = $deliveryRow['type'];
     //订单金额为0时,订单自动完成
     if ($this->final_sum <= 0) {
         $this->redirect('/site/success/message/' . urlencode("订单确认成功,等待发货") . '/?callback=ucenter/order');
     } else {
         $this->setRenderData($dataArray);
         $this->redirect('cart3');
     }
 }
示例#10
0
 /**
  * @brief 获取订单中的支付信息 M:必要信息; R表示店铺; P表示用户;
  * @param $payment_id 			int    支付方式ID
  * @param $type      			string 信息获取方式 order:订单支付;recharge:在线充值;
  * @param $argument   			mix    参数
  * @return array 支付提交信息
  */
 public static function getPaymentInfo($payment_id, $type, $argument)
 {
     //最终返回值
     $payment = array();
     //初始化配置参数
     $paymentInstance = Payment::createPaymentInstance($payment_id);
     $configParam = $paymentInstance->configParam();
     foreach ($configParam as $key => $val) {
         $payment[$key] = '';
     }
     //获取公共信息
     $paymentRow = self::getPaymentById($payment_id, 'config_param');
     if ($paymentRow) {
         $paymentRow = JSON::decode($paymentRow);
         foreach ($paymentRow as $key => $item) {
             $payment[$key] = $item;
         }
     }
     //print_r($payment);die;
     if ($type == 'order') {
         $order_id = $argument;
         //获取订单信息
         $orderObj = new IModel('order');
         $orderRow = $orderObj->getObj('id = ' . $order_id . ' and status = 1');
         if (empty($orderRow)) {
             IError::show(403, '订单信息不正确,不能进行支付');
         }
         //是商家的订单的话,收款信息为商家个人
         if ($orderRow['seller_id'] > 0) {
             $configParam = $paymentInstance->sellerConfigParam($orderRow['seller_id']);
             if ($configParam == 0) {
                 IError::show(403, '商家收款信息未填写,不能进行支付');
             } else {
                 //重写收款信息
                 foreach ($configParam as $key => $val) {
                     $payment[$key] = $val;
                 }
             }
         }
         $payment['M_Remark'] = $orderRow['postscript'];
         $payment['M_OrderId'] = $orderRow['id'];
         $payment['M_OrderNO'] = $orderRow['order_no'];
         $payment['M_Amount'] = $orderRow['order_amount'];
         //用户信息
         $payment['P_Mobile'] = $orderRow['mobile'];
         $payment['P_Name'] = $orderRow['accept_name'];
         $payment['P_PostCode'] = $orderRow['postcode'];
         $payment['P_Telephone'] = $orderRow['telphone'];
         $payment['P_Address'] = $orderRow['address'];
     } else {
         if ($type == 'recharge') {
             if (ISafe::get('user_id') == null) {
                 IError::show(403, '请登录系统');
             }
             if (!isset($argument['account']) || $argument['account'] <= 0) {
                 IError::show(403, '请填入正确的充值金额');
             }
             $rechargeObj = new IModel('online_recharge');
             $reData = array('user_id' => ISafe::get('user_id'), 'recharge_no' => Order_Class::createOrderNum(), 'account' => $argument['account'], 'time' => ITime::getDateTime(), 'payment_name' => $argument['paymentName']);
             $rechargeObj->setData($reData);
             $r_id = $rechargeObj->add();
             //充值时用户id跟随交易号一起发送,以"_"分割
             $payment['M_OrderNO'] = 'recharge_' . $reData['recharge_no'];
             $payment['M_OrderId'] = $r_id;
             $payment['M_Amount'] = $reData['account'];
         }
     }
     $siteConfigObj = new Config("site_config");
     $site_config = $siteConfigObj->getInfo();
     //交易信息
     $payment['M_Time'] = time();
     $payment['M_Paymentid'] = $payment_id;
     //店铺信息
     $payment['R_Address'] = isset($site_config['address']) ? $site_config['address'] : '';
     $payment['R_Name'] = isset($site_config['name']) ? $site_config['name'] : '';
     $payment['R_Mobile'] = isset($site_config['mobile']) ? $site_config['mobile'] : '';
     $payment['R_Telephone'] = isset($site_config['phone']) ? $site_config['phone'] : '';
     return $payment;
 }
示例#11
0
				<col width="150px" />
				<col />
			</colgroup>

			<tr>
				<th>订单号:</th>
				<td><?php 
echo isset($this->data['order_no']) ? $this->data['order_no'] : "";
?>
</td>
			</tr>

			<tr>
				<th>处理结果:</th>
				<td><?php 
echo Order_Class::refundmentText($this->data['pay_status']);
?>
</td>
			</tr>

			<tr>
				<th>退款商品:</th>
				<?php 
$goodsInfo = JSON::decode($this->data['goods']['goods_array']);
?>
				<td><a class="blue" href="<?php 
echo IUrl::creatUrl("/site/products/id/" . $this->data['goods_id'] . "");
?>
" href="_blank"><?php 
echo isset($goodsInfo['name']) ? $goodsInfo['name'] : "";
?>
示例#12
0
 public function order_status()
 {
     $op = IReq::get('op');
     $id = IFilter::act(IReq::get('order_id'), 'int');
     $model = new IModel('order');
     switch ($op) {
         case "cancel":
             $model->setData(array('status' => 3));
             break;
         case "confirm":
             $model->setData(array('status' => 5, 'completion_time' => date('Y-m-d h:i:s')));
             break;
     }
     //修改订单状态并且判断订单的所有者权限
     if ($model->update("id = " . $id . " and user_id = " . $this->user['user_id'])) {
         switch ($op) {
             //取消订单
             case "cancel":
                 //修改红包状态
                 $prop_obj = $model->getObj('id=' . $id, 'prop');
                 $prop_id = isset($prop_obj['prop']) ? $prop_obj['prop'] : '';
                 if ($prop_id != '') {
                     $prop = new IModel('prop');
                     $prop->setData(array('is_close' => 0));
                     $prop->update('id=' . $prop_id);
                 }
                 break;
             case "confirm":
                 //增加用户评论商品机会
                 Order_Class::addGoodsCommentChange($id);
                 break;
         }
     }
     $this->redirect("order_detail/id/{$id}");
 }
示例#13
0
 /**
  * @brief 获取订单中的支付信息 M:必要信息; R表示店铺; P表示用户;
  * @param $payment_id int    支付方式ID
  * @param $type       string 信息获取方式 order:订单支付;recharge:在线充值;
  * @param $argument   mix    参数
  * @return array 支付提交信息
  */
 public static function getPaymentInfo($payment_id, $type, $argument)
 {
     //最终返回值
     $payment = array();
     //获取公共信息
     $paymentRow = self::getPaymentById($payment_id);
     $payment['M_PartnerId'] = $paymentRow['partner_id'];
     $payment['M_PartnerKey'] = $paymentRow['partner_key'];
     if ($type == 'order') {
         $order_id = $argument;
         //获取订单信息
         $orderObj = new IModel('order');
         $orderRow = $orderObj->getObj('id = ' . $order_id . ' and status = 1');
         if (empty($orderRow)) {
             IError::show(403, '订单信息不正确,不能进行支付');
         }
         $payment['M_Remark'] = $orderRow['postscript'];
         $payment['M_OrderId'] = $orderRow['id'];
         $payment['M_OrderNO'] = $orderRow['order_no'];
         $payment['M_Amount'] = $orderRow['order_amount'];
         //用户信息
         $payment['P_Mobile'] = $orderRow['mobile'];
         $payment['P_Name'] = $orderRow['accept_name'];
         $payment['P_PostCode'] = $orderRow['postcode'];
         $payment['P_Telephone'] = $orderRow['telphone'];
         $payment['P_Address'] = $orderRow['address'];
     } else {
         if ($type == 'recharge') {
             if (ISafe::get('user_id') == null) {
                 IError::show(403, '请登录系统');
             }
             if (!isset($argument['account']) || $argument['account'] <= 0) {
                 IError::show(403, '请填入正确的充值金额');
             }
             $rechargeObj = new IModel('online_recharge');
             $reData = array('user_id' => ISafe::get('user_id'), 'recharge_no' => Order_Class::createOrderNum(), 'account' => $argument['account'], 'time' => ITime::getDateTime(), 'payment_name' => $argument['paymentName']);
             $rechargeObj->setData($reData);
             $r_id = $rechargeObj->add();
             //充值时用户id跟随交易号一起发送,以"_"分割
             $payment['M_OrderNO'] = 'recharge_' . $reData['recharge_no'];
             $payment['M_OrderId'] = $r_id;
             $payment['M_Amount'] = $reData['account'];
         }
     }
     $siteConfigObj = new Config("site_config");
     $site_config = $siteConfigObj->getInfo();
     //交易信息
     $payment['M_Time'] = time();
     $payment['M_Paymentid'] = $payment_id;
     //店铺信息
     $payment['R_Address'] = isset($site_config['address']) ? $site_config['address'] : '';
     $payment['R_Name'] = isset($site_config['name']) ? $site_config['name'] : '';
     $payment['R_Mobile'] = isset($site_config['mobile']) ? $site_config['mobile'] : '';
     $payment['R_Telephone'] = isset($site_config['phone']) ? $site_config['phone'] : '';
     return $payment;
 }
示例#14
0
 /**
  * 生成订单
  */
 function cart3()
 {
     $accept_name = IFilter::act(IReq::get('accept_name'));
     $province = IFilter::act(IReq::get('province'), 'int');
     $city = IFilter::act(IReq::get('city'), 'int');
     $area = IFilter::act(IReq::get('area'), 'int');
     $address = IFilter::act(IReq::get('address'));
     $mobile = IFilter::act(IReq::get('mobile'));
     $telphone = IFilter::act(IReq::get('telphone'));
     $zip = IFilter::act(IReq::get('zip'));
     $delivery_id = IFilter::act(IReq::get('delivery_id'), 'int');
     $accept_time = IFilter::act(IReq::get('accept_time'));
     $payment = IFilter::act(IReq::get('payment'), 'int');
     $order_message = IFilter::act(IReq::get('message'));
     $ticket_id = IFilter::act(IReq::get('ticket_id'), 'int');
     $taxes = IFilter::act(IReq::get('taxes'), 'float');
     $insured = IFilter::act(IReq::get('insured'), 'float');
     $tax_title = IFilter::act(IReq::get('tax_title'), 'text');
     $gid = IFilter::act(IReq::get('direct_gid'), 'int');
     $num = IFilter::act(IReq::get('direct_num'), 'int');
     $type = IFilter::act(IReq::get('direct_type'));
     //商品或者货品
     $promo = IFilter::act(IReq::get('direct_promo'));
     $active_id = IFilter::act(IReq::get('direct_active_id'), 'int');
     $order_no = Order_Class::createOrderNum();
     $order_type = 0;
     $dataArray = array();
     //防止表单重复提交
     if (IReq::get('timeKey') != null) {
         if (ISafe::get('timeKey') == IReq::get('timeKey')) {
             IError::show(403, '订单数据不能被重复提交');
             exit;
         } else {
             ISafe::set('timeKey', IReq::get('timeKey'));
         }
     }
     if ($province == 0 || $city == 0 || $area == 0) {
         IError::show(403, '请填写收货地址的省市地区');
     }
     if ($delivery_id == 0) {
         IError::show(403, '请选择配送方式');
     }
     $user_id = $this->user['user_id'] == null ? 0 : $this->user['user_id'];
     //活动特殊处理
     if ($promo != '' && $active_id != '') {
         //团购
         if ($promo == 'groupon') {
             $hashId = $user_id ? $user_id : ICookie::get("regiment_{$active_id}");
             //此团购还存在已经报名但是未付款的情况
             if (regiment::hasJoined($active_id, $hashId) == true) {
                 IError::show(403, '您已经参加过此次团购,请先完成支付');
                 exit;
             }
             //团购已经达到限定的人数
             if (regiment::isFull($active_id) == true) {
                 IError::show(403, '此团购的参加人数已满');
                 exit;
             }
             $order_type = 1;
             //团购开始报名
             $joinUserId = $user_id ? $user_id : null;
             $resultData = regiment::join($active_id, $joinUserId);
             $is_success = '';
             if ($resultData['flag'] == true) {
                 $regimentRelationObj = new IModel('regiment_user_relation');
                 $regimentRelationObj->setData(array('order_no' => $order_no));
                 $is_success = $regimentRelationObj->update('id = ' . $resultData['relation_id']);
             }
             if ($is_success == '' || $resultData['flag'] == false) {
                 $errorMsg = isset($resultData['data']) && $resultData['data'] != '' ? $resultData['data'] : '团购报名失败';
                 IError::show(403, $errorMsg);
                 exit;
             }
         } else {
             if ($promo == 'time') {
                 $order_type = 2;
             }
         }
     }
     //付款方式,判断是否为货到付款
     $deliveryObj = new IModel('delivery');
     $deliveryRow = $deliveryObj->getObj('id = ' . $delivery_id);
     if ($deliveryRow['type'] == 0 && $payment == 0) {
         IError::show(403, '请选择支付方式');
     } else {
         if ($deliveryRow['type'] == 1) {
             $payment = 0;
         }
     }
     //计算费用
     $countSumObj = new CountSum();
     //直接购买商品方式
     if ($type != '' && $gid != 0) {
         //计算$gid商品
         $goodsResult = $countSumObj->direct_count($gid, $type, $num, $promo, $active_id);
     } else {
         //计算购物车中的商品价格$goodsResult
         $goodsResult = $countSumObj->cart_count();
         //清空购物车
         $cartObj = new Cart();
         $cartObj->clear();
     }
     //判断商品商品是否存在
     if (empty($goodsResult['goodsList']) && empty($goodsResult['productList'])) {
         IError::show(403, '商品数据不存在');
         exit;
     }
     //获取红包减免金额
     if ($ticket_id != '') {
         $memberObj = new IModel('member');
         $memberRow = $memberObj->getObj('user_id = ' . $user_id, 'prop,custom');
         if (ISafe::get('ticket_' . $ticket_id) == $ticket_id || stripos(',' . trim($memberRow['prop'], ',') . ',', ',' . $ticket_id . ',') !== false) {
             $propObj = new IModel('prop');
             $ticketRow = $propObj->getObj('id = ' . $ticket_id . ' and NOW() between start_time and end_time and type = 0 and is_close = 0 and is_userd = 0 and is_send = 1');
             if (!empty($ticketRow)) {
                 $dataArray['prop'] = $ticket_id;
             }
             //锁定红包状态
             $propObj->setData(array('is_close' => 2));
             $propObj->update('id = ' . $ticket_id);
         }
     }
     //货到付款的方式
     if ($payment == 0) {
         $paymentName = '货到付款';
         $paymentType = 0;
     } else {
         $paymentObj = new IModel('payment');
         $paymentRow = $paymentObj->getObj('id = ' . $payment, 'type,name');
         $paymentName = $paymentRow['name'];
         $paymentType = $paymentRow['type'];
     }
     //最终订单金额计算
     $orderData = $countSumObj->countOrderFee($goodsResult['sum'], $goodsResult['final_sum'], $goodsResult['weight'], $province, $delivery_id, $payment, $goodsResult['freeFreight'], $insured, $taxes);
     //生成的订单数据
     $dataArray = array('order_no' => $order_no, 'user_id' => $user_id, 'accept_name' => $accept_name, 'pay_type' => $payment, 'distribution' => $delivery_id, 'postcode' => $zip, 'telphone' => $telphone, 'province' => $province, 'city' => $city, 'area' => $area, 'address' => $address, 'mobile' => $mobile, 'create_time' => ITime::getDateTime(), 'postscript' => $order_message, 'accept_time' => $accept_time, 'exp' => $goodsResult['exp'], 'point' => $goodsResult['point'], 'type' => $order_type, 'prop' => isset($dataArray['prop']) ? $dataArray['prop'] : null, 'payable_amount' => $goodsResult['sum'], 'real_amount' => $goodsResult['final_sum'], 'payable_freight' => $orderData['deliveryOrigPrice'], 'real_freight' => $orderData['deliveryPrice'], 'pay_fee' => $orderData['paymentPrice'], 'invoice' => $taxes ? 1 : 0, 'invoice_title' => $tax_title, 'taxes' => $taxes, 'promotions' => $goodsResult['proReduce'] + $goodsResult['reduce'] + (isset($ticketRow['value']) ? $ticketRow['value'] : 0), 'order_amount' => $orderData['orderAmountPrice'] - (isset($ticketRow['value']) ? $ticketRow['value'] : 0), 'if_insured' => $insured ? 1 : 0, 'insured' => $insured);
     $dataArray['order_amount'] = $dataArray['order_amount'] <= 0 ? 0 : $dataArray['order_amount'];
     $orderObj = new IModel('order');
     $orderObj->setData($dataArray);
     $this->order_id = $orderObj->add();
     if ($this->order_id == false) {
         IError::show(403, '订单生成错误');
     }
     /*将订单中的商品插入到order_goods表*/
     $orderInstance = new Order_Class();
     $orderInstance->insertOrderGoods($this->order_id, $goodsResult);
     //记录用户默认习惯的数据
     if (!isset($memberRow['custom'])) {
         $memberObj = new IModel('member');
         $memberRow = $memberObj->getObj('user_id = ' . $user_id, 'custom');
     }
     $memberData = array('custom' => serialize(array('payment' => $payment, 'delivery' => $delivery_id)));
     $memberObj->setData($memberData);
     $memberObj->update('user_id = ' . $user_id);
     //收货地址的处理
     if ($user_id) {
         $addressObj = new IModel('address');
         //如果用户之前没有收货地址,那么会自动记录此次的地址信息并且为默认
         $addressRow = $addressObj->getObj('user_id = ' . $user_id);
         if (empty($addressRow)) {
             $addressData = array('default' => '1', 'user_id' => $user_id, 'accept_name' => $accept_name, 'province' => $province, 'city' => $city, 'area' => $area, 'address' => $address, 'zip' => $zip, 'telphone' => $telphone, 'mobile' => $mobile);
             $addressObj->setData($addressData);
             $addressObj->add();
         } else {
             //如果用户有收货地址,但是没有设置默认项,那么会自动设置此次地址信息为默认
             $radio_address = intval(IReq::get('radio_address'));
             if ($radio_address != 0) {
                 $addressDefRow = $addressObj->getObj('user_id = ' . $user_id . ' and `default` = 1');
                 if (empty($addressDefRow)) {
                     $addressData = array('default' => 1);
                     $addressObj->setData($addressData);
                     $addressObj->update('user_id = ' . $user_id . ' and id = ' . $radio_address);
                 }
             }
         }
     }
     //获取备货时间
     $siteConfigObj = new Config("site_config");
     $site_config = $siteConfigObj->getInfo();
     $this->stockup_time = isset($site_config['stockup_time']) ? $site_config['stockup_time'] : 2;
     //数据渲染
     $this->order_num = $dataArray['order_no'];
     $this->final_sum = $dataArray['order_amount'];
     $this->payment = $paymentName;
     $this->paymentType = $paymentType;
     $this->delivery = $deliveryRow['name'];
     $this->tax_title = $tax_title;
     $this->deliveryType = $deliveryRow['type'];
     //订单金额为0时,订单自动完成
     if ($this->final_sum <= 0) {
         $order_id = Order_Class::updateOrderStatus($dataArray['order_no']);
         if ($order_id != '') {
             if ($user_id) {
                 $this->redirect('/site/success/message/' . urlencode("订单确认成功,等待发货") . '/?callback=ucenter/order_detail/id/' . $order_id);
             } else {
                 $this->redirect('/site/success/message/' . urlencode("订单确认成功,等待发货"));
             }
         } else {
             IError::show(403, '订单修改失败');
         }
     } else {
         $this->setRenderData($dataArray);
         $this->redirect('cart3');
     }
 }
示例#15
0
</td>
				<td>
					<?php 
    $orderStatus = Order_Class::getOrderStatus($item);
    ?>
					<b class="<?php 
    if ($orderStatus >= 6) {
        ?>
green<?php 
    } else {
        ?>
orange<?php 
    }
    ?>
"><?php 
    echo Order_Class::orderStatusText($orderStatus);
    ?>
</b>
				</td>
			</tr>
			<?php 
}
?>

			<tfoot><tr><td colspan="6" class="t_r"><a class="blue" href="<?php 
echo IUrl::creatUrl("/ucenter/order");
?>
">更多订单&gt;&gt;</a></td></tr></tfoot>
		</table>
	</div>
	<div class="box">
示例#16
0
 /**
  * @brief 【重要】支付回调[异步]
  */
 function server_callback()
 {
     //从URL中获取支付方式
     $payment_id = IFilter::act(IReq::get('_id'), 'int');
     $paymentInstance = Payment::createPaymentInstance($payment_id);
     if (!is_object($paymentInstance)) {
         die('fail');
     }
     //初始化参数
     $money = '';
     $message = '支付失败';
     $orderNo = '';
     //执行接口回调函数
     $callbackData = array_merge($_POST, $_GET);
     unset($callbackData['controller']);
     unset($callbackData['action']);
     unset($callbackData['_id']);
     $return = $paymentInstance->serverCallback($callbackData, $payment_id, $money, $message, $orderNo);
     //支付成功
     if ($return == 1) {
         //充值方式
         if (stripos($orderNo, 'recharge') !== false) {
             $tradenoArray = explode('recharge', $orderNo);
             $recharge_no = isset($tradenoArray[1]) ? $tradenoArray[1] : 0;
             if (payment::updateRecharge($recharge_no)) {
                 $paymentInstance->notifyStop();
                 exit;
             }
         } else {
             //读取批量订单付款
             $cacheObj = new ICache('file');
             $moreOrder = $cacheObj->get($orderNo);
             $moreOrder = $moreOrder ? explode(",", $moreOrder) : array($orderNo);
             foreach ($moreOrder as $key => $item) {
                 $order_id = Order_Class::updateOrderStatus($item);
                 if (!$order_id) {
                     throw new IException("异步支付回调修改状态错误,订单ID:" . $order_id);
                 }
             }
             $paymentInstance->notifyStop();
             exit;
         }
     } else {
         $paymentInstance->notifyStop();
         exit;
     }
 }
示例#17
0
 /**
  * @brief 【重要】支付回调[异步]
  */
 function server_callback()
 {
     //从URL中获取支付方式
     $payment_id = IFilter::act(IReq::get('_id'), 'int');
     $paymentInstance = Payment::createPaymentInstance($payment_id);
     if (!is_object($paymentInstance)) {
         die('fail');
     }
     //初始化参数
     $money = '';
     $message = '支付失败';
     $orderNo = '';
     //执行接口回调函数
     $callbackData = array_merge($_POST, $_GET);
     unset($callbackData['controller']);
     unset($callbackData['action']);
     unset($callbackData['_id']);
     $return = $paymentInstance->callback($callbackData, $payment_id, $money, $message, $orderNo);
     //支付成功
     if ($return == 1) {
         //充值方式
         if (stripos($orderNo, 'recharge_') !== false) {
             $tradenoArray = explode('_', $orderNo);
             $recharge_no = isset($tradenoArray[1]) ? $tradenoArray[1] : 0;
             if (payment::updateRecharge($recharge_no)) {
                 $paymentInstance->notifyStop();
                 exit;
             }
         } else {
             $order_id = Order_Class::updateOrderStatus($orderNo);
             if ($order_id) {
                 $paymentInstance->notifyStop();
                 exit;
             }
         }
     } else {
         $paymentInstance->notifyStop();
         exit;
     }
 }
示例#18
0
 /**
  * @brief 获取订单中的支付信息 M:必要信息; R表示店铺; P表示用户;
  * @param $payment_id int    支付方式ID
  * @param $type       string 信息获取方式 order:订单支付;recharge:在线充值;
  * @param $argument   mix    参数
  * @return array 支付提交信息
  */
 public static function getPaymentInfo($payment_id, $type, $argument)
 {
     //最终返回值
     $payment = array();
     //初始化配置参数
     $paymentInstance = Payment::createPaymentInstance($payment_id);
     $configParam = $paymentInstance->configParam();
     foreach ($configParam as $key => $val) {
         $payment[$key] = '';
     }
     //获取公共信息
     $paymentRow = self::getPaymentById($payment_id, 'config_param');
     if ($paymentRow) {
         $paymentRow = JSON::decode($paymentRow);
         foreach ($paymentRow as $key => $item) {
             $payment[$key] = $item;
         }
     }
     if ($type == 'order') {
         $orderIdArray = $argument;
         $M_Amount = 0;
         $M_OrderNO = array();
         foreach ($orderIdArray as $key => $order_id) {
             //获取订单信息
             $orderObj = new IModel('order');
             $orderRow = $orderObj->getObj('id = ' . $order_id . ' and status = 1');
             if (empty($orderRow)) {
                 IError::show(403, '订单信息不正确,不能进行支付');
             }
             //判断商品库存
             $orderGoodsDB = new IModel('order_goods');
             $orderGoodsList = $orderGoodsDB->query('order_id = ' . $order_id);
             foreach ($orderGoodsList as $key => $val) {
                 if (!goods_class::checkStore($val['goods_nums'], $val['goods_id'], $val['product_id'])) {
                     IError::show(403, '商品库存不足无法支付,请重新下单');
                 }
             }
             $M_Amount += $orderRow['order_amount'];
             $M_OrderNO[] = $orderRow['order_no'];
         }
         $payment['M_Remark'] = $orderRow['postscript'];
         $payment['M_OrderId'] = $orderRow['id'];
         $payment['M_OrderNO'] = $orderRow['order_no'];
         $payment['M_Amount'] = $M_Amount;
         //用户信息
         $payment['P_Mobile'] = $orderRow['mobile'];
         $payment['P_Name'] = $orderRow['accept_name'];
         $payment['P_PostCode'] = $orderRow['postcode'];
         $payment['P_Telephone'] = $orderRow['telphone'];
         $payment['P_Address'] = $orderRow['address'];
         //订单批量结算缓存机制
         $cacheObj = new ICache('file');
         $cacheObj->set($payment['M_OrderNO'], join(",", $M_OrderNO));
     } else {
         if ($type == 'recharge') {
             if (ISafe::get('user_id') == null) {
                 IError::show(403, '请登录系统');
             }
             if (!isset($argument['account']) || $argument['account'] <= 0) {
                 IError::show(403, '请填入正确的充值金额');
             }
             $rechargeObj = new IModel('online_recharge');
             $reData = array('user_id' => ISafe::get('user_id'), 'recharge_no' => Order_Class::createOrderNum(), 'account' => $argument['account'], 'time' => ITime::getDateTime(), 'payment_name' => $argument['paymentName']);
             $rechargeObj->setData($reData);
             $r_id = $rechargeObj->add();
             //充值时用户id跟随交易号一起发送,以"_"分割
             $payment['M_OrderNO'] = 'recharge' . $reData['recharge_no'];
             $payment['M_OrderId'] = $r_id;
             $payment['M_Amount'] = $reData['account'];
         }
     }
     $siteConfigObj = new Config("site_config");
     $site_config = $siteConfigObj->getInfo();
     //交易信息
     $payment['M_Time'] = time();
     $payment['M_Paymentid'] = $payment_id;
     //店铺信息
     $payment['R_Address'] = isset($site_config['address']) ? $site_config['address'] : '';
     $payment['R_Name'] = isset($site_config['name']) ? $site_config['name'] : '';
     $payment['R_Mobile'] = isset($site_config['mobile']) ? $site_config['mobile'] : '';
     $payment['R_Telephone'] = isset($site_config['phone']) ? $site_config['phone'] : '';
     return $payment;
 }
示例#19
0
 public function expresswaybill_template()
 {
     $this->layout = 'print';
     $data = array();
     //获得order_id的值
     $order_id = IFilter::act(IReq::get('id'));
     $order_id = is_array($order_id) ? join(',', $order_id) : $order_id;
     if (!$order_id) {
         $this->redirect('order_list');
         exit;
     }
     $ord_class = new Order_Class();
     $this->orderInfo = $ord_class->getOrderInfo($order_id);
     $this->redirect('expresswaybill_template');
 }
示例#20
0
 public function order_report()
 {
     //搜索条件
     $search = IFilter::act(IReq::get('search'), 'strict');
     //条件筛选处理
     list($join, $where) = order_class::getSearchCondition($search);
     //拼接sql
     $orderHandle = new IQuery('order as o');
     $orderHandle->order = "o.id desc";
     $orderHandle->fields = "o.*,d.name as distribute_name,u.username,p.name as payment_name";
     $orderHandle->join = $join;
     $orderHandle->where = $where;
     $orderList = $orderHandle->find();
     $strTable = '<table width="500" border="1">';
     $strTable .= '<tr>';
     $strTable .= '<td style="text-align:center;font-size:12px;width:120px;">订单编号</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;width:120px;">商家id</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;width:120px;">区</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="100">日期</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">收货人</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">电话</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">订单金额</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">实际支付</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">支付方式</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">支付状态</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">发货状态</td>';
     $strTable .= '<td style="text-align:center;font-size:12px;" width="*">商品信息</td>';
     $strTable .= '</tr>';
     foreach ($orderList as $k => $val) {
         $strTable .= '<tr>';
         $strTable .= '<td style="text-align:center;font-size:12px;">&nbsp;' . $val['order_no'] . '</td>';
         $strTable .= '<td style="text-align:center;font-size:12px;">&nbsp;' . $val['seller_id'] . '</td>';
         $strTable .= '<td style="text-align:center;font-size:12px;">&nbsp;' . $val['area'] . '</td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['create_time'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['accept_name'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">&nbsp;' . $val['telphone'] . '&nbsp;' . $val['mobile'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['payable_amount'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['real_amount'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $val['payment_name'] . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . Order_Class::getOrderPayStatusText($val) . ' </td>';
         $strTable .= '<td style="text-align:left;font-size:12px;">' . Order_Class::getOrderDistributionStatusText($val) . ' </td>';
         $orderGoods = Order_class::getOrderGoods($val['id']);
         $strGoods = "";
         foreach ($orderGoods as $good) {
             $strGoods .= "商品编号:" . $good->goodsno . " 商品名称:" . $good->name;
             if ($good->value != '') {
                 $strGoods .= " 规格:" . $good->value;
             }
             $strGoods .= "<br />";
         }
         unset($orderGoods);
         $strTable .= '<td style="text-align:left;font-size:12px;">' . $strGoods . ' </td>';
         $strTable .= '</tr>';
     }
     $strTable .= '</table>';
     unset($orderList);
     $reportObj = new report();
     $reportObj->setFileName('order');
     $reportObj->toDownload($strTable);
     exit;
 }
示例#21
0
 function refundment_update()
 {
     $id = IFilter::act(IReq::get('id'), 'int');
     $pay_status = IFilter::act(IReq::get('pay_status'), 'int');
     $dispose_idea = IFilter::act(IReq::get('dispose_idea'));
     //商户处理退款
     if ($id && Order_Class::isSellerRefund($id, $this->seller['seller_id']) == 2) {
         $tb_refundment_doc = new IModel('refundment_doc');
         $updateData = array('dispose_time' => ITime::getDateTime(), 'dispose_idea' => $dispose_idea, 'pay_status' => $pay_status);
         $tb_refundment_doc->setData($updateData);
         $tb_refundment_doc->update('id = ' . $id);
         if ($pay_status == 2) {
             $result = Order_Class::refund($id, $this->seller['seller_id'], 'seller');
             if (!$result) {
                 die('退款失败');
             }
         }
     }
     $this->redirect('refundment_list');
 }
示例#22
0
					<a href="<?php 
    echo IUrl::creatUrl("/site/home/id/" . $seller_id . "");
    ?>
" target="_blank"><img src="<?php 
    echo IUrl::creatUrl("") . "views/" . $this->theme . "/skin/" . $this->skin . "/images/admin/seller_ico.png";
    ?>
" /></a>
					<?php 
}
?>
				</td>
			</tr>
			<tr class='t_l'>
				<th>处理状态</th>
				<td><?php 
echo Order_Class::refundmentText($pay_status);
?>
</td>
			</tr>
			<tr class='t_l'>
				<th>处理时间:</th><td><?php 
echo isset($dispose_time) ? $dispose_time : "";
?>
</td>
			</tr>
			<tr class='t_l'>
				<th>退款原因:</th><td><?php 
echo isset($content) ? $content : "";
?>
</td>
			</tr>