getList($dataType, $this->postData()); $order_count = [ 'order_count' => [ 'payment' => $model->getCount('payment', $this->postData()), 'delivery' => $model->getCount('delivery', $this->postData()), 'received' => $model->getCount('received', $this->postData()), 'cancel' => $model->getCount('cancel', $this->postData()), ],]; // 自提门店列表 $shop_list = StoreModel::getAllList(); $ex_style = DeliveryTypeEnum::data(); return $this->renderSuccess('', compact('list', 'ex_style', 'shop_list', 'order_count')); } /** * 订单详情 */ public function detail($order_id) { // 订单详情 $detail = OrderModel::detail($order_id); if (isset($detail['pay_time']) && $detail['pay_time'] != '') { $detail['pay_time'] = date('Y-m-d H:i:s', $detail['pay_time']); } if (isset($detail['delivery_time']) && $detail['delivery_time'] != '') { $detail['delivery_time'] = date('Y-m-d H:i:s', $detail['delivery_time']); } // 物流公司列表 $model = new ExpressModel(); $expressList = $model->getAll(); // 门店店员列表 $shopClerkList = (new ShopClerkModel)->getClerk($detail['extract_store_id']); return $this->renderSuccess('', compact('detail', 'expressList', 'shopClerkList')); } /** * 确认发货 */ public function delivery($order_id) { $model = OrderModel::detail($order_id); if ($model->delivery($this->postData('param'))) { return $this->renderSuccess('发货成功'); } return $this->renderError('发货失败'); } /** * 修改订单价格 */ public function updatePrice($order_id) { $model = OrderModel::detail($order_id); if ($model->updatePrice($this->postData('order'))) { return $this->renderSuccess('修改成功'); } return $this->renderError($model->getError() ?: '修改失败'); } /** * 取消订单 */ public function orderCancel($order_no) { // 订单信息 $model = OrderModel::detail(['order_no' => $order_no]); if ($model->orderCancel($this->postData())) { return $this->renderSuccess('操作成功'); } return $this->renderError($model->getError() ?: '操作失败'); } /** * 虚拟商品发货 */ public function virtual($order_id) { // 订单信息 $model = OrderModel::detail($order_id); if ($model->virtual($this->postData())) { return $this->renderSuccess('操作成功'); } return $this->renderError($model->getError() ?: '操作失败'); } /** * 获取收货地址 */ public function orderaddress($order_id) { $order = (new OrderAddress)->where('order_id',$order_id)->find(); $regionData = RegionModel::getCacheTree(); return $this->renderSuccess('', compact('order','regionData')); } /** * 修改收货地址 */ public function addressedit() { $data = $this->postData(); if (empty($data['name']) || empty($data['phone']) ||empty($data['detail']) ||empty($data['province_id'])||empty($data['city_id']) ||empty($data['region_id']) ) { return $this->renderError('请补全收货地址信息'); } if (!Validate::regex($data['phone'], "/^1[3456789]{1}\d{9}$/")) { return $this->renderError('手机号格式不正确'); } $vall = [ 'name' => $data['name'], 'phone' => $data['phone'], 'detail' => $data['detail'], 'province_id'=> $data['province_id'], 'city_id' => $data['city_id'], 'region_id' => $data['region_id'], ]; (new OrderAddress)->where('order_address_id',$data['order_address_id'])->update($vall); return $this->renderSuccess('操作成功'); } }