Exemplo n.º 1
0
 /**
  * 跟新订单
  * @param $get
  * @param $post
  * @return \Lite\Core\Result|void
  */
 public function update($get, $post)
 {
     $id = $get['id'];
     $order = $id ? BusinessOrder::findOneByPk($id) : new BusinessOrder();
     if ($post) {
         $post['order_no'] = $order->order_no ?: BusinessOrder::generateOrderNo();
         $r = Result::convert(parent::update($get, $post));
         if ($r->isSuccess()) {
             $data = $r->getData();
             $r->setJumpUrl(Router::getUrl('BusinessOrder/info', array('id' => $data['id'])));
         }
         return $r;
     }
     $pay_type_list = PayType::find('state = ?', PayType::STATE_ENABLED)->all();
     $default_customer_list = Customer::find()->order(' id asc ')->limit(10)->all();
     if ($order->customer_id) {
         $order_customer = Customer::find('id = ?', $order->customer_id)->all();
         if ($order_customer) {
             $default_customer_list = array_merge($default_customer_list, $order_customer);
         }
     }
     $default_customer_contact_list = array();
     if ($order->customer_id) {
         $default_customer_contact_list = CustomerContact::find('customer_id = ?', $order->customer_id)->all(true);
     }
     return array('order' => $order, 'order_type_list' => $order->getPropertiesDefine('order_type')['options'], 'pay_type_list' => $pay_type_list, 'default_customer_list' => $default_customer_list, 'default_customer_contact_list' => $default_customer_contact_list);
 }
Exemplo n.º 2
0
 public function __construct($data = array())
 {
     parent::__construct($data);
     parent::__construct($data);
     $this->setPropertiesDefine(array('append_file_url' => array('type' => 'file', 'rel' => 'upload-file'), 'business_order' => array('getter' => function (BusinessOrderPayment $item) {
         return BusinessOrder::findOneByPk($item->business_order_id);
     }), 'pay_type_id' => array('options' => function () {
         $tmp = PayType::find('state=?', PayType::STATE_ENABLED)->all(true);
         return array_combine(array_column($tmp, 'id'), array_column($tmp, 'name'));
     }, 'display' => function (self $item) {
         $tmp = PayType::findOneByPk($item->pay_type_id);
         if (!$tmp) {
             return '';
         }
         return $tmp->state == PayType::STATE_ENABLED ? $tmp->name : '<del>' . $tmp->name . '</del>';
     })));
 }
Exemplo n.º 3
0
 public function __construct($data = array())
 {
     parent::__construct($data);
     $this->setPropertiesDefine(array('customer_id' => array('display' => function (BusinessOrder $item) {
         return Customer::findOneByPk($item->customer_id)->company_alias_name;
     }, 'alias' => '公司简称'), 'customer_contact_id' => array('display' => function (BusinessOrder $item) {
         return CustomerContact::findOneByPk($item->customer_contact_id)->chinese_name;
     }, 'alias' => '联系人'), 'pay_type_id' => array('options' => function () {
         $tmp = PayType::find('state=?', PayType::STATE_ENABLED)->all(true);
         return array_combine(array_column($tmp, 'id'), array_column($tmp, 'name'));
     }, 'display' => function (self $item) {
         $tmp = PayType::findOneByPk($item->pay_type_id);
         if (!$tmp) {
             return '';
         }
         return $tmp->state == PayType::STATE_ENABLED ? $tmp->name : '<del>' . $tmp->name . '</del>';
     }), 'settle_currency_name' => array('getter' => function (BusinessOrder $item) {
         return $item->getPropertiesDefine('settle_currency')['options'][$item->settle_currency];
     }), 'sample_produce_order' => array('getter' => function (self $item) {
         return SampleProduceOrder::find('business_order_id=?', $item->id)->one();
     })));
 }