request->get(); $search = isset($get['search']) ? $get['search'] : ''; $where = []; $where['merchantId'] = $this->merchantId; if (isset($get['status']) && $get['status'] != -1) { $where['status'] = $get['status']; } if (!empty($search)) { if (stringUtil::isMobile($search)) { $where['receiveMobile'] = $search; } else { $where['id'] = $search; } } $list = OrderService::getOrderList($where); $list['asset'] = MerchantAssetService::getByMerchantId($this->merchantId); util::success($list); } //订单详情 shish 2019.12.16 public function actionDetail() { $id = Yii::$app->request->get('id'); $detail = OrderService::getOrderById($id); util::success($detail); } //订单归类 shish 2019.12.17 public function actionClassify() { $post = Yii::$app->request->post(); $id = isset($post['id']) ? $post['id'] : 0; $order = OrderService::getById($id); OrderService::valid($order, $this->merchantId); $categoryId = isset($post['categoryId']) ? $post['categoryId'] : $post['categoryId']; $usageId = isset($post['usageId']) ? $post['usageId'] : $post['usageId']; OrderService::classify($id, $categoryId, $usageId); util::complete(); } //更新配送单 shish 2019.12.17 public function actionUpdateSheet() { $post = Yii::$app->request->post(); $id = isset($post['id']) ? $post['id'] : 0; unset($post['id']); $order = OrderService::getById($id); OrderService::valid($order, $this->merchantId); OrderService::updateSheet($order, $post); util::complete('提交成功'); } //商家收款与发货 shish 2019.12.18 public function actionGathering() { $post = Yii::$app->request->post(); $price = isset($post['price']) && is_numeric($post['price']) ? $post['price'] : 0; $payWay = isset($post['payWay']) && is_numeric($post['payWay']) ? $post['payWay'] : 0; $userId = isset($post['userId']) ? $post['userId'] : 0; $userInfo = UserService::getById($userId); if (empty($userInfo) || $userInfo['merchantId'] != $this->merchantId) { util::fail('您选择的客户无效'); } if ($price <= 0) { util::fail('请输入金额'); } $post['prePrice'] = $price; $post['actPrice'] = $price; $post['payWay'] = $payWay; $post['sourceType'] = 1; $post['userId'] = $userId; $post['goodsNum'] = 1; $post['orderName'] = '商品'; $shopId = MerchantService::getDefaultShopId($this->merchant); $post['shopId'] = $shopId; $order = OrderService::addOrder($post); $id = $order['id']; $orderSn = $order['orderSn']; //流水类型列表 $capitalTypeList = configDict::getConfig('capitalType'); $capitalType = $capitalTypeList['xhOrder']['id']; $callbackParams = []; switch ($payWay) { case 0: xhPayToolService::weixinPay($callbackParams, $orderSn, $price, $capitalType, 0); break; case 1: xhPayToolService::alipay($callbackParams, $orderSn, $price, $capitalType, 0, []); break; case 2: xhPayToolService::balancePay($callbackParams, $orderSn, $price, $capitalType, 0); break; default: util::fail('无效支付方式'); } util::success($order); } //免发货管理 shish 2020.1.6 public function actionWithoutSend() { $id = Yii::$app->request->get('id'); $order = OrderService::getById($id); OrderService::valid($order, $this->merchantId); //配送流程变更 $currentFlow = OrderSendClass::withoutSend($order); util::success(['currentFlow' => $currentFlow]); } //修改价格 shish 2020.1.6 public function actionUpdatePrice() { $id = Yii::$app->request->get('id'); $price = Yii::$app->request->get('price', 1); $order = OrderService::getById($id); OrderService::valid($order, $this->merchantId); if (isset($order['modPrice']) && $order['modPrice'] == 0) { util::fail('已发起支付,不能修改价格'); } OrderService::updateById($id, ['actPrice' => $price]); util::complete('修改成功'); } //下单要用到的相关信息 shish 2019.12.6 public function actionOrderRelate() { $regionTree = RegionService::tree(); $shop = ShopService::getDefaultShop($this->merchant); $freight = MerchantExtendService::getFreight($this->merchantExtend); $mapKey = 'OFWBZ-2NTHP-EHNDD-LKWQY-GANM7-PXBJH'; $out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree, 'txMapKey' => $mapKey, 'merchant' => $this->merchant]; util::success($out); } //配送单 shish 2020.2.29 public function actionGetDeliverDetail() { $id = Yii::$app->request->get('id', 0); $order = OrderService::getById($id); OrderService::valid($order, $this->merchantId); $reachDate = isset($order['reachDate']) && !empty($order['reachDate']) ? $order['reachDate'] : ''; $reachPeriodId = $order['reachPeriod']; $reachPeriodArr = [0 => '上午', 1 => '下午', 2 => '晚上']; $reachPeriod = isset($reachPeriodArr[$reachPeriodId]) ? $reachPeriodArr[$reachPeriodId] : ''; $shopId = $order['shopId']; $telephone = ''; if (!empty($shopId)) { $shop = ShopService::getById($shopId); } $telephone = isset($shop['telephone']) ? $shop['telephone'] : ''; $bookName = isset($order['bookName']) ? $order['bookName'] : ''; $bookMobile = isset($order['bookMobile']) ? $order['bookMobile'] : ''; if (isset($order['anonymity']) && $order['anonymity'] == 1) { $bookName = '--'; $bookMobile = '--'; } $data = [ 'reachDate' => $reachDate . ' ' . $reachPeriod, 'orderSn' => $order['orderSn'], 'receiveUserName' => $order['receiveUserName'], 'receiveMobile' => $order['receiveMobile'], 'receiveFullAddress' => $order['receiveAddress'] . $order['receiveFloor'] . "(" . $order['receiveFullAddress'] . ")", 'cardInfo' => $order['cardInfo'], 'bookMobile' => $bookMobile, 'bookName' => $bookName, 'remark' => $order['remark'], 'sendNum' => $order['sendNum'], 'telephone' => 13600903070, 'printTime' => '', 'img' => '', ]; util::success($data); } }