store_id = get_store_id(); $res = $form->catListSelect(); return $this->asJson($res); } public function actionCatList() { $form = new BookingForm(); $form->name = get_params('name'); $form->status = get_params('status', -1); $form->store_id = get_store_id(); $res = $form->catList(); return $this->asJson($res); } public function actionCatInfo() { $form = new BookingForm(); $id = get_params('id', 0); $res = $form->catInfo($id); return $this->asJson($res); } public function actionCatSave() { $form = new BookingForm(); $id = input_params('id', 0); $name = input_params('name', ''); $pic_url = input_params('pic_url', ''); $sort = input_params('sort', 1000); $is_show = input_params('is_show', 1); $form->store_id = get_store_id(); $res = $form->catSave($id, $name, $pic_url, $sort, $is_show); return $this->asJson($res); } public function actionCatStatus() { $form = new BookingForm(); $form->ids = input_params('ids', 0); $form->status = input_params('status', 1); $form->store_id = get_store_id(); $res = $form->catStatus(); return $this->asJson($res); } public function actionGoodsBookingTime() { $goods_id = input_params('goods_id', 0); $form = new \app\modules\client\models\v1\GoodsForm(); $goodsBookingTime = $form->goodsBookingTime($goods_id); return $this->asJson([ 'code' => 0, 'data' => $goodsBookingTime, ]); } public function actionBookingOrderList() { $form = new BookingForm(); $params = all_params(); $form->store_id = get_store_id(); $res = $form->bookingOrderList($params); return $this->asJson($res); } public function actionBookingOrderCountByGoods() { $form = new BookingForm(); $params = all_params(); $form->store_id = get_store_id(); $res = $form->bookingOrderCountByGoods($params); return $this->asJson($res); } public function actionBookingOrderCountByWorker() { $form = new BookingForm(); $params = all_params(); $form->store_id = get_store_id(); $res = $form->bookingOrderCountByWorker($params); return $this->asJson($res); } public function actionAddBookingOrder() { $form = new BookingForm(); $params = all_params(); $form->store_id = get_store_id(); $res = $form->bookingOrderSave($params); return $this->asJson($res); } // 服务人员列表 public function actionWorkerList() { $md_id = get_md_id(); $query = MdStaff::find()->alias('ms')->leftJoin(['md' => Md::tableName()], 'md.id=ms.md_id')->where(['ms.store_id' => get_store_id(), 'ms.is_delete' => 0, 'md.is_delete' => 0])->orderBy("ms.created_at desc, ms.updated_at desc"); if ($md_id) { $query->andWhere(['ms.md_id' => $md_id]); } $list = $query->select('ms.id, ms.name')->asArray()->all(); return $this->asJson([ 'code' => 0, 'data' => $list, ]); } //分配订单 public function actionOrderSetWorker() { $form = new BookingForm(); $form->store_id = get_store_id(); return $this->asJson($form->orderSetWorker(all_params())); } //确认收款 public function actionOrderIsPay() { $form = new BookingForm(); $form->store_id = get_store_id(); return $this->asJson($form->orderIsPay(all_params())); } //确认收货 public function actionOrderConfirm() { $form = new BookingForm(); $form->store_id = get_store_id(); return $this->asJson($form->orderConfirm(all_params())); } //订单操作 public function actionOrderStatus() { $order_id = input_params('order_id'); $type = input_params('type', 5); $cond = [ 'and', ['order_id' => $order_id], ['store_id' => get_store_id()], ]; $attr = []; if($type == 5){ $cond = array_merge($cond, [ ['<', 'status_ext', BookingOrderExt::STATUS_EXT_START], ]); $attr = [ 'status_ext' => BookingOrderExt::STATUS_EXT_START, 'time_start_service' => time(), ]; } if($type == 20){ $cond = array_merge($cond, [ ['<', 'status_ext', BookingOrderExt::STATUS_EXT_HAS_SYS_CONFIRM], ]); $attr = [ 'status_ext' => BookingOrderExt::STATUS_EXT_HAS_SYS_CONFIRM, 'time_sys_confirm' => time(), ]; } $orderExt = BookingOrderExt::find()->where($cond)->one(); if(!$orderExt){ return $this->asJson([ 'code' => 1, 'msg' => '参数错误,或状态异常', ]); } $orderExt->setAttributes($attr, false); $save = $orderExt->save(); if(!$save){ return $this->asJson([ 'code' => 1, 'msg' => '操作失败,' . array_shift($orderExt->getFirstErrors()), ]); } if($type == 20){ NoticeSend::bookExamine($order_id); } return $this->asJson([ 'code' => 0, 'msg' => 'success', ]); } }