<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Shop\Web\Controller; use ModStart\App\Web\Layout\WebPage; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Exception\BizException; use ModStart\Core\Input\Request; use ModStart\Core\Input\Response; use ModStart\Field\AbstractField; use ModStart\Field\AutoRenderedFieldValue; use ModStart\Grid\Grid; use ModStart\Grid\GridFilter; use ModStart\Repository\Filter\RepositoryFilter; use ModStart\Widget\Box; use Module\Express\Provider\ExpressTransportProvider; use Module\Express\Util\ExpressUtil; use Module\Member\Auth\MemberUser; use Module\Member\Support\MemberLoginCheck; use Module\Member\Web\Controller\MemberFrameController; use Module\PayCenter\Support\PayCenterPerform; use Module\Shop\Constant\PayConstant; use Module\Shop\Util\GoodsUtil; use Module\Shop\Util\OrderUtil; use Module\Vendor\Type\OrderStatus; class ShopOrderMemberController extends MemberFrameController implements MemberLoginCheck { public function index(WebPage $iXUoW) { goto DCW0K; MYim6: $W3CVY->repositoryFilter(function (RepositoryFilter $mHisM) { $mHisM->where(array('memberUserId' => MemberUser::id())); }); goto HL9Xw; uyNP1: return $iXUoW->pageTitle('我的订单')->view($this->viewMemberFrame)->body(new Box($W3CVY, '我的订单')); goto JDGLb; DZrvf: $W3CVY->useSimple(function (AbstractField $jJyrp, $YaV4m, $DbHm9) { $NwoSu = ModelUtil::all('order_goods', array('orderId' => $YaV4m->id), array('*'), array('id', 'asc')); GoodsUtil::mergeSnapshot($NwoSu); return AutoRenderedFieldValue::makeView('module::Shop.View.pc.memberOrder.item', array('item' => $YaV4m, 'orderGoodsList' => $NwoSu)); }); goto mLk24; y5Ejf: $W3CVY->disableCUD()->disableItemOperate(); goto DZrvf; HL9Xw: $W3CVY->gridFilter(function (GridFilter $mHisM) { $mHisM->eq('sn', '订单号'); $mHisM->range('created_at', '时间')->date(); }); goto y5Ejf; mLk24: if (Request::isPost()) { return $W3CVY->request(); } goto uyNP1; DCW0K: $W3CVY = Grid::make('order'); goto MYim6; JDGLb: } public function pay(PayCenterPerform $eQyQ4, $E24Va) { goto q5ylW; hTCwQ: if ($v9Xk2['status'] != OrderStatus::WAIT_PAY) { return Response::send(-1, '订单状态不正确', null, modstart_web_url('shop_order_member')); } goto XG2Pz; XG2Pz: if (!($v9Xk2['payFee'] > 0)) { return Response::send(-1, '订单无需付款', null, modstart_web_url('shop_order_member')); } goto t11bo; Jlm2I: if (empty($v9Xk2) || $v9Xk2['memberUserId'] != MemberUser::id()) { return Response::send(-1, '订单不存在', null, modstart_web_url('shop_order_member')); } goto hTCwQ; q5ylW: $v9Xk2 = OrderUtil::getOrderInfo($E24Va); goto Jlm2I; t11bo: return $eQyQ4->performRedirectOrderPay(PayConstant::SHOP_ORDER, $v9Xk2['id'], $v9Xk2['payFee'], '商城订单', modstart_web_url('shop_order_member')); goto k8u6u; k8u6u: } public function detail($E24Va) { goto Tii1L; bOPJQ: if (empty($v9Xk2) || $v9Xk2['memberUserId'] != MemberUser::id()) { return Response::send(-1, '订单不存在'); } goto UHBQL; U5pNb: $v9Xk2 = $this->mergeShippingTransportDetail($v9Xk2); goto yCVnz; UHBQL: $v9Xk2['_shippingCompanyName'] = ExpressUtil::getNameByCode($v9Xk2['shippingName']); goto U5pNb; yCVnz: return $this->view('memberOrder.detail', array('order' => $v9Xk2)); goto kAyOW; Tii1L: $v9Xk2 = OrderUtil::getOrderInfo($E24Va); goto bOPJQ; kAyOW: } public function confirm($E24Va) { goto a0mbQ; yuHW1: BizException::throwsIf('订单不存在', empty($v9Xk2) || $v9Xk2['memberUserId'] != MemberUser::id()); goto bO8e0; bO8e0: BizException::throwsIf('订单状态错误', $v9Xk2['status'] != OrderStatus::WAIT_CONFIRM); goto Nfy3Z; xTCQH: return Response::send(0, '确认收货成功', null, '[reload]'); goto j8kQy; a0mbQ: $v9Xk2 = OrderUtil::get($E24Va); goto yuHW1; Nfy3Z: ModelUtil::update('order', array('id' => $E24Va, 'memberUserId' => MemberUser::id()), array('status' => OrderStatus::COMPLETED)); goto xTCQH; j8kQy: } public function shipping($E24Va) { goto mGYoV; PBukE: $v9Xk2 = $this->mergeShippingTransportDetail($v9Xk2); goto fOwOB; lxoqL: if (empty($v9Xk2) || $v9Xk2['memberUserId'] != MemberUser::id()) { return Response::send(-1, '订单不存在'); } goto PBukE; fOwOB: $this->shareDialogPageViewFrame(); goto anbeN; anbeN: return $this->view('memberOrder.shipping', array('order' => $v9Xk2)); goto tc71a; mGYoV: $v9Xk2 = OrderUtil::get($E24Va); goto lxoqL; tc71a: } private function mergeShippingTransportDetail($v9Xk2) { goto zG4Sf; zG4Sf: $v9Xk2['_shippingTransportStatus'] = '-'; goto Tg0D1; Tg0D1: $v9Xk2['_shippingTransportDetail'] = array(); goto OLhBb; OLhBb: if (!ExpressTransportProvider::isEmpty() && $v9Xk2['shippingCode']) { goto ekmYz; ekmYz: $AzbSd = ExpressTransportProvider::queryTransportDetailCached($v9Xk2['shippingName'], $v9Xk2['shippingCode'], $v9Xk2['addressPhone']); goto SMYqV; uUfWr: $v9Xk2['_shippingTransportDetail'] = $AzbSd['list']; goto dLh9l; SMYqV: $v9Xk2['_shippingTransportStatus'] = $AzbSd['status']; goto uUfWr; dLh9l: } goto S9w1q; S9w1q: return $v9Xk2; goto uwe0M; uwe0M: } }