taxFee = $taxFee; $this->setOrder($order); } public function setOrder(PreOrder $order) { $this->order = $order; $this->uniacid = \YunShop::app()->uniacid; $this->uid = $order->uid; $this->fee_code = $this->getTaxFee()->getCode(); $this->name = $this->getTaxFee()->getName(); $this->rate = $this->getTaxFee()->getRate(); $this->amount = sprintf('%.2f', $this->getTaxFee()->getAmount()); $order->orderTaxFees->push($this); } public function getTaxFee() { return $this->taxFee; } /** * 调用当前类不存在方法时 查询 BaseOrderTaxFee 类存在代替处理 * @param string $method * @param array $parameters * @return mixed */ public function __call($method, $parameters) { if (method_exists($this->getTaxFee(), $method)) { return $this->getTaxFee()->$method($parameters); } return parent::__call($method, $parameters); // TODO: Change the autogenerated stub } public function getCheckedAttribute() { return $this->getTaxFee()->isChecked(); } public function getShowAttribute() { return $this->getTaxFee()->isShow(); } public function getShowNameAttribute() { return $this->getTaxFee()->getShowName(); } /** * @return bool */ public function beforeSaving() { if (!$this->getTaxFee()->isChecked()) { return false; } return parent::beforeSaving(); } }