ソースを参照

feat(profit-share): 新增分账订单功能并优化分账申请流程

- 新增分账订单控制器 ProfitShareOrderController
- 添加分账订单路由配置,支持认证和宏页面中间件
- 在分账接收者列表页展示分账配置信息(手续费、最低/最高金额)
- 实现分账申请金额验证逻辑,包括最小值、最大值和余额检查
- 添加手续费实时计算和实际到账金额显示
- 增加分账配置参数:profit_share_fee、profit_share_min、profit_share_max
- 更新前端UI样式,优化分账申请弹窗显示效果
- 添加金额输入实时校验和错误提示功能
- 禁用无效金额时的确认申请按钮
runphp 4 ヶ月 前
コミット
89daf748aa

+ 56 - 1
config.php

@@ -340,5 +340,60 @@ return [
         '_fc_drag_tag' => 'group',
         'display' => true,
         'hidden' => false
-    ]
+    ],
+    [
+        'type' => 'number',
+        'field' => 'profit_share_fee',
+        'value' => 6,
+        'title' => '分账手续费',
+        'info' => '分账手续费百分比',
+        '$required' => false,
+        'props' => [
+            'precision' => 2,
+            'min' => 1,
+            'max' => 50,
+            'step' => 0.01,
+            'stepStrictly' => true
+        ],
+        '_fc_id' => 'id_Feeemdycfeeubbc',
+        'name' => 'ref_Feeemdycfeeubbd',
+        'display' => true,
+        'hidden' => false,
+        '_fc_drag_tag' => 'inputNumber',
+        'wrap' => [
+            'labelWidth' => '200px'
+        ]
+    ],
+    [
+        'type' => 'number',
+        'field' => 'profit_share_min',
+        'value' => 100,
+        'title' => '分账最低金额',
+        'info' => '',
+        '$required' => false,
+        '_fc_id' => 'id_Fminmdycminubcc',
+        'name' => 'ref_Fminmdycminubcd',
+        'display' => true,
+        'hidden' => false,
+        '_fc_drag_tag' => 'inputNumber',
+        'wrap' => [
+            'labelWidth' => '200px'
+        ]
+    ],
+    [
+        'type' => 'number',
+        'field' => 'profit_share_max',
+        'value' => 5000,
+        'title' => '分账最高金额',
+        'info' => '',
+        '$required' => false,
+        '_fc_id' => 'id_Fmaxmdycmaxubdc',
+        'name' => 'ref_Fmaxmdycmaxubdd',
+        'display' => true,
+        'hidden' => false,
+        '_fc_drag_tag' => 'inputNumber',
+        'wrap' => [
+            'labelWidth' => '200px'
+        ]
+    ],
 ];

+ 3 - 0
route/api.php

@@ -4,6 +4,7 @@ declare(strict_types=1);
 use think\facade\Route;
 use SixShop\Lakala\Controller\Api\{
     IndexController,
+    ProfitShareOrderController,
     ProfitShareReceiverController
 };
 use SixShop\System\Middleware\MacroPageMiddleware;
@@ -12,6 +13,8 @@ use SixShop\System\Middleware\MacroPageMiddleware;
 //
 // 如果需要登录请添加认证中间件auth
 // ->middleware(['auth'])
+Route::resource('profit_share_order', ProfitShareOrderController::class)
+    ->middleware(['auth', MacroPageMiddleware::class]);
 Route::resource('profit_share_receiver', ProfitShareReceiverController::class)
     ->middleware(['auth', MacroPageMiddleware::class]);
 

+ 3 - 0
src/Config.php

@@ -18,6 +18,9 @@ use SixShop\System\Trait\ConfigTrait;
  * @property string $receiver_agreement_file 默认合作协议文件
  * @property string $random_discount_max 随机立减金额上限
  * @property array{merchant_no:string,term_no:string}[] $sub_merchant_list 子商户列表
+ * @property float $profit_share_fee 分账手续费百分比
+ * @property int $profit_share_min 分账最低金额
+ * @property int $profit_share_max 分账最高金额
  */
 class Config
 {

+ 16 - 0
src/Controller/Api/ProfitShareOrderController.php

@@ -0,0 +1,16 @@
+<?php
+declare(strict_types=1);
+
+namespace SixShop\Lakala\Controller\Api;
+
+use SixShop\Core\Request;
+use SixShop\Lakala\Entity\ProfitShareOrderEntity;
+use think\Response;
+
+class ProfitShareOrderController
+{
+    public function save(Request $request, ProfitShareOrderEntity $profitShareOrderEntity): Response
+    {
+
+    }
+}

+ 6 - 1
src/Controller/Api/ProfitShareReceiverController.php

@@ -23,7 +23,7 @@ class ProfitShareReceiverController
         return success_response($entity->saveReceiver($data));
     }
 
-    public function index(Request $request, ProfitShareReceiverEntity $entity): Response
+    public function index(Request $request, ProfitShareReceiverEntity $entity, Config $config): Response
     {
         $userID = $request->userID;
         $params = ['user_id' => $userID];
@@ -38,6 +38,11 @@ class ProfitShareReceiverController
                 'effective' => $effective,
                 'user' => [
                     'balance' => $user->balance,
+                ],
+                'config' => [
+                    'profit_share_fee' => $config->profit_share_fee,
+                    'profit_share_min' => $config->profit_share_min,
+                    'profit_share_max' => $config->profit_share_max,
                 ]
             ]
         );