shopId) || empty($this->mainId)) { util::fail('门店信息无效'); } try { $configs = PsMethodClass::getAllConfigs($this->shopId, $this->mainId); $customInfo = PsMethodClass::buildCustomInfo($this->hd ?? null, $this->custom ?? null); $configs = PsMethodClass::applyCustomHomeRuleToConfigs($configs, $customInfo); $configs = PsMethodClass::applyDailyFeeLockFlags($configs, (int)($this->customId ?? 0)); $result = ['method' => $configs]; $itemTotalAmount = Yii::$app->request->get('itemTotalAmount'); $bigNum = Yii::$app->request->get('bigNum'); if ($itemTotalAmount !== null && $itemTotalAmount !== '' && $bigNum !== null && $bigNum !== '') { $result['fees'] = PsMethodClass::previewMixUnMeetFeeBatch( $this->shopId, $this->mainId, (float)$itemTotalAmount, (float)$bigNum, (int)($this->customId ?? 0), $this->hd ?? null, $this->custom ?? null ); } util::success($result); } catch (\Exception $e) { util::fail($e->getMessage()); } } /** * 混合结算页批量预览未达门槛附加费(商品金额/扎数变化时刷新,切换购买方式不再重复请求) * POST: itemTotalAmount, bigNum */ public function actionCalcMixFeeBatch() { if (empty($this->shopId) || empty($this->mainId)) { util::fail('门店信息无效'); } $itemTotalAmount = (float)Yii::$app->request->post('itemTotalAmount', 0); $bigNum = (float)Yii::$app->request->post('bigNum', 0); try { $fees = PsMethodClass::previewMixUnMeetFeeBatch( $this->shopId, $this->mainId, $itemTotalAmount, $bigNum, (int)($this->customId ?? 0), $this->hd ?? null, $this->custom ?? null ); util::success(['fees' => $fees]); } catch (\Exception $e) { util::fail($e->getMessage()); } } /** * 单购买方式预览(保留兼容) * POST: sendType, itemTotalAmount, bigNum */ public function actionCalcMixFee() { if (empty($this->shopId) || empty($this->mainId)) { util::fail('门店信息无效'); } $sendType = (int)Yii::$app->request->post('sendType', -1); if ($sendType < 0 || $sendType > 4) { util::fail('配送方式无效'); } $itemTotalAmount = (float)Yii::$app->request->post('itemTotalAmount', 0); $bigNum = (float)Yii::$app->request->post('bigNum', 0); $customInfo = PsMethodClass::buildCustomInfo($this->hd ?? null, $this->custom ?? null); $customId = (int)($this->customId ?? 0); try { $result = PsMethodClass::previewMixUnMeetFee( $this->shopId, $this->mainId, $sendType, $itemTotalAmount, $bigNum, $customId, $customInfo ); util::success($result); } catch (\Exception $e) { util::fail($e->getMessage()); } } }