foreach ($orderCanceled as $k => $v) { echo "<li>"; echo "<div class='order-con-head'>"; echo "<span class='ord-number'>订单号:<b>" . $v->orderNo . "</b></span>"; echo "<span class='ord-times'>" . $v->orderTime . "</span>"; echo "</div>"; echo "<div class='order-sub-con'>"; echo "<div class='sub-con-list'>"; $order = \frontend\models\Order::findOne($v->id); $orderDetail = $order->getProductDetail()->all(); $addressName = \frontend\models\UserAddress::findOne($v->addressId); $addressName = $addressName->userName; foreach ($orderDetail as $detk => $detv) { echo "<div class='sub-row'>"; echo "<div>"; $product = \frontend\models\OrderDetail::findOne($detv['id']); $product = $product->getProduct()->one(); echo "<img src='" . GlobalArray::$imgUrlArray['0'] . $product['productLogo'] . "' class='img-responsive' />"; echo "</div>"; echo "<div>" . $product['productName'] . "</div>"; echo "<div>" . $detv['productCount'] . "包</div>"; echo "<div>" . '¥' . $detv['productPrice'] . "</div>"; echo "</div>"; } echo "</div>"; echo "<div>¥" . $v->orderMoney . "</div>"; echo "<div>" . $addressName . "</div>"; echo "<div class='sub-con-details'><span class='orderbtn-default'>已取消</span><a href='" . \Yii::$app->urlManager->createUrl([FVariable::$userOrdercancel_url, 'id' => $v->orderNo]) . "'>订单详情</a></div>"; echo "<div class='sub-con-last'>"; echo "<a href='' class='againbuy'>再次购买</a>"; echo "</div>";
public function findIdOrderDetailIsEvaluate($id) { $OrderDetailLook = OrderDetail::find()->where(array('id' => $id, 'isEvaluate' => 1))->one(); if (!$OrderDetailLook) { return false; } return $OrderDetailLook; }
public function actionOrdercancel() { $userId = Yii::$app->session->get(FVariable::$session_userId_str); if (!$userId) { return $this->redirect(FVariable::$siteLogin_view); } $orderNo = Yii::$app->request->get('id'); $order = new Order(); $details = $order->findByOrderReturn($orderNo); if (!$details) { return $this->redirect(FVariable::$error404_view); } $address = new UserAddress(); $orderDetail = new OrderDetail(); $addressList = $address->findByAddressIdAll($details->addressId); $orderDetailList = $orderDetail->findByIdOrderReturnDetail($details->id); return $this->render(FVariable::$userOrdercancel_view, ['details' => $details, 'addressList' => $addressList, 'orderDetailList' => $orderDetailList]); }
public function getFindComment() { return $this->hasOne(OrderDetail::className(), ['id' => 'typeId']); }
public function getProductdetail() { //同样第一个参数指定关联的子表模型类名 // return $this->hasMany(OrderDetail::className(), ['orderId' => 'id']); }