request->isAjax) { return $this->render('/store-order/index'); } if (\Yii::$app->request->isGet) { //商品列表筛选 $get = \Yii::$app->request->get(); $isReserve = $get['is_reserve'] ?? 0; if($isReserve){ $order_status_list = OrderStatusEnum::getReserveMap(); }else{ $order_status_list = OrderStatusEnum::getMap(); } $payment_type_list = PayTypeEnum::getMap(); $shipping_type_list = ShippingTypeEnum::getMap(); $rules = [ [['order_status'], 'in', 'range' => array_keys($order_status_list)], [['payment_type'], 'in', 'range' => array_keys($payment_type_list)], [['shipping_type'], 'in', 'range' => array_keys($shipping_type_list)], [['start', 'end'], 'datetime', 'format' => 'php:Y-m-d H:i:s'], [['order_no', 'mobile', 'order_id'], 'safe'], [['type', 'type_value'], 'string'], [['is_reserve'],'in', 'range' => [0,1]], // ['mobile', 'match', 'pattern' => '/^1\d{10}$/', 'message' => '请输入正确的手机号码'], ]; $res = \Yii::$app->services->validate->validate($get, $rules); if (!$res) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $where = StoreOrder::searchParams($this->mall_id, $get); $with = ['base_user', 'detail','reserve']; $order = "id desc"; $params = compact('where', 'with', 'order', 'alias'); $page_data = StoreOrder::listPage($params); if ($page_data === false) return $this->error(StoreOrder::getStaticError()); // dd(array_column($page_data['list'], 'order_status')); $compact_params = array_keys($page_data); $store_ids = array_column($page_data['list'],'store_id'); $order_no_arr = array_column($page_data['list'],'order_no'); $order_list = Order::lists(['where'=>[['order_no'=>$order_no_arr]],'index'=>'order_no','select'=>'id,order_no']); $store_list = Store::lists(['where'=>[['id'=>$store_ids]],'index'=>'id','select'=>'id,store_name']); extract($page_data); if(MallAddons::isInstall($this->mall_id,'Printer')){ $printer_list = Printer::lists([ 'where' => [ ['mall_id'=> $this->mall_id], ['store_id'=>$store_ids], ['printer_type'=>2], ['status'=>StatusEnum::ENABLED] ], 'index'=>'store_id' ]); } foreach ($list as &$order) { $order['main_order_id'] = isset($order_list[$order['order_no']]['id'])?$order_list[$order['order_no']]['id']:0; $order_expresses = OrderExpress::getOrderExpresses([['order_id' => $order['id']]]); $order['store_name'] = $store_list[$order['store_id']]['store_name']??''; foreach ($order['detail'] as &$detail) { // 物流信息 $detail['express'] = ''; foreach ($order_expresses as $record) { $order_detail_ids = empty($record['order_detail_ids']) ? [] : json_decode($record['order_detail_ids'], true); if (is_string($order_detail_ids)) $order_detail_ids = []; if (in_array($detail['id'], $order_detail_ids)) { $detail['express'] = $record['express_name'] . ' | ' . $record['express_no']; if ($record['shipping_type'] == 0) $detail['express'] = '--'; } } } $order['Printer']['is_show_printer'] = 0; if(isset($printer_list[$order['store_id']])){ $order['Printer']['is_show_printer'] = 1; } } $export_list = StoreOrder::fieldsList(); $marketing_type_map = MarketingTypeEnum::getMap(); return $this->success('操作成功', compact($compact_params, 'order_status_list', 'payment_type_list', 'shipping_type_list', 'export_list', 'marketing_type_map')); } if (\Yii::$app->request->post('flag') == 'EXPORT') { $post = \Yii::$app->request->post(); $post['mall_id'] = $this->mall_id; $filename = 'o2o门店订单列表-' . date('YmdHis') . '_' . rand(10000, 99999); $res = CsvExportHelper::exportDownLoadCenter($this->mall_id, $filename, DownloadEnum::TYPE_ORDERS, StoreOrder::class, 'exportHandle', $post); if ($res === false) return $this->error('加入导出任务失败' . CsvExportHelper::getStaticError()); return $this->success('添加导出任务成功,任务完成后请在下载中心进行下载!'); } } /** * @name: * @msg: 订单详情 * @param {*} * @return {*} */ public function actionDetail() { if (\Yii::$app->request->isAjax) { if (\Yii::$app->request->isGet) { //商品列表筛选 $get = \Yii::$app->request->get(); $order_status_list = OrderStatusEnum::getMap(); $payment_type_list = PayTypeEnum::getMap(); $shipping_type_list = ShippingTypeEnum::getMap(); $rules = [[['id'], 'required']]; $res = \Yii::$app->services->validate->validate($get, $rules); $where = [['mall_id' => $this->mall_id]]; $where[] = ['=', 'id', $get['id']]; $where[] = ['>=', 'status', StatusEnum::DISABLED]; $with = [ 'base_user', 'detail', 'reserve' ]; $params = compact('where', 'with'); $order = StoreOrder::getOne($where, true, $with); if ($order === false) return $this->error(StoreOrder::getStaticError()); $main_order = Order::findOne(['order_no'=>$order['order_no']]); $express = OrderExpress::lists(['where'=>[['order_id'=>$main_order['id']]]]); $express_log = OrderExpressLog::lists(['where'=>[['order_id'=>$main_order['id']]]]); $order['express'] = $express; $order['express_log'] = $express_log; $express_log = []; if ($order['express_log']) { $time = time(); $hour = \Yii::$app->services->setting->mall->get($this->mall_id, 'logistics.update');// 获取更新物流时间设置 if (empty($hour) && is_array($hour)) $hour = 8;// 默认8小时更新一次 foreach ($order['express_log'] as $item) { $item['status'] = ExpressEnum::getStatusMap($item['status']); // 检查物流是否已完成,未完成且距离上次修改时间超过一个小时 if ($item['table_express_status'] == StatusEnum::DISABLED && $item['updated_at'] + $hour * 3600 < $time) { $item['list'] = OrderExpressLog::execExpressLog($this->mall_id, $item); } $express_log[$item['order_express_id']] = $item; } } if (!empty($order['express'])) { foreach ($order['express'] as &$key) { if (isset($express_log[$key['id']])) { $express_list = Json::decode($express_log[$key['id']]['list']); $key['now_state'] = $express_log[$key['id']]['status']; $key['express_log'] = is_null($express_list) ? '' : array_reverse($express_list['Traces']); } } } if (!empty($order['detail'])) { foreach ($order['detail'] as &$detail) { if (!empty($detail['attr_groups_format'])) { $attr_groups_format = json_decode($detail['attr_groups_format'], true); $attr_list = $attr_groups_format[$detail['sign_id']]; $attr_group_name_list = array_column($attr_list, 'attr_group_name'); $attr_name_list = array_column($attr_list, 'attr_name'); $detail['attr_list'] = []; foreach ($attr_group_name_list as $index => $attr_group_name) { $detail['attr_list'][] = $attr_group_name . ':' . $attr_name_list[$index]; } } if (empty($detail['goods_attr_name']) && !empty($detail['goods_attr_id'])) { if ($detail['order_source'] == 'Reserve') { // 服务订单 $attr_info = StoreGoodsExtra::getOne([['=', 'id', $detail['goods_attr_id']]],true, ['goods']); } else { $attr_info = StoreGoodsAttr::getOne([['=', 'id', $detail['goods_attr_id']]],true, ['goods']); } $detail['goods_attr_name'] = $attr_info ? $attr_info['name'] : ''; } } } $temp_step_arr = OrderStatusEnum::setpArrMap($order['order_status']); // 订单状态跟踪 $step_arr = []; if(!empty($temp_step_arr)){ foreach ($temp_step_arr as $k=>$v){ if(!in_array($v['field'],['deposite_pay_time','final_payment_time'])){ if($order['shipping_type'] == ShippingTypeEnum::PICKUP){ if(in_array($v['field'],['consign_time'])){ continue; } if($v['field'] == 'finish_time'){ $step_arr[] = [ 'field' => 'sign_time', 'title' => '买家自提', ]; } } $step_arr[] = $v; } } } $order_action = OrderAction::getOrderAction([['order_id' => $main_order['id']??0]]); $marketing_type_map = MarketingTypeEnum::getMap(); return $this->success('操作成功', compact('order', 'order_status_list', 'payment_type_list', 'shipping_type_list', 'step_arr', 'order_action', 'marketing_type_map')); } } return $this->render($this->action->id); } /** * @name: * @msg: 修改订单价格 * @param {*} * @return {*} */ public function actionChangePrice() { // 商品操作 $form = \Yii::$app->request->post(); $rules = [[['id', 'shipping_money'], 'required'], [['id'], 'integer'], [['shipping_money'], 'number'], ['detail', 'safe']]; $res = \Yii::$app->services->validate->validate($form, $rules); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $form['mall_id'] = $this->mall['id']; $form['mch_id'] = $this->admin->mch_id; $form['operator_id'] = $this->admin->id; $form['operator_name'] = $this->admin->account; $res = StoreOrder::ChangePrice($form); if ($res === false) return $this->error(StoreOrder::getStaticError()); return $this->success(); } /** * @name: * @msg: 订单支付 * @param {*} * @return {*} */ public function actionPay() { // 商品操作 $form = \Yii::$app->request->post(); $rules = [[['id'], 'required'], [['id'], 'integer']]; $res = \Yii::$app->services->validate->validate($form, $rules); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $form['mall_id'] = $this->mall['id']; $form['mch_id'] = $this->admin->mch_id; $form['operator_id'] = $this->admin->id; $form['operator_name'] = $this->admin->account; $res = StoreOrder::pay($form, PayTypeEnum::OFFLINE); if ($res === false) return $this->error(StoreOrder::getStaticError()); return $this->success(); } /** * @name: * @msg: 关闭订单 * @param {*} * @return {*} */ public function actionClose() { // 商品操作 $form = \Yii::$app->request->post(); $rules = [[['id'], 'required'], [['id'], 'integer']]; $res = \Yii::$app->services->validate->validate($form, $rules); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $form['mall_id'] = $this->mall['id']; $form['mch_id'] = $this->admin->mch_id; $form['operator_id'] = $this->admin->id; $form['operator_name'] = $this->admin->account; $res = StoreOrder::close($form); if ($res === false) return $this->error(StoreOrder::getStaticError()); return $this->success(); } public function actionDel() { // 商品操作 $form = \Yii::$app->request->post(); $rules = [[['id'], 'required'], [['id'], 'integer']]; $res = \Yii::$app->services->validate->validate($form, $rules); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $form['mall_id'] = $this->mall_id; $form['mch_id'] = $this->admin->mch_id; $form['operator_id'] = $this->admin->id; $form['operator_name'] = $this->admin->account; $res = StoreOrder::del($form); if ($res === false) return $this->error(StoreOrder::getStaticError()); return $this->success(); } /** * @name: * @msg: 修改订单备注 * @param {*} * @return {*} */ public function actionRemark() { $form = \Yii::$app->request->post(); $rules = [[['id'], 'required'], [['id'], 'integer'], [['remark', 'seller_remark'], 'string']]; $res = \Yii::$app->services->validate->validate($form, $rules); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $form['mall_id'] = $this->mall['id']; $form['mch_id'] = $this->admin->mch_id; $form['operator_id'] = $this->admin->id; $form['operator_name'] = $this->admin->account; $res = StoreOrder::remark($form); if ($res === false) return $this->error(StoreOrder::getStaticError()); return $this->success(); } /** * @name: * @msg: 修改订单收货地址 * @param {*} * @return {*} */ public function actionChangeAddress() { $form = \Yii::$app->request->post(); $rules = [ [['id', 'receiver_name', 'mobile', 'province', 'city', 'area', 'address', 'region_name'], 'required'], [['id', 'province', 'city', 'area', 'zip'], 'integer'], [['address', 'region_name', 'receiver_name', 'mobile'], 'string'] ]; $res = \Yii::$app->services->validate->validate($form, $rules); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $form['mall_id'] = $this->mall['id']; $form['mch_id'] = $this->admin->mch_id; $form['operator_id'] = $this->admin->id; $form['operator_name'] = $this->admin->account; $form['is_admin'] = 1; $res = StoreOrder::changeAddress($form); if ($res === false) return $this->error(StoreOrder::getStaticError()); return $this->success(); } /** * @name: * @msg: 发货 * @param {*} * @return {*} */ public function actionShipping() { if (\Yii::$app->request->isAjax) { if (\Yii::$app->request->isGet) { // 获取订单发货信息 $jd_mch_code = MallSetting::conf($this->mall_id, 'logistics.jd_mch_code'); $express_list = Express::getExpresses([], [], true, '*'); return $this->success('请求成功', compact('express_list', 'jd_mch_code')); } else { // 发货 $form = \Yii::$app->request->post(); $rules = [ [['shipping_type', 'id'], 'required'], [['express_id', 'shipping_type', 'id'], 'integer'], [['express_name', 'express_no', 'memo'], 'string'], [['order_detail_ids'], 'each', 'rule' => ['integer']], [['shipping_change', 'customer_name'], 'safe'] ]; $res = \Yii::$app->services->validate->validate($form, $rules); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $form['mall_id'] = $this->mall_id; $form['mch_id'] = $this->admin->mch_id; $form['operator_id'] = $this->admin->id; $form['operator_name'] = $this->admin->account; if (empty($form['shipping_change'])) { $res = OrderExpress::delivery($form); // 发货 } else { $res = OrderExpress::shippingChange($form); // 修改物流 } if ($res === false) return $this->error(OrderExpress::getStaticError()); return $this->success('发货/修改物流成功'); } } } /** * 收货 * @param $id * @param string $member_id * @throws UnprocessableEntityHttpException * @throws \yii\web\NotFoundHttpException */ public function actionTakeDelivery() { // 商品操作 $form = \Yii::$app->request->post(); $rules = [[['id'], 'required'], [['id'], 'integer']]; $res = \Yii::$app->services->validate->validate($form, $rules); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $form['mall_id'] = $this->mall['id']; $form['mch_id'] = $this->admin->mch_id; $form['operator_id'] = $this->admin->id; $form['operator_name'] = $this->admin->account; $res = StoreOrder::takeDelivery($form); if ($res === false) return $this->error(StoreOrder::getStaticError()); return $this->success(); } /** * @name: * @msg: 订单操作日志 * @param {*} * @return {*} */ public function actionOrderAction() { try { $request = \Yii::$app->request; if ($request->isAjax) { if ($request->isGet) { $params = \Yii::$app->request->get(); $params['where'] = ['mall_id' => $this->mall_id]; $params['is_page'] = true; $params['order'] = 'created_at desc'; $list = OrderActionEs::getList($params); return $this->success('ok', $list); } } } catch (\Exception $e) { return $this->error($e->getMessage(), []); } return $this->render($this->action->id); } /** * @name: * @msg: 订单完成 * @param {*} * @return {*} */ public function actionSalesOrder() { // 商品操作 $form = \Yii::$app->request->post(); $rules = [[['id'], 'required'], [['id'], 'integer']]; $res = \Yii::$app->services->validate->validate($form, $rules); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $form['mall_id'] = $this->mall_id; $form['operator_id'] = $this->admin->id; $form['operator_name'] = $this->admin->account; $res = StoreOrder::complete($form); if ($res == false) return $this->error('操作订单失败:' . StoreOrder::getStaticError()); return $this->success('操作成功'); } /** * @name: * @msg: 分润明细 * @param {*} * @return {*} */ public function actionCommissionAndScoreList() { $params = \Yii::$app->request->get(); $wallet_type = 'commission'; if (!empty($params['wallet_type'])) $wallet_type = $params['wallet_type']; $condition['where'] = [['order_id' => $params['order_id']]]; $condition['select'] = 'id'; $order_detail_list = StoreOrderDetail::lists($condition); $order_detail_ids = array_column($order_detail_list, 'id'); $store_order = StoreOrder::findOne($params['order_id']); $order = Order::findOne(['order_no'=>$store_order['order_no']]); $mall_order_detail_ids = []; if($order){ $condition['where'] = [['order_id' => $order['id']]]; $condition['select'] = 'id'; $mall_order_detail_list = OrderDetail::lists($condition); $mall_order_detail_ids = array_column($mall_order_detail_list, 'id'); } $condition = [ 'where' => [ [ 'or', [ 'and', ['source_table' => 'store_order_detail'], ['source_table_id' => $order_detail_ids] ], [ 'and', ['source_table' => [OrderDetail::tableName(),'order_detail']], ['source_table_id' => $mall_order_detail_ids] ], ] ], ]; CapitalLog::$capitalType = "{$wallet_type}"; $list = CapitalLog::getList($condition, 0); $level = UserLevel::find()->select("name,level")->where(['mall_id' => $this->mall_id, 'status' => StatusEnum::ENABLED])->asArray()->all(); $level_data = array_column($level, 'name', 'level'); CapitalLog::$capitalType = "{$wallet_type}_frozen"; $condition['where'][] = ['status' => 0]; $frozen_list = CapitalLog::getList($condition, 1); $list = array_merge($list, $frozen_list); return $this->success('操作成功', ['list' => $list, 'user_level' => $level_data]); } /** * @name: * @msg: 售后订单列表 * @param {*} * @return {*} */ public function actionRefundList() { if (!\Yii::$app->request->isAjax) { return $this->render('/store-order/refund', ['goods_type' => Json::encode(GoodsTypeEnum::getMap())]); } if (\Yii::$app->request->isGet) { //商品列表筛选 $get = \Yii::$app->request->get(); $refund_status_list = RefundStatusEnum::getMap(); $refund_type_list = RefundTypeEnum::getMap(); $rules = [ [['is_feedback', 'goods_type'], 'integer'], [['keyword', 'order_no', 'type'], 'string'], [['type', 'order_no', 'keyword', 'refund_status'], 'safe'], ]; $res = \Yii::$app->services->validate->validate($get, $rules); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $where[] = ['mall_id' => $this->mall_id, 'status' => StatusEnum::ENABLED]; $where[] = ['!=', 'store_id', 0]; if (!empty($get['goods_type'])) $where[] = ['goods_type' => $get['goods_type']]; // 搜索查询 !empty($get['order_no']) && $where[] = ['in', 'order_id', OrderRefund::getOidByOrderNo($this->mall_id, $get['order_no'])]; if (isset($get['refund_status'])) { $get['refund_status'] = explode(',',$get['refund_status']); $where[] = ['in', 'refund_status', $get['refund_status']]; //$where[] = ['=', 'refund_status', $get['refund_status']]; } else { $where[] = ['in', 'refund_status', [RefundStatusEnum::APPLY, RefundStatusEnum::HANDEL, RefundStatusEnum::FINISH, RefundStatusEnum::RETURN_GOODS, RefundStatusEnum::EXCHANGE_GOODS, RefundStatusEnum::REFUSE]]; } if (!empty($get['type']) && !empty($get['keyword'])) $where[] = OrderRefund::searchByKeyword($this->mall_id, $get['type'], $get['keyword']); $with = ['base_user', 'orderDetail', 'order']; $order = "id desc"; $params = compact('where', 'with', 'order'); $page_data = OrderRefund::listPage($params, false, true); if ($page_data === false) return $this->error(OrderRefund::getStaticError()); $compact_params = array_keys($page_data); extract($page_data); $store_ids = array_column($list,'store_id'); $store_list = Store::lists([ 'where'=>[ ['id'=>$store_ids], ['mall_id'=>$this->mall_id] ], 'index'=>'id', ]); foreach ($list as &$order) { foreach ($order['orderDetail'] as &$detail) { if (!empty($detail['attr_groups_format'])) { //规格 $attr_groups_format = Json::decode($detail['attr_groups_format'], true); $attr_list = $attr_groups_format[$detail['sign_id']]; $attr_group_name_list = array_column($attr_list, 'attr_group_name'); $attr_name_list = array_column($attr_list, 'attr_name'); $detail['attr_list'] = []; foreach ($attr_group_name_list as $index => $attr_group_name) { $detail['attr_list'][] = $attr_group_name . ':' . $attr_name_list[$index]; } } } if (!empty($order['order'])) { $extraInfo = $order['order']['extra_info']; if (!empty($extraInfo['head_id']) && MallAddons::isInstall($this->mall_id, 'Community')) { $order['order']['community_addons_data'] = (new HeadService())->pickupInfo($order['mall_id'], $extraInfo['head_id']); } } $order['store_name'] = ''; $order['shop_mobile'] = ''; if(isset($store_list[$order['store_id']])){ $order['store_name'] = $store_list[$order['store_id']]['store_name']; $order['shop_mobile'] = $store_list[$order['store_id']]['shop_mobile']; } } return $this->success('操作成功', compact($compact_params, 'refund_status_list', 'refund_type_list')); } } /** * @name: * @msg: 售后订单详情 * @param {*} * @return {*} */ public function actionRefundDetail() { if (\Yii::$app->request->isAjax) { if (\Yii::$app->request->isGet) { //商品列表筛选 $get = \Yii::$app->request->get(); $order_status_list = OrderStatusEnum::getMap(); $payment_type_list = PayTypeEnum::getMap(); $feedback_type_list = OrderStatusEnum::getFeedbackMap(); $address_list = \Yii::$app->services->setting->mall->get($this->mall_id, 'return_address.return_address'); $address_list = $address_list ? json_decode($address_list, true) : []; $rules = [[['id', 'store_id'], 'required']]; $res = \Yii::$app->services->validate->validate($get, $rules); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $where = [['mall_id' => $this->mall_id]]; $where[] = ['id' => $get['id'], 'store_id' => $get['store_id']]; $where[] = ['>=', 'status', StatusEnum::DISABLED]; $with = ['base_user', 'order' => function ($query) { $query->select('*'); }, 'orderDetail', 'marketing', 'step']; $params = compact('where', 'with'); $refund = OrderRefund::getOne($where, true, $with); if ($refund === false) return $this->error(OrderRefund::getStaticError()); foreach ($refund['orderDetail'] as $key => $detail) { if (!empty($detail['attr_groups_format'])) { $attr_groups_format = Json::decode($detail['attr_groups_format'], true); $attr_list = $attr_groups_format[$detail['sign_id']]; $attr_group_name_list = array_column($attr_list, 'attr_group_name'); $attr_name_list = array_column($attr_list, 'attr_name'); $detail['attr_list'] = []; } if (empty($detail['goods_attr_name']) && !empty($detail['goods_attr_id'])) { if ($detail['order_source'] == 'Reserve') { // 服务订单 $attr_info = StoreGoodsExtra::getOne([['=', 'id', $detail['goods_attr_id']]],true, ['goods']); } else { $attr_info = StoreGoodsAttr::getOne([['=', 'id', $detail['goods_attr_id']]],true, ['goods']); } $detail['goods_attr_name'] = $attr_info ? $attr_info['name'] : ''; } } // 返还优惠内容 if (!empty($refund['marketing'])) { $discount = []; $marketing = $refund['marketing']; if (!empty($marketing['deduct_score'])) { $score_name = \Yii::$app->services->setting->mall->get($this->mall_id, 'score.score_name'); $discount[] = floatval($marketing['deduct_score']) . $score_name; } $refund['discount'] = implode('+', $discount); } $step_status = $refund['step'][0]['step_status'] ?? 0; $step_arr = RefundStatusEnum::stepNumArr(in_array($step_status, [RefundStatusEnum::STEP_NEGATIVE_1, RefundStatusEnum::STEP_NEGATIVE_2]) ? 1 : $refund['type']); // 进度条 $step_text = RefundStatusEnum::getStepStatusText($step_status); return $this->success('操作成功', compact('refund', 'order_status_list', 'payment_type_list', 'feedback_type_list', 'step_arr', 'address_list', 'step_text')); } } return $this->render('/store-order/refund-detail'); } /** * @name: * @msg: 售后处理 * @param {*} * @return {*} */ // |TODO:暂时先不做 /* public function actionHandleRefund() { if (\Yii::$app->request->isAjax) { if (\Yii::$app->request->isPost) { //商品列表筛选 $params = \Yii::$app->request->post(); $rules = [ [['id', 'step_status', 'store_id'], 'required'], [['id', 'step_status', 'mobile', 'address_type', 'store_id'], 'integer'], [['saler_express', 'saler_express_no', 'address', 'consignee'], 'string'], [['saler_express', 'saler_express_no', 'address_type', 'customer_name'], 'safe'], ]; $res = \Yii::$app->services->validate->validate($params, $rules); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); // 退货地址 $address = ['consignee' => $params['consignee'], 'mobile' => $params['mobile'], 'address' => $params['address']]; // 换货物流信息 $express = ['saler_express' => $params['saler_express'], 'saler_express_no' => $params['saler_express_no'], 'customer_name' => $params['customer_name']]; $data = [ 'id' => $params['id'], 'store_id' => $params['store_id'], 'step_status' => $params['step_status'], 'address' => $address, 'express' => $express, ]; $logic = new OrderRefundLogic(); $res = $logic->execute($this->mall_id, $data); if ($res == false) return $this->error($logic->getError()); return $this->success('操作成功'); } } } */ public function actionReserve() { $is_show_username = Yii::$app->services->setting->mall->get($this->mall_id, 'order.is_show_username'); return $this->render($this->action->id, ['is_show_username' => $is_show_username ?? 0]); } /** * 预约订单详情 * @return string */ public function actionReserveDetail() { return $this->render($this->action->id); } /** * 获取支付类型 * * @return mixed */ public function actionPaymentType() { return $this->success( 'ok', PayTypeEnum::getMap() ); } }